oci_object_storage_bucket_actions – Perform actions on a Bucket resource in Oracle Cloud Infrastructure¶
New in version 2.5.
Synopsis¶
- Perform actions on a Bucket resource in Oracle Cloud Infrastructure
- For action=copy_object, creates a request to copy an object within a region or to another region.
- For action=rename_object, rename an object in the given Object Storage namespace.
- For action=restore_objects, restores one or more objects specified by the objectName parameter. By default objects will be restored for 24 hours. Duration can be configured using the hours parameter.
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.7
- Python SDK for Oracle Cloud Infrastructure https://oracle-cloud-infrastructure-python-sdk.readthedocs.io
Parameters¶
| Parameter | Choices/Defaults | Comments |
|---|---|---|
|
action
-
/ required
|
|
The action to perform on the Bucket.
|
|
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_type
string
|
|
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
-
/ required
|
The name of the bucket. Avoid entering confidential information. Example: `my-new-bucket1`
|
|
|
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. |
|
|
destination_bucket
-
|
The destination bucket the object will be copied to.
Required for action=copy_object.
|
|
|
destination_namespace
-
|
The destination Object Storage namespace the object will be copied to.
Required for action=copy_object.
|
|
|
destination_object_if_match_e_tag
-
|
The entity tag (ETag) to match against that of the destination object (an object intended to be overwritten). Used to confirm that the destination object stored under a given name is the version of that object storing a specified entity tag.
Applicable only for action=copy_object.
|
|
|
destination_object_if_none_match_e_tag
-
|
The entity tag (ETag) to avoid matching. The only valid value is '*', which indicates that the request should fail if the object already exists in the destination bucket.
Applicable only for action=copy_object.
|
|
|
destination_object_metadata
dictionary
|
Arbitrary string keys and values for the user-defined metadata for the object. Keys must be in "opc-meta-*" format. Avoid entering confidential information. Metadata key-value pairs entered in this field are assigned to the destination object. If you enter no metadata values, the destination object will inherit any existing metadata values associated with the source object.
Applicable only for action=copy_object.
|
|
|
destination_object_name
-
|
The name of the destination object resulting from the copy operation.
Required for action=copy_object.
|
|
|
destination_region
-
|
The destination region the object will be copied to, for example "us-ashburn-1".
Required for action=copy_object.
|
|
|
hours
integer
|
The number of hours for which this object will be restored. By default objects will be restored for 24 hours. You can instead configure the duration using the hours parameter.
Applicable only for action=restore_objects.
|
|
|
namespace_name
-
/ required
|
The Object Storage namespace used for the request.
|
|
|
new_name
-
|
The new name of the source object.
Required for action=rename_object.
|
|
|
new_obj_if_match_e_tag
-
|
The if-match entity tag (ETag) of the new object.
Applicable only for action=rename_object.
|
|
|
new_obj_if_none_match_e_tag
-
|
The if-none-match entity tag (ETag) of the new object.
Applicable only for action=rename_object.
|
|
|
object_name
-
|
An object that is in an archive storage tier and needs to be restored.
Required for action=restore_objects.
|
|
|
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. |
|
|
source_name
-
|
The name of the source object to be renamed.
Required for action=rename_object.
|
|
|
source_object_if_match_e_tag
-
|
The entity tag (ETag) to match against that of the source object. Used to confirm that the source object with a given name is the version of that object storing a specified ETag.
Applicable only for action=copy_object.
|
|
|
source_object_name
-
|
The name of the object to be copied.
Required for action=copy_object.
|
|
|
src_obj_if_match_e_tag
-
|
The if-match entity tag (ETag) of the source object.
Applicable only for action=rename_object.
|
|
|
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 |
|
|
wait
boolean
|
|
Whether to wait for create or delete operation to complete.
|
|
wait_timeout
integer
|
Default: 2000
|
Time, in seconds, to wait when wait=yes.
|
|
wait_until
string
|
The lifecycle state to wait for the resource to transition into when wait=yes. By default, when wait=yes, we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/ RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/ TERMINATED lifecycle state during delete operation.
|
Notes¶
Note
- For OCI python sdk configuration, please refer to https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/configuration.html
Examples¶
- name: Perform action copy_object on bucket
oci_object_storage_bucket_actions:
source_object_name: backup.tar.gz
source_object_if_match_e_tag: '*'
destination_region: uk-london-1
destination_namespace: ansh8lvru1zp
destination_bucket: backup
destination_object_name: backup2.tar.gz
destination_object_if_match_e_tag: '*'
destination_object_if_none_match_e_tag: '*'
destination_object_metadata:
opc-meta-a: b
namespace_name: namespace_name_example
bucket_name: my-new-bucket1
action: copy_object
- name: Perform action rename_object on bucket
oci_object_storage_bucket_actions:
source_name: SourceObjectName
new_name: TargetObjectName
src_obj_if_match_e_tag: '*'
new_obj_if_match_e_tag: '*'
new_obj_if_none_match_e_tag: '*'
namespace_name: namespace_name_example
bucket_name: my-new-bucket1
action: rename_object
- name: Perform action restore_objects on bucket
oci_object_storage_bucket_actions:
namespace_name: namespace_name_example
bucket_name: my-new-bucket1
object_name: object_name_example
action: restore_objects
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
|
bucket
complex
|
on success |
Details of the Bucket resource acted upon by the current operation
Sample:
{'freeform_tags': {'Department': 'Finance'}, 'created_by': 'created_by_example', 'name': 'name_example', 'kms_key_id': 'ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx', 'metadata': {}, 'object_lifecycle_policy_etag': 'object_lifecycle_policy_etag_example', 'namespace': 'namespace_example', 'storage_tier': 'Standard', 'approximate_size': 56, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'public_access_type': 'NoPublicAccess', 'etag': 'etag_example', 'time_created': '2013-10-20T19:20:30+01:00', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'approximate_count': 56}
|
|
|
approximate_count
integer
|
on success |
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.
Sample:
56
|
|
|
approximate_size
integer
|
on success |
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.
Sample:
56
|
|
|
compartment_id
string
|
on success |
The compartment ID in which the bucket is authorized.
Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
|
|
|
created_by
string
|
on success |
The OCID of the user who created the bucket.
Sample:
created_by_example
|
|
|
defined_tags
dictionary
|
on success |
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{"Operations": {"CostCenter": "42"}}`
Sample:
{'Operations': {'CostCenter': 'US'}}
|
|
|
etag
string
|
on success |
The entity tag (ETag) for the bucket.
Sample:
etag_example
|
|
|
freeform_tags
dictionary
|
on success |
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 Resource Tags. Example: `{"Department": "Finance"}`
Sample:
{'Department': 'Finance'}
|
|
|
kms_key_id
string
|
on success |
The OCID of a KMS key id used to call KMS to generate data key or decrypt the encrypted data key.
Sample:
ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx
|
|
|
metadata
dictionary
|
on success |
Arbitrary string keys and values for user-defined metadata.
|
|
|
name
string
|
on success |
The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
Sample:
name_example
|
|
|
namespace
string
|
on success |
The Object Storage namespace in which the bucket lives.
Sample:
namespace_example
|
|
|
object_lifecycle_policy_etag
string
|
on success |
The entity tag (ETag) for the live object lifecycle policy on the bucket.
Sample:
object_lifecycle_policy_etag_example
|
|
|
public_access_type
string
|
on success |
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.
Sample:
NoPublicAccess
|
|
|
storage_tier
string
|
on success |
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.
Sample:
Standard
|
|
|
time_created
string
|
on success |
The date and time the bucket was created, as described in RFC 2616, section 14.29.
Sample:
2013-10-20 19:20:30+01:00
|
|
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Manoj Meda (@manojmeda)
- Mike Ross (@mross22)
- Nabeel Al-Saber (@nalsaber)
Hint
If you notice any issues in this documentation you can edit this document to improve it.