Skip to content

Commit

Permalink
feat(client-controlcatalog): AWS Control Tower provides two new publi…
Browse files Browse the repository at this point in the history
…c APIs controlcatalog:ListControls and controlcatalog:GetControl under controlcatalog service namespace, which enable customers to programmatically retrieve control metadata of available controls.
  • Loading branch information
awstools committed Aug 1, 2024
1 parent 2f7a965 commit c897818
Show file tree
Hide file tree
Showing 11 changed files with 947 additions and 1 deletion.
16 changes: 16 additions & 0 deletions clients/client-controlcatalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,29 @@ see LICENSE for more information.

## Client Commands (Operations List)

<details>
<summary>
GetControl
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/controlcatalog/command/GetControlCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controlcatalog/Interface/GetControlCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controlcatalog/Interface/GetControlCommandOutput/)

</details>
<details>
<summary>
ListCommonControls
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/controlcatalog/command/ListCommonControlsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controlcatalog/Interface/ListCommonControlsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controlcatalog/Interface/ListCommonControlsCommandOutput/)

</details>
<details>
<summary>
ListControls
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/controlcatalog/command/ListControlsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controlcatalog/Interface/ListControlsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-controlcatalog/Interface/ListControlsCommandOutput/)

</details>
<details>
<summary>
Expand Down
31 changes: 31 additions & 0 deletions clients/client-controlcatalog/src/ControlCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
import { createAggregatedClient } from "@smithy/smithy-client";
import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";

