Class: Kubevirt::V1Interface
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Kubevirt::V1Interface
- Defined in:
- lib/kubevirt/models/v1_interface.rb
Instance Attribute Summary collapse
-
#acpi_index ⇒ Object
If specified, the ACPI index is used to provide network interface device naming, that is stable across changes in PCI addresses assigned to the device.
-
#binding ⇒ Object
Returns the value of attribute binding.
-
#boot_order ⇒ Object
BootOrder is an integer value > 0, used to determine ordering of boot devices.
-
#bridge ⇒ Object
InterfaceBridge connects to a given network via a linux bridge.
-
#dhcp_options ⇒ Object
Returns the value of attribute dhcp_options.
-
#mac_address ⇒ Object
Interface MAC address.
-
#macvtap ⇒ Object
DeprecatedInterfaceMacvtap is an alias to the deprecated InterfaceMacvtap that connects to a given network by extending the Kubernetes node's L2 networks via a macvtap interface.
-
#masquerade ⇒ Object
InterfaceMasquerade connects to a given network using netfilter rules to nat the traffic.
-
#model ⇒ Object
Interface model.
-
#name ⇒ Object
Logical name of the interface as well as a reference to the associated networks.
-
#passt ⇒ Object
DeprecatedInterfacePasst is an alias to the deprecated InterfacePasst Deprecated: Removed in v1.3.
-
#passt_binding ⇒ Object
InterfacePasstBinding connects to a given network using passt usermode networking.
-
#pci_address ⇒ Object
If specified, the virtual network interface will be placed on the guests pci address with the specified PCI address.
-
#port_ranges ⇒ Object
List of port ranges to be forwarded to the virtual machine.
-
#ports ⇒ Object
List of ports to be forwarded to the virtual machine.
-
#slirp ⇒ Object
DeprecatedInterfaceSlirp is an alias to the deprecated InterfaceSlirp that connects to a given network using QEMU user networking mode.
-
#sriov ⇒ Object
InterfaceSRIOV connects to a given network by passing-through an SR-IOV PCI device via vfio.
-
#state ⇒ Object
State represents the requested operational state of the interface.
-
#tag ⇒ Object
If specified, the virtual network interface address and its tag will be provided to the guest via config drive.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1Interface
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ V1Interface
Initializes the object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/kubevirt/models/v1_interface.rb', line 141 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1Interface` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Kubevirt::V1Interface`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'acpi_index') self.acpi_index = attributes[:'acpi_index'] end if attributes.key?(:'binding') self.binding = attributes[:'binding'] end if attributes.key?(:'boot_order') self.boot_order = attributes[:'boot_order'] end if attributes.key?(:'bridge') self.bridge = attributes[:'bridge'] end if attributes.key?(:'dhcp_options') self. = attributes[:'dhcp_options'] end if attributes.key?(:'mac_address') self.mac_address = attributes[:'mac_address'] end if attributes.key?(:'macvtap') self.macvtap = attributes[:'macvtap'] end if attributes.key?(:'masquerade') self.masquerade = attributes[:'masquerade'] end if attributes.key?(:'model') self.model = attributes[:'model'] end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = '' end if attributes.key?(:'passt') self.passt = attributes[:'passt'] end if attributes.key?(:'passt_binding') self.passt_binding = attributes[:'passt_binding'] end if attributes.key?(:'pci_address') self.pci_address = attributes[:'pci_address'] end if attributes.key?(:'port_ranges') if (value = attributes[:'port_ranges']).is_a?(Array) self.port_ranges = value end end if attributes.key?(:'ports') if (value = attributes[:'ports']).is_a?(Array) self.ports = value end end if attributes.key?(:'slirp') self.slirp = attributes[:'slirp'] end if attributes.key?(:'sriov') self.sriov = attributes[:'sriov'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'tag') self.tag = attributes[:'tag'] end end |
Instance Attribute Details
#acpi_index ⇒ Object
If specified, the ACPI index is used to provide network interface device naming, that is stable across changes in PCI addresses assigned to the device. This value is required to be unique across all devices and be between 1 and (16*1024-1).
19 20 21 |
# File 'lib/kubevirt/models/v1_interface.rb', line 19 def acpi_index @acpi_index end |
#binding ⇒ Object
Returns the value of attribute binding.
21 22 23 |
# File 'lib/kubevirt/models/v1_interface.rb', line 21 def binding @binding end |
#boot_order ⇒ Object
BootOrder is an integer value > 0, used to determine ordering of boot devices. Lower values take precedence. Each interface or disk that has a boot order must have a unique value. Interfaces without a boot order are not tried.
24 25 26 |
# File 'lib/kubevirt/models/v1_interface.rb', line 24 def boot_order @boot_order end |
#bridge ⇒ Object
InterfaceBridge connects to a given network via a linux bridge.
27 28 29 |
# File 'lib/kubevirt/models/v1_interface.rb', line 27 def bridge @bridge end |
#dhcp_options ⇒ Object
Returns the value of attribute dhcp_options.
29 30 31 |
# File 'lib/kubevirt/models/v1_interface.rb', line 29 def @dhcp_options end |
#mac_address ⇒ Object
Interface MAC address. For example: de:ad:00:00:be:af or DE-AD-00-00-BE-AF.
32 33 34 |
# File 'lib/kubevirt/models/v1_interface.rb', line 32 def mac_address @mac_address end |
#macvtap ⇒ Object
DeprecatedInterfaceMacvtap is an alias to the deprecated InterfaceMacvtap that connects to a given network by extending the Kubernetes node's L2 networks via a macvtap interface. Deprecated: Removed in v1.3
35 36 37 |
# File 'lib/kubevirt/models/v1_interface.rb', line 35 def macvtap @macvtap end |
#masquerade ⇒ Object
InterfaceMasquerade connects to a given network using netfilter rules to nat the traffic.
38 39 40 |
# File 'lib/kubevirt/models/v1_interface.rb', line 38 def masquerade @masquerade end |
#model ⇒ Object
Interface model. One of: e1000, e1000e, igb, ne2k_pci, pcnet, rtl8139, virtio. Defaults to virtio.
41 42 43 |
# File 'lib/kubevirt/models/v1_interface.rb', line 41 def model @model end |
#name ⇒ Object
Logical name of the interface as well as a reference to the associated networks. Must match the Name of a Network.
44 45 46 |
# File 'lib/kubevirt/models/v1_interface.rb', line 44 def name @name end |
#passt ⇒ Object
DeprecatedInterfacePasst is an alias to the deprecated InterfacePasst Deprecated: Removed in v1.3
47 48 49 |
# File 'lib/kubevirt/models/v1_interface.rb', line 47 def passt @passt end |
#passt_binding ⇒ Object
InterfacePasstBinding connects to a given network using passt usermode networking.
50 51 52 |
# File 'lib/kubevirt/models/v1_interface.rb', line 50 def passt_binding @passt_binding end |
#pci_address ⇒ Object
If specified, the virtual network interface will be placed on the guests pci address with the specified PCI address. For example: 0000:81:01.10
53 54 55 |
# File 'lib/kubevirt/models/v1_interface.rb', line 53 def pci_address @pci_address end |
#port_ranges ⇒ Object
List of port ranges to be forwarded to the virtual machine. Mutually exclusive with ports. Only supported on masquerade interfaces. This feature is in Alpha.
56 57 58 |
# File 'lib/kubevirt/models/v1_interface.rb', line 56 def port_ranges @port_ranges end |
#ports ⇒ Object
List of ports to be forwarded to the virtual machine. Mutually exclusive with portRanges.
59 60 61 |
# File 'lib/kubevirt/models/v1_interface.rb', line 59 def ports @ports end |
#slirp ⇒ Object
DeprecatedInterfaceSlirp is an alias to the deprecated InterfaceSlirp that connects to a given network using QEMU user networking mode. Deprecated: Removed in v1.3
62 63 64 |
# File 'lib/kubevirt/models/v1_interface.rb', line 62 def slirp @slirp end |
#sriov ⇒ Object
InterfaceSRIOV connects to a given network by passing-through an SR-IOV PCI device via vfio.
65 66 67 |
# File 'lib/kubevirt/models/v1_interface.rb', line 65 def sriov @sriov end |
#state ⇒ Object
State represents the requested operational state of the interface. The supported values are: absent, expressing a request to remove the interface. down, expressing a request to set the link down. up, expressing a request to set the link up. Empty value functions as up.
68 69 70 |
# File 'lib/kubevirt/models/v1_interface.rb', line 68 def state @state end |
#tag ⇒ Object
If specified, the virtual network interface address and its tag will be provided to the guest via config drive
71 72 73 |
# File 'lib/kubevirt/models/v1_interface.rb', line 71 def tag @tag end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
99 100 101 |
# File 'lib/kubevirt/models/v1_interface.rb', line 99 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
104 105 106 |
# File 'lib/kubevirt/models/v1_interface.rb', line 104 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/kubevirt/models/v1_interface.rb', line 74 def self.attribute_map { :'acpi_index' => :'acpiIndex', :'binding' => :'binding', :'boot_order' => :'bootOrder', :'bridge' => :'bridge', :'dhcp_options' => :'dhcpOptions', :'mac_address' => :'macAddress', :'macvtap' => :'macvtap', :'masquerade' => :'masquerade', :'model' => :'model', :'name' => :'name', :'passt' => :'passt', :'passt_binding' => :'passtBinding', :'pci_address' => :'pciAddress', :'port_ranges' => :'portRanges', :'ports' => :'ports', :'slirp' => :'slirp', :'sriov' => :'sriov', :'state' => :'state', :'tag' => :'tag' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/kubevirt/models/v1_interface.rb', line 309 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
134 135 136 137 |
# File 'lib/kubevirt/models/v1_interface.rb', line 134 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/kubevirt/models/v1_interface.rb', line 109 def self.openapi_types { :'acpi_index' => :'Integer', :'binding' => :'V1PluginBinding', :'boot_order' => :'Integer', :'bridge' => :'Object', :'dhcp_options' => :'V1DHCPOptions', :'mac_address' => :'String', :'macvtap' => :'Object', :'masquerade' => :'Object', :'model' => :'String', :'name' => :'String', :'passt' => :'Object', :'passt_binding' => :'Object', :'pci_address' => :'String', :'port_ranges' => :'Array<V1PortRange>', :'ports' => :'Array<V1Port>', :'slirp' => :'Object', :'sriov' => :'Object', :'state' => :'String', :'tag' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/kubevirt/models/v1_interface.rb', line 270 def ==(o) return true if self.equal?(o) self.class == o.class && acpi_index == o.acpi_index && binding == o.binding && boot_order == o.boot_order && bridge == o.bridge && == o. && mac_address == o.mac_address && macvtap == o.macvtap && masquerade == o.masquerade && model == o.model && name == o.name && passt == o.passt && passt_binding == o.passt_binding && pci_address == o.pci_address && port_ranges == o.port_ranges && ports == o.ports && slirp == o.slirp && sriov == o.sriov && state == o.state && tag == o.tag end |
#eql?(o) ⇒ Boolean
296 297 298 |
# File 'lib/kubevirt/models/v1_interface.rb', line 296 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
302 303 304 |
# File 'lib/kubevirt/models/v1_interface.rb', line 302 def hash [acpi_index, binding, boot_order, bridge, , mac_address, macvtap, masquerade, model, name, passt, passt_binding, pci_address, port_ranges, ports, slirp, sriov, state, tag].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
240 241 242 243 244 245 246 247 248 |
# File 'lib/kubevirt/models/v1_interface.rb', line 240 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/kubevirt/models/v1_interface.rb', line 331 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
252 253 254 255 256 |
# File 'lib/kubevirt/models/v1_interface.rb', line 252 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? true end |