Skip to content

Commit 580cabc

Browse files
author
awstools
committed
feat(client-controltower): Added ResetEnabledControl API.
1 parent eeb1195 commit 580cabc

11 files changed

+308
-6
lines changed

clients/client-controltower/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,14 @@ ResetEnabledBaseline
754754

755755
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/controltower/command/ResetEnabledBaselineCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controltower/Interface/ResetEnabledBaselineCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controltower/Interface/ResetEnabledBaselineCommandOutput/)
756756

757+
</details>
758+
<details>
759+
<summary>
760+
ResetEnabledControl
761+
</summary>
762+
763+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/controltower/command/ResetEnabledControlCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controltower/Interface/ResetEnabledControlCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controltower/Interface/ResetEnabledControlCommandOutput/)
764+
757765
</details>
758766
<details>
759767
<summary>

clients/client-controltower/src/ControlTower.ts

+23
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ import {
103103
ResetEnabledBaselineCommandInput,
104104
ResetEnabledBaselineCommandOutput,
105105
} from "./commands/ResetEnabledBaselineCommand";
106+
import {
107+
ResetEnabledControlCommand,
108+
ResetEnabledControlCommandInput,
109+
ResetEnabledControlCommandOutput,
110+
} from "./commands/ResetEnabledControlCommand";
106111
import {
107112
ResetLandingZoneCommand,
108113
ResetLandingZoneCommandInput,
@@ -153,6 +158,7 @@ const commands = {
153158
ListLandingZonesCommand,
154159
ListTagsForResourceCommand,
155160
ResetEnabledBaselineCommand,
161+
ResetEnabledControlCommand,
156162
ResetLandingZoneCommand,
157163
TagResourceCommand,
158164
UntagResourceCommand,
@@ -495,6 +501,23 @@ export interface ControlTower {
495501
cb: (err: any, data?: ResetEnabledBaselineCommandOutput) => void
496502
): void;
497503

504+
/**
505+
* @see {@link ResetEnabledControlCommand}
506+
*/
507+
resetEnabledControl(
508+
args: ResetEnabledControlCommandInput,
509+
options?: __HttpHandlerOptions
510+
): Promise<ResetEnabledControlCommandOutput>;
511+
resetEnabledControl(
512+
args: ResetEnabledControlCommandInput,
513+
cb: (err: any, data?: ResetEnabledControlCommandOutput) => void
514+
): void;
515+
resetEnabledControl(
516+
args: ResetEnabledControlCommandInput,
517+
options: __HttpHandlerOptions,
518+
cb: (err: any, data?: ResetEnabledControlCommandOutput) => void
519+
): void;
520+
498521
/**
499522
* @see {@link ResetLandingZoneCommand}
500523
*/

clients/client-controltower/src/ControlTowerClient.ts

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ import {
101101
ResetEnabledBaselineCommandInput,
102102
ResetEnabledBaselineCommandOutput,
103103
} from "./commands/ResetEnabledBaselineCommand";
104+
import {
105+
ResetEnabledControlCommandInput,
106+
ResetEnabledControlCommandOutput,
107+
} from "./commands/ResetEnabledControlCommand";
104108
import { ResetLandingZoneCommandInput, ResetLandingZoneCommandOutput } from "./commands/ResetLandingZoneCommand";
105109
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
106110
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
@@ -149,6 +153,7 @@ export type ServiceInputTypes =
149153
| ListLandingZonesCommandInput
150154
| ListTagsForResourceCommandInput
151155
| ResetEnabledBaselineCommandInput
156+
| ResetEnabledControlCommandInput
152157
| ResetLandingZoneCommandInput
153158
| TagResourceCommandInput
154159
| UntagResourceCommandInput
@@ -181,6 +186,7 @@ export type ServiceOutputTypes =
181186
| ListLandingZonesCommandOutput
182187
| ListTagsForResourceCommandOutput
183188
| ResetEnabledBaselineCommandOutput
189+
| ResetEnabledControlCommandOutput
184190
| ResetLandingZoneCommandOutput
185191
| TagResourceCommandOutput
186192
| UntagResourceCommandOutput

clients/client-controltower/src/commands/GetControlOperationCommand.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface GetControlOperationCommandOutput extends GetControlOperationOut
4646
* const response = await client.send(command);
4747
* // { // GetControlOperationOutput
4848
* // controlOperation: { // ControlOperation
49-
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL",
49+
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL" || "RESET_ENABLED_CONTROL",
5050
* // startTime: new Date("TIMESTAMP"),
5151
* // endTime: new Date("TIMESTAMP"),
5252
* // status: "SUCCEEDED" || "FAILED" || "IN_PROGRESS",

clients/client-controltower/src/commands/ListControlOperationsCommand.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export interface ListControlOperationsCommandOutput extends ListControlOperation
5050
* "SUCCEEDED" || "FAILED" || "IN_PROGRESS",
5151
* ],
5252
* controlOperationTypes: [ // ControlOperationTypes
53-
* "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL",
53+
* "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL" || "RESET_ENABLED_CONTROL",
5454
* ],
5555
* },
5656
* nextToken: "STRING_VALUE",
@@ -61,7 +61,7 @@ export interface ListControlOperationsCommandOutput extends ListControlOperation
6161
* // { // ListControlOperationsOutput
6262
* // controlOperations: [ // ControlOperations // required
6363
* // { // ControlOperationSummary
64-
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL",
64+
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL" || "RESET_ENABLED_CONTROL",
6565
* // startTime: new Date("TIMESTAMP"),
6666
* // endTime: new Date("TIMESTAMP"),
6767
* // status: "SUCCEEDED" || "FAILED" || "IN_PROGRESS",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { ControlTowerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ControlTowerClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { ResetEnabledControlInput, ResetEnabledControlOutput } from "../models/models_0";
10+
import { de_ResetEnabledControlCommand, se_ResetEnabledControlCommand } from "../protocols/Aws_restJson1";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link ResetEnabledControlCommand}.
21+
*/
22+
export interface ResetEnabledControlCommandInput extends ResetEnabledControlInput {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link ResetEnabledControlCommand}.
27+
*/
28+
export interface ResetEnabledControlCommandOutput extends ResetEnabledControlOutput, __MetadataBearer {}
29+
30+
/**
31+
* <p>Resets an enabled control.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { ControlTowerClient, ResetEnabledControlCommand } from "@aws-sdk/client-controltower"; // ES Modules import
36+
* // const { ControlTowerClient, ResetEnabledControlCommand } = require("@aws-sdk/client-controltower"); // CommonJS import
37+
* const client = new ControlTowerClient(config);
38+
* const input = { // ResetEnabledControlInput
39+
* enabledControlIdentifier: "STRING_VALUE", // required
40+
* };
41+
* const command = new ResetEnabledControlCommand(input);
42+
* const response = await client.send(command);
43+
* // { // ResetEnabledControlOutput
44+
* // operationIdentifier: "STRING_VALUE", // required
45+
* // };
46+
*
47+
* ```
48+
*
49+
* @param ResetEnabledControlCommandInput - {@link ResetEnabledControlCommandInput}
50+
* @returns {@link ResetEnabledControlCommandOutput}
51+
* @see {@link ResetEnabledControlCommandInput} for command's `input` shape.
52+
* @see {@link ResetEnabledControlCommandOutput} for command's `response` shape.
53+
* @see {@link ControlTowerClientResolvedConfig | config} for ControlTowerClient's `config` shape.
54+
*
55+
* @throws {@link AccessDeniedException} (client fault)
56+
* <p>You do not have sufficient access to perform this action.</p>
57+
*
58+
* @throws {@link ConflictException} (client fault)
59+
* <p>Updating or deleting the resource can cause an inconsistent state.</p>
60+
*
61+
* @throws {@link InternalServerException} (server fault)
62+
* <p>An unexpected error occurred during processing of a request.</p>
63+
*
64+
* @throws {@link ResourceNotFoundException} (client fault)
65+
* <p>The request references a resource that does not exist.</p>
66+
*
67+
* @throws {@link ServiceQuotaExceededException} (client fault)
68+
* <p>The request would cause a service quota to be exceeded. The limit is 10 concurrent operations.</p>
69+
*
70+
* @throws {@link ThrottlingException} (client fault)
71+
* <p>The request was denied due to request throttling.</p>
72+
*
73+
* @throws {@link ValidationException} (client fault)
74+
* <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
75+
*
76+
* @throws {@link ControlTowerServiceException}
77+
* <p>Base exception class for all service exceptions from ControlTower service.</p>
78+
*
79+
* @public
80+
*/
81+
export class ResetEnabledControlCommand extends $Command
82+
.classBuilder<
83+
ResetEnabledControlCommandInput,
84+
ResetEnabledControlCommandOutput,
85+
ControlTowerClientResolvedConfig,
86+
ServiceInputTypes,
87+
ServiceOutputTypes
88+
>()
89+
.ep(commonParams)
90+
.m(function (this: any, Command: any, cs: any, config: ControlTowerClientResolvedConfig, o: any) {
91+
return [
92+
getSerdePlugin(config, this.serialize, this.deserialize),
93+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
94+
];
95+
})
96+
.s("AWSControlTowerApis", "ResetEnabledControl", {})
97+
.n("ControlTowerClient", "ResetEnabledControlCommand")
98+
.f(void 0, void 0)
99+
.ser(se_ResetEnabledControlCommand)
100+
.de(de_ResetEnabledControlCommand)
101+
.build() {
102+
/** @internal type navigation helper, not in runtime. */
103+
protected declare static __types: {
104+
api: {
105+
input: ResetEnabledControlInput;
106+
output: ResetEnabledControlOutput;
107+
};
108+
sdk: {
109+
input: ResetEnabledControlCommandInput;
110+
output: ResetEnabledControlCommandOutput;
111+
};
112+
};
113+
}

