Class: OCI::ContainerInstances::Models::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/container_instances/models/container.rb

Overview

A single container on a container instance.

If you delete a container, the record remains visible for a short period of time before being permanently removed.

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.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 = {}) ⇒ Container

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
336
337
338
339
340
341
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
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
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/oci/container_instances/models/container.rb', line 261

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

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

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

  self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']

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

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

  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']

  self.availability_domain = attributes[:'availabilityDomain'] if attributes[:'availabilityDomain']

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

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

  self.fault_domain = attributes[:'faultDomain'] if attributes[:'faultDomain']

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

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

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

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

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

  self.exit_code = attributes[:'exitCode'] if attributes[:'exitCode']

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

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

  self.time_terminated = attributes[:'timeTerminated'] if attributes[:'timeTerminated']

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

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

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

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

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

  self.container_instance_id = attributes[:'containerInstanceId'] if attributes[:'containerInstanceId']

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

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

  self.image_url = attributes[:'imageUrl'] if attributes[:'imageUrl']

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

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

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

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

  self.working_directory = attributes[:'workingDirectory'] if attributes[:'workingDirectory']

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

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

  self.environment_variables = attributes[:'environmentVariables'] if attributes[:'environmentVariables']

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

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

  self.volume_mounts = attributes[:'volumeMounts'] if attributes[:'volumeMounts']

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

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

  self.health_checks = attributes[:'healthChecks'] if attributes[:'healthChecks']

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

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

  self.is_resource_principal_disabled = attributes[:'isResourcePrincipalDisabled'] unless attributes[:'isResourcePrincipalDisabled'].nil?

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

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

  self.resource_config = attributes[:'resourceConfig'] if attributes[:'resourceConfig']

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

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

  self.container_restart_attempt_count = attributes[:'containerRestartAttemptCount'] if attributes[:'containerRestartAttemptCount']

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

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

  self.security_context = attributes[:'securityContext'] if attributes[:'securityContext']

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

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

Instance Attribute Details

#argumentsArray<String>

A list of string arguments for the ENTRYPOINT process of the container.

Many containers use an ENTRYPOINT process pointing to a shell /bin/bash. For those containers, you can use the argument list to specify the main command in the container process.

Returns:

  • (Array<String>)


118
119
120
# File 'lib/oci/container_instances/models/container.rb', line 118

def arguments
  @arguments
end

#availability_domainString

[Required] The availability domain where the container instance that hosts the container runs.

Returns:

  • (String)


59
60
61
# File 'lib/oci/container_instances/models/container.rb', line 59

def availability_domain
  @availability_domain
end

#commandArray<String>

This command overrides ENTRYPOINT process of the container. If you do not specify this command, the existing ENTRYPOINT process defined in the image is the default.

Returns:

  • (Array<String>)


110
111
112
# File 'lib/oci/container_instances/models/container.rb', line 110

def command
  @command
end

#compartment_idString

[Required] The OCID of the compartment that contains the container.

Returns:

  • (String)


37
38
39
# File 'lib/oci/container_instances/models/container.rb', line 37

def compartment_id
  @compartment_id
end

#container_instance_idString

[Required] The OCID of the container instance that the container is running on.

Returns:

  • (String)


93
94
95
# File 'lib/oci/container_instances/models/container.rb', line 93

def container_instance_id
  @container_instance_id
end

#container_restart_attempt_countInteger

The number of container restart attempts. Depending on the restart policy, a restart might be attempted after a health check failure or a container exit.

Returns:

  • (Integer)


156
157
158
# File 'lib/oci/container_instances/models/container.rb', line 156

def container_restart_attempt_count
  @container_restart_attempt_count
end

