oracle.oci.oci_object_storage_bucket_actions (5.0.0) — module

Perform actions on a Bucket 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

Perform actions on a Bucket resource in Oracle Cloud Infrastructure

For I(action=make_bucket_writable), stops replication to the destination bucket and removes the replication policy. When the replication policy was created, this destination bucket became read-only except for new and changed objects replicated automatically from the source bucket. MakeBucketWritable removes the replication policy. This bucket is no longer the target for replication and is now writable, allowing users to make changes to bucket contents.

For I(action=reencrypt), re-encrypts the unique data encryption key that encrypts each object written to the bucket by using the most recent version of the master encryption key assigned to the bucket. (All data encryption keys are encrypted by a master encryption key. Master encryption keys are assigned to buckets and managed by Oracle by default, but you can assign a key that you created and control through the Oracle Cloud Infrastructure Key Management service.) The kmsKeyId property of the bucket determines which master encryption key is assigned to the bucket. If you assigned a different Key Management master encryption key to the bucket, you can call this API to re-encrypt all data encryption keys with the newly assigned key. Similarly, you might want to re-encrypt all data encryption keys if the assigned key has been rotated to a new key version since objects were last added to the bucket. If you call this API and there is no kmsKeyId associated with the bucket, the call will fail. Calling this API starts a work request task to re-encrypt the data encryption key of all objects in the bucket. Only objects created before the time of the API call will be re-encrypted. The call can take a long time, depending on how many objects are in the bucket and how big they are. This API returns a work request ID that you can use to retrieve the status of the work request task. All the versions of objects will be re-encrypted whether versioning is enabled or suspended at the bucket.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Perform action make_bucket_writable on bucket
  oci_object_storage_bucket_actions:
    # required
    namespace_name: namespace_name_example
    bucket_name: bucket_name_example
    action: make_bucket_writable
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Perform action reencrypt on bucket
  oci_object_storage_bucket_actions:
    # required
    namespace_name: namespace_name_example
    bucket_name: bucket_name_example
    action: reencrypt

Inputs

    
wait:
    default: true
    description: Whether to wait for create or delete operation to complete.
    type: bool

action:
    choices:
    - make_bucket_writable
    - reencrypt
    description:
    - The action to perform on the Bucket.
    required: true
    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

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

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

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

wait_timeout:
    description: Time, in seconds, to wait when I(wait=yes). Defaults to 1200 for most
      of the services but some services might have a longer wait timeout.
    type: int

namespace_name:
    description:
    - The Object Storage namespace used for the request.
    required: true
    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

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

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

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

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