clients/client-controltower/src/commands/UpdateEnabledControlCommand.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface UpdateEnabledControlCommandOutput extends UpdateEnabledControlO
3232
* Updates the configuration of an already enabled control.</p>
3333
* <p>If the enabled control shows an <code>EnablementStatus</code> of SUCCEEDED, supply parameters that are different from the currently configured parameters. Otherwise, Amazon Web Services Control Tower will not accept the request.</p>
3434
* <p>If the enabled control shows an <code>EnablementStatus</code> of FAILED, Amazon Web Services Control Tower updates the control to match any valid parameters that you supply.</p>
35-
* <p>If the <code>DriftSummary</code> status for the control shows as DRIFTED, you cannot call this API. Instead, you can update the control by calling <code>DisableControl</code> and again calling <code>EnableControl</code>, or you can run an extending governance operation. For usage examples, see the <a href="https://docs.aws.amazon.com/controltower/latest/controlreference/control-api-examples-short.html">
35+
* <p>If the <code>DriftSummary</code> status for the control shows as <code>DRIFTED</code>, you cannot call this API. Instead, you can update the control by calling the <code>ResetEnabledControl</code> API. Alternatively, you can call <code>DisableControl</code> and then call <code>EnableControl</code> again. Also, you can run an extending governance operation to repair drift. For usage examples, see the <a href="https://docs.aws.amazon.com/controltower/latest/controlreference/control-api-examples-short.html">
3636
* <i>Controls Reference Guide</i>
3737
* </a>.
3838
* </p>

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

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export * from "./ListLandingZoneOperationsCommand";
2020
export * from "./ListLandingZonesCommand";
2121
export * from "./ListTagsForResourceCommand";
2222
export * from "./ResetEnabledBaselineCommand";
23+
export * from "./ResetEnabledControlCommand";
2324
export * from "./ResetLandingZoneCommand";
2425
export * from "./TagResourceCommand";
2526
export * from "./UntagResourceCommand";