#defined_tagsHash<String, Hash<String, Object>>

Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {\"foo-namespace\": {\"bar-key\": \"value\"}}.

Returns:

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


49
50
51
# File 'lib/oci/container_instances/models/container.rb', line 49

def defined_tags
  @defined_tags
end

#display_nameString

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

Returns:

  • (String)


33
34
35
# File 'lib/oci/container_instances/models/container.rb', line 33

def display_name
  @display_name
end

#environment_variablesHash<String, String>

A map of additional environment variables to set in the environment of the ENTRYPOINT process of the container. These variables are in addition to any variables already defined in the container's image.

Returns:

  • (Hash<String, String>)


132
133
134
# File 'lib/oci/container_instances/models/container.rb', line 132

def environment_variables
  @environment_variables
end

#exit_codeInteger

The exit code of the container process when it stopped running.

Returns:

  • (Integer)


77
78
79
# File 'lib/oci/container_instances/models/container.rb', line 77

def exit_code
  @exit_code
end

#fault_domainString

The fault domain of the container instance that hosts the container runs.

Returns:

  • (String)


63
64
65
# File 'lib/oci/container_instances/models/container.rb', line 63

def fault_domain
  @fault_domain
end

#freeform_tagsHash<String, String>

Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {\"bar-key\": \"value\"}

Returns:

  • (Hash<String, String>)


43
44
45
# File 'lib/oci/container_instances/models/container.rb', line 43

def freeform_tags
  @freeform_tags
end

#health_checksArray<OCI::ContainerInstances::Models::ContainerHealthCheck>

List of container health checks



141
142
143
# File 'lib/oci/container_instances/models/container.rb', line 141

def health_checks
  @health_checks
end

#idString

[Required] The OCID of the container.

Returns:

  • (String)


29
30
31
# File 'lib/oci/container_instances/models/container.rb', line 29

def id
  @id
end

#image_urlString

[Required] The container image information. Currently only supports public Docker registry.

You can provide either the image name (containerImage), image name with version (containerImagev1), or complete Docker image URL docker.io/library/containerImage:latest.

If you do not provide a registry, the registry defaults to public Docker hub docker.io/library. The registry used for the container image must be reachable over the VNIC of the container instance.

Returns:

  • (String)


104
105
106
# File 'lib/oci/container_instances/models/container.rb', line 104

def image_url
  @image_url
end

#is_resource_principal_disabledBOOLEAN

Determines if the container will have access to the container instance resource principal.

This method utilizes resource principal version 2.2. For more information on how to use the exposed resource principal elements, see docs.oracle.com/en-us/iaas/Content/API/Concepts/sdk_authentication_methods.htm#sdk_authentication_methods_resource_principal.

Returns:

  • (BOOLEAN)


149
150
151
# File 'lib/oci/container_instances/models/container.rb', line 149

def is_resource_principal_disabled
  @is_resource_principal_disabled
end

#lifecycle_detailsString

A message that describes the current state of the container in more detail. Can be used to provide actionable information.

Returns:

  • (String)


73
74
75
# File 'lib/oci/container_instances/models/container.rb', line 73

def lifecycle_details
  @lifecycle_details
end

#lifecycle_stateString

[Required] The current state of the container.

Returns:

  • (String)


67
68
69
# File 'lib/oci/container_instances/models/container.rb', line 67

def lifecycle_state
  @lifecycle_state
end

#resource_configOCI::ContainerInstances::Models::ContainerResourceConfig



152
153
154
# File 'lib/oci/container_instances/models/container.rb', line 152

def resource_config
  @resource_config
end

#security_contextOCI::ContainerInstances::Models::SecurityContext



159
160
161
# File 'lib/oci/container_instances/models/container.rb', line 159

def security_context
  @security_context
end

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

Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {\"orcl-cloud\": {\"free-tier-retained\": \"true\"}}.

Returns:

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


55
56
57
# File 'lib/oci/container_instances/models/container.rb', line 55

def system_tags
  @system_tags
end

#time_createdDateTime

[Required] The time the container was created, in the format defined by RFC 3339.

Returns:

  • (DateTime)


85
86
87
# File 'lib/oci/container_instances/models/container.rb', line 85

def time_created
  @time_created
end

#time_terminatedDateTime

The time when the container last deleted (terminated), in the format defined by RFC 3339.

Returns:

  • (DateTime)


81
82
83
# File 'lib/oci/container_instances/models/container.rb', line 81

def time_terminated
  @time_terminated
end

#time_updatedDateTime

The time the container was updated, in the format defined by RFC 3339.

Returns:

  • (DateTime)


89
90
91
# File 'lib/oci/container_instances/models/container.rb', line 89

def time_updated
  @time_updated
end

#volume_mountsArray<OCI::ContainerInstances::Models::VolumeMount>

List of the volume mounts.



137
138
139
# File 'lib/oci/container_instances/models/container.rb', line 137

def volume_mounts
  @volume_mounts
end

#working_directoryString

The working directory within the container's filesystem for the container process. If not specified, the default working directory from the image is used.

Returns:

  • (String)


125
126
127
# File 'lib/oci/container_instances/models/container.rb', line 125

def working_directory
  @working_directory
end

Class Method Details

.attribute_mapObject

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



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
# File 'lib/oci/container_instances/models/container.rb', line 162

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'display_name': :'displayName',
    'compartment_id': :'compartmentId',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'system_tags': :'systemTags',
    'availability_domain': :'availabilityDomain',
    'fault_domain': :'faultDomain',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_details': :'lifecycleDetails',
    'exit_code': :'exitCode',
    'time_terminated': :'timeTerminated',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'container_instance_id': :'containerInstanceId',
    'image_url': :'imageUrl',
    'command': :'command',
    'arguments': :'arguments',
    'working_directory': :'workingDirectory',
    'environment_variables': :'environmentVariables',
    'volume_mounts': :'volumeMounts',
    'health_checks': :'healthChecks',
    'is_resource_principal_disabled': :'isResourcePrincipalDisabled',
    'resource_config': :'resourceConfig',
    'container_restart_attempt_count': :'containerRestartAttemptCount',
    'security_context': :'securityContext'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/oci/container_instances/models/container.rb', line 196

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'display_name': :'String',
    'compartment_id': :'String',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'system_tags': :'Hash<String, Hash<String, Object>>',
    'availability_domain': :'String',
    'fault_domain': :'String',
    'lifecycle_state': :'String',
    'lifecycle_details': :'String',
    'exit_code': :'Integer',
    'time_terminated': :'DateTime',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'container_instance_id': :'String',
    'image_url': :'String',
    'command': :'Array<String>',
    'arguments': :'Array<String>',
    'working_directory': :'String',
    'environment_variables': :'Hash<String, String>',
    'volume_mounts': :'Array<OCI::ContainerInstances::Models::VolumeMount>',
    'health_checks': :'Array<OCI::ContainerInstances::Models::ContainerHealthCheck>',
    'is_resource_principal_disabled': :'BOOLEAN',
    'resource_config': :'OCI::ContainerInstances::Models::ContainerResourceConfig',
    'container_restart_attempt_count': :'Integer',
    'security_context': :'OCI::ContainerInstances::Models::SecurityContext'
    # 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



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/oci/container_instances/models/container.rb', line 432

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

  self.class == other.class &&
    id == other.id &&
    display_name == other.display_name &&
    compartment_id == other.compartment_id &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    system_tags == other.system_tags &&
    availability_domain == other.availability_domain &&
    fault_domain == other.fault_domain &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_details == other.lifecycle_details &&
    exit_code == other.exit_code &&
    time_terminated == other.time_terminated &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    container_instance_id == other.container_instance_id &&
    image_url == other.image_url &&
    command == other.command &&
    arguments == other.arguments &&
    working_directory == other.working_directory &&
    environment_variables == other.environment_variables &&
    volume_mounts == other.volume_mounts &&
    health_checks == other.health_checks &&
    is_resource_principal_disabled == other.is_resource_principal_disabled &&
    resource_config == other.resource_config &&
    container_restart_attempt_count == other.container_restart_attempt_count &&
    security_context == other.security_context
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



487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/oci/container_instances/models/container.rb', line 487

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


467
468
469
# File 'lib/oci/container_instances/models/container.rb', line 467

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



476
477
478
# File 'lib/oci/container_instances/models/container.rb', line 476

def hash
  [id, display_name, compartment_id, freeform_tags, defined_tags, system_tags, availability_domain, fault_domain, lifecycle_state, lifecycle_details, exit_code, time_terminated, time_created, time_updated, container_instance_id, image_url, command, arguments, working_directory, environment_variables, volume_mounts, health_checks, is_resource_principal_disabled, resource_config, container_restart_attempt_count, security_context].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



520
521
522
523
524
525
526
527
528
529
# File 'lib/oci/container_instances/models/container.rb', line 520

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



514
515
516
# File 'lib/oci/container_instances/models/container.rb', line 514

def to_s
  to_hash.to_s
end