oracle.oci.oci_object_storage_object (5.0.0) — module

Manage an Object resource in Oracle Cloud Infrastructure

| "added in version" 2.9.0 of oracle.oci"

Authors: Oracle (@oracle)

preview | supported by community

Install collection

Install with ansible-galaxy collection install oracle.oci:==5.0.0


Add to requirements.yml

  collections:
    - name: oracle.oci
      version: 5.0.0

Description

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 M(oracle.oci.oci_object_storage_object_actions) module: copy, reencrypt, rename, restore, update_object_storage_tier.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"

Inputs

    
src:
    description:
    - The source file path when uploading an object. Use with I(state=present) to upload
      an object. This option is mutually exclusive with I(dest).
    - This parameter is updatable.
    type: str

dest:
    description:
    - The destination file path when downloading an object. Use with I(namespace_name),
      I(bucket_name) and I(object_name) to download an object.
    - This parameter is updatable.
    type: str

force:
    default: 'true'
    description:
    - Force overwriting existing local file when downloading or existing remote object
      when uploading.
    - This parameter is updatable.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - The state of the Object.
    - Use I(state=present) to update an existing an Object.
    - Use I(state=absent) to delete an Object.
    required: false
    type: str

expect:
    description:
    - 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.
    type: str

region:
    description:
    - 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 C(config_file_location)).
      Please refer to U(https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm)
      for more information on OCI regions.
    type: str

tenancy:
    description:
    - 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 C(config_file_location)). To get the tenancy OCID, please
      refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm)
    type: str

api_user:
    description:
    - 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 C(config_file_location)).
      To get the user's OCID, please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
    type: str

opc_meta:
    description:
    - Optional user-defined metadata key and value.
    - This parameter is updatable.
    type: dict

auth_type:
    choices:
    - api_key
    - instance_principal
    - instance_obo_user
    - resource_principal
    - security_token
    default: api_key
    description:
    - The type of authentication to use for making API requests. By default C(auth_type="api_key")
      based authentication is performed and the API key (see I(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 C(auth_type="instance_principal")
      to use instance principal based authentication when running ansible playbooks within
      an OCI compute instance.
    type: str

version_id:
    description:
    - VersionId used to identify a particular version of the object
    type: str

bucket_name:
    description:
    - 'The name of the bucket. Avoid entering confidential information. Example: `my-new-bucket1`'
    required: true
    type: str

cert_bundle:
    description:
    - 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.
    type: str

content_md5:
    description:
    - '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.
    type: str

object_name:
    description:
    - 'The name of the object. Avoid entering confidential information. Example: `test/object1.log`'
    required: true
    type: str

auth_purpose:
    choices:
    - service_principal
    description:
    - The auth purpose which can be used in conjunction with 'auth_type=instance_principal'.
      The default auth_purpose for instance_principal is None.
    type: str

content_type:
    description:
    - 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.
    type: str

storage_tier:
    choices:
    - Standard
    - InfrequentAccess
    - Archive
    description:
    - 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.
    type: str

cache_control:
    description:
    - 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.
    type: str

content_length:
    description:
    - The content length of the body.
    - This parameter is updatable.
    type: int

namespace_name:
    description:
    - The Object Storage namespace used for the request.
    required: true
    type: str

content_encoding:
    description:
    - 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.
    type: str

content_language:
    description:
    - 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.
    type: str

api_user_key_file:
    description:
    - 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 C(config_file_location)).
      If the key is encrypted with a pass-phrase, the C(api_user_key_pass_phrase) option
      must also be provided.
    type: str

opc_sse_kms_key_id:
    description:
    - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm)
      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.
    type: str

config_profile_name:
    description:
    - The profile to load from the config file referenced by C(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 C(config_file_location).
    type: str

content_disposition:
    description:
    - 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.
    type: str

api_user_fingerprint:
    description:
    - 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 C(config_file_location)). To
      get the key pair's fingerprint value please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
    type: str

config_file_location:
    description:
    - 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.
    type: str

opc_sse_customer_key:
    description:
    - The optional header that specifies the base64-encoded 256-bit encryption key to
      use to encrypt or decrypt the data. For more information, see L(Using Your Own Keys
      for Server-Side Encryption,https://docs.cloud.oracle.com/Content/Object/Tasks/usingyourencryptionkeys.htm).
    - This parameter is updatable.
    type: str

api_user_key_pass_phrase:
    description:
    - Passphrase used by the key referenced in C(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 C(config_file_location)).
    type: str

opc_sse_customer_algorithm:
    description:
    - The optional header that specifies "AES256" as the encryption algorithm. For more
      information, see L(Using Your Own Keys for Server-Side Encryption,https://docs.cloud.oracle.com/Content/Object/Tasks/usingyourencryptionkeys.htm).
    - This parameter is updatable.
    type: str

opc_sse_customer_key_sha256:
    description:
    - 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 L(Using Your Own Keys for Server-Side Encryption,https://docs.cloud.oracle.com/Content/Object/Tasks/usingyourencryptionkeys.htm).
    - This parameter is updatable.
    type: str

realm_specific_endpoint_template_enabled:
    description:
    - Enable/Disable realm specific endpoint template for service client. By Default,
      realm specific endpoint template is disabled. If not set, then the value of the
      OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used.
    type: bool

Outputs

object:
  contains:
    archival_state:
      description:
      - Archival state of an object. This field is set only for objects in Archive
        tier.
      returned: on success
      sample: Archived
      type: str
    etag:
      description:
      - The current entity tag (ETag) for the object.
      returned: on success
      sample: etag_example
      type: str
    headers:
      description:
      - response headers for the object
      returned: on success
      sample:
        Content-Length: '37'
        opc-meta-key1: value1
      type: dict
    md5:
      description:
      - Base64-encoded MD5 hash of the object data.
      returned: on success
      sample: md5_example
      type: str
    name:
      description:
      - 'The name of the object. Avoid entering confidential information. Example:
        test/object1.log'
      returned: on success
      sample: name_example
      type: str
    size:
      description:
      - Size of the object in bytes.
      returned: on success
      sample: 56
      type: int
    storage_tier:
      description:
      - The storage tier that the object is stored in.
      returned: on success
      sample: Standard
      type: str
    time_created:
      description:
      - The date and time the object was created, as described in L(RFC 2616,https://tools.ietf.org/html/rfc2616#section-14.29).
      returned: on success
      sample: '2013-10-20T19:20:30+01:00'
      type: str
    time_modified:
      description:
      - The date and time the object was modified, as described in L(RFC 2616,https://tools.ietf.org/rfc/rfc2616),
        section 14.29.
      returned: on success
      sample: '2013-10-20T19:20:30+01:00'
      type: str
  description:
  - Details of the Object resource acted upon by the current operation
  returned: on success
  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'
  type: complex