bucket:
  contains:
    approximate_count:
      description:
      - The approximate number of objects in the bucket. Count statistics are reported
        periodically. You will see a lag between what is displayed and the actual
        object count.
      returned: on success
      sample: 56
      type: int
    approximate_size:
      description:
      - The approximate total size in bytes of all objects in the bucket. Size statistics
        are reported periodically. You will see a lag between what is displayed and
        the actual size of the bucket.
      returned: on success
      sample: 56
      type: int
    auto_tiering:
      description:
      - The auto tiering status on the bucket. A bucket is created with auto tiering
        `Disabled` by default. For auto tiering `InfrequentAccess`, objects are transitioned
        automatically between the 'Standard' and 'InfrequentAccess' tiers based on
        the access pattern of the objects.
      returned: on success
      sample: Disabled
      type: str
    compartment_id:
      description:
      - The compartment ID in which the bucket is authorized.
      returned: on success
      sample: ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
      type: str
    created_by:
      description:
      - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm)
        of the user who created the bucket.
      returned: on success
      sample: created_by_example
      type: str
    defined_tags:
      description:
      - 'Defined tags for this resource. Each key is predefined and scoped to a namespace.
        For more information, see L(Resource Tags,https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
        Example: `{"Operations": {"CostCenter": "42"}}`'
      returned: on success
      sample:
        Operations:
          CostCenter: US
      type: dict
    etag:
      description:
      - The entity tag (ETag) for the bucket.
      returned: on success
      sample: etag_example
      type: str
    freeform_tags:
      description:
      - 'Free-form tags for this resource. Each tag is a simple key-value pair with
        no predefined name, type, or namespace. For more information, see L(Resource
        Tags,https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
        Example: `{"Department": "Finance"}`'
      returned: on success
      sample:
        Department: Finance
      type: dict
    id:
      description:
      - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm)
        of the bucket.
      returned: on success
      sample: ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
      type: str
    is_read_only:
      description:
      - Whether or not this bucket is read only. By default, `isReadOnly` is set to
        `false`. This will be set to 'true' when this bucket is configured as a destination
        in a replication policy.
      returned: on success
      sample: true
      type: bool
    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.
      returned: on success
      sample: ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx
      type: str
    metadata:
      description:
      - Arbitrary string keys and values for user-defined metadata.
      returned: on success
      sample: {}
      type: dict
    name:
      description:
      - 'The name of the bucket. Avoid entering confidential information. Example:
        my-new-bucket1'
      returned: on success
      sample: name_example
      type: str
    namespace:
      description:
      - The Object Storage namespace in which the bucket resides.
      returned: on success
      sample: namespace_example
      type: str
    object_events_enabled:
      description:
      - Whether or not events are emitted for object state changes in this bucket.
        By default, `objectEventsEnabled` is set to `false`. Set `objectEventsEnabled`
        to `true` to emit events for object state changes. For more information about
        events, see L(Overview of Events,https://docs.cloud.oracle.com/Content/Events/Concepts/eventsoverview.htm).
      returned: on success
      sample: true
      type: bool
    object_lifecycle_policy_etag:
      description:
      - The entity tag (ETag) for the live object lifecycle policy on the bucket.
      returned: on success
      sample: object_lifecycle_policy_etag_example
      type: str
    public_access_type:
      description:
      - The type of public access enabled on this bucket. A bucket is set to `NoPublicAccess`
        by default, which only allows an authenticated caller to access the bucket
        and its contents. When `ObjectRead` is enabled on the bucket, public access
        is allowed for the `GetObject`, `HeadObject`, and `ListObjects` operations.
        When `ObjectReadWithoutList` is enabled on the bucket, public access is allowed
        for the `GetObject` and `HeadObject` operations.
      returned: on success
      sample: NoPublicAccess
      type: str
    replication_enabled:
      description:
      - Whether or not this bucket is a replication source. By default, `replicationEnabled`
        is set to `false`. This will be set to 'true' when you create a replication
        policy for the bucket.
      returned: on success
      sample: true
      type: bool
    storage_tier:
      description:
      - The storage tier type assigned to the bucket. A bucket is set to `Standard`
        tier by default, which means objects uploaded or copied to the bucket will
        be in the standard storage tier. When the `Archive` tier type is set explicitly
        for a bucket, objects uploaded or copied to the bucket will be stored in archive
        storage. The `storageTier` property is immutable after bucket is created.
      returned: on success
      sample: Standard
      type: str
    time_created:
      description:
      - The date and time the bucket 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
    versioning:
      description:
      - The versioning status on the bucket. A bucket is created with versioning `Disabled`
        by default. For versioning `Enabled`, objects are protected from overwrites
        and deletes, by maintaining their version history. When versioning is `Suspended`,
        the previous versions will still remain but new versions will no longer be
        created when overwitten or deleted.
      returned: on success
      sample: Enabled
      type: str
  description:
  - Details of the Bucket resource acted upon by the current operation
  returned: on success
  sample:
    approximate_count: 56
    approximate_size: 56
    auto_tiering: Disabled
    compartment_id: ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
    created_by: created_by_example
    defined_tags:
      Operations:
        CostCenter: US
    etag: etag_example
    freeform_tags:
      Department: Finance
    id: ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
    is_read_only: true
    kms_key_id: ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx
    metadata: {}
    name: name_example
    namespace: namespace_example
    object_events_enabled: true
    object_lifecycle_policy_etag: object_lifecycle_policy_etag_example
    public_access_type: NoPublicAccess
    replication_enabled: true
    storage_tier: Standard
    time_created: '2013-10-20T19:20:30+01:00'
    versioning: Enabled
  type: complex