Class: OCI::ContainerInstances::Models::CreateContainerDetails

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

Overview

Information to create a new container within a container instance.

The container created by this call contains both the tags specified in this object and any tags specified in the parent container instance.

The container is created in the same compartment, availability domain, and fault domain as its container instance.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateContainerDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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

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.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.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']
  self.working_directory = "null" if working_directory.nil? && !attributes.key?(:'workingDirectory') # rubocop:disable Style/StringLiterals

  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.working_directory = "null" if working_directory.nil? && !attributes.key?(:'workingDirectory') && !attributes.key?(:'working_directory') # rubocop:disable Style/StringLiterals

  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.is_resource_principal_disabled = attributes[:'isResourcePrincipalDisabled'] unless attributes[:'isResourcePrincipalDisabled'].nil?
  self.is_resource_principal_disabled = false if is_resource_principal_disabled.nil? && !attributes.key?(:'isResourcePrincipalDisabled') # rubocop:disable Style/StringLiterals

  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.is_resource_principal_disabled = false if is_resource_principal_disabled.nil? && !attributes.key?(:'isResourcePrincipalDisabled') && !attributes.key?(:'is_resource_principal_disabled') # rubocop:disable Style/StringLiterals

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

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

Instance Attribute Details

#argumentsArray<String>

A list of string arguments for a container's ENTRYPOINT process.

Many containers use an ENTRYPOINT process pointing to a shell (/bin/bash). For those containers, this argument list specifies the main command in the container process.

The total size of all arguments combined must be 64 KB or smaller.

Returns:

  • (Array<String>)


48
49
50
# File 'lib/oci/container_instances/models/create_container_details.rb', line 48

def arguments
  @arguments
end

#commandArray<String>

An optional command that overrides the ENTRYPOINT process. If you do not provide a value, the existing ENTRYPOINT process defined in the image is used.

Returns:

  • (Array<String>)


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

def command
  @command
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>>)


101
102
103
# File 'lib/oci/container_instances/models/create_container_details.rb', line 101

def defined_tags
  @defined_tags
end

#display_nameString

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. If you don't provide a name, a name is generated automatically.

Returns:

  • (String)


22
23
24
# File 'lib/oci/container_instances/models/create_container_details.rb', line 22

def display_name
  @display_name
end

#environment_variablesHash<String, String>

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

The total size of all environment variables combined, name and values, must be 64 KB or smaller.

Returns:

  • (Hash<String, String>)


64
65
66
# File 'lib/oci/container_instances/models/create_container_details.rb', line 64

def environment_variables
  @environment_variables
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>)


95
96
97
# File 'lib/oci/container_instances/models/create_container_details.rb', line 95

def freeform_tags
  @freeform_tags
end

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

list of container health checks to check container status and take appropriate action if container status is failed. There are three types of health checks that we currently support HTTP, TCP, and Command.



86
87
88
# File 'lib/oci/container_instances/models/create_container_details.rb', line 86

def health_checks
  @health_checks
end

#image_urlString

[Required] A URL identifying the image that the container runs in, such as docker.io/library/busybox:latest. If you do not provide a tag, the tag will default to latest.

If no registry is provided, will default the registry to public docker hub docker.io/library.

The registry used for container image must be reachable over the Container Instance's VNIC.

Returns:

  • (String)


31
32
33
# File 'lib/oci/container_instances/models/create_container_details.rb', line 31

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 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)


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

def is_resource_principal_disabled
  @is_resource_principal_disabled
end

#resource_configOCI::ContainerInstances::Models::CreateContainerResourceConfigDetails



80
81
82
# File 'lib/oci/container_instances/models/create_container_details.rb', line 80

def resource_config
  @resource_config
end

#security_contextOCI::ContainerInstances::Models::CreateSecurityContextDetails



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

def security_context
  @security_context
end

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

List of the volume mounts.



69
70
71
# File 'lib/oci/container_instances/models/create_container_details.rb', line 69

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)


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

def working_directory
  @working_directory
end

Class Method Details

.attribute_mapObject

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



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/oci/container_instances/models/create_container_details.rb', line 104

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'displayName',
    'image_url': :'imageUrl',
    'command': :'command',
    'arguments': :'arguments',
    'working_directory': :'workingDirectory',
    'environment_variables': :'environmentVariables',
    'volume_mounts': :'volumeMounts',
    'is_resource_principal_disabled': :'isResourcePrincipalDisabled',
    'resource_config': :'resourceConfig',
    'health_checks': :'healthChecks',
    'security_context': :'securityContext',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/oci/container_instances/models/create_container_details.rb', line 125

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'String',
    'image_url': :'String',
    'command': :'Array<String>',
    'arguments': :'Array<String>',
    'working_directory': :'String',
    'environment_variables': :'Hash<String, String>',
    'volume_mounts': :'Array<OCI::ContainerInstances::Models::CreateVolumeMountDetails>',
    'is_resource_principal_disabled': :'BOOLEAN',
    'resource_config': :'OCI::ContainerInstances::Models::CreateContainerResourceConfigDetails',
    'health_checks': :'Array<OCI::ContainerInstances::Models::CreateContainerHealthCheckDetails>',
    'security_context': :'OCI::ContainerInstances::Models::CreateSecurityContextDetails',
    'freeform_tags': :'Hash<String, String>',
    'defined_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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/oci/container_instances/models/create_container_details.rb', line 252

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

  self.class == other.class &&
    display_name == other.display_name &&
    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 &&
    is_resource_principal_disabled == other.is_resource_principal_disabled &&
    resource_config == other.resource_config &&
    health_checks == other.health_checks &&
    security_context == other.security_context &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_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



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/oci/container_instances/models/create_container_details.rb', line 294

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


274
275
276
# File 'lib/oci/container_instances/models/create_container_details.rb', line 274

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



283
284
285
# File 'lib/oci/container_instances/models/create_container_details.rb', line 283

def hash
  [display_name, image_url, command, arguments, working_directory, environment_variables, volume_mounts, is_resource_principal_disabled, resource_config, health_checks, security_context, freeform_tags, defined_tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



327
328
329
330
331
332
333
334
335
336
# File 'lib/oci/container_instances/models/create_container_details.rb', line 327

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



321
322
323
# File 'lib/oci/container_instances/models/create_container_details.rb', line 321

def to_s
  to_hash.to_s
end