clients/client-controltower/src/models/models_0.ts

+23
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ export interface GetControlOperationInput {
336336
export const ControlOperationType = {
337337
DISABLE_CONTROL: "DISABLE_CONTROL",
338338
ENABLE_CONTROL: "ENABLE_CONTROL",
339+
RESET_ENABLED_CONTROL: "RESET_ENABLED_CONTROL",
339340
UPDATE_ENABLED_CONTROL: "UPDATE_ENABLED_CONTROL",
340341
} as const;
341342

@@ -1342,6 +1343,28 @@ export interface ListEnabledControlsOutput {
13421343
nextToken?: string;
13431344
}
13441345

1346+
/**
1347+
* @public
1348+
*/
1349+
export interface ResetEnabledControlInput {
1350+
/**
1351+
* <p>The ARN of the enabled control to be reset.</p>
1352+
* @public
1353+
*/
1354+
enabledControlIdentifier: string | undefined;
1355+
}
1356+
1357+
/**
1358+
* @public
1359+
*/
1360+
export interface ResetEnabledControlOutput {
1361+
/**
1362+
* <p> The operation identifier for this <code>ResetEnabledControl</code> operation. </p>
1363+
* @public
1364+
*/
1365+
operationIdentifier: string | undefined;
1366+
}
1367+
13451368
/**
13461369
* @public
13471370
*/

clients/client-controltower/src/protocols/Aws_restJson1.ts

+47
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ import {
7272
ResetEnabledBaselineCommandInput,
7373
ResetEnabledBaselineCommandOutput,
7474
} from "../commands/ResetEnabledBaselineCommand";
75+
import {
76+
ResetEnabledControlCommandInput,
77+
ResetEnabledControlCommandOutput,
78+
} from "../commands/ResetEnabledControlCommand";
7579
import { ResetLandingZoneCommandInput, ResetLandingZoneCommandOutput } from "../commands/ResetLandingZoneCommand";
7680
import { TagResourceCommandInput, TagResourceCommandOutput } from "../commands/TagResourceCommand";
7781
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "../commands/UntagResourceCommand";
@@ -593,6 +597,28 @@ export const se_ResetEnabledBaselineCommand = async (
593597
return b.build();
594598
};
595599

600+
/**
601+
* serializeAws_restJson1ResetEnabledControlCommand
602+
*/
603+
export const se_ResetEnabledControlCommand = async (
604+
input: ResetEnabledControlCommandInput,
605+
context: __SerdeContext
606+
): Promise<__HttpRequest> => {
607+
const b = rb(input, context);
608+
const headers: any = {
609+
"content-type": "application/json",
610+
};
611+
b.bp("/reset-enabled-control");
612+
let body: any;
613+
body = JSON.stringify(
614+
take(input, {
615+
enabledControlIdentifier: [],
616+
})
617+
);
618+
b.m("POST").h(headers).b(body);
619+
return b.build();
620+
};
621+
596622
/**
597623
* serializeAws_restJson1ResetLandingZoneCommand
598624
*/
@@ -1180,6 +1206,27 @@ export const de_ResetEnabledBaselineCommand = async (
11801206
return contents;
11811207
};
11821208

1209+
/**
1210+
* deserializeAws_restJson1ResetEnabledControlCommand
1211+
*/
1212+
export const de_ResetEnabledControlCommand = async (
1213+
output: __HttpResponse,
1214+
context: __SerdeContext
1215+
): Promise<ResetEnabledControlCommandOutput> => {
1216+
if (output.statusCode !== 200 && output.statusCode >= 300) {
1217+
return de_CommandError(output, context);
1218+
}
1219+
const contents: any = map({
1220+
$metadata: deserializeMetadata(output),
1221+
});
1222+
const data: Record<string, any> = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1223+
const doc = take(data, {
1224+
operationIdentifier: __expectString,
1225+
});
1226+
Object.assign(contents, doc);
1227+
return contents;
1228+
};
1229+
11831230
/**
11841231
* deserializeAws_restJson1ResetLandingZoneCommand
11851232
*/

0 commit comments

Comments
 (0)