Class: SwaggerClient::Agent

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Agent

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 191

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

def addresses
  @addresses
end

#agent_idObject

The identifier of the agent.



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

def agent_id
  @agent_id
end

#assessed_for_policiesObject

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



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

def assessed_for_policies
  @assessed_for_policies
end

#assessed_for_vulnerabilitiesObject

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



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

def assessed_for_vulnerabilities
  @assessed_for_vulnerabilities
end

#configurationsObject

Configuration key-values pairs enumerated on the asset.



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

def configurations
  @configurations
end

#databasesObject

The databases enumerated on the asset.



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

def databases
  @databases
end

#filesObject

The files discovered with searching on the asset.



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

def files
  @files
end

#historyObject

The history of changes to the asset over time.



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

def history
  @history
end

#host_nameObject

The primary host name (local or FQDN) of the asset.



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

def host_name
  @host_name
end

#host_namesObject

All host names or aliases discovered on the asset.



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

def host_names
  @host_names
end

#idObject

The identifier of the asset.



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

def id
  @id
end

#idsObject

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



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

def ids
  @ids
end

#ipObject

The primary IPv4 or IPv6 address of the asset.



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

def ip
  @ip
end

#last_assessed_for_vulnerabilitiesObject

The time the last vulnerability assessment occured.



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

def last_assessed_for_vulnerabilities
  @last_assessed_for_vulnerabilities
end

Hypermedia links to corresponding or related resources.



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

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.



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

def mac
  @mac
end

#osObject

The full description of the operating system of the asset.



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

def os
  @os
end

#os_certaintyObject

$SwaggerClient::Agent.assetasset.osasset.os.certainty



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

def os_certainty
  @os_certainty
end

#os_fingerprintObject

Returns the value of attribute os_fingerprint.



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

def os_fingerprint
  @os_fingerprint
end

#raw_risk_scoreObject

The base risk score of the asset.



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

def raw_risk_score
  @raw_risk_score
end

#risk_scoreObject

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



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

def risk_score
  @risk_score
end

#servicesObject

The services discovered on the asset.



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

def services
  @services
end

#softwareObject

The software discovered on the asset.



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

def software
  @software
end

#typeObject

The type of asset.



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

def type
  @type
end

#user_groupsObject

The group accounts enumerated on the asset.



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

def user_groups
  @user_groups
end

#usersObject

The user accounts enumerated on the asset.



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

def users
  @users
end

#vulnerabilitiesObject

Returns the value of attribute vulnerabilities.



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

def vulnerabilities
  @vulnerabilities
end

Class Method Details

.attribute_mapObject

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



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 118

def self.attribute_map
  {
    :'addresses' => :'addresses',
    :'agent_id' => :'agentId',
    :'assessed_for_policies' => :'assessedForPolicies',
    :'assessed_for_vulnerabilities' => :'assessedForVulnerabilities',
    :'configurations' => :'configurations',
    :'databases' => :'databases',
    :'files' => :'files',
    :'history' => :'history',
    :'host_name' => :'hostName',
    :'host_names' => :'hostNames',
    :'id' => :'id',
    :'ids' => :'ids',
    :'ip' => :'ip',
    :'last_assessed_for_vulnerabilities' => :'lastAssessedForVulnerabilities',
    :'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



416
417
418
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 416

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

.openapi_nullableObject

List of attributes with nullable: true



184
185
186
187
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 184

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'addresses' => :'Object',
    :'agent_id' => :'Object',
    :'assessed_for_policies' => :'Object',
    :'assessed_for_vulnerabilities' => :'Object',
    :'configurations' => :'Object',
    :'databases' => :'Object',
    :'files' => :'Object',
    :'history' => :'Object',
    :'host_name' => :'Object',
    :'host_names' => :'Object',
    :'id' => :'Object',
    :'ids' => :'Object',
    :'ip' => :'Object',
    :'last_assessed_for_vulnerabilities' => :'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



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 369

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      addresses == o.addresses &&
      agent_id == o.agent_id &&
      assessed_for_policies == o.assessed_for_policies &&
      assessed_for_vulnerabilities == o.assessed_for_vulnerabilities &&
      configurations == o.configurations &&
      databases == o.databases &&
      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 &&
      last_assessed_for_vulnerabilities == o.last_assessed_for_vulnerabilities &&
      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



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 446

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



515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 515

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



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 423

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


403
404
405
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 403

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



409
410
411
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 409

def hash
  [addresses, agent_id, assessed_for_policies, assessed_for_vulnerabilities, configurations, databases, files, history, host_name, host_names, id, ids, ip, last_assessed_for_vulnerabilities, 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



339
340
341
342
343
344
345
346
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 339

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



491
492
493
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 491

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



497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 497

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



485
486
487
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 485

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



350
351
352
353
354
355
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/models/agent.rb', line 350

def valid?
  return false if @last_assessed_for_vulnerabilities.nil?
  type_validator = EnumAttributeValidator.new('Object', ['unknown', 'guest', 'hypervisor', 'physical', 'mobile'])
  return false unless type_validator.valid?(@type)
  true
end