Class: IbmCloudPower::NetworkPeerUpdate

Inherits:
ApiModelBase show all
Defined in:
lib/ibm_cloud_power/models/network_peer_update.rb

Overview

network peer update parameters

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ NetworkPeerUpdate

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



128
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
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 128

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudPower::NetworkPeerUpdate` 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::NetworkPeerUpdate`. 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?(:'customer_asn')
    self.customer_asn = attributes[:'customer_asn']
  end

  if attributes.key?(:'customer_cidr')
    self.customer_cidr = attributes[:'customer_cidr']
  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?(:'ibm_asn')
    self.ibm_asn = attributes[:'ibm_asn']
  end

  if attributes.key?(:'ibm_cidr')
    self.ibm_cidr = attributes[:'ibm_cidr']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'peer_interface_id')
    self.peer_interface_id = attributes[:'peer_interface_id']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = 'dcnetwork_bgp'
  end

  if attributes.key?(:'vlan')
    self.vlan = attributes[:'vlan']
  end
end

Instance Attribute Details

#customer_asnObject

ASN number at customer network side



20
21
22
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 20

def customer_asn
  @customer_asn
end

#customer_cidrObject

IP address used for configuring customer network interface with network subnet mask. customerCidr and ibmCidr must have matching network and subnet mask values.



23
24
25
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 23

def customer_cidr
  @customer_cidr
end

#default_export_route_filterObject

default action for export route filter * allow: allow * deny: deny



26
27
28
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 26

def default_export_route_filter
  @default_export_route_filter
end

#default_import_route_filterObject

default action for import route filter * allow: allow * deny: deny



29
30
31
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 29

def default_import_route_filter
  @default_import_route_filter
end

#ibm_asnObject

ASN number at IBM PowerVS side



32
33
34
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 32

def ibm_asn
  @ibm_asn
end

#ibm_cidrObject

IP address used for configuring IBM network interface with network subnet mask. customerCidr and ibmCidr must have matching network and subnet mask values.



35
36
37
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 35

def ibm_cidr
  @ibm_cidr
end

#nameObject

user defined name



38
39
40
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 38

def name
  @name
end

#peer_interface_idObject

peer interface id. use API '/v1/network-peers/interfaces' to get a list of valid peer interface id



41
42
43
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 41

def peer_interface_id
  @peer_interface_id
end

#typeObject

type of the peer network * dcnetwork_bgp: broader gateway protocol is used to share routes between two autonomous network



44
45
46
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 44

def type
  @type
end

#vlanObject

A vlan configured at the customer network.



47
48
49
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 47

def vlan
  @vlan
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



88
89
90
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 88

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



93
94
95
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 93

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 72

def self.attribute_map
  {
    :'customer_asn' => :'customerASN',
    :'customer_cidr' => :'customerCidr',
    :'default_export_route_filter' => :'defaultExportRouteFilter',
    :'default_import_route_filter' => :'defaultImportRouteFilter',
    :'ibm_asn' => :'ibmASN',
    :'ibm_cidr' => :'ibmCidr',
    :'name' => :'name',
    :'peer_interface_id' => :'peerInterfaceID',
    :'type' => :'type',
    :'vlan' => :'vlan'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 272

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_nullableObject

List of attributes with nullable: true



114
115
116
117
118
119
120
121
122
123
124
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 114

def self.openapi_nullable
  Set.new([
    :'customer_asn',
    :'customer_cidr',
    :'ibm_asn',
    :'ibm_cidr',
    :'name',
    :'peer_interface_id',
    :'vlan'
  ])
end

.openapi_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 98

def self.openapi_types
  {
    :'customer_asn' => :'Integer',
    :'customer_cidr' => :'String',
    :'default_export_route_filter' => :'String',
    :'default_import_route_filter' => :'String',
    :'ibm_asn' => :'Integer',
    :'ibm_cidr' => :'String',
    :'name' => :'String',
    :'peer_interface_id' => :'String',
    :'type' => :'String',
    :'vlan' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 242

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      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 &&
      ibm_asn == o.ibm_asn &&
      ibm_cidr == o.ibm_cidr &&
      name == o.name &&
      peer_interface_id == o.peer_interface_id &&
      type == o.type &&
      vlan == o.vlan
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


259
260
261
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 259

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



265
266
267
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 265

def hash
  [customer_asn, customer_cidr, default_export_route_filter, default_import_route_filter, ibm_asn, ibm_cidr, name, peer_interface_id, type, vlan].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



191
192
193
194
195
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 191

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 294

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

Returns:

  • (Boolean)

    true if the model is valid



199
200
201
202
203
204
205
206
207
208
# File 'lib/ibm_cloud_power/models/network_peer_update.rb', line 199

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  default_export_route_filter_validator = EnumAttributeValidator.new('String', ["allow", "deny"])
  return false unless default_export_route_filter_validator.valid?(@default_export_route_filter)
  default_import_route_filter_validator = EnumAttributeValidator.new('String', ["allow", "deny"])
  return false unless default_import_route_filter_validator.valid?(@default_import_route_filter)
  type_validator = EnumAttributeValidator.new('String', ["dcnetwork_bgp"])
  return false unless type_validator.valid?(@type)
  true
end