Class: OCI::FleetAppsManagement::Models::FleetTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/fleet_apps_management/models/fleet_target.rb

Overview

A confirmed target within a fleet.

Constant Summary collapse

COMPLIANCE_STATE_ENUM =
[
  COMPLIANCE_STATE_UNKNOWN = 'UNKNOWN'.freeze,
  COMPLIANCE_STATE_COMPLIANT = 'COMPLIANT'.freeze,
  COMPLIANCE_STATE_NON_COMPLIANT = 'NON_COMPLIANT'.freeze,
  COMPLIANCE_STATE_WARNING = 'WARNING'.freeze,
  COMPLIANCE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FleetTarget

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
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
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 145

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.id = attributes[:'id'] if attributes[:'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.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.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

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

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

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

  self.compliance_state = attributes[:'complianceState'] if attributes[:'complianceState']

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

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

  self.time_of_last_successful_discovery = attributes[:'timeOfLastSuccessfulDiscovery'] if attributes[:'timeOfLastSuccessfulDiscovery']

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

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

  self.time_of_last_discovery_attempt = attributes[:'timeOfLastDiscoveryAttempt'] if attributes[:'timeOfLastDiscoveryAttempt']

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

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

  self.is_last_discovery_attempt_successful = attributes[:'isLastDiscoveryAttemptSuccessful'] unless attributes[:'isLastDiscoveryAttemptSuccessful'].nil?

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

  self.is_last_discovery_attempt_successful = attributes[:'is_last_discovery_attempt_successful'] unless attributes[:'is_last_discovery_attempt_successful'].nil?

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

  self.system_tags = attributes[:'systemTags'] if attributes[:'systemTags']

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

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

Instance Attribute Details

#compartment_idString

compartment OCID

Returns:

  • (String)


33
34
35
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 33

def compartment_id
  @compartment_id
end

#compliance_stateString

The last known compliance state of the target.

Returns:

  • (String)


60
61
62
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 60

def compliance_state
  @compliance_state
end

#display_nameString

[Required] A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

Example: My new resource

Returns:

  • (String)


41
42
43
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 41

def display_name
  @display_name
end

#idString

[Required] The OCID of the resource.

Returns:

  • (String)


29
30
31
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 29

def id
  @id
end

#is_last_discovery_attempt_successfulBOOLEAN

A boolean flag that represents whether the last discovery attempt was successful.

Returns:

  • (BOOLEAN)


72
73
74
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 72

def is_last_discovery_attempt_successful
  @is_last_discovery_attempt_successful
end

#lifecycle_stateString

The current state of the FleetTarget.

Returns:

  • (String)


76
77
78
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 76

def lifecycle_state
  @lifecycle_state
end

#productString

Product to which the target belongs to.

Returns:

  • (String)


53
54
55
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 53

def product
  @product
end

#resourceOCI::FleetAppsManagement::Models::TargetResource



56
57
58
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 56

def resource
  @resource
end

#system_tagsHash<String, Hash<String, Object>>

System tags for this resource. Each key is predefined and scoped to a namespace. Example: {\"orcl-cloud\": {\"free-tier-retained\": \"true\"}}

Returns:

  • (Hash<String, Hash<String, Object>>)


82
83
84
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 82

def system_tags
  @system_tags
end

#time_createdDateTime

The time this resource was created. An RFC3339 formatted datetime string.

Returns:

  • (DateTime)


45
46
47
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 45

def time_created
  @time_created
end

#time_of_last_discovery_attemptDateTime

The time when last discovery was attempted.

Returns:

  • (DateTime)


68
69
70
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 68

def time_of_last_discovery_attempt
  @time_of_last_discovery_attempt
end

#time_of_last_successful_discoveryDateTime

The time when the last successful discovery was made.

Returns:

  • (DateTime)


64
65
66
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 64

def time_of_last_successful_discovery
  @time_of_last_successful_discovery
end

#versionString

Current version of target.

Returns:

  • (String)


49
50
51
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 49

def version
  @version
end

Class Method Details

.attribute_mapObject

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 85

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'compartment_id': :'compartmentId',
    'display_name': :'displayName',
    'time_created': :'timeCreated',
    'version': :'version',
    'product': :'product',
    'resource': :'resource',
    'compliance_state': :'complianceState',
    'time_of_last_successful_discovery': :'timeOfLastSuccessfulDiscovery',
    'time_of_last_discovery_attempt': :'timeOfLastDiscoveryAttempt',
    'is_last_discovery_attempt_successful': :'isLastDiscoveryAttemptSuccessful',
    'lifecycle_state': :'lifecycleState',
    'system_tags': :'systemTags'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 106

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'compartment_id': :'String',
    'display_name': :'String',
    'time_created': :'DateTime',
    'version': :'String',
    'product': :'String',
    'resource': :'OCI::FleetAppsManagement::Models::TargetResource',
    'compliance_state': :'String',
    'time_of_last_successful_discovery': :'DateTime',
    'time_of_last_discovery_attempt': :'DateTime',
    'is_last_discovery_attempt_successful': :'BOOLEAN',
    'lifecycle_state': :'String',
    'system_tags': :'Hash<String, Hash<String, Object>>'
    # 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



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 247

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

  self.class == other.class &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    display_name == other.display_name &&
    time_created == other.time_created &&
    version == other.version &&
    product == other.product &&
    resource == other.resource &&
    compliance_state == other.compliance_state &&
    time_of_last_successful_discovery == other.time_of_last_successful_discovery &&
    time_of_last_discovery_attempt == other.time_of_last_discovery_attempt &&
    is_last_discovery_attempt_successful == other.is_last_discovery_attempt_successful &&
    lifecycle_state == other.lifecycle_state &&
    system_tags == other.system_tags
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



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 289

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


269
270
271
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 269

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



278
279
280
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 278

def hash
  [id, compartment_id, display_name, time_created, version, product, resource, compliance_state, time_of_last_successful_discovery, time_of_last_discovery_attempt, is_last_discovery_attempt_successful, lifecycle_state, system_tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



322
323
324
325
326
327
328
329
330
331
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 322

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



316
317
318
# File 'lib/oci/fleet_apps_management/models/fleet_target.rb', line 316

def to_s
  to_hash.to_s
end