Class: OCI::CloudGuard::Models::ResourceProfileSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_guard/models/resource_profile_summary.rb

Overview

Summary information for a resource profile.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourceProfileSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
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
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 103

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.sightings_count = attributes[:'sightingsCount'] if attributes[:'sightingsCount']

  raise 'You cannot provide both :sightingsCount and :sightings_count' if attributes.key?(:'sightingsCount') && attributes.key?(:'sightings_count')

  self.sightings_count = attributes[:'sightings_count'] if attributes[:'sightings_count']

  self.id = attributes[:'id'] if attributes[:'id']

  self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']

  raise 'You cannot provide both :resourceId and :resource_id' if attributes.key?(:'resourceId') && attributes.key?(:'resource_id')

  self.resource_id = attributes[:'resource_id'] if attributes[:'resource_id']

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')

  self.display_name = attributes[:'display_name'] if attributes[:'display_name']

  self.type = attributes[:'type'] if attributes[:'type']

  self.risk_score = attributes[:'riskScore'] if attributes[:'riskScore']

  raise 'You cannot provide both :riskScore and :risk_score' if attributes.key?(:'riskScore') && attributes.key?(:'risk_score')

  self.risk_score = attributes[:'risk_score'] if attributes[:'risk_score']

  self.tactics = attributes[:'tactics'] if attributes[:'tactics']

  self.time_first_detected = attributes[:'timeFirstDetected'] if attributes[:'timeFirstDetected']

  raise 'You cannot provide both :timeFirstDetected and :time_first_detected' if attributes.key?(:'timeFirstDetected') && attributes.key?(:'time_first_detected')

  self.time_first_detected = attributes[:'time_first_detected'] if attributes[:'time_first_detected']

  self.time_last_detected = attributes[:'timeLastDetected'] if attributes[:'timeLastDetected']

  raise 'You cannot provide both :timeLastDetected and :time_last_detected' if attributes.key?(:'timeLastDetected') && attributes.key?(:'time_last_detected')

  self.time_last_detected = attributes[:'time_last_detected'] if attributes[:'time_last_detected']

  self.problems_count = attributes[:'problemsCount'] if attributes[:'problemsCount']

  raise 'You cannot provide both :problemsCount and :problems_count' if attributes.key?(:'problemsCount') && attributes.key?(:'problems_count')

  self.problems_count = attributes[:'problems_count'] if attributes[:'problems_count']
end

Instance Attribute Details

#display_nameString

[Required] Display name for the resource profile

Returns:

  • (String)


25
26
27
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 25

def display_name
  @display_name
end

#idString

[Required] Unique identifier for the resource profile

Returns:

  • (String)


17
18
19
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 17

def id
  @id
end

#problems_countInteger

Number of problems associated with this resource profile

Returns:

  • (Integer)


49
50
51
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 49

def problems_count
  @problems_count
end

#resource_idString

[Required] Unique identifier for the resource associated with the resource profile

Returns:

  • (String)


21
22
23
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 21

def resource_id
  @resource_id
end

#risk_scoreFloat

[Required] Risk score for the resource profile

Returns:

  • (Float)


33
34
35
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 33

def risk_score
  @risk_score
end

#sightings_countInteger

Number of sightings associated with the resource profile

Returns:

  • (Integer)


13
14
15
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 13

def sightings_count
  @sightings_count
end

#tacticsArray<OCI::CloudGuard::Models::TacticSummary>

[Required] List of tactic summaries associated with the resource profile



37
38
39
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 37

def tactics
  @tactics
end

#time_first_detectedDateTime

[Required] The date and time the resource profile was first detected. Format defined by RFC3339.

Returns:

  • (DateTime)


41
42
43
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 41

def time_first_detected
  @time_first_detected
end

#time_last_detectedDateTime

[Required] The date and time the resource profile was last detected. Format defined by RFC3339.

Returns:

  • (DateTime)


45
46
47
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 45

def time_last_detected
  @time_last_detected
end

#typeString

[Required] Resource type for the resource profile

Returns:

  • (String)


29
30
31
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 29

def type
  @type
end

Class Method Details

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'sightings_count': :'sightingsCount',
    'id': :'id',
    'resource_id': :'resourceId',
    'display_name': :'displayName',
    'type': :'type',
    'risk_score': :'riskScore',
    'tactics': :'tactics',
    'time_first_detected': :'timeFirstDetected',
    'time_last_detected': :'timeLastDetected',
    'problems_count': :'problemsCount'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 70

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'sightings_count': :'Integer',
    'id': :'String',
    'resource_id': :'String',
    'display_name': :'String',
    'type': :'String',
    'risk_score': :'Float',
    'tactics': :'Array<OCI::CloudGuard::Models::TacticSummary>',
    'time_first_detected': :'DateTime',
    'time_last_detected': :'DateTime',
    'problems_count': :'Integer'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 165

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    sightings_count == other.sightings_count &&
    id == other.id &&
    resource_id == other.resource_id &&
    display_name == other.display_name &&
    type == other.type &&
    risk_score == other.risk_score &&
    tactics == other.tactics &&
    time_first_detected == other.time_first_detected &&
    time_last_detected == other.time_last_detected &&
    problems_count == other.problems_count
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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 204

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


184
185
186
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 184

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



193
194
195
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 193

def hash
  [sightings_count, id, resource_id, display_name, type, risk_score, tactics, time_first_detected, time_last_detected, problems_count].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



237
238
239
240
241
242
243
244
245
246
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 237

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



231
232
233
# File 'lib/oci/cloud_guard/models/resource_profile_summary.rb', line 231

def to_s
  to_hash.to_s
end