oracle.oci.oci_object_storage_object – Manage an Object resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.10.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_object_storage_object.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to update and delete an Object resource in Oracle Cloud Infrastructure

  • This resource has the following action operations in the oracle.oci.oci_object_storage_object_actions module: copy, reencrypt, rename, restore, update_object_storage_tier.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
bucket_name
string / required
The name of the bucket. Avoid entering confidential information. Example: `my-new-bucket1`
cache_control
string
The optional Cache-Control header that defines the caching behavior value to be returned in GetObject and HeadObject responses. Specifying values for this header has no effect on Object Storage behavior. Programs that read the object determine what to do based on the value provided. For example, you could use this header to identify objects that require caching restrictions.
This parameter is updatable.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
content_disposition
string
The optional Content-Disposition header that defines presentational information for the object to be returned in GetObject and HeadObject responses. Specifying values for this header has no effect on Object Storage behavior. Programs that read the object determine what to do based on the value provided. For example, you could use this header to let users download objects with custom filenames in a browser.
This parameter is updatable.
content_encoding
string
The optional Content-Encoding header that defines the content encodings that were applied to the object to upload. Specifying values for this header has no effect on Object Storage behavior. Programs that read the object determine what to do based on the value provided. For example, you could use this header to determine what decoding mechanisms need to be applied to obtain the media-type specified by the Content-Type header of the object.
This parameter is updatable.
content_language
string
The optional Content-Language header that defines the content language of the object to upload. Specifying values for this header has no effect on Object Storage behavior. Programs that read the object determine what to do based on the value provided. For example, you could use this header to identify and differentiate objects based on a particular language.
This parameter is updatable.
content_length
integer
The content length of the body.
This parameter is updatable.
content_md5
string
The optional base-64 header that defines the encoded MD5 hash of the body. If the optional Content-MD5 header is present, Object Storage performs an integrity check on the body of the HTTP request by computing the MD5 hash for the body and comparing it to the MD5 hash supplied in the header. If the two hashes do not match, the object is rejected and an HTTP-400 Unmatched Content MD5 error is returned with the message:
"The computed MD5 of the request body (ACTUAL_MD5) does not match the Content-MD5 header (HEADER_MD5)"
This parameter is updatable.
content_type
string
The optional Content-Type header that defines the standard MIME type format of the object. Content type defaults to 'application/octet-stream' if not specified in the PutObject call. Specifying values for this header has no effect on Object Storage behavior. Programs that read the object determine what to do based on the value provided. For example, you could use this header to identify and perform special operations on text only objects.
This parameter is updatable.
dest
string
The destination file path when downloading an object. Use with namespace_name, bucket_name and object_name to download an object.
This parameter is updatable.
expect
string
A value of `100-continue` requests preliminary verification of the request method, path, and headers before the request body is sent. If no error results from such verification, the server will send a 100 (Continue) interim response to indicate readiness for the request body. The only allowed value for this parameter is "100-Continue" (case-insensitive).
This parameter is updatable.
force
boolean
    Choices:
  • no
  • yes
Default:
"true"
Force overwriting existing local file when downloading or existing remote object when uploading.
This parameter is updatable.
namespace_name
string / required
The Object Storage namespace used for the request.
object_name
string / required
The name of the object. Avoid entering confidential information. Example: `test/object1.log`
opc_meta
dictionary
Optional user-defined metadata key and value.
This parameter is updatable.
opc_sse_customer_algorithm
string
The optional header that specifies "AES256" as the encryption algorithm. For more information, see Using Your Own Keys for Server-Side Encryption.
This parameter is updatable.
opc_sse_customer_key
string
The optional header that specifies the base64-encoded 256-bit encryption key to use to encrypt or decrypt the data. For more information, see Using Your Own Keys for Server-Side Encryption.
This parameter is updatable.
opc_sse_customer_key_sha256
string
The optional header that specifies the base64-encoded SHA256 hash of the encryption key. This value is used to check the integrity of the encryption key. For more information, see Using Your Own Keys for Server-Side Encryption.
This parameter is updatable.
opc_sse_kms_key_id
string
The OCID of a master encryption key used to call the Key Management service to generate a data encryption key or to encrypt or decrypt a data encryption key.
This parameter is updatable.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
src
string
The source file path when uploading an object. Use with state=present to upload an object. This option is mutually exclusive with dest.
This parameter is updatable.
state
string
    Choices:
  • present ←
  • absent
The state of the Object.
Use state=present to update an existing an Object.
Use state=absent to delete an Object.
storage_tier
string
    Choices:
  • Standard
  • InfrequentAccess
  • Archive
The storage tier that the object should be stored in. If not specified, the object will be stored in the same storage tier as the bucket.
This parameter is updatable.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
version_id
string
VersionId used to identify a particular version of the object

Examples

- name: Update object
  oci_object_storage_object:
    # required
    namespace_name: namespace_name_example
    bucket_name: bucket_name_example
    object_name: object_name_example

    # optional
    src: /usr/local/myfile.txt
    force: true
    dest: /usr/local/myfile.txt
    content_length: 56
    expect: expect_example
    content_md5: content_md5_example
    content_type: content_type_example
    content_language: content_language_example
    content_encoding: content_encoding_example
    content_disposition: content_disposition_example
    cache_control: cache_control_example
    opc_sse_customer_algorithm: opc_sse_customer_algorithm_example
    opc_sse_customer_key: opc_sse_customer_key_example
    opc_sse_customer_key_sha256: opc_sse_customer_key_sha256_example
    opc_sse_kms_key_id: "ocid1.opcssekmskey.oc1..xxxxxxEXAMPLExxxxxx"
    storage_tier: Standard
    opc_meta: opc_meta_example

- name: Delete object
  oci_object_storage_object:
    # required
    namespace_name: namespace_name_example
    bucket_name: bucket_name_example
    object_name: object_name_example
    state: absent

    # optional
    version_id: "ocid1.version.oc1..xxxxxxEXAMPLExxxxxx"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
object
complex
on success
Details of the Object resource acted upon by the current operation

Sample:
{'archival_state': 'Archived', 'etag': 'etag_example', 'headers': {'Content-Length': '37', 'opc-meta-key1': 'value1'}, 'md5': 'md5_example', 'name': 'name_example', 'size': 56, 'storage_tier': 'Standard', 'time_created': '2013-10-20T19:20:30+01:00', 'time_modified': '2013-10-20T19:20:30+01:00'}
 
archival_state
string
on success
Archival state of an object. This field is set only for objects in Archive tier.

Sample:
Archived
 
etag
string
on success
The current entity tag (ETag) for the object.

Sample:
etag_example
 
headers
dictionary
on success
response headers for the object

Sample:
{'Content-Length': '37', 'opc-meta-key1': 'value1'}
 
md5
string
on success
Base64-encoded MD5 hash of the object data.

Sample:
md5_example
 
name
string
on success
The name of the object. Avoid entering confidential information. Example: test/object1.log

Sample:
name_example
 
size
integer
on success
Size of the object in bytes.

Sample:
56
 
storage_tier
string
on success
The storage tier that the object is stored in.

Sample:
Standard
 
time_created
string
on success
The date and time the object was created, as described in RFC 2616.

Sample:
2013-10-20T19:20:30+01:00
 
time_modified
string
on success
The date and time the object was modified, as described in RFC 2616, section 14.29.

Sample:
2013-10-20T19:20:30+01:00


Authors

  • Oracle (@oracle)