import { GetControlCommand, GetControlCommandInput, GetControlCommandOutput } from "./commands/GetControlCommand";
import {
ListCommonControlsCommand,
ListCommonControlsCommandInput,
ListCommonControlsCommandOutput,
} from "./commands/ListCommonControlsCommand";
import {
ListControlsCommand,
ListControlsCommandInput,
ListControlsCommandOutput,
} from "./commands/ListControlsCommand";
import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "./commands/ListDomainsCommand";
import {
ListObjectivesCommand,
Expand All @@ -16,12 +22,25 @@ import {
import { ControlCatalogClient, ControlCatalogClientConfig } from "./ControlCatalogClient";

const commands = {
GetControlCommand,
ListCommonControlsCommand,
ListControlsCommand,
ListDomainsCommand,
ListObjectivesCommand,
};

export interface ControlCatalog {
/**
* @see {@link GetControlCommand}
*/
getControl(args: GetControlCommandInput, options?: __HttpHandlerOptions): Promise<GetControlCommandOutput>;
getControl(args: GetControlCommandInput, cb: (err: any, data?: GetControlCommandOutput) => void): void;
getControl(
args: GetControlCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetControlCommandOutput) => void
): void;

/**
* @see {@link ListCommonControlsCommand}
*/
Expand All @@ -40,6 +59,18 @@ export interface ControlCatalog {
cb: (err: any, data?: ListCommonControlsCommandOutput) => void
): void;

/**
* @see {@link ListControlsCommand}
*/
listControls(): Promise<ListControlsCommandOutput>;
listControls(args: ListControlsCommandInput, options?: __HttpHandlerOptions): Promise<ListControlsCommandOutput>;
listControls(args: ListControlsCommandInput, cb: (err: any, data?: ListControlsCommandOutput) => void): void;
listControls(
args: ListControlsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListControlsCommandOutput) => void
): void;

/**
* @see {@link ListDomainsCommand}
*/
Expand Down
11 changes: 10 additions & 1 deletion clients/client-controlcatalog/src/ControlCatalogClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ import {
HttpAuthSchemeResolvedConfig,
resolveHttpAuthSchemeConfig,
} from "./auth/httpAuthSchemeProvider";
import { GetControlCommandInput, GetControlCommandOutput } from "./commands/GetControlCommand";
import { ListCommonControlsCommandInput, ListCommonControlsCommandOutput } from "./commands/ListCommonControlsCommand";
import { ListControlsCommandInput, ListControlsCommandOutput } from "./commands/ListControlsCommand";
import { ListDomainsCommandInput, ListDomainsCommandOutput } from "./commands/ListDomainsCommand";
import { ListObjectivesCommandInput, ListObjectivesCommandOutput } from "./commands/ListObjectivesCommand";
import {
Expand All @@ -70,13 +72,20 @@ export { __Client };
/**
* @public
*/
export type ServiceInputTypes = ListCommonControlsCommandInput | ListDomainsCommandInput | ListObjectivesCommandInput;
export type ServiceInputTypes =
| GetControlCommandInput
| ListCommonControlsCommandInput
| ListControlsCommandInput
| ListDomainsCommandInput
| ListObjectivesCommandInput;

/**
* @public
*/
export type ServiceOutputTypes =
| GetControlCommandOutput
| ListCommonControlsCommandOutput
| ListControlsCommandOutput
| ListDomainsCommandOutput
| ListObjectivesCommandOutput;

Expand Down
107 changes: 107 additions & 0 deletions clients/client-controlcatalog/src/commands/GetControlCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// 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 { ControlCatalogClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ControlCatalogClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { GetControlRequest, GetControlResponse } from "../models/models_0";
import { de_GetControlCommand, se_GetControlCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link GetControlCommand}.
*/
export interface GetControlCommandInput extends GetControlRequest {}
/**
* @public
*
* The output of {@link GetControlCommand}.
*/
export interface GetControlCommandOutput extends GetControlResponse, __MetadataBearer {}

/**
* <p>Returns details about a specific control, most notably a list of Amazon Web Services Regions where this control is supported. Input a value for the <i>ControlArn</i> parameter, in ARN form. <code>GetControl</code> accepts <i>controltower</i> or <i>controlcatalog</i> control ARNs as input. Returns a <i>controlcatalog</i> ARN format.</p>
* <p>In the API response, controls that have the value <code>GLOBAL</code> in the <code>Scope</code> field do not show the <code>DeployableRegions</code> field, because it does not apply. Controls that have the value <code>REGIONAL</code> in the <code>Scope</code> field return a value for the <code>DeployableRegions</code> field, as shown in the example.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ControlCatalogClient, GetControlCommand } from "@aws-sdk/client-controlcatalog"; // ES Modules import
* // const { ControlCatalogClient, GetControlCommand } = require("@aws-sdk/client-controlcatalog"); // CommonJS import
* const client = new ControlCatalogClient(config);
* const input = { // GetControlRequest
* ControlArn: "STRING_VALUE", // required
* };
* const command = new GetControlCommand(input);
* const response = await client.send(command);
* // { // GetControlResponse
* // Arn: "STRING_VALUE", // required
* // Name: "STRING_VALUE", // required
* // Description: "STRING_VALUE", // required
* // Behavior: "PREVENTIVE" || "PROACTIVE" || "DETECTIVE", // required
* // RegionConfiguration: { // RegionConfiguration
* // Scope: "GLOBAL" || "REGIONAL", // required
* // DeployableRegions: [ // DeployableRegions
* // "STRING_VALUE",
* // ],
* // },
* // };
*
* ```
*
* @param GetControlCommandInput - {@link GetControlCommandInput}
* @returns {@link GetControlCommandOutput}
* @see {@link GetControlCommandInput} for command's `input` shape.
* @see {@link GetControlCommandOutput} for command's `response` shape.
* @see {@link ControlCatalogClientResolvedConfig | config} for ControlCatalogClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You do not have sufficient access to perform this action.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal service error occurred during the processing of your request. Try again later.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The requested resource does not exist.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied due to request throttling.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The request has invalid or missing parameters.</p>
*
* @throws {@link ControlCatalogServiceException}
* <p>Base exception class for all service exceptions from ControlCatalog service.</p>
*
* @public
*/
export class GetControlCommand extends $Command
.classBuilder<
GetControlCommandInput,
GetControlCommandOutput,
ControlCatalogClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: ControlCatalogClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("ControlCatalog", "GetControl", {})
.n("ControlCatalogClient", "GetControlCommand")
.f(void 0, void 0)
.ser(se_GetControlCommand)
.de(de_GetControlCommand)
.build() {}
102 changes: 102 additions & 0 deletions clients/client-controlcatalog/src/commands/ListControlsCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// 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 { ControlCatalogClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ControlCatalogClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { ListControlsRequest, ListControlsResponse } from "../models/models_0";
import { de_ListControlsCommand, se_ListControlsCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link ListControlsCommand}.
*/
export interface ListControlsCommandInput extends ListControlsRequest {}
/**
* @public
*
* The output of {@link ListControlsCommand}.
*/
export interface ListControlsCommandOutput extends ListControlsResponse, __MetadataBearer {}

/**
* <p>Returns a paginated list of all available controls in the Amazon Web Services Control Catalog library. Allows you to discover available controls. The list of controls is given as structures of type <i>controlSummary</i>. The ARN is returned in the global <i>controlcatalog</i> format, as shown in the examples.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ControlCatalogClient, ListControlsCommand } from "@aws-sdk/client-controlcatalog"; // ES Modules import
* // const { ControlCatalogClient, ListControlsCommand } = require("@aws-sdk/client-controlcatalog"); // CommonJS import
* const client = new ControlCatalogClient(config);
* const input = { // ListControlsRequest
* NextToken: "STRING_VALUE",
* MaxResults: Number("int"),
* };
* const command = new ListControlsCommand(input);
* const response = await client.send(command);
* // { // ListControlsResponse
* // Controls: [ // Controls // required
* // { // ControlSummary
* // Arn: "STRING_VALUE", // required
* // Name: "STRING_VALUE", // required
* // Description: "STRING_VALUE", // required
* // },
* // ],
* // NextToken: "STRING_VALUE",
* // };
*
* ```
*
* @param ListControlsCommandInput - {@link ListControlsCommandInput}
* @returns {@link ListControlsCommandOutput}
* @see {@link ListControlsCommandInput} for command's `input` shape.
* @see {@link ListControlsCommandOutput} for command's `response` shape.
* @see {@link ControlCatalogClientResolvedConfig | config} for ControlCatalogClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You do not have sufficient access to perform this action.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal service error occurred during the processing of your request. Try again later.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied due to request throttling.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The request has invalid or missing parameters.</p>
*
* @throws {@link ControlCatalogServiceException}
* <p>Base exception class for all service exceptions from ControlCatalog service.</p>
*
* @public
*/
export class ListControlsCommand extends $Command
.classBuilder<
ListControlsCommandInput,
ListControlsCommandOutput,
ControlCatalogClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: ControlCatalogClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("ControlCatalog", "ListControls", {})
.n("ControlCatalogClient", "ListControlsCommand")
.f(void 0, void 0)
.ser(se_ListControlsCommand)
.de(de_ListControlsCommand)
.build() {}
2 changes: 2 additions & 0 deletions clients/client-controlcatalog/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// smithy-typescript generated code
export * from "./GetControlCommand";
export * from "./ListCommonControlsCommand";
export * from "./ListControlsCommand";
export * from "./ListDomainsCommand";
export * from "./ListObjectivesCommand";
Loading

0 comments on commit c897818

Please sign in to comment.