UpdateRuleCommand

Updates an existing Recycle Bin retention rule. You can update a retention rule's description, resource tags, and retention period at any time after creation. You can't update a retention rule's resource type after creation. For more information, see Update Recycle Bin retention rules  in the Amazon Elastic Compute Cloud User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { RbinClient, UpdateRuleCommand } from "@aws-sdk/client-rbin"; // ES Modules import
// const { RbinClient, UpdateRuleCommand } = require("@aws-sdk/client-rbin"); // CommonJS import
const client = new RbinClient(config);
const input = { // UpdateRuleRequest
  Identifier: "STRING_VALUE", // required
  RetentionPeriod: { // RetentionPeriod
    RetentionPeriodValue: Number("int"), // required
    RetentionPeriodUnit: "DAYS", // required
  },
  Description: "STRING_VALUE",
  ResourceType: "EBS_SNAPSHOT" || "EC2_IMAGE",
  ResourceTags: [ // ResourceTags
    { // ResourceTag
      ResourceTagKey: "STRING_VALUE", // required
      ResourceTagValue: "STRING_VALUE",
    },
  ],
  ExcludeResourceTags: [ // ExcludeResourceTags
    {
      ResourceTagKey: "STRING_VALUE", // required
      ResourceTagValue: "STRING_VALUE",
    },
  ],
};
const command = new UpdateRuleCommand(input);
const response = await client.send(command);
// { // UpdateRuleResponse
//   Identifier: "STRING_VALUE",
//   RetentionPeriod: { // RetentionPeriod
//     RetentionPeriodValue: Number("int"), // required
//     RetentionPeriodUnit: "DAYS", // required
//   },
//   Description: "STRING_VALUE",
//   ResourceType: "EBS_SNAPSHOT" || "EC2_IMAGE",
//   ResourceTags: [ // ResourceTags
//     { // ResourceTag
//       ResourceTagKey: "STRING_VALUE", // required
//       ResourceTagValue: "STRING_VALUE",
//     },
//   ],
//   Status: "pending" || "available",
//   LockState: "locked" || "pending_unlock" || "unlocked",
//   LockEndTime: new Date("TIMESTAMP"),
//   RuleArn: "STRING_VALUE",
//   ExcludeResourceTags: [ // ExcludeResourceTags
//     {
//       ResourceTagKey: "STRING_VALUE", // required
//       ResourceTagValue: "STRING_VALUE",
//     },
//   ],
// };

UpdateRuleCommand Input

See UpdateRuleCommandInput for more details

Parameter
Type
Description
Identifier
Required
string | undefined

The unique ID of the retention rule.

Description
string | undefined

The retention rule description.

ExcludeResourceTags
ResourceTag[] | undefined

[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.

You can't specify exclusion tags for tag-level retention rules.

ResourceTags
ResourceTag[] | undefined

[Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.

You can add the same tag key and value pair to a maximum or five retention rules.

To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.

ResourceType
ResourceType | undefined

This parameter is currently not supported. You can't update a retention rule's resource type after creation.

RetentionPeriod
RetentionPeriod | undefined

Information about the retention period for which the retention rule is to retain resources.

UpdateRuleCommand Output

See UpdateRuleCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Description
string | undefined

The retention rule description.

ExcludeResourceTags
ResourceTag[] | undefined

[Region-level retention rules only] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.

Identifier
string | undefined

The unique ID of the retention rule.

LockEndTime
Date | undefined

The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.

LockState
LockState | undefined

[Region-level retention rules only] The lock state for the retention rule.

  • locked - The retention rule is locked and can't be modified or deleted.

  • pending_unlock - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.

  • unlocked - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.

  • null - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the locked and unlocked states only; it can never transition back to null.

ResourceTags
ResourceTag[] | undefined

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
ResourceType | undefined

The resource type retained by the retention rule.

RetentionPeriod
RetentionPeriod | undefined

Information about the retention period for which the retention rule is to retain resources.

RuleArn
string | undefined

The Amazon Resource Name (ARN) of the retention rule.

Status
RuleStatus | undefined

The state of the retention rule. Only retention rules that are in the available state retain resources.

Throws

Name
Fault
Details
ConflictException
client

The specified retention rule lock request can't be completed.

InternalServerException
server

The service could not respond to the request due to an internal problem.

ResourceNotFoundException
client

The specified resource was not found.

ServiceQuotaExceededException
client

The request would cause a service quota for the number of tags per resource to be exceeded.

ValidationException
client

One or more of the parameters in the request is not valid.

RbinServiceException
Base exception class for all service exceptions from Rbin service.