Class: OCI::ResourceManager::Models::StackResourceDriftSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/resource_manager/models/stack_resource_drift_summary.rb

Overview

Drift status details for the indicated resource and stack. Includes actual and expected (defined) properties.

Constant Summary collapse

RESOURCE_DRIFT_STATUS_ENUM =
[
  RESOURCE_DRIFT_STATUS_NOT_CHECKED = 'NOT_CHECKED'.freeze,
  RESOURCE_DRIFT_STATUS_IN_SYNC = 'IN_SYNC'.freeze,
  RESOURCE_DRIFT_STATUS_MODIFIED = 'MODIFIED'.freeze,
  RESOURCE_DRIFT_STATUS_DELETED = 'DELETED'.freeze,
  RESOURCE_DRIFT_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StackResourceDriftSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :stack_id (String)

    The value to assign to the #stack_id property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :resource_name (String)

    The value to assign to the #resource_name property

  • :resource_id (String)

    The value to assign to the #resource_id property

  • :resource_type (String)

    The value to assign to the #resource_type property

  • :resource_drift_status (String)

    The value to assign to the #resource_drift_status property

  • :actual_properties (Hash<String, String>)

    The value to assign to the #actual_properties property

  • :expected_properties (Hash<String, String>)

    The value to assign to the #expected_properties property

  • :time_drift_checked (DateTime)

    The value to assign to the #time_drift_checked property



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
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/oci/resource_manager/models/stack_resource_drift_summary.rb', line 122

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.stack_id = attributes[:'stackId'] if attributes[:'stackId']

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

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

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

  self.resource_name = attributes[:'resourceName'] if attributes[:'resourceName']

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

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

  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.resource_type = attributes[:'resourceType'] if attributes[:'resourceType']

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

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

  self.resource_drift_status = attributes[:'resourceDriftStatus'] if attributes[:'resourceDriftStatus']

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

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

  self.actual_properties = attributes[:'actualProperties'] if attributes[:'actualProperties']

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

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

  self.expected_properties = attributes[:'expectedProperties'] if attributes[:'expectedProperties']

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

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

  self.time_drift_checked = attributes[:'timeDriftChecked'] if attributes[:'timeDriftChecked']

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

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

Instance Attribute Details

#actual_propertiesHash<String, String>

Actual values of properties that the stack defines for the indicated resource. Each property and value is provided as a key-value pair. The following example shows actual values for the resource's display name and server type: {\"display_name\": \"tf-default-dhcp-options-new\", \"options.0.server_type\": \"VcnLocalPlusInternet\"}

Returns:

  • (Hash<String, String>)


56
57
58
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 56

def actual_properties
  @actual_properties
end

#compartment_idString

The OCID of the compartment where the stack is located.

Returns:

  • (String)


27
28
29
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 27

def compartment_id
  @compartment_id
end

#expected_propertiesHash<String, String>

Expected values of properties that the stack defines for the indicated resource. Each property and value is provided as a key-value pair. The following example shows expected (defined) values for the resource's display name and server type: {\"display_name\": \"tf-default-dhcp-options\", \"options.0.server_type\": \"VcnLocalPlusInternet\"}

Returns:

  • (Hash<String, String>)


64
65
66
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 64

def expected_properties
  @expected_properties
end

#resource_drift_statusString

The drift status of the resource. A drift status value indicates whether or not the actual state of the resource differs from the expected (defined) state for that resource.

Returns:

  • (String)


48
49
50
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 48

def resource_drift_status
  @resource_drift_status
end

#resource_idString

The OCID of the resource provisioned by Terraform.

Returns:

  • (String)


35
36
37
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 35

def resource_id
  @resource_id
end

#resource_nameString

The name of the resource as defined in the stack.

Returns:

  • (String)


31
32
33
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 31

def resource_name
  @resource_name
end

#resource_typeString

The provider resource type. Must be supported by the Oracle Cloud Infrastructure provider. Example: oci_core_instance

Returns:

  • (String)


42
43
44
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 42

def resource_type
  @resource_type
end

#stack_idString

The OCID of the stack.

Returns:

  • (String)


23
24
25
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 23

def stack_id
  @stack_id
end

#time_drift_checkedDateTime

The date and time when the drift detection was executed. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z

Returns:

  • (DateTime)


71
72
73
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 71

def time_drift_checked
  @time_drift_checked
end

Class Method Details

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 74

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'stack_id': :'stackId',
    'compartment_id': :'compartmentId',
    'resource_name': :'resourceName',
    'resource_id': :'resourceId',
    'resource_type': :'resourceType',
    'resource_drift_status': :'resourceDriftStatus',
    'actual_properties': :'actualProperties',
    'expected_properties': :'expectedProperties',
    'time_drift_checked': :'timeDriftChecked'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 91

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'stack_id': :'String',
    'compartment_id': :'String',
    'resource_name': :'String',
    'resource_id': :'String',
    'resource_type': :'String',
    'resource_drift_status': :'String',
    'actual_properties': :'Hash<String, String>',
    'expected_properties': :'Hash<String, String>',
    'time_drift_checked': :'DateTime'
    # 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



203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 203

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

  self.class == other.class &&
    stack_id == other.stack_id &&
    compartment_id == other.compartment_id &&
    resource_name == other.resource_name &&
    resource_id == other.resource_id &&
    resource_type == other.resource_type &&
    resource_drift_status == other.resource_drift_status &&
    actual_properties == other.actual_properties &&
    expected_properties == other.expected_properties &&
    time_drift_checked == other.time_drift_checked
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



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 241

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


221
222
223
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 221

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



230
231
232
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 230

def hash
  [stack_id, compartment_id, resource_name, resource_id, resource_type, resource_drift_status, actual_properties, expected_properties, time_drift_checked].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



274
275
276
277
278
279
280
281
282
283
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 274

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



268
269
270
# File 'lib/oci/resource_manager/models/stack_resource_drift_summary.rb', line 268

def to_s
  to_hash.to_s
end