Skip to main content

retention_rules

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

Overview​

Nameretention_rules
TypeResource
Idoci.object_storage.retention_rules

Fields​

The following fields are returned by SELECT queries:

The specified retention rule.

NameDatatypeDescription
idstringUnique identifier for the retention rule.
displayNamestringUser specified name for the retention rule.
durationobjectThe amount of time that objects in the bucket should be preserved for and which is calculated in relation to each object's Last-Modified timestamp. If duration is not present, then there is no time limit and the objects in the bucket will be preserved indefinitely.
etagstringThe entity tag (ETag) for the retention rule.
timeCreatedstring (date-time)The date and time that the retention rule was created as per [RFC3339](https:​//tools.ietf.org/html/rfc3339).
timeModifiedstring (date-time)The date and time that the retention rule was modified as per [RFC3339](https:​//tools.ietf.org/html/rfc3339).
timeRuleLockedstring (date-time)The date and time as per [RFC 3339](https:​//tools.ietf.org/html/rfc3339) after which this rule becomes locked. and can only be deleted by deleting the bucket.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectnamespaceName, bucketName, retentionRuleId, regionopc-client-request-idGet the specified retention rule.
listselectnamespaceName, bucketName, regionpageList the retention rules for a bucket. The retention rules are sorted based on creation time,<br />with the most recently created retention rule returned first.<br />
createinsertnamespaceName, bucketName, regionopc-client-request-idCreates a new retention rule in the specified bucket. The new rule will take effect typically within 30 seconds.<br />Note that a maximum of 100 rules are supported on a bucket.<br />
updateupdatenamespaceName, bucketName, retentionRuleId, regionif-match, opc-client-request-idUpdates the specified retention rule. Rule changes take effect typically within 30 seconds.<br />
deletedeletenamespaceName, bucketName, retentionRuleId, regionif-match, opc-client-request-idDeletes the specified rule. The deletion takes effect typically within 30 seconds.

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
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)
retentionRuleIdstringThe ID of the retention rule.
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.
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​

Get the specified retention rule.

SELECT
id,
displayName,
duration,
etag,
timeCreated,
timeModified,
timeRuleLocked
FROM oci.object_storage.retention_rules
WHERE namespaceName = '{{ namespaceName }}' -- required
AND bucketName = '{{ bucketName }}' -- required
AND retentionRuleId = '{{ retentionRuleId }}' -- required
AND region = '{{ region }}' -- required
AND opc-client-request-id = '{{ opc-client-request-id }}'
;

INSERT examples​

Creates a new retention rule in the specified bucket. The new rule will take effect typically within 30 seconds.<br />Note that a maximum of 100 rules are supported on a bucket.<br />

INSERT INTO oci.object_storage.retention_rules (
displayName,
duration,
timeRuleLocked,
namespaceName,
bucketName,
region,
opc-client-request-id
)
SELECT
'{{ displayName }}',
'{{ duration }}',
'{{ timeRuleLocked }}',
'{{ namespaceName }}',
'{{ bucketName }}',
'{{ region }}',
'{{ opc-client-request-id }}'
RETURNING
id,
displayName,
duration,
etag,
timeCreated,
timeModified,
timeRuleLocked
;

UPDATE examples​

Updates the specified retention rule. Rule changes take effect typically within 30 seconds.<br />

UPDATE oci.object_storage.retention_rules
SET
displayName = '{{ displayName }}',
duration = '{{ duration }}',
timeRuleLocked = '{{ timeRuleLocked }}'
WHERE
namespaceName = '{{ namespaceName }}' --required
AND bucketName = '{{ bucketName }}' --required
AND retentionRuleId = '{{ retentionRuleId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match}}'
AND opc-client-request-id = '{{ opc-client-request-id}}'
RETURNING
id,
displayName,
duration,
etag,
timeCreated,
timeModified,
timeRuleLocked;

DELETE examples​

Deletes the specified rule. The deletion takes effect typically within 30 seconds.

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