update

Description

Performs a partial or full update of a bucket’s user-defined metadata.

Use UpdateBucket to move a bucket from one compartment to another within the same tenancy. Supply the compartmentID of the compartment that you want to move the bucket to. For more information about moving resources between compartments, see Moving Resources to a Different Compartment.

Usage

oci os bucket update [OPTIONS]

Required Parameters

--bucket-name, --name, -bn [text]

The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1

Optional Parameters

--auto-tiering [text]

The auto tiering status on the bucket. If in state InfrequentAccess, objects are transitioned automatically between the ‘Standard’ and ‘InfrequentAccess’ tiers based on the access pattern of the objects. When auto tiering is Disabled, there will be no automatic transitions between storage tiers.

--compartment-id, -c [text]

The compartmentId for the compartment to move the bucket to.

--defined-tags [complex type]

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{“Operations”: {“CostCenter”: “42”}} This is a complex type whose value must be valid JSON. The value can be provided as a string on the command line or passed in as a file using the file://path/to/file syntax.

The --generate-param-json-input option can be used to generate an example of the JSON which must be provided. We recommend storing this example in a file, modifying it as needed and then passing it back in via the file:// syntax.

--freeform-tags [complex type]

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”} This is a complex type whose value must be valid JSON. The value can be provided as a string on the command line or passed in as a file using the file://path/to/file syntax.

The --generate-param-json-input option can be used to generate an example of the JSON which must be provided. We recommend storing this example in a file, modifying it as needed and then passing it back in via the file:// syntax.

--from-json [text]

Provide input to this command as a JSON document from a file using the file://path-to/file syntax.

The --generate-full-command-json-input option can be used to generate a sample json file to be used with this command option. The key names are pre-populated and match the command option names (converted to camelCase format, e.g. compartment-id –> compartmentId), while the values of the keys need to be populated by the user before using the sample file as an input to this command. For any command option that accepts multiple values, the value of the key can be a JSON array.

Options can still be provided on the command line. If an option exists in both the JSON document and the command line then the command line specified value will be used.

For examples on usage of this option, please see our “using CLI with advanced JSON options” link: https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/cliusing.htm#AdvancedJSONOptions

--if-match [text]

The entity tag (ETag) to match with the ETag of an existing resource. If the specified ETag matches the ETag of the existing resource, GET and HEAD requests will return the resource and PUT and POST requests will upload the resource.

--kms-key-id [text]

The OCID of the Key Management master encryption key to associate with the specified bucket. If this value is empty, the Update operation will remove the associated key, if there is one, from the bucket. (The bucket will continue to be encrypted, but with an encryption key managed by Oracle.)

--metadata [complex type]

Arbitrary string, up to 4KB, of keys and values for user-defined metadata. This is a complex type whose value must be valid JSON. The value can be provided as a string on the command line or passed in as a file using the file://path/to/file syntax.

The --generate-param-json-input option can be used to generate an example of the JSON which must be provided. We recommend storing this example in a file, modifying it as needed and then passing it back in via the file:// syntax.

--namespace-name, --namespace, -ns [text]

The Object Storage namespace used for the request. If not provided, this parameter will be obtained internally using a call to ‘oci os ns get’

--object-events-enabled [boolean]

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 Overview of Events.

--public-access-type [text]

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.

Accepted values are:

NoPublicAccess, ObjectRead, ObjectReadWithoutList
--versioning [text]

The versioning status on the bucket. If in state Enabled, multiple versions of the same object can be kept in the bucket. When the object is overwritten or deleted, previous versions will still be available. When versioning is Suspended, the previous versions will still remain but new versions will no longer be created when overwitten or deleted. Versioning cannot be disabled on a bucket once enabled.

Accepted values are:

Enabled, Suspended

Example using required parameter

Copy the following CLI commands into a file named example.sh. Run the command by typing “bash example.sh” and replacing the example parameters with your own.

Please note this sample will only work in the POSIX-compliant bash-like shell. You need to set up the OCI configuration and appropriate security policies before trying the examples.

    export bucket_name=<substitute-value-of-bucket_name> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/os/bucket/update.html#cmdoption-bucket-name

    oci os bucket update --bucket-name $bucket_name

Other Examples

Description

Updates the auto-tiering status of the bucket

Command

 oci os bucket update -bn bucket-client --auto-tiering InfrequentAccess

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaa3ffjane6aoullgob4daj6xw2bzkm7maswctna2zgoxfny4smpoha",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "24404a80-83ce-4455-b003-b4fa1c959617",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {},
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": false,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Disabled"
 },
 "etag": "24404a80-83ce-4455-b003-b4fa1c959617"
}

Description

Moves the bucket to specified compartment

