Class: OCI::ObjectStorage::ObjectStorageClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/object_storage/object_storage_client.rb

Overview

Common set of Object and Archive Storage APIs for managing buckets and objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: nil, region: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ ObjectStorageClient

Creates a new ObjectStorageClient. 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.

  • signer (OCI::BaseSigner) (defaults to: nil)

    A signer implementation which can be used by this client. If this is not provided then a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication, so that the instance principals signer can be provided to the client

  • proxy_settings (OCI::ApiClientProxySettings) (defaults to: nil)

    If your environment requires you to use a proxy server for outgoing HTTP requests the details for the proxy can be provided in this parameter

  • retry_config (OCI::Retry::RetryConfig) (defaults to: nil)

    The retry configuration for this service client. This represents the default retry configuration to apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is ‘nil`, which means that an operation will not perform any retries



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/object_storage/object_storage_client.rb', line 48

def initialize(config: nil, region: nil, signer: nil, proxy_settings: nil, retry_config: nil)
  # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
  # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
  # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
  # pass it to this constructor.
  #
  # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
  # so try and load the config from the default file.
  config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
  config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
  config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)

  if signer.nil?
    signer = OCI::Signer.new(
      config.user,
      config.fingerprint,
      config.tenancy,
      config.key_file,
      pass_phrase: config.pass_phrase,
      private_key_content: config.key_content
    )
  end

  @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
  @retry_config = retry_config

  region ||= config.region
  region ||= signer.region if signer.respond_to?(: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/object_storage/object_storage_client.rb', line 12

def api_client
  @api_client
end

#endpointString (readonly)

Fully qualified endpoint URL

Returns:

  • (String)


16
17
18
# File 'lib/oci/object_storage/object_storage_client.rb', line 16

def endpoint
  @endpoint
end

#regionString

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

Returns:

  • (String)


26
27
28
# File 'lib/oci/object_storage/object_storage_client.rb', line 26

def region
  @region
end

#retry_configOCI::Retry::RetryConfig (readonly)

The default retry configuration to apply to all operations in this service client. This can be overridden on a per-operation basis. The default retry configuration value is ‘nil`, which means that an operation will not perform any retries



22
23
24
# File 'lib/oci/object_storage/object_storage_client.rb', line 22

def retry_config
  @retry_config
end

Instance Method Details

#abort_multipart_upload(namespace_name, bucket_name, object_name, upload_id, opts = {}) ⇒ Response

Aborts an in-progress multipart upload and deletes all parts that have been uploaded.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

  • upload_id (String)

    The upload ID for a multipart upload.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/oci/object_storage/object_storage_client.rb', line 117

