Class: Falcon::DomainNetwork

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/models/domain_network.rb

Overview

Represents a network entity

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DomainNetwork

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/crimson-falcon/models/domain_network.rb', line 177

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::DomainNetwork` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Falcon::DomainNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'scanner_aids')
    if (value = attributes[:'scanner_aids']).is_a?(Array)
      self.scanner_aids = value
    end
  end

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

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

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

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

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

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

Instance Attribute Details

#cidObject

The customer to which the network belongs



36
37
38
# File 'lib/crimson-falcon/models/domain_network.rb', line 36

def cid
  @cid
end

#created_byObject

The user that created the network



39
40
41
# File 'lib/crimson-falcon/models/domain_network.rb', line 39

def created_by
  @created_by
end

#created_timestampObject

The time at which the network was created



42
43
44
# File 'lib/crimson-falcon/models/domain_network.rb', line 42

def created_timestamp
  @created_timestamp
end

#gateway_external_ipObject

External IP address of the gateway of the network



45
46
47
# File 'lib/crimson-falcon/models/domain_network.rb', line 45

def gateway_external_ip
  @gateway_external_ip
end

#gateway_internal_ipObject

Internal IP address of the gateway of the network



48
49
50
# File 'lib/crimson-falcon/models/domain_network.rb', line 48

def gateway_internal_ip
  @gateway_internal_ip
end

#gateway_mac_addressObject

The MAC address of the gateway of the network



51
52
53
# File 'lib/crimson-falcon/models/domain_network.rb', line 51

def gateway_mac_address
  @gateway_mac_address
end

#gateway_vendor_nameObject

The vendor name of the gateway of the network



54
55
56
# File 'lib/crimson-falcon/models/domain_network.rb', line 54

def gateway_vendor_name
  @gateway_vendor_name
end

#has_conflictObject

Indicates whether networks contained by the zone to which this network is assigned to, have conflicts within them



57
58
59
# File 'lib/crimson-falcon/models/domain_network.rb', line 57

def has_conflict
  @has_conflict
end

#idObject

The unique identifier of the network



60
61
62
# File 'lib/crimson-falcon/models/domain_network.rb', line 60

def id
  @id
end

#managed_assets_countObject

Count of managed assets identified in the network



63
64
65
# File 'lib/crimson-falcon/models/domain_network.rb', line 63

def managed_assets_count
  @managed_assets_count
end

#nameObject

The name which was given to the network



66
67
68
# File 'lib/crimson-falcon/models/domain_network.rb', line 66

def name
  @name
end

#ownershipObject

Indicates ownership of the network



69
70
71
# File 'lib/crimson-falcon/models/domain_network.rb', line 69

def ownership
  @ownership
end

#scanner_aidsObject

The scanner AIDs assigned to the network



72
73
74
# File 'lib/crimson-falcon/models/domain_network.rb', line 72

def scanner_aids
  @scanner_aids
end

#scanner_assignment_typeObject

The scanner assignment type for the network



75
76
77
# File 'lib/crimson-falcon/models/domain_network.rb', line 75

def scanner_assignment_type
  @scanner_assignment_type
end

#subnetObject

The subnet that is assigned to the network



78
79
80
# File 'lib/crimson-falcon/models/domain_network.rb', line 78

def subnet
  @subnet
end

#typeObject

The type of the network



81
82
83
# File 'lib/crimson-falcon/models/domain_network.rb', line 81

def type
  @type
end

#updated_byObject

The user that updated the network



84
85
86
# File 'lib/crimson-falcon/models/domain_network.rb', line 84

def updated_by
  @updated_by
end

#updated_timestampObject

The time at which the network was updated



87
88
89
# File 'lib/crimson-falcon/models/domain_network.rb', line 87

def updated_timestamp
  @updated_timestamp
end

#zone_idObject

The zone to which the network is assigned



90
91
92
# File 'lib/crimson-falcon/models/domain_network.rb', line 90

def zone_id
  @zone_id
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



140
141
142
# File 'lib/crimson-falcon/models/domain_network.rb', line 140

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/crimson-falcon/models/domain_network.rb', line 115

def self.attribute_map
  {
    :'cid' => :'cid',
    :'created_by' => :'created_by',
    :'created_timestamp' => :'created_timestamp',
    :'gateway_external_ip' => :'gateway_external_ip',
    :'gateway_internal_ip' => :'gateway_internal_ip',
    :'gateway_mac_address' => :'gateway_mac_address',
    :'gateway_vendor_name' => :'gateway_vendor_name',
    :'has_conflict' => :'has_conflict',
    :'id' => :'id',
    :'managed_assets_count' => :'managed_assets_count',
    :'name' => :'name',
    :'ownership' => :'ownership',
    :'scanner_aids' => :'scanner_aids',
    :'scanner_assignment_type' => :'scanner_assignment_type',
    :'subnet' => :'subnet',
    :'type' => :'type',
    :'updated_by' => :'updated_by',
    :'updated_timestamp' => :'updated_timestamp',
    :'zone_id' => :'zone_id'
  }
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



439
440
441
# File 'lib/crimson-falcon/models/domain_network.rb', line 439

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



170
171
172
173
# File 'lib/crimson-falcon/models/domain_network.rb', line 170

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/crimson-falcon/models/domain_network.rb', line 145

def self.openapi_types
  {
    :'cid' => :'String',
    :'created_by' => :'String',
    :'created_timestamp' => :'String',
    :'gateway_external_ip' => :'String',
    :'gateway_internal_ip' => :'String',
    :'gateway_mac_address' => :'String',
    :'gateway_vendor_name' => :'String',
    :'has_conflict' => :'Boolean',
    :'id' => :'String',
    :'managed_assets_count' => :'Integer',
    :'name' => :'String',
    :'ownership' => :'String',
    :'scanner_aids' => :'Array<String>',
    :'scanner_assignment_type' => :'String',
    :'subnet' => :'String',
    :'type' => :'String',
    :'updated_by' => :'String',
    :'updated_timestamp' => :'String',
    :'zone_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/crimson-falcon/models/domain_network.rb', line 400

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      cid == o.cid &&
      created_by == o.created_by &&
      created_timestamp == o.created_timestamp &&
      gateway_external_ip == o.gateway_external_ip &&
      gateway_internal_ip == o.gateway_internal_ip &&
      gateway_mac_address == o.gateway_mac_address &&
      gateway_vendor_name == o.gateway_vendor_name &&
      has_conflict == o.has_conflict &&
      id == o.id &&
      managed_assets_count == o.managed_assets_count &&
      name == o.name &&
      ownership == o.ownership &&
      scanner_aids == o.scanner_aids &&
      scanner_assignment_type == o.scanner_assignment_type &&
      subnet == o.subnet &&
      type == o.type &&
      updated_by == o.updated_by &&
      updated_timestamp == o.updated_timestamp &&
      zone_id == o.zone_id
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/crimson-falcon/models/domain_network.rb', line 470

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Falcon.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/crimson-falcon/models/domain_network.rb', line 541

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/crimson-falcon/models/domain_network.rb', line 446

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


426
427
428
# File 'lib/crimson-falcon/models/domain_network.rb', line 426

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



432
433
434
# File 'lib/crimson-falcon/models/domain_network.rb', line 432

def hash
  [cid, created_by, created_timestamp, gateway_external_ip, gateway_internal_ip, gateway_mac_address, gateway_vendor_name, has_conflict, id, managed_assets_count, name, ownership, scanner_aids, scanner_assignment_type, subnet, type, updated_by, updated_timestamp, zone_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



271
272
273
274
275
276
277
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
# File 'lib/crimson-falcon/models/domain_network.rb', line 271

def list_invalid_properties
  invalid_properties = Array.new
  if @cid.nil?
    invalid_properties.push('invalid value for "cid", cid cannot be nil.')
  end

  if @created_by.nil?
    invalid_properties.push('invalid value for "created_by", created_by cannot be nil.')
  end

  if @created_timestamp.nil?
    invalid_properties.push('invalid value for "created_timestamp", created_timestamp cannot be nil.')
  end

  if @gateway_external_ip.nil?
    invalid_properties.push('invalid value for "gateway_external_ip", gateway_external_ip cannot be nil.')
  end

  if @gateway_internal_ip.nil?
    invalid_properties.push('invalid value for "gateway_internal_ip", gateway_internal_ip cannot be nil.')
  end

  if @gateway_mac_address.nil?
    invalid_properties.push('invalid value for "gateway_mac_address", gateway_mac_address cannot be nil.')
  end

  if @gateway_vendor_name.nil?
    invalid_properties.push('invalid value for "gateway_vendor_name", gateway_vendor_name cannot be nil.')
  end

  if @has_conflict.nil?
    invalid_properties.push('invalid value for "has_conflict", has_conflict cannot be nil.')
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @managed_assets_count.nil?
    invalid_properties.push('invalid value for "managed_assets_count", managed_assets_count cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @ownership.nil?
    invalid_properties.push('invalid value for "ownership", ownership cannot be nil.')
  end

  if @scanner_assignment_type.nil?
    invalid_properties.push('invalid value for "scanner_assignment_type", scanner_assignment_type cannot be nil.')
  end

  if @subnet.nil?
    invalid_properties.push('invalid value for "subnet", subnet cannot be nil.')
  end

  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @zone_id.nil?
    invalid_properties.push('invalid value for "zone_id", zone_id cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



517
518
519
# File 'lib/crimson-falcon/models/domain_network.rb', line 517

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/crimson-falcon/models/domain_network.rb', line 523

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



511
512
513
# File 'lib/crimson-falcon/models/domain_network.rb', line 511

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/crimson-falcon/models/domain_network.rb', line 342

def valid?
  return false if @cid.nil?
  return false if @created_by.nil?
  return false if @created_timestamp.nil?
  return false if @gateway_external_ip.nil?
  return false if @gateway_internal_ip.nil?
  return false if @gateway_mac_address.nil?
  return false if @gateway_vendor_name.nil?
  return false if @has_conflict.nil?
  return false if @id.nil?
  return false if @managed_assets_count.nil?
  return false if @name.nil?
  return false if @ownership.nil?
  ownership_validator = EnumAttributeValidator.new('String', ["unknown,confirmed,denied"])
  return false unless ownership_validator.valid?(@ownership)
  return false if @scanner_assignment_type.nil?
  scanner_assignment_type_validator = EnumAttributeValidator.new('String', ["local,zone,manual"])
  return false unless scanner_assignment_type_validator.valid?(@scanner_assignment_type)
  return false if @subnet.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["user,system"])
  return false unless type_validator.valid?(@type)
  return false if @zone_id.nil?
  true
end