retention_rules
Creates, updates, deletes, gets or lists a retention_rules resource.
Overview​
| Name | retention_rules |
| Type | Resource |
| Id | oci.object_storage.retention_rules |
Fields​
The following fields are returned by SELECT queries:
- get
- list
The specified retention rule.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the retention rule. |
displayName | string | User specified name for the retention rule. |
duration | object | The 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. |
etag | string | The entity tag (ETag) for the retention rule. |
timeCreated | string (date-time) | The date and time that the retention rule was created as per [RFC3339](https:​//tools.ietf.org/html/rfc3339). |
timeModified | string (date-time) | The date and time that the retention rule was modified as per [RFC3339](https:​//tools.ietf.org/html/rfc3339). |
timeRuleLocked | string (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. |
The list of retention rules.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the retention rule. |
displayName | string | User specified name for the retention rule. |
duration | object | The 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. |
etag | string | The entity tag (ETag) for the retention rule. |
timeCreated | string (date-time) | The date and time that the retention rule was created as per [RFC3339](https:​//tools.ietf.org/html/rfc3339). |
timeModified | string (date-time) | The date and time that the retention rule was modified as per [RFC3339](https:​//tools.ietf.org/html/rfc3339). |
timeRuleLocked | string (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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | namespaceName, bucketName, retentionRuleId, region | opc-client-request-id | Get the specified retention rule. |
list | select | namespaceName, bucketName, region | page | List 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 /> |
create | insert | namespaceName, bucketName, region | opc-client-request-id | 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 /> |
update | update | namespaceName, bucketName, retentionRuleId, region | if-match, opc-client-request-id | Updates the specified retention rule. Rule changes take effect typically within 30 seconds.<br /> |
delete | delete | namespaceName, bucketName, retentionRuleId, region | if-match, opc-client-request-id | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
bucketName | string | The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1 |
namespaceName | string | The Object Storage namespace used for the request. |
region | string | OCI 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) |
retentionRuleId | string | The ID of the retention rule. |
if-match | string | 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. |
opc-client-request-id | string | The client request ID for tracing. |
page | string | For 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
- list
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 }}'
;
List 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 />
SELECT
id,
displayName,
duration,
etag,
timeCreated,
timeModified,
timeRuleLocked
FROM oci.object_storage.retention_rules
WHERE namespaceName = '{{ namespaceName }}' -- required
AND bucketName = '{{ bucketName }}' -- required
AND region = '{{ region }}' -- required
AND page = '{{ page }}'
;
INSERT examples​
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: retention_rules
props:
- name: namespaceName
value: "{{ namespaceName }}"
description: Required parameter for the retention_rules resource.
- name: bucketName
value: "{{ bucketName }}"
description: Required parameter for the retention_rules resource.
- name: region
value: "{{ region }}"
description: Required parameter for the retention_rules resource.
- name: displayName
value: "{{ displayName }}"
description: |
A user-specified name for the retention rule. Names can be helpful in identifying retention rules.
Avoid entering confidential information.
- name: duration
description: |
The 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.
value:
timeAmount: {{ timeAmount }}
timeUnit: "{{ timeUnit }}"
- name: timeRuleLocked
value: "{{ timeRuleLocked }}"
description: |
The date and time as per [RFC 3339](https://tools.ietf.org/html/rfc3339) after which this rule is locked
and can only be deleted by deleting the bucket. Once a rule is locked, only increases in the duration are
allowed and no other properties can be changed. This property cannot be updated for rules that are in a
locked state. Specifying it when a duration is not specified is considered an error.
- name: opc-client-request-id
value: "{{ opc-client-request-id }}"
description: The client request ID for tracing.
description: The client request ID for tracing.
UPDATE examples​
- update
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​
- delete
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 }}'
;