Command

 oci os bucket update -bn bucket-client -c ocid1.compartment.oc1..aaaaaaaaifdv4z64j6tyrovldq74t4fv5qadmbrt5goclfxhiqql7fjnn62q

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaaifdv4z64j6tyrovldq74t4fv5qadmbrt5goclfxhiqql7fjnn62q",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "fdc04ff6-a6c8-49df-8b0f-369744e230ff",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {},
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": false,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Disabled"
 },
 "etag": "fdc04ff6-a6c8-49df-8b0f-369744e230ff"
}

Description

Generates a JSON file which represents all possible options that can be provided to this command

Command

 oci os bucket update -bn bucket-client --generate-full-command-json-input > example.json

Output

{
 "autoTiering": "string",
 "bucketName": "string",
 "compartmentId": "string",
 "definedTags": {
      "tagNamespace1": {
           "tagKey1": "tagValue1",
           "tagKey2": "tagValue2"
      },
      "tagNamespace2": {
           "tagKey1": "tagValue1",
           "tagKey2": "tagValue2"
      }
 },
 "freeformTags": {
      "tagKey1": "tagValue1",
      "tagKey2": "tagValue2"
 },
 "ifMatch": "string",
 "kmsKeyId": "string",
 "metadata": {
      "string1": "string",
      "string2": "string"
 },
 "name": "string",
 "namespace": "string",
 "namespaceName": "string",
 "objectEventsEnabled": true,
 "publicAccessType": "NoPublicAccess|ObjectRead|ObjectReadWithoutList",
 "versioning": "Enabled|Suspended"
}

Description

Provides input to the update command from the JSON file

Command

 oci os bucket update -bn bucket-client --from-json file://example.json

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaa3ffjane6aoullgob4daj6xw2bzkm7maswctna2zgoxfny4smpoha",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "fdf516c3-f7f9-4220-855c-5d727f3dc387",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {},
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": true,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Enabled"
 },
 "etag": "fdf516c3-f7f9-4220-855c-5d727f3dc387"
}

Description

Updates the metadata of bucket with the specified metadata

Command

 oci os bucket update -bn bucket-client --metadata '{"abc":"123"}'

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaa3ffjane6aoullgob4daj6xw2bzkm7maswctna2zgoxfny4smpoha",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "72dcfdab-d6c2-4568-8f4c-0d720c149139",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {
           "abc": "123"
      },
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": true,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Enabled"
 },
 "etag": "72dcfdab-d6c2-4568-8f4c-0d720c149139"
}

Description

Enables or disables bucket object events

Command

 oci os bucket update -bn bucket-client --object-events-enabled True

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaa3ffjane6aoullgob4daj6xw2bzkm7maswctna2zgoxfny4smpoha",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "fb4f1673-45ce-4dee-b30a-157cc41f24fd",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {
           "abc": "123"
      },
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": true,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Enabled"
 },
 "etag": "fb4f1673-45ce-4dee-b30a-157cc41f24fd"
}

Description

Updates access type of the bucket

Command

 oci os bucket update -bn bucket-client --public-access-type NoPublicAccess

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaa3ffjane6aoullgob4daj6xw2bzkm7maswctna2zgoxfny4smpoha",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "4fc8872f-e359-4608-8cbd-1d7067c6062d",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {
           "abc": "123"
      },
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": true,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Enabled"
 },
 "etag": "4fc8872f-e359-4608-8cbd-1d7067c6062d"
}

Description

Updates the versioning status of the bucket

Command

 oci os bucket update -bn bucket-client --versioning Suspended

Output

{
 "data": {
      "approximate-count": null,
      "approximate-size": null,
      "auto-tiering": "InfrequentAccess",
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaa3ffjane6aoullgob4daj6xw2bzkm7maswctna2zgoxfny4smpoha",
      "created-by": "ocid1.user.oc1..aaaaaaaatflstw5i7x3pb5ukijuanrhdgijymtiqwlkexuzar2aoyaluqcdq",
      "defined-tags": {},
      "etag": "16e49d00-6e48-4151-b58a-f0282f3558c4",
      "freeform-tags": {},
      "id": "ocid1.bucket.oc1.phx.aaaaaaaaqhynklzj6uau5e5queqnr23ndanpfzdqlwrwysyjdzug7dakeila",
      "is-read-only": false,
      "kms-key-id": null,
      "metadata": {
           "abc": "123"
      },
      "name": "bucket-client",
      "namespace": "bmcostests",
      "object-events-enabled": true,
      "object-lifecycle-policy-etag": null,
      "public-access-type": "NoPublicAccess",
      "replication-enabled": false,
      "storage-tier": "Standard",
      "time-created": "2022-11-21T10:05:53.969000+00:00",
      "versioning": "Suspended"
 },
 "etag": "16e49d00-6e48-4151-b58a-f0282f3558c4"
}