Class: SwaggerClient::AssetCreate

Inherits:
Object
  • Object
show all
Defined in:
lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AssetCreate

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 172

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#addressesObject

All addresses discovered on the asset.



17
18
19
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 17

def addresses
  @addresses
end

#assessed_for_policiesObject

Whether the asset has been assessed for policies at least once.



20
21
22
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 20

def assessed_for_policies
  @assessed_for_policies
end

#assessed_for_vulnerabilitiesObject

Whether the asset has been assessed for vulnerabilities at least once.



23
24
25
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 23

def assessed_for_vulnerabilities
  @assessed_for_vulnerabilities
end

#configurationsObject

Configuration key-values pairs enumerated on the asset.



26
27
28
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 26

def configurations
  @configurations
end

#cpeObject

The Common Platform Enumeration (CPE) of the operating system. This is the tertiary means of specifying the operating system fingerprint. Use ‘"osFingerprint"` or `"os"` as a more accurate means of defining the operating system.



29
30
31
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 29

def cpe
  @cpe
end

#databasesObject

The databases enumerated on the asset.



32
33
34
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 32

def databases
  @databases
end

#dateObject

The date the data was collected on the asset.



35
36
37
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 35

def date
  @date
end

#descriptionObject

The description of the source or collection of information on the asset. This description will appear in the history of the asset for future auditing purposes.



38
39
40
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 38

def description
  @description
end

#filesObject

The files discovered with searching on the asset.



41
42
43
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 41

def files
  @files
end

#historyObject

The history of changes to the asset over time.



44
45
46
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 44

def history
  @history
end

#host_nameObject

Returns the value of attribute host_name.



46
47
48
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 46

def host_name
  @host_name
end

#host_namesObject

Additional host names for the asset.



49
50
51
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 49

def host_names
  @host_names
end

#idObject

The identifier of the asset.



52
53
54
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 52

def id
  @id
end

#idsObject

Unique identifiers found on the asset, such as hardware or operating system identifiers.



55
56
57
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 55

def ids
  @ids
end

#ipObject

The primary IPv4 or IPv6 address of the asset.



58
59
60
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 58

def ip
  @ip
end

Returns the value of attribute links.



60
61
62
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 60

def links
  @links
end

#macObject

The primary Media Access Control (MAC) address of the asset. The format is six groups of two hexadecimal digits separated by colons.



63
64
65
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 63

def mac
  @mac
end

#osObject

Free-form textual description of the operating system of the asset, typically from a fingerprinting source. This input will be parsed to produce a full fingerprint. This is the secondary means of specifying the operating system. Use ‘osFingerprint` for a more accurate definition.



66
67
68
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 66

def os
  @os
end

#os_certaintyObject

$SwaggerClient::AssetCreate.assetasset.osasset.os.certaintyasset.os.certainty.write



69
70
71
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 69

def os_certainty
  @os_certainty
end

#os_fingerprintObject

Returns the value of attribute os_fingerprint.



71
72
73
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 71

def os_fingerprint
  @os_fingerprint
end

#raw_risk_scoreObject

The base risk score of the asset.



74
75
76
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 74

def raw_risk_score
  @raw_risk_score
end

#risk_scoreObject

The risk score (with criticality adjustments) of the asset.



77
78
79
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 77

def risk_score
  @risk_score
end

#servicesObject

The services discovered on the asset.



80
81
82
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 80

def services
  @services
end

#softwareObject

The software discovered on the asset.



83
84
85
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 83

def software
  @software
end

#typeObject

The type of asset.



86
87
88
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 86

def type
  @type
end

#user_groupsObject

The group accounts enumerated on the asset.



89
90
91
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 89

def user_groups
  @user_groups
end

#usersObject

The user accounts enumerated on the asset.



92
93
94
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 92

def users
  @users
end

#vulnerabilitiesObject

Returns the value of attribute vulnerabilities.



94
95
96
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 94

def vulnerabilities
  @vulnerabilities
end

Class Method Details

.attribute_mapObject

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



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 97

