Class: OCI::Core::ComputeClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/core/compute_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: nil, region: nil) ⇒ ComputeClient

Creates a new ComputeClient. If a config is not specified, then the global OCI.config will be used.

A region must be specified in either the config or the region parameter. If specified in both, then the region parameter will be used.

Parameters:

  • config (Config) (defaults to: nil)

    A Config object.

  • region (String) (defaults to: nil)

    A region used to determine the service endpoint. This will usually correspond to a value in Regions::REGION_ENUM, but may be an arbitrary string.



32
33
34
35
36
37
38
39
40
41
# File 'lib/oci/core/compute_client.rb', line 32

def initialize(config:nil, region:nil)
  config ||= OCI.config
  config.validate

  signer = Signer.new(config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase, private_key_content: config.key_content, signing_strategy: Signer::STANDARD)
  @api_client = ApiClient.new(config, signer)

  region ||= config.region
  self.region = region
end

Instance Attribute Details

#api_clientOCI::ApiClient (readonly)

Client used to make HTTP requests.

Returns:



12
13
14
# File 'lib/oci/core/compute_client.rb', line 12

def api_client
  @api_client
end

#endpointString (readonly)

Fully qualified endpoint URL

Returns:

  • (String)


16
17
18
# File 'lib/oci/core/compute_client.rb', line 16

def endpoint
  @endpoint
end

#regionString

The region, which will usually correspond to a value in Regions::REGION_ENUM.

Returns:

  • (String)


20
21
22
# File 'lib/oci/core/compute_client.rb', line 20

def region
  @region
end

Instance Method Details

#attach_boot_volume(attach_boot_volume_details, opts = {}) ⇒ Response

Attaches the specified boot volume to the specified instance.

Parameters:

  • attach_boot_volume_details (AttachBootVolumeDetails)

    Attach boot volume request

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::BootVolumeAttachment



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/oci/core/compute_client.rb', line 72

