Skip to content

Commit cf212da

Browse files
author
awstools
committed
feat(client-rbin): This release adds support for Rule Lock for Recycle Bin, which allows you to lock retention rules so that they can no longer be modified or deleted.
1 parent b6cf732 commit cf212da

File tree

11 files changed

+1690
-312
lines changed

11 files changed

+1690
-312
lines changed

clients/client-rbin/src/Rbin.ts

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import {
1010
ListTagsForResourceCommandInput,
1111
ListTagsForResourceCommandOutput,
1212
} from "./commands/ListTagsForResourceCommand";
13+
import { LockRuleCommand, LockRuleCommandInput, LockRuleCommandOutput } from "./commands/LockRuleCommand";
1314
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
15+
import { UnlockRuleCommand, UnlockRuleCommandInput, UnlockRuleCommandOutput } from "./commands/UnlockRuleCommand";
1416
import {
1517
UntagResourceCommand,
1618
UntagResourceCommandInput,
@@ -174,6 +176,32 @@ export class Rbin extends RbinClient {
174176
}
175177
}
176178

179+
/**
180+
* <p>Locks a retention rule. A locked retention rule can't be modified or deleted.</p>
181+
*/
182+
public lockRule(args: LockRuleCommandInput, options?: __HttpHandlerOptions): Promise<LockRuleCommandOutput>;
183+
public lockRule(args: LockRuleCommandInput, cb: (err: any, data?: LockRuleCommandOutput) => void): void;
184+
public lockRule(
185+
args: LockRuleCommandInput,
186+
options: __HttpHandlerOptions,
187+
cb: (err: any, data?: LockRuleCommandOutput) => void
188+
): void;
189+
public lockRule(
190+
args: LockRuleCommandInput,
191+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: LockRuleCommandOutput) => void),
192+
cb?: (err: any, data?: LockRuleCommandOutput) => void
193+
): Promise<LockRuleCommandOutput> | void {
194+
const command = new LockRuleCommand(args);
195+
if (typeof optionsOrCb === "function") {
196+
this.send(command, optionsOrCb);
197+
} else if (typeof cb === "function") {
198+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
199+
this.send(command, optionsOrCb || {}, cb);
200+
} else {
201+
return this.send(command, optionsOrCb);
202+
}
203+
}
204+
177205
/**
178206
* <p>Assigns tags to the specified retention rule.</p>
179207
*/
@@ -200,6 +228,33 @@ export class Rbin extends RbinClient {
200228
}
201229
}
202230

231+
/**
232+
* <p>Unlocks a retention rule. After a retention rule is unlocked, it can be modified or deleted
233+
* only after the unlock delay period expires.</p>
234+
*/
235+
public unlockRule(args: UnlockRuleCommandInput, options?: __HttpHandlerOptions): Promise<UnlockRuleCommandOutput>;
236+
public unlockRule(args: UnlockRuleCommandInput, cb: (err: any, data?: UnlockRuleCommandOutput) => void): void;
237+
public unlockRule(
238+
args: UnlockRuleCommandInput,
239+
options: __HttpHandlerOptions,
240+
cb: (err: any, data?: UnlockRuleCommandOutput) => void
241+
): void;
242+
public unlockRule(
243+
args: UnlockRuleCommandInput,
244+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UnlockRuleCommandOutput) => void),
245+
cb?: (err: any, data?: UnlockRuleCommandOutput) => void
246+
): Promise<UnlockRuleCommandOutput> | void {
247+
const command = new UnlockRuleCommand(args);
248+
if (typeof optionsOrCb === "function") {
249+
this.send(command, optionsOrCb);
250+
} else if (typeof cb === "function") {
251+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
252+
this.send(command, optionsOrCb || {}, cb);
253+
} else {
254+
return this.send(command, optionsOrCb);
255+
}
256+
}
257+
203258
/**
204259
* <p>Unassigns a tag from a retention rule.</p>
205260
*/
@@ -233,7 +288,9 @@ export class Rbin extends RbinClient {
233288
}
234289