def self.attribute_map
  {
    :'addresses' => :'addresses',
    :'assessed_for_policies' => :'assessedForPolicies',
    :'assessed_for_vulnerabilities' => :'assessedForVulnerabilities',
    :'configurations' => :'configurations',
    :'cpe' => :'cpe',
    :'databases' => :'databases',
    :'date' => :'date',
    :'description' => :'description',
    :'files' => :'files',
    :'history' => :'history',
    :'host_name' => :'hostName',
    :'host_names' => :'hostNames',
    :'id' => :'id',
    :'ids' => :'ids',
    :'ip' => :'ip',
    :'links' => :'links',
    :'mac' => :'mac',
    :'os' => :'os',
    :'os_certainty' => :'osCertainty',
    :'os_fingerprint' => :'osFingerprint',
    :'raw_risk_score' => :'rawRiskScore',
    :'risk_score' => :'riskScore',
    :'services' => :'services',
    :'software' => :'software',
    :'type' => :'type',
    :'user_groups' => :'userGroups',
    :'users' => :'users',
    :'vulnerabilities' => :'vulnerabilities'
  }
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



390
391
392
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 390

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

.openapi_nullableObject

List of attributes with nullable: true



165
166
167
168
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 165

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

.openapi_typesObject

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
154
155
156
157
158
159
160
161
162
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 131

def self.openapi_types
  {
    :'addresses' => :'Object',
    :'assessed_for_policies' => :'Object',
    :'assessed_for_vulnerabilities' => :'Object',
    :'configurations' => :'Object',
    :'cpe' => :'Object',
    :'databases' => :'Object',
    :'date' => :'Object',
    :'description' => :'Object',
    :'files' => :'Object',
    :'history' => :'Object',
    :'host_name' => :'Object',
    :'host_names' => :'Object',
    :'id' => :'Object',
    :'ids' => :'Object',
    :'ip' => :'Object',
    :'links' => :'Object',
    :'mac' => :'Object',
    :'os' => :'Object',
    :'os_certainty' => :'Object',
    :'os_fingerprint' => :'Object',
    :'raw_risk_score' => :'Object',
    :'risk_score' => :'Object',
    :'services' => :'Object',
    :'software' => :'Object',
    :'type' => :'Object',
    :'user_groups' => :'Object',
    :'users' => :'Object',
    :'vulnerabilities' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
367
368
369
370
371
372
373
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 342

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      addresses == o.addresses &&
      assessed_for_policies == o.assessed_for_policies &&
      assessed_for_vulnerabilities == o.assessed_for_vulnerabilities &&
      configurations == o.configurations &&
      cpe == o.cpe &&
      databases == o.databases &&
      date == o.date &&
      description == o.description &&
      files == o.files &&
      history == o.history &&
      host_name == o.host_name &&
      host_names == o.host_names &&
      id == o.id &&
      ids == o.ids &&
      ip == o.ip &&
      links == o.links &&
      mac == o.mac &&
      os == o.os &&
      os_certainty == o.os_certainty &&
      os_fingerprint == o.os_fingerprint &&
      raw_risk_score == o.raw_risk_score &&
      risk_score == o.risk_score &&
      services == o.services &&
      software == o.software &&
      type == o.type &&
      user_groups == o.user_groups &&
      users == o.users &&
      vulnerabilities == o.vulnerabilities
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



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 420

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    SwaggerClient.const_get(type).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



489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 489

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



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 397

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

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


377
378
379
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 377

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



383
384
385
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 383

def hash
  [addresses, assessed_for_policies, assessed_for_vulnerabilities, configurations, cpe, databases, date, description, files, history, host_name, host_names, id, ids, ip, links, mac, os, os_certainty, os_fingerprint, raw_risk_score, risk_score, services, software, type, user_groups, users, vulnerabilities].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



324
325
326
327
328
329
330
331
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 324

def list_invalid_properties
  invalid_properties = Array.new
  if @date.nil?
    invalid_properties.push('invalid value for "date", date 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



465
466
467
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 465

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



471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 471

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



459
460
461
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 459

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



335
336
337
338
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/asset_create.rb', line 335

def valid?
  return false if @date.nil?
  true
end