def attach_boot_volume(attach_boot_volume_details, opts = {})
  logger.debug "Calling operation ComputeClient#attach_boot_volume." if logger

  fail "Missing the required parameter 'attach_boot_volume_details' when calling attach_boot_volume." if attach_boot_volume_details.nil?

  path = "/bootVolumeAttachments/"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(attach_boot_volume_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::BootVolumeAttachment')
end

#attach_vnic(attach_vnic_details, opts = {}) ⇒ Response

Creates a secondary VNIC and attaches it to the specified instance. For more information about secondary VNICs, see [Virtual Network Interface Cards (VNICs)](docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm).

Parameters:

  • attach_vnic_details (AttachVnicDetails)

    Attach VNIC details.

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::VnicAttachment



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
# File 'lib/oci/core/compute_client.rb', line 113

def attach_vnic(attach_vnic_details, opts = {})
  logger.debug "Calling operation ComputeClient#attach_vnic." if logger

  fail "Missing the required parameter 'attach_vnic_details' when calling attach_vnic." if attach_vnic_details.nil?

  path = "/vnicAttachments/"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(attach_vnic_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::VnicAttachment')
end

#attach_volume(attach_volume_details, opts = {}) ⇒ Response

Attaches the specified storage volume to the specified instance.

Parameters:

  • attach_volume_details (AttachVolumeDetails)

    Attach volume request

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::VolumeAttachment



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
# File 'lib/oci/core/compute_client.rb', line 152

def attach_volume(attach_volume_details, opts = {})
  logger.debug "Calling operation ComputeClient#attach_volume." if logger

  fail "Missing the required parameter 'attach_volume_details' when calling attach_volume." if attach_volume_details.nil?

  path = "/volumeAttachments/"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(attach_volume_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::VolumeAttachment')
end

#capture_console_history(capture_console_history_details, opts = {}) ⇒ Response

Captures the most recent serial console data (up to a megabyte) for the specified instance.

The ‘CaptureConsoleHistory` operation works with the other console history operations as described below.

  1. Use ‘CaptureConsoleHistory` to request the capture of up to a megabyte of the

most recent console history. This call returns a ‘ConsoleHistory` object. The object will have a state of REQUESTED.

  1. Wait for the capture operation to succeed by polling ‘GetConsoleHistory` with

the identifier of the console history metadata. The state of the ‘ConsoleHistory` object will go from REQUESTED to GETTING-HISTORY and then SUCCEEDED (or FAILED).

  1. Use ‘GetConsoleHistoryContent` to get the actual console history data (not the

metadata).

  1. Optionally, use ‘DeleteConsoleHistory` to delete the console history metadata

and the console history data.

Parameters:

  • capture_console_history_details (CaptureConsoleHistoryDetails)

    Console history details

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::ConsoleHistory



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
# File 'lib/oci/core/compute_client.rb', line 207

def capture_console_history(capture_console_history_details, opts = {})
  logger.debug "Calling operation ComputeClient#capture_console_history." if logger

  fail "Missing the required parameter 'capture_console_history_details' when calling capture_console_history." if capture_console_history_details.nil?

  path = "/instanceConsoleHistories/"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(capture_console_history_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::ConsoleHistory')
end

#create_image(create_image_details, opts = {}) ⇒ Response

Creates a boot disk image for the specified instance or imports an exported image from the Oracle Cloud Infrastructure Object Storage service.

When creating a new image, you must provide the OCID of the instance you want to use as the basis for the image, and the OCID of the compartment containing that instance. For more information about images, see [Managing Custom Images](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).

When importing an exported image from Object Storage, you specify the source information in image_source_details.

When importing an image based on the namespace, bucket name, and object name, use image_source_via_object_storage_tuple_details.

When importing an image based on the Object Storage URL, use image_source_via_object_storage_uri_details. See [Object Storage URLs](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm#URLs) and [pre-authenticated requests](docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingaccess.htm#pre-auth) for constructing URLs for image import/export.

For more information about importing exported images, see [Image Import/Export](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm).

You may optionally specify a *display name* for the image, which is simply a friendly name or description. It does not have to be unique, and you can change it. See update_image. Avoid entering confidential information.

Parameters:

  • create_image_details (CreateImageDetails)

    Image creation details

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Image



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
# File 'lib/oci/core/compute_client.rb', line 268

def create_image(create_image_details, opts = {})
  logger.debug "Calling operation ComputeClient#create_image." if logger

  fail "Missing the required parameter 'create_image_details' when calling create_image." if create_image_details.nil?

  path = "/images/"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(create_image_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Image')
end

#create_instance_console_connection(create_instance_console_connection_details, opts = {}) ⇒ Response

Creates a new console connection to the specified instance. Once the console connection has been created and is available, you connect to the console using SSH.

For more information about console access, see [Accessing the Console](docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/serialconsole.htm).

Parameters:

  • create_instance_console_connection_details (CreateInstanceConsoleConnectionDetails)

    Request object for creating an InstanceConsoleConnection

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::InstanceConsoleConnection



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
# File 'lib/oci/core/compute_client.rb', line 311

def create_instance_console_connection(create_instance_console_connection_details, opts = {})
  logger.debug "Calling operation ComputeClient#create_instance_console_connection." if logger

  fail "Missing the required parameter 'create_instance_console_connection_details' when calling create_instance_console_connection." if create_instance_console_connection_details.nil?

  path = "/instanceConsoleConnections"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(create_instance_console_connection_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::InstanceConsoleConnection')
end

#delete_console_history(instance_console_history_id, opts = {}) ⇒ Response

Deletes the specified console history metadata and the console history data.

Parameters:

  • instance_console_history_id (String)

    The OCID of the console history.

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



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
# File 'lib/oci/core/compute_client.rb', line 347

def delete_console_history(instance_console_history_id, opts = {})
  logger.debug "Calling operation ComputeClient#delete_console_history." if logger

  fail "Missing the required parameter 'instance_console_history_id' when calling delete_console_history." if instance_console_history_id.nil?

  path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#delete_image(image_id, opts = {}) ⇒ Response

Deletes an image.

Parameters:

  • image_id (String)

    The OCID of the image.

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



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
# File 'lib/oci/core/compute_client.rb', line 382

def delete_image(image_id, opts = {})
  logger.debug "Calling operation ComputeClient#delete_image." if logger

  fail "Missing the required parameter 'image_id' when calling delete_image." if image_id.nil?

  path = "/images/{imageId}".sub('{imageId}', image_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#delete_instance_console_connection(instance_console_connection_id, opts = {}) ⇒ Response

Deletes the specified instance console connection.

Parameters:

  • instance_console_connection_id (String)

    The OCID of the intance console connection

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/oci/core/compute_client.rb', line 417

def delete_instance_console_connection(instance_console_connection_id, opts = {})
  logger.debug "Calling operation ComputeClient#delete_instance_console_connection." if logger

  fail "Missing the required parameter 'instance_console_connection_id' when calling delete_instance_console_connection." if instance_console_connection_id.nil?

  path = "/instanceConsoleConnections/{instanceConsoleConnectionId}".sub('{instanceConsoleConnectionId}', instance_console_connection_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#detach_boot_volume(boot_volume_attachment_id, opts = {}) ⇒ Response

Detaches a boot volume from an instance. You must specify the OCID of the boot volume attachment.

This is an asynchronous operation. The attachment’s ‘lifecycleState` will change to DETACHING temporarily until the attachment is completely removed.

Parameters:

  • boot_volume_attachment_id (String)

    The OCID of the boot volume attachment.

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/oci/core/compute_client.rb', line 456

def detach_boot_volume(boot_volume_attachment_id, opts = {})
  logger.debug "Calling operation ComputeClient#detach_boot_volume." if logger

  fail "Missing the required parameter 'boot_volume_attachment_id' when calling detach_boot_volume." if boot_volume_attachment_id.nil?

  path = "/bootVolumeAttachments/{bootVolumeAttachmentId}".sub('{bootVolumeAttachmentId}', boot_volume_attachment_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#detach_vnic(vnic_attachment_id, opts = {}) ⇒ Response

Detaches and deletes the specified secondary VNIC. This operation cannot be used on the instance’s primary VNIC. When you terminate an instance, all attached VNICs (primary and secondary) are automatically detached and deleted.

Important: If the VNIC has a PrivateIp that is the [target of a route rule](docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip), deleting the VNIC causes that route rule to blackhole and the traffic will be dropped.

Parameters:

  • vnic_attachment_id (String)

    The OCID of the VNIC attachment.

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/oci/core/compute_client.rb', line 501

def detach_vnic(vnic_attachment_id, opts = {})
  logger.debug "Calling operation ComputeClient#detach_vnic." if logger

  fail "Missing the required parameter 'vnic_attachment_id' when calling detach_vnic." if vnic_attachment_id.nil?

  path = "/vnicAttachments/{vnicAttachmentId}".sub('{vnicAttachmentId}', vnic_attachment_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#detach_volume(volume_attachment_id, opts = {}) ⇒ Response

Detaches a storage volume from an instance. You must specify the OCID of the volume attachment.

This is an asynchronous operation. The attachment’s ‘lifecycleState` will change to DETACHING temporarily until the attachment is completely removed.

Parameters:

  • volume_attachment_id (String)

    The OCID of the volume attachment.

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/oci/core/compute_client.rb', line 540

def detach_volume(volume_attachment_id, opts = {})
  logger.debug "Calling operation ComputeClient#detach_volume." if logger

  fail "Missing the required parameter 'volume_attachment_id' when calling detach_volume." if volume_attachment_id.nil?

  path = "/volumeAttachments/{volumeAttachmentId}".sub('{volumeAttachmentId}', volume_attachment_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#export_image(image_id, export_image_details, opts = {}) ⇒ Response

Exports the specified image to the Oracle Cloud Infrastructure Object Storage service. You can use the Object Storage URL, or the namespace, bucket name, and object name when specifying the location to export to.

For more information about exporting images, see [Image Import/Export](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm).

To perform an image export, you need write access to the Object Storage bucket for the image, see [Let Users Write Objects to Object Storage Buckets](docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm#Let4).

See [Object Storage URLs](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm#URLs) and [pre-authenticated requests](docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingaccess.htm#pre-auth) for constructing URLs for image import/export.

Parameters:

  • image_id (String)

    The OCID of the image.

  • export_image_details (ExportImageDetails)

    Details for the image export.

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Image



592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/oci/core/compute_client.rb', line 592

def export_image(image_id, export_image_details, opts = {})
  logger.debug "Calling operation ComputeClient#export_image." if logger

  fail "Missing the required parameter 'image_id' when calling export_image." if image_id.nil?
  fail "Missing the required parameter 'export_image_details' when calling export_image." if export_image_details.nil?

  path = "/images/{imageId}/actions/export".sub('{imageId}', image_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = @api_client.object_to_http_body(export_image_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Image')
end

#get_boot_volume_attachment(boot_volume_attachment_id, opts = {}) ⇒ Response

Gets information about the specified boot volume attachment.

Parameters:

  • boot_volume_attachment_id (String)

    The OCID of the boot volume attachment.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::BootVolumeAttachment



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/oci/core/compute_client.rb', line 626

def get_boot_volume_attachment(boot_volume_attachment_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_boot_volume_attachment." if logger

  fail "Missing the required parameter 'boot_volume_attachment_id' when calling get_boot_volume_attachment." if boot_volume_attachment_id.nil?

  path = "/bootVolumeAttachments/{bootVolumeAttachmentId}".sub('{bootVolumeAttachmentId}', boot_volume_attachment_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::BootVolumeAttachment')
end

#get_console_history(instance_console_history_id, opts = {}) ⇒ Response

Shows the metadata for the specified console history. See capture_console_history for details about using the console history operations.

Parameters:

  • instance_console_history_id (String)

    The OCID of the console history.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::ConsoleHistory



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
# File 'lib/oci/core/compute_client.rb', line 660

def get_console_history(instance_console_history_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_console_history." if logger

  fail "Missing the required parameter 'instance_console_history_id' when calling get_console_history." if instance_console_history_id.nil?

  path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::ConsoleHistory')
end

#get_console_history_content(instance_console_history_id, opts = {}) ⇒ Response

Gets the actual console history data (not the metadata). See capture_console_history for details about using the console history operations.

Parameters:

  • instance_console_history_id (String)

    The OCID of the console history.

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

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    Offset of the snapshot data to retrieve.

  • :length (Integer)

    Length of the snapshot data to retrieve.

Returns:

  • (Response)

    A Response object with data of type String



696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/oci/core/compute_client.rb', line 696

def get_console_history_content(instance_console_history_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_console_history_content." if logger

  fail "Missing the required parameter 'instance_console_history_id' when calling get_console_history_content." if instance_console_history_id.nil?

  path = "/instanceConsoleHistories/{instanceConsoleHistoryId}/data".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)

  # Query Params
  query_params = {}
  query_params[:'offset'] = opts[:'offset'] if opts[:'offset']
  query_params[:'length'] = opts[:'length'] if opts[:'length']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'String')
end

#get_image(image_id, opts = {}) ⇒ Response

Gets the specified image.

Parameters:

  • image_id (String)

    The OCID of the image.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Image



729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/oci/core/compute_client.rb', line 729

def get_image(image_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_image." if logger

  fail "Missing the required parameter 'image_id' when calling get_image." if image_id.nil?

  path = "/images/{imageId}".sub('{imageId}', image_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Image')
end

#get_instance(instance_id, opts = {}) ⇒ Response

Gets information about the specified instance.

Parameters:

  • instance_id (String)

    The OCID of the instance.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Instance



760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
# File 'lib/oci/core/compute_client.rb', line 760

def get_instance(instance_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_instance." if logger

  fail "Missing the required parameter 'instance_id' when calling get_instance." if instance_id.nil?

  path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Instance')
end

#get_instance_console_connection(instance_console_connection_id, opts = {}) ⇒ Response

Gets the specified instance console connection’s information.

Parameters:

  • instance_console_connection_id (String)

    The OCID of the intance console connection

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::InstanceConsoleConnection



791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
# File 'lib/oci/core/compute_client.rb', line 791

def get_instance_console_connection(instance_console_connection_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_instance_console_connection." if logger

  fail "Missing the required parameter 'instance_console_connection_id' when calling get_instance_console_connection." if instance_console_connection_id.nil?

  path = "/instanceConsoleConnections/{instanceConsoleConnectionId}".sub('{instanceConsoleConnectionId}', instance_console_connection_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::InstanceConsoleConnection')
end

#get_vnic_attachment(vnic_attachment_id, opts = {}) ⇒ Response

Gets the information for the specified VNIC attachment.

Parameters:

  • vnic_attachment_id (String)

    The OCID of the VNIC attachment.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::VnicAttachment



823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
# File 'lib/oci/core/compute_client.rb', line 823

def get_vnic_attachment(vnic_attachment_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_vnic_attachment." if logger

  fail "Missing the required parameter 'vnic_attachment_id' when calling get_vnic_attachment." if vnic_attachment_id.nil?

  path = "/vnicAttachments/{vnicAttachmentId}".sub('{vnicAttachmentId}', vnic_attachment_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::VnicAttachment')
end

#get_volume_attachment(volume_attachment_id, opts = {}) ⇒ Response

Gets information about the specified volume attachment.

Parameters:

  • volume_attachment_id (String)

    The OCID of the volume attachment.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::VolumeAttachment



854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
# File 'lib/oci/core/compute_client.rb', line 854

def get_volume_attachment(volume_attachment_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_volume_attachment." if logger

  fail "Missing the required parameter 'volume_attachment_id' when calling get_volume_attachment." if volume_attachment_id.nil?

  path = "/volumeAttachments/{volumeAttachmentId}".sub('{volumeAttachmentId}', volume_attachment_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::VolumeAttachment')
end

#get_windows_instance_initial_credentials(instance_id, opts = {}) ⇒ Response

Gets the generated credentials for the instance. Only works for Windows instances. The returned credentials are only valid for the initial login.

Parameters:

  • instance_id (String)

    The OCID of the instance.

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

    the optional parameters

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::InstanceCredentials



887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
# File 'lib/oci/core/compute_client.rb', line 887

def get_windows_instance_initial_credentials(instance_id, opts = {})
  logger.debug "Calling operation ComputeClient#get_windows_instance_initial_credentials." if logger

  fail "Missing the required parameter 'instance_id' when calling get_windows_instance_initial_credentials." if instance_id.nil?

  path = "/instances/{instanceId}/initialCredentials".sub('{instanceId}', instance_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::InstanceCredentials')
end

#instance_action(instance_id, action, opts = {}) ⇒ Response

Performs one of the power actions (start, stop, softreset, or reset) on the specified instance.

start - power on

stop - power off

softreset - ACPI shutdown and power on

reset - power off and power on

Note that the stop state has no effect on the resources you consume. Billing continues for instances that you stop, and related resources continue to apply against any relevant quotas. You must terminate an instance (terminate_instance) to remove its resources from billing and quotas.

Parameters:

  • instance_id (String)

    The OCID of the instance.

  • action (String)

    The action to perform on the instance. Allowed values are: STOP, START, SOFTRESET, RESET

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Instance



946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
# File 'lib/oci/core/compute_client.rb', line 946

def instance_action(instance_id, action, opts = {})
  logger.debug "Calling operation ComputeClient#instance_action." if logger

  fail "Missing the required parameter 'instance_id' when calling instance_action." if instance_id.nil?
  fail "Missing the required parameter 'action' when calling instance_action." if action.nil?
  unless ['STOP', 'START', 'SOFTRESET', 'RESET'].include?(action)
    fail "Invalid value for 'action', must be one of STOP, START, SOFTRESET, RESET."
  end

  path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)

  # Query Params
  query_params = {}
  query_params[:'action'] = action

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Instance')
end

#launch_instance(launch_instance_details, opts = {}) ⇒ Response

Creates a new instance in the specified compartment and the specified Availability Domain. For general information about instances, see [Overview of the Compute Service](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm).

For information about access control and compartments, see [Overview of the IAM Service](docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm).

For information about Availability Domains, see [Regions and Availability Domains](docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). To get a list of Availability Domains, use the ‘ListAvailabilityDomains` operation in the Identity and Access Management Service API.

All Oracle Cloud Infrastructure resources, including instances, get an Oracle-assigned, unique ID called an Oracle Cloud Identifier (OCID). When you create a resource, you can find its OCID in the response. You can also retrieve a resource’s OCID by using a List API operation on that resource type, or by viewing the resource in the Console.

When you launch an instance, it is automatically attached to a virtual network interface card (VNIC), called the *primary VNIC*. The VNIC has a private IP address from the subnet’s CIDR. You can either assign a private IP address of your choice or let Oracle automatically assign one. You can choose whether the instance has a public IP address. To retrieve the addresses, use the list_vnic_attachments operation to get the VNIC ID for the instance, and then call get_vnic with the VNIC ID.

You can later add secondary VNICs to an instance. For more information, see [Virtual Network Interface Cards (VNICs)](docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm).

Parameters:

  • launch_instance_details (LaunchInstanceDetails)

    Instance details

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Instance



1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/oci/core/compute_client.rb', line 1019

def launch_instance(launch_instance_details, opts = {})
  logger.debug "Calling operation ComputeClient#launch_instance." if logger

  fail "Missing the required parameter 'launch_instance_details' when calling launch_instance." if launch_instance_details.nil?

  path = "/instances/"

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']

  post_body = @api_client.object_to_http_body(launch_instance_details)

  return @api_client.call_api(
    :POST,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Instance')
end

#list_boot_volume_attachments(availability_domain, compartment_id, opts = {}) ⇒ Response

Lists the boot volume attachments in the specified compartment. You can filter the list by specifying an instance OCID, boot volume OCID, or both.

Parameters:

  • availability_domain (String)

    The name of the Availability Domain.

    Example: ‘Uocm:PHX-AD-1`

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :instance_id (String)

    The OCID of the instance.

  • :boot_volume_id (String)

    The OCID of the boot volume.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::BootVolumeAttachment>



1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
# File 'lib/oci/core/compute_client.rb', line 1065

def list_boot_volume_attachments(availability_domain, compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_boot_volume_attachments." if logger

  fail "Missing the required parameter 'availability_domain' when calling list_boot_volume_attachments." if availability_domain.nil?
  fail "Missing the required parameter 'compartment_id' when calling list_boot_volume_attachments." if compartment_id.nil?

  path = "/bootVolumeAttachments/"

  # Query Params
  query_params = {}
  query_params[:'availabilityDomain'] = availability_domain
  query_params[:'compartmentId'] = compartment_id
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
  query_params[:'bootVolumeId'] = opts[:'boot_volume_id'] if opts[:'boot_volume_id']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::BootVolumeAttachment>')
end

#list_console_histories(compartment_id, opts = {}) ⇒ Response

Lists the console history metadata for the specified compartment or instance.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :availability_domain (String)

    The name of the Availability Domain.

    Example: ‘Uocm:PHX-AD-1`

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :instance_id (String)

    The OCID of the instance.

  • :sort_by (String)

    The field to sort by. You can provide one sort order (‘sortOrder`). Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive.

    Note: In general, some "List" operations (for example, ‘ListInstances`) let you optionally filter by Availability Domain if the scope of the resource type is within a single Availability Domain. If you call one of these "List" operations without specifying an Availability Domain, the resources are grouped by Availability Domain, then sorted.

    Allowed values are: TIMECREATED, DISPLAYNAME

  • :sort_order (String)

    The sort order to use, either ascending (‘ASC`) or descending (`DESC`). The DISPLAYNAME sort order is case sensitive.

    Allowed values are: ASC, DESC

  • :lifecycle_state (String)

    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::ConsoleHistory>



1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
# File 'lib/oci/core/compute_client.rb', line 1131

def list_console_histories(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_console_histories." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_console_histories." if compartment_id.nil?

  if opts[:'sort_by'] && !['TIMECREATED', 'DISPLAYNAME'].include?(opts[:'sort_by'])
    fail 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
  end

  if opts[:'sort_order'] && !['ASC', 'DESC'].include?(opts[:'sort_order'])
    fail 'Invalid value for "sort_order", must be one of ASC, DESC.'
  end

  if opts[:'lifecycle_state'] && !OCI::Core::Models::ConsoleHistory::LIFECYCLE_STATE_ENUM.include?(opts[:'lifecycle_state'])
    fail 'Invalid value for "lifecycle_state", must be one of the values in OCI::Core::Models::ConsoleHistory::LIFECYCLE_STATE_ENUM.'
  end

  path = "/instanceConsoleHistories/"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
  query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']
  query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']
  query_params[:'lifecycleState'] = opts[:'lifecycle_state'] if opts[:'lifecycle_state']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::ConsoleHistory>')
end

#list_images(compartment_id, opts = {}) ⇒ Response

Lists the available images in the specified compartment. If you specify a value for the ‘sortBy` parameter, Oracle-provided images appear first in the list, followed by custom images. For more information about images, see [Managing Custom Images](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :display_name (String)

    A filter to return only resources that match the given display name exactly.

  • :operating_system (String)

    The image’s operating system.

    Example: ‘Oracle Linux`

  • :operating_system_version (String)

    The image’s operating system version.

    Example: ‘7.2`

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :sort_by (String)

    The field to sort by. You can provide one sort order (‘sortOrder`). Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive.

    Note: In general, some "List" operations (for example, ‘ListInstances`) let you optionally filter by Availability Domain if the scope of the resource type is within a single Availability Domain. If you call one of these "List" operations without specifying an Availability Domain, the resources are grouped by Availability Domain, then sorted.

    Allowed values are: TIMECREATED, DISPLAYNAME

  • :sort_order (String)

    The sort order to use, either ascending (‘ASC`) or descending (`DESC`). The DISPLAYNAME sort order is case sensitive.

    Allowed values are: ASC, DESC

  • :lifecycle_state (String)

    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::Image>



1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/oci/core/compute_client.rb', line 1219

def list_images(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_images." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_images." if compartment_id.nil?

  if opts[:'sort_by'] && !['TIMECREATED', 'DISPLAYNAME'].include?(opts[:'sort_by'])
    fail 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
  end

  if opts[:'sort_order'] && !['ASC', 'DESC'].include?(opts[:'sort_order'])
    fail 'Invalid value for "sort_order", must be one of ASC, DESC.'
  end

  if opts[:'lifecycle_state'] && !OCI::Core::Models::Image::LIFECYCLE_STATE_ENUM.include?(opts[:'lifecycle_state'])
    fail 'Invalid value for "lifecycle_state", must be one of the values in OCI::Core::Models::Image::LIFECYCLE_STATE_ENUM.'
  end

  path = "/images/"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'displayName'] = opts[:'display_name'] if opts[:'display_name']
  query_params[:'operatingSystem'] = opts[:'operating_system'] if opts[:'operating_system']
  query_params[:'operatingSystemVersion'] = opts[:'operating_system_version'] if opts[:'operating_system_version']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']
  query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']
  query_params[:'lifecycleState'] = opts[:'lifecycle_state'] if opts[:'lifecycle_state']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::Image>')
end

#list_instance_console_connections(compartment_id, opts = {}) ⇒ Response

Lists the console connections for the specified compartment or instance.

For more information about console access, see [Accessing the Instance Console](docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/serialconsole.htm).

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :instance_id (String)

    The OCID of the instance.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::InstanceConsoleConnection>



1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
# File 'lib/oci/core/compute_client.rb', line 1281

def list_instance_console_connections(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_instance_console_connections." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_instance_console_connections." if compartment_id.nil?

  path = "/instanceConsoleConnections"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::InstanceConsoleConnection>')
end

#list_instances(compartment_id, opts = {}) ⇒ Response

Lists the instances in the specified compartment and the specified Availability Domain. You can filter the results by specifying an instance name (the list will include all the identically-named instances in the compartment).

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :availability_domain (String)

    The name of the Availability Domain.

    Example: ‘Uocm:PHX-AD-1`

  • :display_name (String)

    A filter to return only resources that match the given display name exactly.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :sort_by (String)

    The field to sort by. You can provide one sort order (‘sortOrder`). Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive.

    Note: In general, some "List" operations (for example, ‘ListInstances`) let you optionally filter by Availability Domain if the scope of the resource type is within a single Availability Domain. If you call one of these "List" operations without specifying an Availability Domain, the resources are grouped by Availability Domain, then sorted.

    Allowed values are: TIMECREATED, DISPLAYNAME

  • :sort_order (String)

    The sort order to use, either ascending (‘ASC`) or descending (`DESC`). The DISPLAYNAME sort order is case sensitive.

    Allowed values are: ASC, DESC

  • :lifecycle_state (String)

    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::Instance>



1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
# File 'lib/oci/core/compute_client.rb', line 1347

def list_instances(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_instances." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_instances." if compartment_id.nil?

  if opts[:'sort_by'] && !['TIMECREATED', 'DISPLAYNAME'].include?(opts[:'sort_by'])
    fail 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
  end

  if opts[:'sort_order'] && !['ASC', 'DESC'].include?(opts[:'sort_order'])
    fail 'Invalid value for "sort_order", must be one of ASC, DESC.'
  end

  if opts[:'lifecycle_state'] && !OCI::Core::Models::Instance::LIFECYCLE_STATE_ENUM.include?(opts[:'lifecycle_state'])
    fail 'Invalid value for "lifecycle_state", must be one of the values in OCI::Core::Models::Instance::LIFECYCLE_STATE_ENUM.'
  end

  path = "/instances/"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
  query_params[:'displayName'] = opts[:'display_name'] if opts[:'display_name']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']
  query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']
  query_params[:'lifecycleState'] = opts[:'lifecycle_state'] if opts[:'lifecycle_state']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::Instance>')
end

#list_shapes(compartment_id, opts = {}) ⇒ Response

Lists the shapes that can be used to launch an instance within the specified compartment. You can filter the list by compatibility with a specific image.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :availability_domain (String)

    The name of the Availability Domain.

    Example: ‘Uocm:PHX-AD-1`

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :image_id (String)

    The OCID of an image.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::Shape>



1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
# File 'lib/oci/core/compute_client.rb', line 1411

def list_shapes(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_shapes." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_shapes." if compartment_id.nil?

  path = "/shapes"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'imageId'] = opts[:'image_id'] if opts[:'image_id']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::Shape>')
end

#list_vnic_attachments(compartment_id, opts = {}) ⇒ Response

Lists the VNIC attachments in the specified compartment. A VNIC attachment resides in the same compartment as the attached instance. The list can be filtered by instance, VNIC, or Availability Domain.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :availability_domain (String)

    The name of the Availability Domain.

    Example: ‘Uocm:PHX-AD-1`

  • :instance_id (String)

    The OCID of the instance.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :vnic_id (String)

    The OCID of the VNIC.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::VnicAttachment>



1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
# File 'lib/oci/core/compute_client.rb', line 1462

def list_vnic_attachments(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_vnic_attachments." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_vnic_attachments." if compartment_id.nil?

  path = "/vnicAttachments/"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
  query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'vnicId'] = opts[:'vnic_id'] if opts[:'vnic_id']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::VnicAttachment>')
end

#list_volume_attachments(compartment_id, opts = {}) ⇒ Response

Lists the volume attachments in the specified compartment. You can filter the list by specifying an instance OCID, volume OCID, or both.

Currently, the only supported volume attachment type is IScsiVolumeAttachment.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

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

    the optional parameters

Options Hash (opts):

  • :availability_domain (String)

    The name of the Availability Domain.

    Example: ‘Uocm:PHX-AD-1`

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call.

    Example: ‘500`

  • :page (String)

    The value of the ‘opc-next-page` response header from the previous "List" call.

  • :instance_id (String)

    The OCID of the instance.

  • :volume_id (String)

    The OCID of the volume.

Returns:

  • (Response)

    A Response object with data of type Array<OCI::Core::Models::VolumeAttachment>



1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
# File 'lib/oci/core/compute_client.rb', line 1515

def list_volume_attachments(compartment_id, opts = {})
  logger.debug "Calling operation ComputeClient#list_volume_attachments." if logger

  fail "Missing the required parameter 'compartment_id' when calling list_volume_attachments." if compartment_id.nil?

  path = "/volumeAttachments/"

  # Query Params
  query_params = {}
  query_params[:'compartmentId'] = compartment_id
  query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
  query_params[:'volumeId'] = opts[:'volume_id'] if opts[:'volume_id']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'

  post_body = nil

  return @api_client.call_api(
    :GET,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'Array<OCI::Core::Models::VolumeAttachment>')
end

#loggerLogger

Returns The logger for this client. May be nil.

Returns:

  • (Logger)

    The logger for this client. May be nil.



56
57
58
# File 'lib/oci/core/compute_client.rb', line 56

def logger
  @api_client.config.logger
end

#terminate_instance(instance_id, opts = {}) ⇒ Response

Terminates the specified instance. Any attached VNICs and volumes are automatically detached when the instance terminates.

To preserve the boot volume associated with the instance, specify ‘true` for `PreserveBootVolumeQueryParam`. To delete the boot volume when the instance is deleted, specify `false` or do not specify a value for `PreserveBootVolumeQueryParam`.

This is an asynchronous operation. The instance’s ‘lifecycleState` will change to TERMINATING temporarily until the instance is completely removed.

Parameters:

  • instance_id (String)

    The OCID of the instance.

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

  • :preserve_boot_volume (BOOLEAN)

    Specifies whether to delete or preserve the boot volume when terminating an instance. The default value is false.

Returns:

  • (Response)

    A Response object with data of type nil



1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
# File 'lib/oci/core/compute_client.rb', line 1567

def terminate_instance(instance_id, opts = {})
  logger.debug "Calling operation ComputeClient#terminate_instance." if logger

  fail "Missing the required parameter 'instance_id' when calling terminate_instance." if instance_id.nil?

  path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)

  # Query Params
  query_params = {}
  query_params[:'preserveBootVolume'] = opts[:'preserve_boot_volume'] if opts[:'preserve_boot_volume']

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = nil

  return @api_client.call_api(
    :DELETE,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body)
end

#update_console_history(instance_console_history_id, update_console_history_details, opts = {}) ⇒ Response

Updates the specified console history metadata.

Parameters:

  • instance_console_history_id (String)

    The OCID of the console history.

  • update_console_history_details (UpdateConsoleHistoryDetails)

    Update instance fields

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

    the optional parameters

Options Hash (opts):

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::ConsoleHistory



1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
# File 'lib/oci/core/compute_client.rb', line 1604

def update_console_history(instance_console_history_id, update_console_history_details, opts = {})
  logger.debug "Calling operation ComputeClient#update_console_history." if logger

  fail "Missing the required parameter 'instance_console_history_id' when calling update_console_history." if instance_console_history_id.nil?
  fail "Missing the required parameter 'update_console_history_details' when calling update_console_history." if update_console_history_details.nil?

  path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = @api_client.object_to_http_body(update_console_history_details)

  return @api_client.call_api(
    :PUT,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::ConsoleHistory')
end

#update_image(image_id, update_image_details, opts = {}) ⇒ Response

Updates the display name of the image. Avoid entering confidential information.

Parameters:

  • image_id (String)

    The OCID of the image.

  • update_image_details (UpdateImageDetails)

    Updates the image display name field. Avoid entering confidential information.

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Image



1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
# File 'lib/oci/core/compute_client.rb', line 1648

def update_image(image_id, update_image_details, opts = {})
  logger.debug "Calling operation ComputeClient#update_image." if logger

  fail "Missing the required parameter 'image_id' when calling update_image." if image_id.nil?
  fail "Missing the required parameter 'update_image_details' when calling update_image." if update_image_details.nil?

  path = "/images/{imageId}".sub('{imageId}', image_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = @api_client.object_to_http_body(update_image_details)

  return @api_client.call_api(
    :PUT,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Image')
end

#update_instance(instance_id, update_instance_details, opts = {}) ⇒ Response

Updates the display name of the specified instance. Avoid entering confidential information. The OCID of the instance remains the same.

Parameters:

  • instance_id (String)

    The OCID of the instance.

  • update_instance_details (UpdateInstanceDetails)

    Update instance fields

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

    the optional parameters

Options Hash (opts):

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the ‘if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource’s current etag value.

Returns:

  • (Response)

    A Response object with data of type OCI::Core::Models::Instance



1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
# File 'lib/oci/core/compute_client.rb', line 1695

def update_instance(instance_id, update_instance_details, opts = {})
  logger.debug "Calling operation ComputeClient#update_instance." if logger

  fail "Missing the required parameter 'instance_id' when calling update_instance." if instance_id.nil?
  fail "Missing the required parameter 'update_instance_details' when calling update_instance." if update_instance_details.nil?

  path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)

  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
  header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']

  post_body = @api_client.object_to_http_body(update_instance_details)

  return @api_client.call_api(
    :PUT,
    path,
    endpoint,
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => 'OCI::Core::Models::Instance')
end