Class: IbmCloudPower::NetworkReference
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- IbmCloudPower::NetworkReference
- Defined in:
- lib/ibm_cloud_power/models/network_reference.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.
-
#crn ⇒ Object
The CRN for this resource.
-
#dhcp_managed ⇒ Object
DHCP Enabled Network.
-
#href ⇒ Object
Link to Network resource.
-
#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.
-
#type ⇒ Object
Type of Network - 'vlan' (private network) 'pub-vlan' (public network) 'dhcp-vlan' (for satellite locations only).
-
#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 = {}) ⇒ NetworkReference
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 = {}) ⇒ NetworkReference
Initializes the object
129 130 131 132 133 134 135 136 137 138 139 140 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 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 129 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::NetworkReference` 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::NetworkReference`. 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?(:'crn') self.crn = attributes[:'crn'] end if attributes.key?(:'dhcp_managed') self.dhcp_managed = attributes[:'dhcp_managed'] end if attributes.key?(:'href') self.href = attributes[:'href'] else self.href = 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?(:'type') self.type = attributes[:'type'] else self.type = 'vlan' 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_reference.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_reference.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_reference.rb', line 24 def arp_broadcast @arp_broadcast end |
#crn ⇒ Object
The CRN for this resource
27 28 29 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 27 def crn @crn end |
#dhcp_managed ⇒ Object
DHCP Enabled Network
30 31 32 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 30 def dhcp_managed @dhcp_managed end |
#href ⇒ Object
Link to Network resource
33 34 35 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 33 def href @href end |
#jumbo ⇒ Object
(deprecated - replaced by mtu) Enable MTU Jumbo Network (for multi-zone locations only)
36 37 38 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 36 def jumbo @jumbo end |
#mtu ⇒ Object
Maximum transmission unit
39 40 41 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 39 def mtu @mtu end |
#name ⇒ Object
Network Name
42 43 44 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 42 def name @name end |
#network_id ⇒ Object
Unique Network ID
45 46 47 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 45 def network_id @network_id end |
#type ⇒ Object
Type of Network - 'vlan' (private network) 'pub-vlan' (public network) 'dhcp-vlan' (for satellite locations only)
48 49 50 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 48 def type @type end |
#vlan_id ⇒ Object
VLAN ID
51 52 53 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 51 def vlan_id @vlan_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
94 95 96 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 94 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
99 100 101 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 99 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 76 def self.attribute_map { :'access_config' => :'accessConfig', :'advertise' => :'advertise', :'arp_broadcast' => :'arpBroadcast', :'crn' => :'crn', :'dhcp_managed' => :'dhcpManaged', :'href' => :'href', :'jumbo' => :'jumbo', :'mtu' => :'mtu', :'name' => :'name', :'network_id' => :'networkID', :'type' => :'type', :'vlan_id' => :'vlanID' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 380 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
122 123 124 125 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 122 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 104 def self.openapi_types { :'access_config' => :'AccessConfig', :'advertise' => :'String', :'arp_broadcast' => :'String', :'crn' => :'String', :'dhcp_managed' => :'Boolean', :'href' => :'String', :'jumbo' => :'Boolean', :'mtu' => :'Integer', :'name' => :'String', :'network_id' => :'String', :'type' => :'String', :'vlan_id' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 348 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 && crn == o.crn && dhcp_managed == o.dhcp_managed && href == o.href && jumbo == o.jumbo && mtu == o.mtu && name == o.name && network_id == o.network_id && type == o.type && vlan_id == o.vlan_id end |
#eql?(o) ⇒ Boolean
367 368 369 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 367 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
373 374 375 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 373 def hash [access_config, advertise, arp_broadcast, crn, dhcp_managed, href, jumbo, mtu, name, network_id, type, vlan_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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/ibm_cloud_power/models/network_reference.rb', line 204 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @href.nil? invalid_properties.push('invalid value for "href", href 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 @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
402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 402 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
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/ibm_cloud_power/models/network_reference.rb', line 240 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 @href.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 @vlan_id.nil? true end |