Skip to content

Commit

Permalink
feat(client-controltower): Added ResetEnabledControl API.
Browse files Browse the repository at this point in the history
  • Loading branch information
awstools committed Nov 12, 2024
1 parent eeb1195 commit 580cabc
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 6 deletions.
8 changes: 8 additions & 0 deletions clients/client-controltower/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,14 @@ ResetEnabledBaseline

[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/)

</details>
<details>
<summary>
ResetEnabledControl
</summary>

[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/)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-controltower/src/ControlTower.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ import {
ResetEnabledBaselineCommandInput,
ResetEnabledBaselineCommandOutput,
} from "./commands/ResetEnabledBaselineCommand";
import {
ResetEnabledControlCommand,
ResetEnabledControlCommandInput,
ResetEnabledControlCommandOutput,
} from "./commands/ResetEnabledControlCommand";
import {
ResetLandingZoneCommand,
ResetLandingZoneCommandInput,
Expand Down Expand Up @@ -153,6 +158,7 @@ const commands = {
ListLandingZonesCommand,
ListTagsForResourceCommand,
ResetEnabledBaselineCommand,
ResetEnabledControlCommand,
ResetLandingZoneCommand,
TagResourceCommand,
UntagResourceCommand,
Expand Down Expand Up @@ -495,6 +501,23 @@ export interface ControlTower {
cb: (err: any, data?: ResetEnabledBaselineCommandOutput) => void
): void;

/**
* @see {@link ResetEnabledControlCommand}
*/
resetEnabledControl(
args: ResetEnabledControlCommandInput,
options?: __HttpHandlerOptions
): Promise<ResetEnabledControlCommandOutput>;
resetEnabledControl(
args: ResetEnabledControlCommandInput,
cb: (err: any, data?: ResetEnabledControlCommandOutput) => void
): void;
resetEnabledControl(
args: ResetEnabledControlCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ResetEnabledControlCommandOutput) => void
): void;

/**
* @see {@link ResetLandingZoneCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-controltower/src/ControlTowerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ import {
ResetEnabledBaselineCommandInput,
ResetEnabledBaselineCommandOutput,
} from "./commands/ResetEnabledBaselineCommand";
import {
ResetEnabledControlCommandInput,
ResetEnabledControlCommandOutput,
} from "./commands/ResetEnabledControlCommand";
import { ResetLandingZoneCommandInput, ResetLandingZoneCommandOutput } from "./commands/ResetLandingZoneCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
Expand Down Expand Up @@ -149,6 +153,7 @@ export type ServiceInputTypes =
| ListLandingZonesCommandInput
| ListTagsForResourceCommandInput
| ResetEnabledBaselineCommandInput
| ResetEnabledControlCommandInput
| ResetLandingZoneCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
Expand Down Expand Up @@ -181,6 +186,7 @@ export type ServiceOutputTypes =
| ListLandingZonesCommandOutput
| ListTagsForResourceCommandOutput
| ResetEnabledBaselineCommandOutput
| ResetEnabledControlCommandOutput
| ResetLandingZoneCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface GetControlOperationCommandOutput extends GetControlOperationOut
* const response = await client.send(command);
* // { // GetControlOperationOutput
* // controlOperation: { // ControlOperation
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL",
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL" || "RESET_ENABLED_CONTROL",
* // startTime: new Date("TIMESTAMP"),
* // endTime: new Date("TIMESTAMP"),
* // status: "SUCCEEDED" || "FAILED" || "IN_PROGRESS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface ListControlOperationsCommandOutput extends ListControlOperation
* "SUCCEEDED" || "FAILED" || "IN_PROGRESS",
* ],
* controlOperationTypes: [ // ControlOperationTypes
* "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL",
* "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL" || "RESET_ENABLED_CONTROL",
* ],
* },
* nextToken: "STRING_VALUE",
Expand All @@ -61,7 +61,7 @@ export interface ListControlOperationsCommandOutput extends ListControlOperation
* // { // ListControlOperationsOutput
* // controlOperations: [ // ControlOperations // required
* // { // ControlOperationSummary
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL",
* // operationType: "ENABLE_CONTROL" || "DISABLE_CONTROL" || "UPDATE_ENABLED_CONTROL" || "RESET_ENABLED_CONTROL",
* // startTime: new Date("TIMESTAMP"),
* // endTime: new Date("TIMESTAMP"),
* // status: "SUCCEEDED" || "FAILED" || "IN_PROGRESS",
Expand Down
113 changes: 113 additions & 0 deletions clients/client-controltower/src/commands/ResetEnabledControlCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { ControlTowerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ControlTowerClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { ResetEnabledControlInput, ResetEnabledControlOutput } from "../models/models_0";
import { de_ResetEnabledControlCommand, se_ResetEnabledControlCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link ResetEnabledControlCommand}.
*/
export interface ResetEnabledControlCommandInput extends ResetEnabledControlInput {}
/**
* @public
*
* The output of {@link ResetEnabledControlCommand}.
*/
export interface ResetEnabledControlCommandOutput extends ResetEnabledControlOutput, __MetadataBearer {}

/**
* <p>Resets an enabled control.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ControlTowerClient, ResetEnabledControlCommand } from "@aws-sdk/client-controltower"; // ES Modules import
* // const { ControlTowerClient, ResetEnabledControlCommand } = require("@aws-sdk/client-controltower"); // CommonJS import
* const client = new ControlTowerClient(config);
* const input = { // ResetEnabledControlInput
* enabledControlIdentifier: "STRING_VALUE", // required
* };
* const command = new ResetEnabledControlCommand(input);
* const response = await client.send(command);
* // { // ResetEnabledControlOutput
* // operationIdentifier: "STRING_VALUE", // required
* // };
*
* ```
*
* @param ResetEnabledControlCommandInput - {@link ResetEnabledControlCommandInput}
* @returns {@link ResetEnabledControlCommandOutput}
* @see {@link ResetEnabledControlCommandInput} for command's `input` shape.
* @see {@link ResetEnabledControlCommandOutput} for command's `response` shape.
* @see {@link ControlTowerClientResolvedConfig | config} for ControlTowerClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You do not have sufficient access to perform this action.</p>
*
* @throws {@link ConflictException} (client fault)
* <p>Updating or deleting the resource can cause an inconsistent state.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An unexpected error occurred during processing of a request.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The request references a resource that does not exist.</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>The request would cause a service quota to be exceeded. The limit is 10 concurrent operations.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied due to request throttling.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
*
* @throws {@link ControlTowerServiceException}
* <p>Base exception class for all service exceptions from ControlTower service.</p>
*
* @public
*/
export class ResetEnabledControlCommand extends $Command
.classBuilder<
ResetEnabledControlCommandInput,
ResetEnabledControlCommandOutput,
ControlTowerClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep(commonParams)
.m(function (this: any, Command: any, cs: any, config: ControlTowerClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AWSControlTowerApis", "ResetEnabledControl", {})
.n("ControlTowerClient", "ResetEnabledControlCommand")
.f(void 0, void 0)
.ser(se_ResetEnabledControlCommand)
.de(de_ResetEnabledControlCommand)
.build() {
/** @internal type navigation helper, not in runtime. */
protected declare static __types: {
api: {
input: ResetEnabledControlInput;
output: ResetEnabledControlOutput;
};
sdk: {
input: ResetEnabledControlCommandInput;
output: ResetEnabledControlCommandOutput;
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface UpdateEnabledControlCommandOutput extends UpdateEnabledControlO
* Updates the configuration of an already enabled control.</p>
* <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>
* <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>
* <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">
* <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">
* <i>Controls Reference Guide</i>
* </a>.
* </p>
Expand Down
1 change: 1 addition & 0 deletions clients/client-controltower/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export * from "./ListLandingZoneOperationsCommand";
export * from "./ListLandingZonesCommand";
export * from "./ListTagsForResourceCommand";
export * from "./ResetEnabledBaselineCommand";
export * from "./ResetEnabledControlCommand";
export * from "./ResetLandingZoneCommand";
export * from "./TagResourceCommand";
export * from "./UntagResourceCommand";
Expand Down
23 changes: 23 additions & 0 deletions clients/client-controltower/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export interface GetControlOperationInput {
export const ControlOperationType = {
DISABLE_CONTROL: "DISABLE_CONTROL",
ENABLE_CONTROL: "ENABLE_CONTROL",
RESET_ENABLED_CONTROL: "RESET_ENABLED_CONTROL",
UPDATE_ENABLED_CONTROL: "UPDATE_ENABLED_CONTROL",
} as const;

Expand Down Expand Up @@ -1342,6 +1343,28 @@ export interface ListEnabledControlsOutput {
nextToken?: string;
}

/**
* @public
*/
export interface ResetEnabledControlInput {
/**
* <p>The ARN of the enabled control to be reset.</p>
* @public
*/
enabledControlIdentifier: string | undefined;
}

/**
* @public
*/
export interface ResetEnabledControlOutput {
/**
* <p> The operation identifier for this <code>ResetEnabledControl</code> operation. </p>
* @public
*/
operationIdentifier: string | undefined;
}

/**
* @public
*/
Expand Down
47 changes: 47 additions & 0 deletions clients/client-controltower/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ import {
ResetEnabledBaselineCommandInput,
ResetEnabledBaselineCommandOutput,
} from "../commands/ResetEnabledBaselineCommand";
import {
ResetEnabledControlCommandInput,
ResetEnabledControlCommandOutput,
} from "../commands/ResetEnabledControlCommand";
import { ResetLandingZoneCommandInput, ResetLandingZoneCommandOutput } from "../commands/ResetLandingZoneCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "../commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "../commands/UntagResourceCommand";
Expand Down Expand Up @@ -593,6 +597,28 @@ export const se_ResetEnabledBaselineCommand = async (
return b.build();
};

/**
* serializeAws_restJson1ResetEnabledControlCommand
*/
export const se_ResetEnabledControlCommand = async (
input: ResetEnabledControlCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> => {
const b = rb(input, context);
const headers: any = {
"content-type": "application/json",
};
b.bp("/reset-enabled-control");
let body: any;
body = JSON.stringify(
take(input, {
enabledControlIdentifier: [],
})
);
b.m("POST").h(headers).b(body);
return b.build();
};

/**
* serializeAws_restJson1ResetLandingZoneCommand
*/
Expand Down Expand Up @@ -1180,6 +1206,27 @@ export const de_ResetEnabledBaselineCommand = async (
return contents;
};

/**
* deserializeAws_restJson1ResetEnabledControlCommand
*/
export const de_ResetEnabledControlCommand = async (
output: __HttpResponse,
context: __SerdeContext
): Promise<ResetEnabledControlCommandOutput> => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents: any = map({
$metadata: deserializeMetadata(output),
});
const data: Record<string, any> = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
const doc = take(data, {
operationIdentifier: __expectString,
});
Object.assign(contents, doc);
return contents;
};

/**
* deserializeAws_restJson1ResetLandingZoneCommand
*/
Expand Down
Loading

0 comments on commit 580cabc

Please sign in to comment.