235290
/**
236-
* <p>Updates an existing Recycle Bin retention rule. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule">
291+
* <p>Updates an existing Recycle Bin retention rule. You can update a retention rule's description,
292+
* resource tags, and retention period at any time after creation. You can't update a retention rule's
293+
* resource type after creation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule">
237294
* Update Recycle Bin retention rules</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
238295
*/
239296
public updateRule(args: UpdateRuleCommandInput, options?: __HttpHandlerOptions): Promise<UpdateRuleCommandOutput>;

clients/client-rbin/src/RbinClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ import {
5555
ListTagsForResourceCommandInput,
5656
ListTagsForResourceCommandOutput,
5757
} from "./commands/ListTagsForResourceCommand";
58+
import { LockRuleCommandInput, LockRuleCommandOutput } from "./commands/LockRuleCommand";
5859
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
60+
import { UnlockRuleCommandInput, UnlockRuleCommandOutput } from "./commands/UnlockRuleCommand";
5961
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
6062
import { UpdateRuleCommandInput, UpdateRuleCommandOutput } from "./commands/UpdateRuleCommand";
6163
import {
@@ -72,7 +74,9 @@ export type ServiceInputTypes =
7274
| GetRuleCommandInput
7375
| ListRulesCommandInput
7476
| ListTagsForResourceCommandInput
77+
| LockRuleCommandInput
7578
| TagResourceCommandInput
79+
| UnlockRuleCommandInput
7680
| UntagResourceCommandInput
7781
| UpdateRuleCommandInput;
7882

@@ -82,7 +86,9 @@ export type ServiceOutputTypes =
8286
| GetRuleCommandOutput
8387
| ListRulesCommandOutput
8488
| ListTagsForResourceCommandOutput
89+
| LockRuleCommandOutput
8590
| TagResourceCommandOutput
91+
| UnlockRuleCommandOutput
8692
| UntagResourceCommandOutput
8793
| UpdateRuleCommandOutput;
8894

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
3+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
5+
import { Command as $Command } from "@aws-sdk/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
} from "@aws-sdk/types";
15+
16+
import {
17+
LockRuleRequest,
18+
LockRuleRequestFilterSensitiveLog,
19+
LockRuleResponse,
20+
LockRuleResponseFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_restJson1LockRuleCommand,
24+
serializeAws_restJson1LockRuleCommand,
25+
} from "../protocols/Aws_restJson1";
26+
import { RbinClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RbinClient";
27+
28+
export interface LockRuleCommandInput extends LockRuleRequest {}
29+
export interface LockRuleCommandOutput extends LockRuleResponse, __MetadataBearer {}
30+
31+
/**
32+
* <p>Locks a retention rule. A locked retention rule can't be modified or deleted.</p>
33+
* @example
34+
* Use a bare-bones client and the command you need to make an API call.
35+
* ```javascript
36+
* import { RbinClient, LockRuleCommand } from "@aws-sdk/client-rbin"; // ES Modules import
37+
* // const { RbinClient, LockRuleCommand } = require("@aws-sdk/client-rbin"); // CommonJS import
38+
* const client = new RbinClient(config);
39+
* const command = new LockRuleCommand(input);
40+
* const response = await client.send(command);
41+
* ```
42+
*
43+
* @see {@link LockRuleCommandInput} for command's `input` shape.
44+
* @see {@link LockRuleCommandOutput} for command's `response` shape.
45+
* @see {@link RbinClientResolvedConfig | config} for RbinClient's `config` shape.
46+
*
47+
*/
48+
export class LockRuleCommand extends $Command<LockRuleCommandInput, LockRuleCommandOutput, RbinClientResolvedConfig> {
49+
// Start section: command_properties
50+
// End section: command_properties
51+
52+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
53+
return {
54+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
55+
Endpoint: { type: "builtInParams", name: "endpoint" },
56+
Region: { type: "builtInParams", name: "region" },
57+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
58+
};
59+
}
60+
61+
constructor(readonly input: LockRuleCommandInput) {
62+
// Start section: command_constructor
63+
super();
64+
// End section: command_constructor
65+
}
66+
67+
/**
68+
* @internal
69+
*/
70+
resolveMiddleware(
71+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
72+
configuration: RbinClientResolvedConfig,
73+
options?: __HttpHandlerOptions
74+
): Handler<LockRuleCommandInput, LockRuleCommandOutput> {
75+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
76+
this.middlewareStack.use(getEndpointPlugin(configuration, LockRuleCommand.getEndpointParameterInstructions()));
77+
78+
const stack = clientStack.concat(this.middlewareStack);
79+
80+
const { logger } = configuration;
81+
const clientName = "RbinClient";
82+
const commandName = "LockRuleCommand";
83+
const handlerExecutionContext: HandlerExecutionContext = {
84+
logger,
85+
clientName,
86+
commandName,
87+
inputFilterSensitiveLog: LockRuleRequestFilterSensitiveLog,
88+
outputFilterSensitiveLog: LockRuleResponseFilterSensitiveLog,
89+
};
90+
const { requestHandler } = configuration;
91+
return stack.resolve(
92+
(request: FinalizeHandlerArguments<any>) =>
93+
requestHandler.handle(request.request as __HttpRequest, options || {}),
94+
handlerExecutionContext
95+
);
96+
}
97+
98+
private serialize(input: LockRuleCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
99+
return serializeAws_restJson1LockRuleCommand(input, context);
100+
}
101+
102+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<LockRuleCommandOutput> {
103+
return deserializeAws_restJson1LockRuleCommand(output, context);
104+
}
105+
106+
// Start section: command_body_extra
107+
// End section: command_body_extra
108+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
3+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
5+
import { Command as $Command } from "@aws-sdk/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
} from "@aws-sdk/types";
15+
16+
import {
17+
UnlockRuleRequest,
18+
UnlockRuleRequestFilterSensitiveLog,
19+
UnlockRuleResponse,
20+
UnlockRuleResponseFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_restJson1UnlockRuleCommand,
24+
serializeAws_restJson1UnlockRuleCommand,
25+
} from "../protocols/Aws_restJson1";
26+
import { RbinClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RbinClient";
27+
28+
export interface UnlockRuleCommandInput extends UnlockRuleRequest {}
29+
export interface UnlockRuleCommandOutput extends UnlockRuleResponse, __MetadataBearer {}
30+
31+
/**
32+
* <p>Unlocks a retention rule. After a retention rule is unlocked, it can be modified or deleted
33+
* only after the unlock delay period expires.</p>
34+
* @example
35+
* Use a bare-bones client and the command you need to make an API call.
36+
* ```javascript
37+
* import { RbinClient, UnlockRuleCommand } from "@aws-sdk/client-rbin"; // ES Modules import
38+
* // const { RbinClient, UnlockRuleCommand } = require("@aws-sdk/client-rbin"); // CommonJS import
39+
* const client = new RbinClient(config);
40+
* const command = new UnlockRuleCommand(input);
41+
* const response = await client.send(command);
42+
* ```
43+
*
44+
* @see {@link UnlockRuleCommandInput} for command's `input` shape.
45+
* @see {@link UnlockRuleCommandOutput} for command's `response` shape.
46+
* @see {@link RbinClientResolvedConfig | config} for RbinClient's `config` shape.
47+
*
48+
*/
49+
export class UnlockRuleCommand extends $Command<
50+
UnlockRuleCommandInput,
51+
UnlockRuleCommandOutput,
52+
RbinClientResolvedConfig
53+
> {
54+
// Start section: command_properties
55+
// End section: command_properties
56+
57+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
58+
return {
59+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
60+
Endpoint: { type: "builtInParams", name: "endpoint" },
61+
Region: { type: "builtInParams", name: "region" },
62+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
63+
};
64+
}
65+
66+
constructor(readonly input: UnlockRuleCommandInput) {
67+
// Start section: command_constructor
68+
super();
69+
// End section: command_constructor
70+
}
71+
72+
/**
73+
* @internal
74+
*/
75+
resolveMiddleware(
76+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
77+
configuration: RbinClientResolvedConfig,
78+
options?: __HttpHandlerOptions
79+
): Handler<UnlockRuleCommandInput, UnlockRuleCommandOutput> {
80+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
81+
this.middlewareStack.use(getEndpointPlugin(configuration, UnlockRuleCommand.getEndpointParameterInstructions()));
82+
83+
const stack = clientStack.concat(this.middlewareStack);
84+
85+
const { logger } = configuration;
86+
const clientName = "RbinClient";
87+
const commandName = "UnlockRuleCommand";
88+
const handlerExecutionContext: HandlerExecutionContext = {
89+
logger,
90+
clientName,
91+
commandName,
92+
inputFilterSensitiveLog: UnlockRuleRequestFilterSensitiveLog,
93+
outputFilterSensitiveLog: UnlockRuleResponseFilterSensitiveLog,
94+
};
95+
const { requestHandler } = configuration;
96+
return stack.resolve(
97+
(request: FinalizeHandlerArguments<any>) =>
98+
requestHandler.handle(request.request as __HttpRequest, options || {}),
99+
handlerExecutionContext
100+
);
101+
}
102+
103+
private serialize(input: UnlockRuleCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
104+
return serializeAws_restJson1UnlockRuleCommand(input, context);
105+
}
106+
107+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<UnlockRuleCommandOutput> {
108+
return deserializeAws_restJson1UnlockRuleCommand(output, context);
109+
}
110+
111+
// Start section: command_body_extra
112+
// End section: command_body_extra
113+
}

