Skip to main content

buckets

Creates, updates, deletes, gets or lists a buckets resource.

Overview​

Namebuckets
TypeResource
Idoci.object_storage.buckets

Fields​

The following fields are returned by SELECT queries:

A bucket representation for the requested bucket.

NameDatatypeDescription
idstringThe [OCID](/Content/General/Concepts/identifiers.htm) of the bucket.
namestringThe name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
approximateCountinteger (int64)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.
approximateSizeinteger (int64)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.
autoTieringstringThe 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. (Disabled, InfrequentAccess)
bucketScopestringThe bucket scope determines weather the bucket name must be unique within the tenancy and region (essentially the namespace) or across all tenancies in the region. The bucket scope also determines if the bucket supports S3 virtual-hosted style URL's or not. Allowed values: NAMESPACE: Only supports path-style bucket access, bucket name only needs to be unique within the tenancy and region. REGION: Supports both path-style and virtual-hosted URL style access, bucket name needs to be unique across all tenancies in the region. (NAMESPACE, REGION)
compartmentIdstringThe compartment ID in which the bucket is authorized.
createdBystringThe [OCID](/Content/General/Concepts/identifiers.htm) of the user who created the bucket.
definedTagsobjectDefined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}}
etagstringThe entity tag (ETag) for the bucket.
freeformTagsobjectFree-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](/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"}
isBucketKeyEnabledbooleanSpecifies whether Object Storage should use intermediate cached Bucket Encryption Keys with server-side encryption using KMS (SSE-KMS) for new objects in the bucket. This reduces calls to OCI Vault Key Management Service (KMS). Existing objects are not affected.
isReadOnlybooleanWhether 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.
kmsKeyIdstringThe [OCID](/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.
metadataobjectArbitrary string keys and values for user-defined metadata.
namespacestringThe Object Storage namespace in which the bucket resides.
objectEventsEnabledbooleanWhether 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](/Content/Events/Concepts/eventsoverview.htm).
objectLifecyclePolicyEtagstringThe entity tag (ETag) for the live object lifecycle policy on the bucket.
publicAccessTypestringThe 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. (NoPublicAccess, ObjectRead, ObjectReadWithoutList)
replicationEnabledbooleanWhether 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.
storageTierstringThe 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. (Standard, Archive)
timeCreatedstring (date-time)The date and time the bucket was created, as described in [RFC 2616](https:​//tools.ietf.org/html/rfc2616#section-14.29).
versioningstringThe 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. (Enabled, Suspended, Disabled)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectnamespaceName, bucketName, regionif-match, if-none-match, opc-client-request-id, fieldsGets the current representation of the given bucket in the given Object Storage namespace.<br />
listselectnamespaceName, compartmentId, regionlimit, page, fields, opc-client-request-idGets a list of all BucketSummary items in a compartment. A BucketSummary contains only summary fields for the bucket<br />and does not contain fields like the user-defined metadata.<br /><br />ListBuckets returns a BucketSummary containing at most 1000 buckets. To paginate through more buckets, use the returned<br />opc-next-page value with the page request parameter.<br /><br />To use this and other API operations, you must be authorized in an IAM policy. If you are not authorized,<br />talk to an administrator. If you are an administrator who needs to write policies to give users access, see<br />[Getting Started with Policies](/Content/Identity/Concepts/policygetstarted.htm).<br />
createinsertnamespaceName, region, name, compartmentIdopc-client-request-idCreates a bucket in the given namespace with a bucket name and optional user-defined metadata. Avoid entering<br />confidential information in bucket names.<br />
updateupdatenamespaceName, bucketName, regionif-match, opc-client-request-idPerforms a partial or full update of a bucket's user-defined metadata.<br /><br />Use UpdateBucket to move a bucket from one compartment to another within the same tenancy. Supply the compartmentID<br />of the compartment that you want to move the bucket to. For more information about moving resources between compartments,<br />see [Moving Resources to a Different Compartment](/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).<br />
deletedeletenamespaceName, bucketName, regionif-match, opc-client-request-idDeletes a bucket if the bucket is already empty. If the bucket is not empty, use<br />[DeleteObject](#/en/objectstorage/20160918/Object/DeleteObject) first. In addition,<br />you cannot delete a bucket that has a multipart upload in progress or a pre-authenticated<br />request associated with that bucket.<br />

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
bucketNamestringThe name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
compartmentIdstringThe ID of the compartment in which to list buckets.
namespaceNamestringThe Object Storage namespace used for the request.
regionstringOCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION)
fieldsarrayBucket summary in list of buckets includes the 'namespace', 'name', 'compartmentId', 'createdBy', 'timeCreated', and 'etag' fields. This parameter can also include 'tags' (freeformTags and definedTags). The only supported value of this parameter is 'tags' for now. Example 'tags'.
if-matchstringThe 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.
if-none-matchstringThe entity tag (ETag) to avoid matching. Wildcards ('*') are not allowed. If the specified ETag does not match the ETag of the existing resource, the request returns the expected response. If the ETag matches the ETag of the existing resource, the request returns an HTTP 304 status without a response body.
limitintegerFor list pagination. The maximum number of results per page, or items to return in a paginated "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine).
opc-client-request-idstringThe client request ID for tracing.
pagestringFor list pagination. The value of the opc-next-page response header from the previous "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine).

SELECT examples​

Gets the current representation of the given bucket in the given Object Storage namespace.<br />

SELECT
id,
name,
approximateCount,
approximateSize,
autoTiering,
bucketScope,
compartmentId,
createdBy,
definedTags,
etag,
freeformTags,
isBucketKeyEnabled,
isReadOnly,
kmsKeyId,
metadata,
namespace,
objectEventsEnabled,
objectLifecyclePolicyEtag,
publicAccessType,
replicationEnabled,
storageTier,
timeCreated,
versioning
FROM oci.object_storage.buckets
WHERE namespaceName = '{{ namespaceName }}' -- required
AND bucketName = '{{ bucketName }}' -- required
AND region = '{{ region }}' -- required
AND if-match = '{{ if-match }}'
AND if-none-match = '{{ if-none-match }}'
AND opc-client-request-id = '{{ opc-client-request-id }}'
AND fields = '{{ fields }}'
;

INSERT examples​

Creates a bucket in the given namespace with a bucket name and optional user-defined metadata. Avoid entering<br />confidential information in bucket names.<br />

INSERT INTO oci.object_storage.buckets (
autoTiering,
bucketScope,
compartmentId,
definedTags,
freeformTags,
isBucketKeyEnabled,
kmsKeyId,
metadata,
name,
objectEventsEnabled,
publicAccessType,
storageTier,
versioning,
namespaceName,
region,
opc-client-request-id
)
SELECT
'{{ autoTiering }}',
'{{ bucketScope }}',
'{{ compartmentId }}' /* required */,
'{{ definedTags }}',
'{{ freeformTags }}',
{{ isBucketKeyEnabled }},
'{{ kmsKeyId }}',
'{{ metadata }}',
'{{ name }}' /* required */,
{{ objectEventsEnabled }},
'{{ publicAccessType }}',
'{{ storageTier }}',
'{{ versioning }}',
'{{ namespaceName }}',
'{{ region }}',
'{{ opc-client-request-id }}'
RETURNING
id,
name,
approximateCount,
approximateSize,
autoTiering,
bucketScope,
compartmentId,
createdBy,
definedTags,
etag,
freeformTags,
isBucketKeyEnabled,
isReadOnly,
kmsKeyId,
metadata,
namespace,
objectEventsEnabled,
objectLifecyclePolicyEtag,
publicAccessType,
replicationEnabled,
storageTier,
timeCreated,
versioning
;

UPDATE examples​

Performs a partial or full update of a bucket's user-defined metadata.<br /><br />Use UpdateBucket to move a bucket from one compartment to another within the same tenancy. Supply the compartmentID<br />of the compartment that you want to move the bucket to. For more information about moving resources between compartments,<br />see [Moving Resources to a Different Compartment](/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).<br />

UPDATE oci.object_storage.buckets
SET
autoTiering = '{{ autoTiering }}',
bucketScope = '{{ bucketScope }}',
compartmentId = '{{ compartmentId }}',
definedTags = '{{ definedTags }}',
freeformTags = '{{ freeformTags }}',
isBucketKeyEnabled = {{ isBucketKeyEnabled }},
kmsKeyId = '{{ kmsKeyId }}',
metadata = '{{ metadata }}',
name = '{{ name }}',
namespace = '{{ namespace }}',
objectEventsEnabled = {{ objectEventsEnabled }},
publicAccessType = '{{ publicAccessType }}',
versioning = '{{ versioning }}'
WHERE
namespaceName = '{{ namespaceName }}' --required
AND bucketName = '{{ bucketName }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match}}'
AND opc-client-request-id = '{{ opc-client-request-id}}'
RETURNING
id,
name,
approximateCount,
approximateSize,
autoTiering,
bucketScope,
compartmentId,
createdBy,
definedTags,
etag,
freeformTags,
isBucketKeyEnabled,
isReadOnly,
kmsKeyId,
metadata,
namespace,
objectEventsEnabled,
objectLifecyclePolicyEtag,
publicAccessType,
replicationEnabled,
storageTier,
timeCreated,
versioning;

DELETE examples​

Deletes a bucket if the bucket is already empty. If the bucket is not empty, use<br />[DeleteObject](#/en/objectstorage/20160918/Object/DeleteObject) first. In addition,<br />you cannot delete a bucket that has a multipart upload in progress or a pre-authenticated<br />request associated with that bucket.<br />

DELETE FROM oci.object_storage.buckets
WHERE namespaceName = '{{ namespaceName }}' --required
AND bucketName = '{{ bucketName }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
AND opc-client-request-id = '{{ opc-client-request-id }}'
;