Class: IbmCloudPower::NetworkPeer
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- IbmCloudPower::NetworkPeer
- Defined in:
- lib/ibm_cloud_power/models/network_peer.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#creation_date ⇒ Object
time stamp for create network peer.
-
#customer_asn ⇒ Object
ASN number at customer network side.
-
#customer_cidr ⇒ Object
IP address used for configuring customer network interface with network subnet mask.
-
#default_export_route_filter ⇒ Object
default action for export route filter * allow: allow * deny: deny.
-
#default_import_route_filter ⇒ Object
default action for import route filter * allow: allow * deny: deny.
-
#error ⇒ Object
error description.
-
#export_route_filters ⇒ Object
List of export route filters.
-
#ibm_asn ⇒ Object
ASN number at IBM PowerVS side.
-
#ibm_cidr ⇒ Object
IP address used for configuring IBM network interface with network subnet mask.
-
#id ⇒ Object
network peer id.
-
#import_route_filters ⇒ Object
List of import route filters.
-
#name ⇒ Object
user defined name.
-
#peer_interface_id ⇒ Object
peer interface id.
-
#state ⇒ Object
status of the network peer.
-
#type ⇒ Object
type of the peer network * dcnetwork_bgp: broader gateway protocol is used to share routes between two autonomous network.
-
#updated_date ⇒ Object
time stamp for update network peer.
-
#vlan ⇒ Object
A vlan configured at the customer network.
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 = {}) ⇒ NetworkPeer
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 = {}) ⇒ NetworkPeer
Initializes the object
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 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 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 155 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::NetworkPeer` 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::NetworkPeer`. 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?(:'creation_date') self.creation_date = attributes[:'creation_date'] else self.creation_date = nil end if attributes.key?(:'customer_asn') self.customer_asn = attributes[:'customer_asn'] else self.customer_asn = nil end if attributes.key?(:'customer_cidr') self.customer_cidr = attributes[:'customer_cidr'] else self.customer_cidr = nil end if attributes.key?(:'default_export_route_filter') self.default_export_route_filter = attributes[:'default_export_route_filter'] else self.default_export_route_filter = 'allow' end if attributes.key?(:'default_import_route_filter') self.default_import_route_filter = attributes[:'default_import_route_filter'] else self.default_import_route_filter = 'allow' end if attributes.key?(:'error') self.error = attributes[:'error'] else self.error = nil end if attributes.key?(:'export_route_filters') if (value = attributes[:'export_route_filters']).is_a?(Array) self.export_route_filters = value end else self.export_route_filters = nil end if attributes.key?(:'ibm_asn') self.ibm_asn = attributes[:'ibm_asn'] else self.ibm_asn = nil end if attributes.key?(:'ibm_cidr') self.ibm_cidr = attributes[:'ibm_cidr'] else self.ibm_cidr = nil end if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'import_route_filters') if (value = attributes[:'import_route_filters']).is_a?(Array) self.import_route_filters = value end else self.import_route_filters = nil end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'peer_interface_id') self.peer_interface_id = attributes[:'peer_interface_id'] else self.peer_interface_id = nil end if attributes.key?(:'state') self.state = attributes[:'state'] else self.state = nil end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = 'dcnetwork_bgp' end if attributes.key?(:'updated_date') self.updated_date = attributes[:'updated_date'] else self.updated_date = nil end if attributes.key?(:'vlan') self.vlan = attributes[:'vlan'] else self.vlan = nil end end |
Instance Attribute Details
#creation_date ⇒ Object
time stamp for create network peer
19 20 21 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 19 def creation_date @creation_date end |
#customer_asn ⇒ Object
ASN number at customer network side
22 23 24 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 22 def customer_asn @customer_asn end |
#customer_cidr ⇒ Object
IP address used for configuring customer network interface with network subnet mask. customerCidr and ibmCidr must have matching network and subnet mask values.
25 26 27 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 25 def customer_cidr @customer_cidr end |
#default_export_route_filter ⇒ Object
default action for export route filter * allow: allow * deny: deny
28 29 30 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 28 def default_export_route_filter @default_export_route_filter end |
#default_import_route_filter ⇒ Object
default action for import route filter * allow: allow * deny: deny
31 32 33 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 31 def default_import_route_filter @default_import_route_filter end |
#error ⇒ Object
error description
34 35 36 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 34 def error @error end |
#export_route_filters ⇒ Object
List of export route filters
37 38 39 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 37 def export_route_filters @export_route_filters end |
#ibm_asn ⇒ Object
ASN number at IBM PowerVS side
40 41 42 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 40 def ibm_asn @ibm_asn end |
#ibm_cidr ⇒ Object
IP address used for configuring IBM network interface with network subnet mask. customerCidr and ibmCidr must have matching network and subnet mask values.
43 44 45 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 43 def ibm_cidr @ibm_cidr end |
#id ⇒ Object
network peer id
46 47 48 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 46 def id @id end |
#import_route_filters ⇒ Object
List of import route filters
49 50 51 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 49 def import_route_filters @import_route_filters end |
#name ⇒ Object
user defined name
52 53 54 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 52 def name @name end |
#peer_interface_id ⇒ Object
peer interface id. use API '/v1/network-peers/interfaces' to get a list of valid peer interface id
55 56 57 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 55 def peer_interface_id @peer_interface_id end |
#state ⇒ Object
status of the network peer
58 59 60 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 58 def state @state end |
#type ⇒ Object
type of the peer network * dcnetwork_bgp: broader gateway protocol is used to share routes between two autonomous network
61 62 63 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 61 def type @type end |
#updated_date ⇒ Object
time stamp for update network peer
64 65 66 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 64 def updated_date @updated_date end |
#vlan ⇒ Object
A vlan configured at the customer network.
67 68 69 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 67 def vlan @vlan end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
115 116 117 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 115 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
120 121 122 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 120 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 92 def self.attribute_map { :'creation_date' => :'creationDate', :'customer_asn' => :'customerASN', :'customer_cidr' => :'customerCidr', :'default_export_route_filter' => :'defaultExportRouteFilter', :'default_import_route_filter' => :'defaultImportRouteFilter', :'error' => :'error', :'export_route_filters' => :'exportRouteFilters', :'ibm_asn' => :'ibmASN', :'ibm_cidr' => :'ibmCidr', :'id' => :'id', :'import_route_filters' => :'importRouteFilters', :'name' => :'name', :'peer_interface_id' => :'peerInterfaceID', :'state' => :'state', :'type' => :'type', :'updated_date' => :'updatedDate', :'vlan' => :'vlan' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 593 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
148 149 150 151 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 148 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 125 def self.openapi_types { :'creation_date' => :'String', :'customer_asn' => :'Integer', :'customer_cidr' => :'String', :'default_export_route_filter' => :'String', :'default_import_route_filter' => :'String', :'error' => :'String', :'export_route_filters' => :'Array<RouteFilter>', :'ibm_asn' => :'Integer', :'ibm_cidr' => :'String', :'id' => :'String', :'import_route_filters' => :'Array<RouteFilter>', :'name' => :'String', :'peer_interface_id' => :'String', :'state' => :'String', :'type' => :'String', :'updated_date' => :'String', :'vlan' => :'Integer' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 556 def ==(o) return true if self.equal?(o) self.class == o.class && creation_date == o.creation_date && customer_asn == o.customer_asn && customer_cidr == o.customer_cidr && default_export_route_filter == o.default_export_route_filter && default_import_route_filter == o.default_import_route_filter && error == o.error && export_route_filters == o.export_route_filters && ibm_asn == o.ibm_asn && ibm_cidr == o.ibm_cidr && id == o.id && import_route_filters == o.import_route_filters && name == o.name && peer_interface_id == o.peer_interface_id && state == o.state && type == o.type && updated_date == o.updated_date && vlan == o.vlan end |
#eql?(o) ⇒ Boolean
580 581 582 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 580 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
586 587 588 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 586 def hash [creation_date, customer_asn, customer_cidr, default_export_route_filter, default_import_route_filter, error, export_route_filters, ibm_asn, ibm_cidr, id, import_route_filters, name, peer_interface_id, state, type, updated_date, vlan].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
278 279 280 281 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 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 278 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @creation_date.nil? invalid_properties.push('invalid value for "creation_date", creation_date cannot be nil.') end if @customer_asn.nil? invalid_properties.push('invalid value for "customer_asn", customer_asn cannot be nil.') end if @customer_cidr.nil? invalid_properties.push('invalid value for "customer_cidr", customer_cidr cannot be nil.') end if @default_export_route_filter.nil? invalid_properties.push('invalid value for "default_export_route_filter", default_export_route_filter cannot be nil.') end if @default_import_route_filter.nil? invalid_properties.push('invalid value for "default_import_route_filter", default_import_route_filter cannot be nil.') end if @error.nil? invalid_properties.push('invalid value for "error", error cannot be nil.') end if @export_route_filters.nil? invalid_properties.push('invalid value for "export_route_filters", export_route_filters cannot be nil.') end if @ibm_asn.nil? invalid_properties.push('invalid value for "ibm_asn", ibm_asn cannot be nil.') end if @ibm_cidr.nil? invalid_properties.push('invalid value for "ibm_cidr", ibm_cidr cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @import_route_filters.nil? invalid_properties.push('invalid value for "import_route_filters", import_route_filters cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @peer_interface_id.nil? invalid_properties.push('invalid value for "peer_interface_id", peer_interface_id cannot be nil.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @updated_date.nil? invalid_properties.push('invalid value for "updated_date", updated_date cannot be nil.') end if @vlan.nil? invalid_properties.push('invalid value for "vlan", vlan cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
615 616 617 618 619 620 621 622 623 624 625 626 627 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 615 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
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/ibm_cloud_power/models/network_peer.rb', line 354 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @creation_date.nil? return false if @customer_asn.nil? return false if @customer_cidr.nil? return false if @default_export_route_filter.nil? default_export_route_filter_validator = EnumAttributeValidator.new('String', ["allow", "deny"]) return false unless default_export_route_filter_validator.valid?(@default_export_route_filter) return false if @default_import_route_filter.nil? default_import_route_filter_validator = EnumAttributeValidator.new('String', ["allow", "deny"]) return false unless default_import_route_filter_validator.valid?(@default_import_route_filter) return false if @error.nil? return false if @export_route_filters.nil? return false if @ibm_asn.nil? return false if @ibm_cidr.nil? return false if @id.nil? return false if @import_route_filters.nil? return false if @name.nil? return false if @peer_interface_id.nil? return false if @state.nil? state_validator = EnumAttributeValidator.new('String', ["active", "configuring", "removing", "error", "updating"]) return false unless state_validator.valid?(@state) return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["dcnetwork_bgp"]) return false unless type_validator.valid?(@type) return false if @updated_date.nil? return false if @vlan.nil? true end |