clients/client-rbin/src/commands/UpdateRuleCommand.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export interface UpdateRuleCommandInput extends UpdateRuleRequest {}
2929
export interface UpdateRuleCommandOutput extends UpdateRuleResponse, __MetadataBearer {}
3030

3131
/**
32-
* <p>Updates an existing Recycle Bin retention rule. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule">
32+
* <p>Updates an existing Recycle Bin retention rule. You can update a retention rule's description,
33+
* resource tags, and retention period at any time after creation. You can't update a retention rule's
34+
* resource type after creation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule">
3335
* Update Recycle Bin retention rules</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
3436
* @example
3537
* Use a bare-bones client and the command you need to make an API call.

clients/client-rbin/src/commands/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export * from "./DeleteRuleCommand";
44
export * from "./GetRuleCommand";
55
export * from "./ListRulesCommand";
66
export * from "./ListTagsForResourceCommand";
7+
export * from "./LockRuleCommand";
78
export * from "./TagResourceCommand";
9+
export * from "./UnlockRuleCommand";
810
export * from "./UntagResourceCommand";
911
export * from "./UpdateRuleCommand";

clients/client-rbin/src/endpoint/EndpointParameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const resolveClientEndpointParameters = <T>(
2424
};
2525

2626
export interface EndpointParameters extends __EndpointParameters {
27-
Region?: string;
27+
Region: string;
2828
UseDualStack?: boolean;
2929
UseFIPS?: boolean;
3030
Endpoint?: string;

clients/client-rbin/src/endpoint/ruleset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const ruleSet: RuleSetObject = {
66
parameters: {
77
Region: {
88
builtIn: "AWS::Region",
9-
required: false,
9+
required: true,
1010
documentation: "The AWS region used to dispatch the request.",
1111
type: "String",
1212
},

0 commit comments

Comments
 (0)