Class: IbmCloudPower::Network
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- IbmCloudPower::Network
- Defined in:
- lib/ibm_cloud_power/models/network.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#access_config ⇒ Object
Returns the value of attribute access_config.
-
#advertise ⇒ Object
Indicates if the network is advertised externally of the workspace to PER and\or peer networks.
-
#arp_broadcast ⇒ Object
Indicates if the ARP broadcast is enabled.
-
#cidr ⇒ Object
Network in CIDR notation (192.168.0.0/24).
-
#cloud_connections ⇒ Object
(currently not available) cloud connections this network is attached.
-
#crn ⇒ Object
The CRN for this resource.
-
#dhcp_managed ⇒ Object
DHCP Enabled Network.
-
#dns_servers ⇒ Object
DNS Servers.
-
#gateway ⇒ Object
Gateway IP Address.
-
#ip_address_metrics ⇒ Object
Returns the value of attribute ip_address_metrics.
-
#ip_address_ranges ⇒ Object
IP Address Ranges.
-
#jumbo ⇒ Object
(deprecated - replaced by mtu) Enable MTU Jumbo Network (for multi-zone locations only).
-
#mtu ⇒ Object
Maximum transmission unit.
-
#name ⇒ Object
Network Name.
-
#network_id ⇒ Object
Unique Network ID.
-
#public_ip_address_ranges ⇒ Object
Public IP Address Ranges (for pub-vlan networks).
-
#type ⇒ Object
Type of Network - 'vlan' (private network) 'pub-vlan' (public network) 'dhcp-vlan' (for satellite locations only).
-
#user_tags ⇒ Object
List of user tags.
-
#vlan_id ⇒ Object
VLAN ID.
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 = {}) ⇒ Network
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 = {}) ⇒ Network
Initializes the object
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 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/ibm_cloud_power/models/network.rb', line 163 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::Network` 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 `IbmCloudPower::Network`. 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?(:'access_config') self.access_config = attributes[:'access_config'] end if attributes.key?(:'advertise') self.advertise = attributes[:'advertise'] end if attributes.key?(:'arp_broadcast') self.arp_broadcast = attributes[:'arp_broadcast'] end if attributes.key?(:'cidr') self.cidr = attributes[:'cidr'] else self.cidr = nil end if attributes.key?(:'cloud_connections') if (value = attributes[:'cloud_connections']).is_a?(Array) self.cloud_connections = value end end if attributes.key?(:'crn') self.crn = attributes[:'crn'] end if attributes.key?(:'dhcp_managed') self.dhcp_managed = attributes[:'dhcp_managed'] end if attributes.key?(:'dns_servers') if (value = attributes[:'dns_servers']).is_a?(Array) self.dns_servers = value end else self.dns_servers = nil end if attributes.key?(:'gateway') self.gateway = attributes[:'gateway'] end if attributes.key?(:'ip_address_metrics') self.ip_address_metrics = attributes[:'ip_address_metrics'] else self.ip_address_metrics = nil end if attributes.key?(:'ip_address_ranges') if (value = attributes[:'ip_address_ranges']).is_a?(Array) self.ip_address_ranges = value end else self.ip_address_ranges = nil end if attributes.key?(:'jumbo') self.jumbo = attributes[:'jumbo'] end if attributes.key?(:'mtu') self.mtu = attributes[:'mtu'] end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'network_id') self.network_id = attributes[:'network_id'] else self.network_id = nil end if attributes.key?(:'public_ip_address_ranges') if (value = attributes[:'public_ip_address_ranges']).is_a?(Array) self.public_ip_address_ranges = value end end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = 'vlan' end if attributes.key?(:'user_tags') if (value = attributes[:'user_tags']).is_a?(Array) self. = value end end if attributes.key?(:'vlan_id') self.vlan_id = attributes[:'vlan_id'] else self.vlan_id = nil end end |
Instance Attribute Details
#access_config ⇒ Object
Returns the value of attribute access_config.
18 19 20 |
# File 'lib/ibm_cloud_power/models/network.rb', line 18 def access_config @access_config end |
#advertise ⇒ Object
Indicates if the network is advertised externally of the workspace to PER and\or peer networks.
21 22 23 |
# File 'lib/ibm_cloud_power/models/network.rb', line 21 def advertise @advertise end |
#arp_broadcast ⇒ Object
Indicates if the ARP broadcast is enabled
24 25 26 |
# File 'lib/ibm_cloud_power/models/network.rb', line 24 def arp_broadcast @arp_broadcast end |
#cidr ⇒ Object
Network in CIDR notation (192.168.0.0/24)
27 28 29 |
# File 'lib/ibm_cloud_power/models/network.rb', line 27 def cidr @cidr end |
#cloud_connections ⇒ Object
(currently not available) cloud connections this network is attached
30 31 32 |
# File 'lib/ibm_cloud_power/models/network.rb', line 30 def cloud_connections @cloud_connections end |
#crn ⇒ Object
The CRN for this resource
33 34 35 |
# File 'lib/ibm_cloud_power/models/network.rb', line 33 def crn @crn end |
#dhcp_managed ⇒ Object
DHCP Enabled Network
36 37 38 |
# File 'lib/ibm_cloud_power/models/network.rb', line 36 def dhcp_managed @dhcp_managed end |
#dns_servers ⇒ Object
DNS Servers
39 40 41 |
# File 'lib/ibm_cloud_power/models/network.rb', line 39 def dns_servers @dns_servers end |
#gateway ⇒ Object
Gateway IP Address
42 43 44 |
# File 'lib/ibm_cloud_power/models/network.rb', line 42 def gateway @gateway end |
#ip_address_metrics ⇒ Object
Returns the value of attribute ip_address_metrics.
44 45 46 |
# File 'lib/ibm_cloud_power/models/network.rb', line 44 def ip_address_metrics @ip_address_metrics end |
#ip_address_ranges ⇒ Object
IP Address Ranges
47 48 49 |
# File 'lib/ibm_cloud_power/models/network.rb', line 47 def ip_address_ranges @ip_address_ranges end |
#jumbo ⇒ Object
(deprecated - replaced by mtu) Enable MTU Jumbo Network (for multi-zone locations only)
50 51 52 |
# File 'lib/ibm_cloud_power/models/network.rb', line 50 def jumbo @jumbo end |
#mtu ⇒ Object
Maximum transmission unit
53 54 55 |
# File 'lib/ibm_cloud_power/models/network.rb', line 53 def mtu @mtu end |
#name ⇒ Object
Network Name
56 57 58 |
# File 'lib/ibm_cloud_power/models/network.rb', line 56 def name @name end |
#network_id ⇒ Object
Unique Network ID
59 60 61 |
# File 'lib/ibm_cloud_power/models/network.rb', line 59 def network_id @network_id end |
#public_ip_address_ranges ⇒ Object
Public IP Address Ranges (for pub-vlan networks)
62 63 64 |
# File 'lib/ibm_cloud_power/models/network.rb', line 62 def public_ip_address_ranges @public_ip_address_ranges end |
#type ⇒ Object
Type of Network - 'vlan' (private network) 'pub-vlan' (public network) 'dhcp-vlan' (for satellite locations only)
65 66 67 |
# File 'lib/ibm_cloud_power/models/network.rb', line 65 def type @type end |
#user_tags ⇒ Object
List of user tags
68 69 70 |
# File 'lib/ibm_cloud_power/models/network.rb', line 68 def @user_tags end |
#vlan_id ⇒ Object
VLAN ID
71 72 73 |
# File 'lib/ibm_cloud_power/models/network.rb', line 71 def vlan_id @vlan_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
121 122 123 |
# File 'lib/ibm_cloud_power/models/network.rb', line 121 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
126 127 128 |
# File 'lib/ibm_cloud_power/models/network.rb', line 126 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/ibm_cloud_power/models/network.rb', line 96 def self.attribute_map { :'access_config' => :'accessConfig', :'advertise' => :'advertise', :'arp_broadcast' => :'arpBroadcast', :'cidr' => :'cidr', :'cloud_connections' => :'cloudConnections', :'crn' => :'crn', :'dhcp_managed' => :'dhcpManaged', :'dns_servers' => :'dnsServers', :'gateway' => :'gateway', :'ip_address_metrics' => :'ipAddressMetrics', :'ip_address_ranges' => :'ipAddressRanges', :'jumbo' => :'jumbo', :'mtu' => :'mtu', :'name' => :'name', :'network_id' => :'networkID', :'public_ip_address_ranges' => :'publicIPAddressRanges', :'type' => :'type', :'user_tags' => :'userTags', :'vlan_id' => :'vlanID' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/ibm_cloud_power/models/network.rb', line 529 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
156 157 158 159 |
# File 'lib/ibm_cloud_power/models/network.rb', line 156 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/ibm_cloud_power/models/network.rb', line 131 def self.openapi_types { :'access_config' => :'AccessConfig', :'advertise' => :'String', :'arp_broadcast' => :'String', :'cidr' => :'String', :'cloud_connections' => :'Array<NetworkCloudConnectionsInner>', :'crn' => :'String', :'dhcp_managed' => :'Boolean', :'dns_servers' => :'Array<String>', :'gateway' => :'String', :'ip_address_metrics' => :'NetworkIpAddressMetrics', :'ip_address_ranges' => :'Array<IPAddressRange>', :'jumbo' => :'Boolean', :'mtu' => :'Integer', :'name' => :'String', :'network_id' => :'String', :'public_ip_address_ranges' => :'Array<IPAddressRange>', :'type' => :'String', :'user_tags' => :'Array<String>', :'vlan_id' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/ibm_cloud_power/models/network.rb', line 490 def ==(o) return true if self.equal?(o) self.class == o.class && access_config == o.access_config && advertise == o.advertise && arp_broadcast == o.arp_broadcast && cidr == o.cidr && cloud_connections == o.cloud_connections && crn == o.crn && dhcp_managed == o.dhcp_managed && dns_servers == o.dns_servers && gateway == o.gateway && ip_address_metrics == o.ip_address_metrics && ip_address_ranges == o.ip_address_ranges && jumbo == o.jumbo && mtu == o.mtu && name == o.name && network_id == o.network_id && public_ip_address_ranges == o.public_ip_address_ranges && type == o.type && == o. && vlan_id == o.vlan_id end |
#eql?(o) ⇒ Boolean
516 517 518 |
# File 'lib/ibm_cloud_power/models/network.rb', line 516 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
522 523 524 |
# File 'lib/ibm_cloud_power/models/network.rb', line 522 def hash [access_config, advertise, arp_broadcast, cidr, cloud_connections, crn, dhcp_managed, dns_servers, gateway, ip_address_metrics, ip_address_ranges, jumbo, mtu, name, network_id, public_ip_address_ranges, type, , vlan_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/ibm_cloud_power/models/network.rb', line 282 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @cidr.nil? invalid_properties.push('invalid value for "cidr", cidr cannot be nil.') end if @dns_servers.nil? invalid_properties.push('invalid value for "dns_servers", dns_servers cannot be nil.') end if @ip_address_metrics.nil? invalid_properties.push('invalid value for "ip_address_metrics", ip_address_metrics cannot be nil.') end if @ip_address_ranges.nil? invalid_properties.push('invalid value for "ip_address_ranges", ip_address_ranges cannot be nil.') end if !@mtu.nil? && @mtu > 9000 invalid_properties.push('invalid value for "mtu", must be smaller than or equal to 9000.') end if !@mtu.nil? && @mtu < 1450 invalid_properties.push('invalid value for "mtu", must be greater than or equal to 1450.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @network_id.nil? invalid_properties.push('invalid value for "network_id", network_id cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if !@user_tags.nil? && @user_tags.length > 100 invalid_properties.push('invalid value for "user_tags", number of items must be less than or equal to 100.') end if @vlan_id.nil? invalid_properties.push('invalid value for "vlan_id", vlan_id cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/ibm_cloud_power/models/network.rb', line 551 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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/ibm_cloud_power/models/network.rb', line 334 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' advertise_validator = EnumAttributeValidator.new('String', ["enable", "disable"]) return false unless advertise_validator.valid?(@advertise) arp_broadcast_validator = EnumAttributeValidator.new('String', ["enable", "disable"]) return false unless arp_broadcast_validator.valid?(@arp_broadcast) return false if @cidr.nil? return false if @dns_servers.nil? return false if @ip_address_metrics.nil? return false if @ip_address_ranges.nil? return false if !@mtu.nil? && @mtu > 9000 return false if !@mtu.nil? && @mtu < 1450 return false if @name.nil? return false if @network_id.nil? return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["vlan", "pub-vlan", "dhcp-vlan"]) return false unless type_validator.valid?(@type) return false if !@user_tags.nil? && @user_tags.length > 100 return false if @vlan_id.nil? true end |