def abort_multipart_upload(namespace_name, bucket_name, object_name, upload_id, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#abort_multipart_upload.' if logger

  raise "Missing the required parameter 'namespace_name' when calling abort_multipart_upload." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling abort_multipart_upload." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling abort_multipart_upload." if object_name.nil?
  raise "Missing the required parameter 'upload_id' when calling abort_multipart_upload." if upload_id.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/u/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:uploadId] = upload_id

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#abort_multipart_upload') do
    @api_client.call_api(
      :DELETE,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#commit_multipart_upload(namespace_name, bucket_name, object_name, upload_id, commit_multipart_upload_details, opts = {}) ⇒ Response

Commits a multipart upload, which involves checking part numbers and ETags of the parts, to create an aggregate object.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

  • upload_id (String)

    The upload ID for a multipart upload.

  • commit_multipart_upload_details (OCI::ObjectStorage::Models::CommitMultipartUploadDetails)

    The part numbers and ETags for the parts you want to commit.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



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
# File 'lib/oci/object_storage/object_storage_client.rb', line 190

def commit_multipart_upload(namespace_name, bucket_name, object_name, upload_id, commit_multipart_upload_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#commit_multipart_upload.' if logger

  raise "Missing the required parameter 'namespace_name' when calling commit_multipart_upload." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling commit_multipart_upload." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling commit_multipart_upload." if object_name.nil?
  raise "Missing the required parameter 'upload_id' when calling commit_multipart_upload." if upload_id.nil?
  raise "Missing the required parameter 'commit_multipart_upload_details' when calling commit_multipart_upload." if commit_multipart_upload_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/u/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:uploadId] = upload_id

  # 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]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(commit_multipart_upload_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#commit_multipart_upload') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#create_bucket(namespace_name, create_bucket_details, opts = {}) ⇒ Response

Creates a bucket in the given namespace with a bucket name and optional user-defined metadata.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • create_bucket_details (OCI::ObjectStorage::Models::CreateBucketDetails)

    Request object for creating a bucket.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type Bucket



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/oci/object_storage/object_storage_client.rb', line 253

def create_bucket(namespace_name, create_bucket_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#create_bucket.' if logger

  raise "Missing the required parameter 'namespace_name' when calling create_bucket." if namespace_name.nil?
  raise "Missing the required parameter 'create_bucket_details' when calling create_bucket." if create_bucket_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)

  path = '/n/{namespaceName}/b/'.sub('{namespaceName}', namespace_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(create_bucket_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#create_bucket') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::Bucket'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#create_multipart_upload(namespace_name, bucket_name, create_multipart_upload_details, opts = {}) ⇒ Response

Starts a new multipart upload to a specific object in the given bucket in the given namespace.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • create_multipart_upload_details (OCI::ObjectStorage::Models::CreateMultipartUploadDetails)

    Request object for creating a multi-part upload.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/oci/object_storage/object_storage_client.rb', line 318

def create_multipart_upload(namespace_name, bucket_name, create_multipart_upload_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#create_multipart_upload.' if logger

  raise "Missing the required parameter 'namespace_name' when calling create_multipart_upload." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling create_multipart_upload." if bucket_name.nil?
  raise "Missing the required parameter 'create_multipart_upload_details' when calling create_multipart_upload." if create_multipart_upload_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/u'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(create_multipart_upload_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#create_multipart_upload') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::MultipartUpload'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#create_preauthenticated_request(namespace_name, bucket_name, create_preauthenticated_request_details, opts = {}) ⇒ Response

Creates a pre-authenticated request specific to the bucket.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • create_preauthenticated_request_details (OCI::ObjectStorage::Models::CreatePreauthenticatedRequestDetails)

    Information needed to create the pre-authenticated request.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/oci/object_storage/object_storage_client.rb', line 381

def create_preauthenticated_request(namespace_name, bucket_name, create_preauthenticated_request_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#create_preauthenticated_request.' if logger

  raise "Missing the required parameter 'namespace_name' when calling create_preauthenticated_request." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling create_preauthenticated_request." if bucket_name.nil?
  raise "Missing the required parameter 'create_preauthenticated_request_details' when calling create_preauthenticated_request." if create_preauthenticated_request_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/p/'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(create_preauthenticated_request_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#create_preauthenticated_request') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::PreauthenticatedRequest'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#delete_bucket(namespace_name, bucket_name, opts = {}) ⇒ Response

Deletes a bucket if it is already empty. If the bucket is not empty, use delete_object first.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



444
445
446
447
448
449
450
451
452
453
454
455
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
482
# File 'lib/oci/object_storage/object_storage_client.rb', line 444

def delete_bucket(namespace_name, bucket_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#delete_bucket.' if logger

  raise "Missing the required parameter 'namespace_name' when calling delete_bucket." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling delete_bucket." if bucket_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#delete_bucket') do
    @api_client.call_api(
      :DELETE,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#delete_object(namespace_name, bucket_name, object_name, opts = {}) ⇒ Response

Deletes an object.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/oci/object_storage/object_storage_client.rb', line 509

def delete_object(namespace_name, bucket_name, object_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#delete_object.' if logger

  raise "Missing the required parameter 'namespace_name' when calling delete_object." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling delete_object." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling delete_object." if object_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/o/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#delete_object') do
    @api_client.call_api(
      :DELETE,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#delete_preauthenticated_request(namespace_name, bucket_name, par_id, opts = {}) ⇒ Response

Deletes the pre-authenticated request for the bucket.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • par_id (String)

    The unique identifier for the pre-authenticated request. This can be used to manage operations against the pre-authenticated request, such as GET or DELETE.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'lib/oci/object_storage/object_storage_client.rb', line 572

def delete_preauthenticated_request(namespace_name, bucket_name, par_id, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#delete_preauthenticated_request.' if logger

  raise "Missing the required parameter 'namespace_name' when calling delete_preauthenticated_request." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling delete_preauthenticated_request." if bucket_name.nil?
  raise "Missing the required parameter 'par_id' when calling delete_preauthenticated_request." if par_id.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'par_id' must not be blank" if OCI::Internal::Util.blank_string?(par_id)

  path = '/n/{namespaceName}/b/{bucketName}/p/{parId}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{parId}', par_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#delete_preauthenticated_request') do
    @api_client.call_api(
      :DELETE,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_bucket(namespace_name, bucket_name, opts = {}) ⇒ Response

Gets the current representation of the given bucket in the given namespace.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type Bucket



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/oci/object_storage/object_storage_client.rb', line 638

def get_bucket(namespace_name, bucket_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#get_bucket.' if logger

  raise "Missing the required parameter 'namespace_name' when calling get_bucket." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling get_bucket." if bucket_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#get_bucket') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::Bucket'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_namespace(opts = {}) ⇒ Response

Namespaces are unique. Namespaces are either the tenancy name or a random string automatically generated during account creation. You cannot edit a namespace.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

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
724
725
726
727
728
729
730
# File 'lib/oci/object_storage/object_storage_client.rb', line 696

def get_namespace(opts = {})
  logger.debug 'Calling operation ObjectStorageClient#get_namespace.' if logger


  path = '/n/'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#get_namespace') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'String'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_namespace_metadata(namespace_name, opts = {}) ⇒ Response

Get the metadata for the namespace, which contains defaultS3CompartmentId and defaultSwiftCompartmentId. Any user with the NAMESPACE_READ permission will be able to see the current metadata. If you’re not authorized, talk to an administrator. If you’re an administrator who needs to write policies to give users access, see [Getting Started with Policies](docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



751
752
753
754
755
756
757
758
759
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
786
787
# File 'lib/oci/object_storage/object_storage_client.rb', line 751

def (namespace_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#get_namespace_metadata.' if logger

  raise "Missing the required parameter 'namespace_name' when calling get_namespace_metadata." if namespace_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)

  path = '/n/{namespaceName}'.sub('{namespaceName}', namespace_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#get_namespace_metadata') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::NamespaceMetadata'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_object(namespace_name, bucket_name, object_name, opts = {}, &block) ⇒ Response

Gets the metadata and body of an object.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

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

    the optional parameters

  • [Block] (Hash)

    a customizable set of options

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

  • :range (String)

    Optional byte range to fetch, as described in [RFC 7233](tools.ietf.org/rfc/rfc7233), section 2.1. Note that only a single range of bytes is supported.

  • :response_target (String, IO)

    Streaming http body into a file (specified by file name or File object) or IO object if the block is not given

Returns:

  • (Response)

    A Response object with data of type String if response_target and block are not given, otherwise with nil data



822
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
849
850
851
852
853
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
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
# File 'lib/oci/object_storage/object_storage_client.rb', line 822

def get_object(namespace_name, bucket_name, object_name, opts = {}, &block)
  logger.debug 'Calling operation ObjectStorageClient#get_object.' if logger

  raise "Missing the required parameter 'namespace_name' when calling get_object." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling get_object." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling get_object." if object_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/o/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  header_params[:range] = opts[:range] if opts[:range]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#get_object') do
    if !block.nil?
      @api_client.call_api(
        :GET,
        path,
        endpoint,
        header_params: header_params,
        query_params: query_params,
        operation_signing_strategy: operation_signing_strategy,
        body: post_body,
        return_type: 'Stream',
        &block
      )
    elsif opts[:response_target]
      if opts[:response_target].respond_to? :write
        @api_client.call_api(
          :GET,
          path,
          endpoint,
          header_params: header_params,
          query_params: query_params,
          operation_signing_strategy: operation_signing_strategy,
          body: post_body,
          return_type: 'Stream',
          &proc { |chunk, _response| opts[:response_target].write(chunk) }
        )
      elsif opts[:response_target].is_a?(String)
        File.open(opts[:response_target], 'wb') do |output|
          return @api_client.call_api(
            :GET,
            path,
            endpoint,
            header_params: header_params,
            query_params: query_params,
            operation_signing_strategy: operation_signing_strategy,
            body: post_body,
            return_type: 'Stream',
            &proc { |chunk, _response| output.write(chunk) }
          )
        end
      end
    else
      @api_client.call_api(
        :GET,
        path,
        endpoint,
        header_params: header_params,
        query_params: query_params,
        operation_signing_strategy: operation_signing_strategy,
        body: post_body,
        return_type: 'String'
      )
    end
  end
  # rubocop:enable Metrics/BlockLength
end

#get_preauthenticated_request(namespace_name, bucket_name, par_id, opts = {}) ⇒ Response

Gets the pre-authenticated request for the bucket.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • par_id (String)

    The unique identifier for the pre-authenticated request. This can be used to manage operations against the pre-authenticated request, such as GET or DELETE.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
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
# File 'lib/oci/object_storage/object_storage_client.rb', line 930

def get_preauthenticated_request(namespace_name, bucket_name, par_id, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#get_preauthenticated_request.' if logger

  raise "Missing the required parameter 'namespace_name' when calling get_preauthenticated_request." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling get_preauthenticated_request." if bucket_name.nil?
  raise "Missing the required parameter 'par_id' when calling get_preauthenticated_request." if par_id.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'par_id' must not be blank" if OCI::Internal::Util.blank_string?(par_id)

  path = '/n/{namespaceName}/b/{bucketName}/p/{parId}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{parId}', par_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#get_preauthenticated_request') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::PreauthenticatedRequestSummary'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#head_bucket(namespace_name, bucket_name, opts = {}) ⇒ Response

Efficiently checks to see if a bucket exists and gets the current ETag for the bucket.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
# File 'lib/oci/object_storage/object_storage_client.rb', line 997

def head_bucket(namespace_name, bucket_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#head_bucket.' if logger

  raise "Missing the required parameter 'namespace_name' when calling head_bucket." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling head_bucket." if bucket_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#head_bucket') do
    @api_client.call_api(
      :HEAD,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#head_object(namespace_name, bucket_name, object_name, opts = {}) ⇒ Response

Gets the user-defined metadata and entity tag for an object.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



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
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
# File 'lib/oci/object_storage/object_storage_client.rb', line 1066

def head_object(namespace_name, bucket_name, object_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#head_object.' if logger

  raise "Missing the required parameter 'namespace_name' when calling head_object." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling head_object." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling head_object." if object_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/o/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#head_object') do
    @api_client.call_api(
      :HEAD,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_buckets(namespace_name, compartment_id, opts = {}) ⇒ Response

Gets a list of all ‘BucketSummary`s in a compartment. A `BucketSummary` contains only summary fields for the bucket and does not contain fields like the user-defined metadata.

To use this and other API operations, you must be authorized in an IAM policy. If you’re not authorized, talk to an administrator. If you’re an administrator who needs to write policies to give users access, see [Getting Started with Policies](docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • compartment_id (String)

    The ID of the compartment in which to list buckets.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :limit (Integer)

    The maximum number of items to return.

  • :page (String)

    The page at which to start retrieving results.

  • :fields (Array<String>)

    Bucket summary in list of buckets includes the ‘namespace’, ‘name’, ‘compartmentId’, ‘createdBy’, ‘timeCreated’, and ‘etag’ fields. This parameter can also include ‘tags’ (freeformTags and definedTags). The only supported value of this parameter is ‘tags’ for now. Example ‘tags’.

    Allowed values are: tags

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



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
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
# File 'lib/oci/object_storage/object_storage_client.rb', line 1138

def list_buckets(namespace_name, compartment_id, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#list_buckets.' if logger

  raise "Missing the required parameter 'namespace_name' when calling list_buckets." if namespace_name.nil?
  raise "Missing the required parameter 'compartment_id' when calling list_buckets." if compartment_id.nil?


  fields_allowable_values = %w[tags]
  if opts[:fields] && !opts[:fields].empty?
    opts[:fields].each do |val_to_check|
      unless fields_allowable_values.include?(val_to_check)
        raise 'Invalid value for "fields", must be one of tags.'
      end
    end
  end
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)

  path = '/n/{namespaceName}/b/'.sub('{namespaceName}', namespace_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:fields] = OCI::ApiClient.build_collection_params(opts[:fields], :csv) if opts[:fields] && !opts[:fields].empty?

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#list_buckets') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'Array<OCI::ObjectStorage::Models::BucketSummary>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_multipart_upload_parts(namespace_name, bucket_name, object_name, upload_id, opts = {}) ⇒ Response

Lists the parts of an in-progress multipart upload.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

  • upload_id (String)

    The upload ID for a multipart upload.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :limit (Integer)

    The maximum number of items to return.

  • :page (String)

    The page at which to start retrieving results.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



1216
1217
1218
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
# File 'lib/oci/object_storage/object_storage_client.rb', line 1216

def list_multipart_upload_parts(namespace_name, bucket_name, object_name, upload_id, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#list_multipart_upload_parts.' if logger

  raise "Missing the required parameter 'namespace_name' when calling list_multipart_upload_parts." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling list_multipart_upload_parts." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling list_multipart_upload_parts." if object_name.nil?
  raise "Missing the required parameter 'upload_id' when calling list_multipart_upload_parts." if upload_id.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/u/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:uploadId] = upload_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'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#list_multipart_upload_parts') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'Array<OCI::ObjectStorage::Models::MultipartUploadPartSummary>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_multipart_uploads(namespace_name, bucket_name, opts = {}) ⇒ Response

Lists all in-progress multipart uploads for the given bucket in the given namespace.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :limit (Integer)

    The maximum number of items to return.

  • :page (String)

    The page at which to start retrieving results.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



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
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
# File 'lib/oci/object_storage/object_storage_client.rb', line 1283

def list_multipart_uploads(namespace_name, bucket_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#list_multipart_uploads.' if logger

  raise "Missing the required parameter 'namespace_name' when calling list_multipart_uploads." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling list_multipart_uploads." if bucket_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/u'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  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'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#list_multipart_uploads') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'Array<OCI::ObjectStorage::Models::MultipartUpload>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_objects(namespace_name, bucket_name, opts = {}) ⇒ Response

Lists the objects in a bucket.

To use this and other API operations, you must be authorized in an IAM policy. If you’re not authorized, talk to an administrator. If you’re an administrator who needs to write policies to give users access, see [Getting Started with Policies](docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :prefix (String)

    The string to use for matching against the start of object names in a list query.

  • :start (String)

    Object names returned by a list query must be greater or equal to this parameter.

  • :_end (String)

    Object names returned by a list query must be strictly less than this parameter.

  • :limit (Integer)

    The maximum number of items to return.

  • :delimiter (String)

    When this parameter is set, only objects whose names do not contain the delimiter character (after an optionally specified prefix) are returned in the objects key of the response body. Scanned objects whose names contain the delimiter have the part of their name up to the first occurrence of the delimiter (including the optional prefix) returned as a set of prefixes. Note that only ‘/’ is a supported delimiter character at this time.

  • :fields (String)

    Object summary in list of objects includes the ‘name’ field. This parameter can also include ‘size’ (object size in bytes), ‘md5’, and ‘timeCreated’ (object creation date and time) fields. Value of this parameter should be a comma-separated, case-insensitive list of those field names. For example ‘name,timeCreated,md5’.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



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
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
# File 'lib/oci/object_storage/object_storage_client.rb', line 1363

def list_objects(namespace_name, bucket_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#list_objects.' if logger

  raise "Missing the required parameter 'namespace_name' when calling list_objects." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling list_objects." if bucket_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/o'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:prefix] = opts[:prefix] if opts[:prefix]
  query_params[:start] = opts[:start] if opts[:start]
  query_params[:end] = opts[:_end] if opts[:_end]
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:delimiter] = opts[:delimiter] if opts[:delimiter]
  query_params[:fields] = opts[:fields] if opts[:fields]

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#list_objects') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::ListObjects'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_preauthenticated_requests(namespace_name, bucket_name, opts = {}) ⇒ Response

Lists pre-authenticated requests for the bucket.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :object_name_prefix (String)

    User-specified object name prefixes can be used to query and return a list of pre-authenticated requests.

  • :limit (Integer)

    The maximum number of items to return.

  • :page (String)

    The page at which to start retrieving results.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
# File 'lib/oci/object_storage/object_storage_client.rb', line 1431

def list_preauthenticated_requests(namespace_name, bucket_name, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#list_preauthenticated_requests.' if logger

  raise "Missing the required parameter 'namespace_name' when calling list_preauthenticated_requests." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling list_preauthenticated_requests." if bucket_name.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/p/'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:objectNamePrefix] = opts[:object_name_prefix] if opts[:object_name_prefix]
  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'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#list_preauthenticated_requests') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'Array<OCI::ObjectStorage::Models::PreauthenticatedRequestSummary>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#loggerLogger

Returns The logger for this client. May be nil.

Returns:

  • (Logger)

    The logger for this client. May be nil.



93
94
95
# File 'lib/oci/object_storage/object_storage_client.rb', line 93

def logger
  @api_client.config.logger
end

#put_object(namespace_name, bucket_name, object_name, put_object_body, opts = {}) ⇒ Response

Creates a new object or overwrites an existing one.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

  • put_object_body (String, IO)

    The object to upload to the object store.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :content_length (Integer)

    The content length of the body.

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

  • :expect (String)

    100-continue (default to 100-continue)

  • :content_md5 (String)

    The base-64 encoded MD5 hash of the body.

  • :content_type (String)

    The content type of the object. Defaults to ‘application/octet-stream’ if not overridden during the PutObject call.

  • :content_language (String)

    The content language of the object.

  • :content_encoding (String)

    The content encoding of the object.

  • :opc_meta (Hash<String, String>)

    Optional user-defined metadata key and value. “opc-meta-” will be appended to each Hash key before it is sent to the server.

Returns:

  • (Response)

    A Response object with data of type nil



1511
1512
1513
1514
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
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
# File 'lib/oci/object_storage/object_storage_client.rb', line 1511

def put_object(namespace_name, bucket_name, object_name, put_object_body, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#put_object.' if logger

  raise "Missing the required parameter 'namespace_name' when calling put_object." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling put_object." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling put_object." if object_name.nil?
  raise "Missing the required parameter 'put_object_body' when calling put_object." if put_object_body.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/o/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :exclude_body

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  header_params[:expect] = opts[:expect] if opts[:expect]
  header_params[:'content-length'] = opts[:content_length] if opts[:content_length]
  header_params[:'content-md5'] = opts[:content_md5] if opts[:content_md5]
  header_params[:'content-type'] = opts[:content_type] if opts[:content_type]
  header_params[:'content-language'] = opts[:content_language] if opts[:content_language]
  header_params[:'content-encoding'] = opts[:content_encoding] if opts[:content_encoding]
  # rubocop:enable Style/NegatedIf

  if opts[:opc_meta]
    opts[:opc_meta].each do |key, value|
      header_params["opc-meta-#{key}".to_sym] = value
    end
  end
  header_params['content-type'] ||= 'application/octet-stream'

  post_body = @api_client.object_to_http_body(put_object_body)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#put_object') do
    @api_client.call_api(
      :PUT,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#rename_object(namespace_name, bucket_name, rename_object_details, opts = {}) ⇒ Response

Rename an object from source key to target key in the given namespace.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • rename_object_details (OCI::ObjectStorage::Models::RenameObjectDetails)

    The sourceName and newName of rename operation.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
# File 'lib/oci/object_storage/object_storage_client.rb', line 1587

def rename_object(namespace_name, bucket_name, rename_object_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#rename_object.' if logger

  raise "Missing the required parameter 'namespace_name' when calling rename_object." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling rename_object." if bucket_name.nil?
  raise "Missing the required parameter 'rename_object_details' when calling rename_object." if rename_object_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/actions/renameObject'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(rename_object_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#rename_object') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#restore_objects(namespace_name, bucket_name, restore_objects_details, opts = {}) ⇒ Response

Restore one or more objects specified by objectName parameter. By default object will be restored for 24 hours.Duration can be configured using hours parameter.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • restore_objects_details (OCI::ObjectStorage::Models::RestoreObjectsDetails)

    Request to restore objects.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type nil



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
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
# File 'lib/oci/object_storage/object_storage_client.rb', line 1648

def restore_objects(namespace_name, bucket_name, restore_objects_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#restore_objects.' if logger

  raise "Missing the required parameter 'namespace_name' when calling restore_objects." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling restore_objects." if bucket_name.nil?
  raise "Missing the required parameter 'restore_objects_details' when calling restore_objects." if restore_objects_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/actions/restoreObjects'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(restore_objects_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#restore_objects') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_bucket(namespace_name, bucket_name, update_bucket_details, opts = {}) ⇒ Response

Performs a partial or full update of a bucket’s user-defined metadata.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • update_bucket_details (OCI::ObjectStorage::Models::UpdateBucketDetails)

    Request object for updating a bucket.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:

  • (Response)

    A Response object with data of type Bucket



1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
# File 'lib/oci/object_storage/object_storage_client.rb', line 1711

def update_bucket(namespace_name, bucket_name, update_bucket_details, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#update_bucket.' if logger

  raise "Missing the required parameter 'namespace_name' when calling update_bucket." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling update_bucket." if bucket_name.nil?
  raise "Missing the required parameter 'update_bucket_details' when calling update_bucket." if update_bucket_details.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)

  path = '/n/{namespaceName}/b/{bucketName}/'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # 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]
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(update_bucket_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#update_bucket') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::Bucket'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_namespace_metadata(namespace_name, update_namespace_metadata_details, opts = {}) ⇒ Response

Change the default Swift/S3 compartmentId of user’s namespace into the user-defined compartmentId. Upon doing this, all subsequent bucket creations will use the new default compartment, but no previously created buckets will be modified. A user must have the NAMESPACE_UPDATE permission to make changes to the default compartments for S3 and Swift.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :opc_client_request_id (String)

    The client request ID for tracing.

Returns:



1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
# File 'lib/oci/object_storage/object_storage_client.rb', line 1773

def (namespace_name, , opts = {})
  logger.debug 'Calling operation ObjectStorageClient#update_namespace_metadata.' if logger

  raise "Missing the required parameter 'namespace_name' when calling update_namespace_metadata." if namespace_name.nil?
  raise "Missing the required parameter 'update_namespace_metadata_details' when calling update_namespace_metadata." if .nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)

  path = '/n/{namespaceName}'.sub('{namespaceName}', namespace_name.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params['content-type'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body()

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#update_namespace_metadata') do
    @api_client.call_api(
      :PUT,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::ObjectStorage::Models::NamespaceMetadata'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#upload_part(namespace_name, bucket_name, object_name, upload_id, upload_part_num, upload_part_body, opts = {}) ⇒ Response

Uploads a single part of a multipart upload.

Parameters:

  • namespace_name (String)

    The top-level namespace used for the request.

  • bucket_name (String)

    The name of the bucket. Avoid entering confidential information. Example: ‘my-new-bucket1`

  • object_name (String)

    The name of the object. Avoid entering confidential information. Example: ‘test/object1.log`

  • upload_id (String)

    The upload ID for a multipart upload.

  • upload_part_num (Integer)

    The part number that identifies the object part currently being uploaded.

  • upload_part_body (String, IO)

    The part being uploaded to the Object Storage Service.

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

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit ‘nil` value is provided then the operation will not retry

  • :content_length (Integer)

    The content length of the body.

  • :opc_client_request_id (String)

    The client request ID for tracing.

  • :if_match (String)

    The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :if_none_match (String)

    The entity tag to avoid matching. The only valid value is u2018*u2019, which indicates that the request should fail if the object already exists. For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.

  • :expect (String)

    100-continue (default to 100-continue)

  • :content_md5 (String)

    The base-64 encoded MD5 hash of the body.

Returns:

  • (Response)

    A Response object with data of type nil



1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
# File 'lib/oci/object_storage/object_storage_client.rb', line 1846

def upload_part(namespace_name, bucket_name, object_name, upload_id, upload_part_num, upload_part_body, opts = {})
  logger.debug 'Calling operation ObjectStorageClient#upload_part.' if logger

  raise "Missing the required parameter 'namespace_name' when calling upload_part." if namespace_name.nil?
  raise "Missing the required parameter 'bucket_name' when calling upload_part." if bucket_name.nil?
  raise "Missing the required parameter 'object_name' when calling upload_part." if object_name.nil?
  raise "Missing the required parameter 'upload_id' when calling upload_part." if upload_id.nil?
  raise "Missing the required parameter 'upload_part_num' when calling upload_part." if upload_part_num.nil?
  raise "Missing the required parameter 'upload_part_body' when calling upload_part." if upload_part_body.nil?
  raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
  raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
  raise "Parameter value for 'object_name' must not be blank" if OCI::Internal::Util.blank_string?(object_name)

  path = '/n/{namespaceName}/b/{bucketName}/u/{objectName}'.sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
  operation_signing_strategy = :exclude_body

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:uploadId] = upload_id
  query_params[:uploadPartNum] = upload_part_num

  # Header Params
  header_params = {}
  header_params['accept'] = 'application/json'
  header_params[:'opc-client-request-id'] = opts[:opc_client_request_id] if opts[:opc_client_request_id]
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'if-none-match'] = opts[:if_none_match] if opts[:if_none_match]
  header_params[:expect] = opts[:expect] if opts[:expect]
  header_params[:'content-length'] = opts[:content_length] if opts[:content_length]
  header_params[:'content-md5'] = opts[:content_md5] if opts[:content_md5]
  # rubocop:enable Style/NegatedIf
  header_params['content-type'] ||= 'application/octet-stream'

  post_body = @api_client.object_to_http_body(upload_part_body)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ObjectStorageClient#upload_part') do
    @api_client.call_api(
      :PUT,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end