Tagging an Object Storage Bucket when Updating
Add metadata to an Object Storage bucket when you update an existing one. This metadata enables you to define keys and values and associate them with resources.
For more information, see Overview of Tagging.
Use the
--defined-tags
or--freeform-tags
options when running the oci os bucket update command to tag a private endpoint you're updating:oci os bucket update --name bucket_name --defined-tags JSON_formatted_defined_tag --freeform-tags JSON_formatted_free-form_tag [OPTIONS]
Provide key-value pair input for
--defined-tags
and--freeform-tags
as valid formatted JSON. See Passing Complex Input and Using a JSON File for Complex Input for information about JSON formatting.For example:
oci os bucket update --name MyBucket --defined-tags '{"Operations": {"CostCenter": "42"}}' --freeform-tags '{"Chicago_Team": "marketing_videos"}' { "data": { "approximate-count": null, "approximate-size": null, "auto-tiering": null, "compartment-id": "ocid.compartment.oc1..exampleuniqueID", "created-by": "ocid1.user.oc1..exampleuniqueID", "defined-tags": { "operations": { "costcenter": "42" } }, "etag": "0a26b47d-c43f-4ef8-9c26-02bb8d69fa34", "freeform-tags": { "Chicago_Team": "marketing_videos", "id": "ocid1.bucket.oc1..exampleuniqueID", "is-read-only": false, "kms-key-id": null, "metadata": { "department": "Finance" }, "name": "MyBucket", "namespace": "MyNamespace", "object-events-enabled": false, "object-lifecycle-policy-etag": null, "public-access-type": "NoPublicAccess", "replication-enabled": false, "storage-tier": "Standard", "time-created": "2020-06-22T19:04:05.879000+00:00", "versioning": "Disabled" }, "etag": "0a26b47d-c43f-4ef8-9c26-02bb8d69fa34" }
For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the UpdateBucket operation. Include the
definedTags
andfreeformTags
attributes and their values.When accessing the Object Storage API, the bucket name is used with the Object Storage namespace name to form the request URL:
n/object_storage_namespace/b/bucket