diff --git a/clients/client-controlcatalog/README.md b/clients/client-controlcatalog/README.md index 87b61e5028bd..7cc4f6c50412 100644 --- a/clients/client-controlcatalog/README.md +++ b/clients/client-controlcatalog/README.md @@ -230,6 +230,14 @@ see LICENSE for more information. ## Client Commands (Operations List) +
+ +GetControl + + +[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/) + +
ListCommonControls @@ -237,6 +245,14 @@ ListCommonControls [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/) +
+
+ +ListControls + + +[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/) +
diff --git a/clients/client-controlcatalog/src/ControlCatalog.ts b/clients/client-controlcatalog/src/ControlCatalog.ts index 7c549f411441..186809992be1 100644 --- a/clients/client-controlcatalog/src/ControlCatalog.ts +++ b/clients/client-controlcatalog/src/ControlCatalog.ts @@ -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, @@ -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; + 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} */ @@ -40,6 +59,18 @@ export interface ControlCatalog { cb: (err: any, data?: ListCommonControlsCommandOutput) => void ): void; + /** + * @see {@link ListControlsCommand} + */ + listControls(): Promise; + listControls(args: ListControlsCommandInput, options?: __HttpHandlerOptions): Promise; + 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} */ diff --git a/clients/client-controlcatalog/src/ControlCatalogClient.ts b/clients/client-controlcatalog/src/ControlCatalogClient.ts index 70d6d22da73f..fc1b9c4e94b6 100644 --- a/clients/client-controlcatalog/src/ControlCatalogClient.ts +++ b/clients/client-controlcatalog/src/ControlCatalogClient.ts @@ -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 { @@ -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; diff --git a/clients/client-controlcatalog/src/commands/GetControlCommand.ts b/clients/client-controlcatalog/src/commands/GetControlCommand.ts new file mode 100644 index 000000000000..60bcf5046284 --- /dev/null +++ b/clients/client-controlcatalog/src/commands/GetControlCommand.ts @@ -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 {} + +/** + *

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 ControlArn parameter, in ARN form. GetControl accepts controltower or controlcatalog control ARNs as input. Returns a controlcatalog ARN format.

+ *

In the API response, controls that have the value GLOBAL in the Scope field do not show the DeployableRegions field, because it does not apply. Controls that have the value REGIONAL in the Scope field return a value for the DeployableRegions field, as shown in the example.

+ * @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) + *

You do not have sufficient access to perform this action.

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal service error occurred during the processing of your request. Try again later.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The requested resource does not exist.

+ * + * @throws {@link ThrottlingException} (client fault) + *

The request was denied due to request throttling.

+ * + * @throws {@link ValidationException} (client fault) + *

The request has invalid or missing parameters.

+ * + * @throws {@link ControlCatalogServiceException} + *

Base exception class for all service exceptions from ControlCatalog service.

+ * + * @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() {} diff --git a/clients/client-controlcatalog/src/commands/ListControlsCommand.ts b/clients/client-controlcatalog/src/commands/ListControlsCommand.ts new file mode 100644 index 000000000000..a4191e472c78 --- /dev/null +++ b/clients/client-controlcatalog/src/commands/ListControlsCommand.ts @@ -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 {} + +/** + *

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 controlSummary. The ARN is returned in the global controlcatalog format, as shown in the examples.

+ * @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) + *

You do not have sufficient access to perform this action.

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal service error occurred during the processing of your request. Try again later.

+ * + * @throws {@link ThrottlingException} (client fault) + *

The request was denied due to request throttling.

+ * + * @throws {@link ValidationException} (client fault) + *

The request has invalid or missing parameters.

+ * + * @throws {@link ControlCatalogServiceException} + *

Base exception class for all service exceptions from ControlCatalog service.

+ * + * @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() {} diff --git a/clients/client-controlcatalog/src/commands/index.ts b/clients/client-controlcatalog/src/commands/index.ts index b13889c948a2..7d1a04b083a1 100644 --- a/clients/client-controlcatalog/src/commands/index.ts +++ b/clients/client-controlcatalog/src/commands/index.ts @@ -1,4 +1,6 @@ // smithy-typescript generated code +export * from "./GetControlCommand"; export * from "./ListCommonControlsCommand"; +export * from "./ListControlsCommand"; export * from "./ListDomainsCommand"; export * from "./ListObjectivesCommand"; diff --git a/clients/client-controlcatalog/src/models/models_0.ts b/clients/client-controlcatalog/src/models/models_0.ts index e822283978ad..043267e1c3ed 100644 --- a/clients/client-controlcatalog/src/models/models_0.ts +++ b/clients/client-controlcatalog/src/models/models_0.ts @@ -247,6 +247,198 @@ export class ValidationException extends __BaseException { } } +/** + * @public + * @enum + */ +export const ControlBehavior = { + DETECTIVE: "DETECTIVE", + PREVENTIVE: "PREVENTIVE", + PROACTIVE: "PROACTIVE", +} as const; + +/** + * @public + */ +export type ControlBehavior = (typeof ControlBehavior)[keyof typeof ControlBehavior]; + +/** + * @public + */ +export interface GetControlRequest { + /** + *

The Amazon Resource Name (ARN) of the control. It has one of the following formats:

+ *

+ * Global format + *

+ *

+ * arn:\{PARTITION\}:controlcatalog:::control/\{CONTROL_CATALOG_OPAQUE_ID\} + *

+ *

+ * Or Regional format + *

+ *

+ * arn:\{PARTITION\}:controltower:\{REGION\}::control/\{CONTROL_TOWER_OPAQUE_ID\} + *

+ *

Here is a more general pattern that covers Amazon Web Services Control Tower and Control Catalog ARNs:

+ *

+ * ^arn:(aws(?:[-a-z]*)?):(controlcatalog|controltower):[a-zA-Z0-9-]*::control/[0-9a-zA-Z_\\-]+$ + *

+ * @public + */ + ControlArn: string | undefined; +} + +/** + * @public + * @enum + */ +export const ControlScope = { + GLOBAL: "GLOBAL", + REGIONAL: "REGIONAL", +} as const; + +/** + * @public + */ +export type ControlScope = (typeof ControlScope)[keyof typeof ControlScope]; + +/** + *

Returns information about the control, including the scope of the control, if enabled, and the Regions in which the control currently is available for deployment.

+ *

If you are applying controls through an Amazon Web Services Control Tower landing zone environment, remember that the values returned in the RegionConfiguration API operation are not related to the governed Regions in your landing zone. For example, if you are governing Regions A,B,and C while the control is available in Regions A, B, C, and D, you'd see a response with DeployableRegions of A, B, C, and D for a control with REGIONAL scope, even though you may not intend to deploy the control in Region D, because you do not govern it through your landing zone.

+ * @public + */ +export interface RegionConfiguration { + /** + *

The coverage of the control, if deployed. Scope is an enumerated type, with value Regional, or Global. A control with Global scope is effective in all Amazon Web Services Regions, regardless of the Region from which it is enabled, or to which it is deployed. A control implemented by an SCP is usually Global in scope. A control with Regional scope has operations that are restricted specifically to the Region from which it is enabled and to which it is deployed. Controls implemented by Config rules and CloudFormation hooks usually are Regional in scope. Security Hub controls usually are Regional in scope.

+ * @public + */ + Scope: ControlScope | undefined; + + /** + *

Regions in which the control is available to be deployed.

+ * @public + */ + DeployableRegions?: string[]; +} + +/** + * @public + */ +export interface GetControlResponse { + /** + *

The Amazon Resource Name (ARN) of the control.

+ * @public + */ + Arn: string | undefined; + + /** + *

The display name of the control.

+ * @public + */ + Name: string | undefined; + + /** + *

A description of what the control does.

+ * @public + */ + Description: string | undefined; + + /** + *

A term that identifies the control's functional behavior. One of Preventive, Deteictive, Proactive + *

+ * @public + */ + Behavior: ControlBehavior | undefined; + + /** + *

Returns information about the control, including the scope of the control, if enabled, and the Regions in which the control currently is available for deployment.

+ *

If you are applying controls through an Amazon Web Services Control Tower landing zone environment, remember that the values returned in the RegionConfiguration API operation are not related to the governed Regions in your landing zone. For example, if you are governing Regions A,B,and C while the control is available in Regions A, B, C, and D, you'd see a response with DeployableRegions of A, B, C, and D for a control with REGIONAL scope, even though you may not intend to deploy the control in Region D, because you do not govern it through your landing zone.

+ * @public + */ + RegionConfiguration: RegionConfiguration | undefined; +} + +/** + *

The requested resource does not exist.

+ * @public + */ +export class ResourceNotFoundException extends __BaseException { + readonly name: "ResourceNotFoundException" = "ResourceNotFoundException"; + readonly $fault: "client" = "client"; + Message?: string; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ResourceNotFoundException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ResourceNotFoundException.prototype); + this.Message = opts.Message; + } +} + +/** + * @public + */ +export interface ListControlsRequest { + /** + *

The pagination token that's used to fetch the next set of results.

+ * @public + */ + NextToken?: string; + + /** + *

The maximum number of results on a page or for an API request call.

+ * @public + */ + MaxResults?: number; +} + +/** + *

Overview of information about a control.

+ * @public + */ +export interface ControlSummary { + /** + *

The Amazon Resource Name (ARN) of the control.

+ * @public + */ + Arn: string | undefined; + + /** + *

The display name of the control.

+ * @public + */ + Name: string | undefined; + + /** + *

A description of the control, as it may appear in the console. Describes the functionality of the control.

+ * @public + */ + Description: string | undefined; +} + +/** + * @public + */ +export interface ListControlsResponse { + /** + *

Returns a list of controls, given as structures of type controlSummary.

+ * @public + */ + Controls: ControlSummary[] | undefined; + + /** + *

The pagination token that's used to fetch the next set of results.

+ * @public + */ + NextToken?: string; +} + /** * @public */ diff --git a/clients/client-controlcatalog/src/pagination/ListControlsPaginator.ts b/clients/client-controlcatalog/src/pagination/ListControlsPaginator.ts new file mode 100644 index 000000000000..edd7e26c9c8d --- /dev/null +++ b/clients/client-controlcatalog/src/pagination/ListControlsPaginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { + ListControlsCommand, + ListControlsCommandInput, + ListControlsCommandOutput, +} from "../commands/ListControlsCommand"; +import { ControlCatalogClient } from "../ControlCatalogClient"; +import { ControlCatalogPaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateListControls: ( + config: ControlCatalogPaginationConfiguration, + input: ListControlsCommandInput, + ...rest: any[] +) => Paginator = createPaginator< + ControlCatalogPaginationConfiguration, + ListControlsCommandInput, + ListControlsCommandOutput +>(ControlCatalogClient, ListControlsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-controlcatalog/src/pagination/index.ts b/clients/client-controlcatalog/src/pagination/index.ts index ae3b3a3917ca..2cebf576c81e 100644 --- a/clients/client-controlcatalog/src/pagination/index.ts +++ b/clients/client-controlcatalog/src/pagination/index.ts @@ -1,5 +1,6 @@ // smithy-typescript generated code export * from "./Interfaces"; export * from "./ListCommonControlsPaginator"; +export * from "./ListControlsPaginator"; export * from "./ListDomainsPaginator"; export * from "./ListObjectivesPaginator"; diff --git a/clients/client-controlcatalog/src/protocols/Aws_restJson1.ts b/clients/client-controlcatalog/src/protocols/Aws_restJson1.ts index 396daede01d6..c7616806c80c 100644 --- a/clients/client-controlcatalog/src/protocols/Aws_restJson1.ts +++ b/clients/client-controlcatalog/src/protocols/Aws_restJson1.ts @@ -22,7 +22,9 @@ import { SerdeContext as __SerdeContext, } from "@smithy/types"; +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 { ControlCatalogServiceException as __BaseException } from "../models/ControlCatalogServiceException"; @@ -36,10 +38,33 @@ import { ObjectiveFilter, ObjectiveResourceFilter, ObjectiveSummary, + ResourceNotFoundException, ThrottlingException, ValidationException, } from "../models/models_0"; +/** + * serializeAws_restJson1GetControlCommand + */ +export const se_GetControlCommand = async ( + input: GetControlCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/get-control"); + let body: any; + body = JSON.stringify( + take(input, { + ControlArn: [], + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1ListCommonControlsCommand */ @@ -66,6 +91,25 @@ export const se_ListCommonControlsCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1ListControlsCommand + */ +export const se_ListControlsCommand = async ( + input: ListControlsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/list-controls"); + const query: any = map({ + [_nT]: [, input[_NT]!], + [_mR]: [() => input.MaxResults !== void 0, () => input[_MR]!.toString()], + }); + let body: any; + b.m("POST").h(headers).q(query).b(body); + return b.build(); +}; + /** * serializeAws_restJson1ListDomainsCommand */ @@ -111,6 +155,31 @@ export const se_ListObjectivesCommand = async ( return b.build(); }; +/** + * deserializeAws_restJson1GetControlCommand + */ +export const de_GetControlCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + Arn: __expectString, + Behavior: __expectString, + Description: __expectString, + Name: __expectString, + RegionConfiguration: _json, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1ListCommonControlsCommand */ @@ -133,6 +202,28 @@ export const de_ListCommonControlsCommand = async ( return contents; }; +/** + * deserializeAws_restJson1ListControlsCommand + */ +export const de_ListControlsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + Controls: _json, + NextToken: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1ListDomainsCommand */ @@ -193,6 +284,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): case "InternalServerException": case "com.amazonaws.controlcatalog#InternalServerException": throw await de_InternalServerExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.controlcatalog#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); case "ThrottlingException": case "com.amazonaws.controlcatalog#ThrottlingException": throw await de_ThrottlingExceptionRes(parsedOutput, context); @@ -250,6 +344,26 @@ const de_InternalServerExceptionRes = async ( return __decorateServiceException(exception, parsedOutput.body); }; +/** + * deserializeAws_restJson1ResourceNotFoundExceptionRes + */ +const de_ResourceNotFoundExceptionRes = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: any = map({}); + const data: any = parsedOutput.body; + const doc = take(data, { + Message: __expectString, + }); + Object.assign(contents, doc); + const exception = new ResourceNotFoundException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents, + }); + return __decorateServiceException(exception, parsedOutput.body); +}; + /** * deserializeAws_restJson1ThrottlingExceptionRes */ @@ -327,6 +441,12 @@ const de_CommonControlSummaryList = (output: any, context: __SerdeContext): Comm return retVal; }; +// de_Controls omitted. + +// de_ControlSummary omitted. + +// de_DeployableRegions omitted. + /** * deserializeAws_restJson1DomainSummary */ @@ -378,6 +498,8 @@ const de_ObjectiveSummaryList = (output: any, context: __SerdeContext): Objectiv return retVal; }; +// de_RegionConfiguration omitted. + const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ httpStatusCode: output.statusCode, requestId: diff --git a/codegen/sdk-codegen/aws-models/controlcatalog.json b/codegen/sdk-codegen/aws-models/controlcatalog.json index 09bf48d29a10..899bb2a5238c 100644 --- a/codegen/sdk-codegen/aws-models/controlcatalog.json +++ b/codegen/sdk-codegen/aws-models/controlcatalog.json @@ -163,6 +163,39 @@ "target": "com.amazonaws.controlcatalog#CommonControlSummary" } }, + "com.amazonaws.controlcatalog#ControlArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 34, + "max": 2048 + }, + "smithy.api#pattern": "^arn:(aws(?:[-a-z]*)?):(controlcatalog|controltower):[a-zA-Z0-9-]*::control/[0-9a-zA-Z_\\-]+$" + } + }, + "com.amazonaws.controlcatalog#ControlBehavior": { + "type": "enum", + "members": { + "PREVENTIVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PREVENTIVE" + } + }, + "PROACTIVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PROACTIVE" + } + }, + "DETECTIVE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DETECTIVE" + } + } + } + }, "com.amazonaws.controlcatalog#ControlCatalog": { "type": "service", "version": "2018-05-10", @@ -170,6 +203,9 @@ { "target": "com.amazonaws.controlcatalog#CommonControlResource" }, + { + "target": "com.amazonaws.controlcatalog#ControlResource" + }, { "target": "com.amazonaws.controlcatalog#DomainResource" }, @@ -876,6 +912,88 @@ } } }, + "com.amazonaws.controlcatalog#ControlResource": { + "type": "resource", + "identifiers": { + "ControlArn": { + "target": "com.amazonaws.controlcatalog#ControlArn" + } + }, + "read": { + "target": "com.amazonaws.controlcatalog#GetControl" + }, + "list": { + "target": "com.amazonaws.controlcatalog#ListControls" + }, + "traits": { + "aws.api#arn": { + "template": "{ControlArn}", + "absolute": true + }, + "aws.iam#disableConditionKeyInference": {}, + "aws.iam#iamResource": { + "name": "control" + } + } + }, + "com.amazonaws.controlcatalog#ControlScope": { + "type": "enum", + "members": { + "GLOBAL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "GLOBAL" + } + }, + "REGIONAL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "REGIONAL" + } + } + } + }, + "com.amazonaws.controlcatalog#ControlSummary": { + "type": "structure", + "members": { + "Arn": { + "target": "com.amazonaws.controlcatalog#ControlArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the control.

", + "smithy.api#required": {} + } + }, + "Name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The display name of the control.

", + "smithy.api#required": {} + } + }, + "Description": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

A description of the control, as it may appear in the console. Describes the functionality of the control.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Overview of information about a control.

" + } + }, + "com.amazonaws.controlcatalog#Controls": { + "type": "list", + "member": { + "target": "com.amazonaws.controlcatalog#ControlSummary" + } + }, + "com.amazonaws.controlcatalog#DeployableRegions": { + "type": "list", + "member": { + "target": "com.amazonaws.controlcatalog#RegionCode" + } + }, "com.amazonaws.controlcatalog#DomainArn": { "type": "string", "traits": { @@ -977,6 +1095,98 @@ "target": "com.amazonaws.controlcatalog#DomainSummary" } }, + "com.amazonaws.controlcatalog#GetControl": { + "type": "operation", + "input": { + "target": "com.amazonaws.controlcatalog#GetControlRequest" + }, + "output": { + "target": "com.amazonaws.controlcatalog#GetControlResponse" + }, + "errors": [ + { + "target": "com.amazonaws.controlcatalog#AccessDeniedException" + }, + { + "target": "com.amazonaws.controlcatalog#InternalServerException" + }, + { + "target": "com.amazonaws.controlcatalog#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.controlcatalog#ThrottlingException" + }, + { + "target": "com.amazonaws.controlcatalog#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

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 ControlArn parameter, in ARN form. GetControl accepts controltower or controlcatalog control ARNs as input. Returns a controlcatalog ARN format.

\n

In the API response, controls that have the value GLOBAL in the Scope field do not show the DeployableRegions field, because it does not apply. Controls that have the value REGIONAL in the Scope field return a value for the DeployableRegions field, as shown in the example.

", + "smithy.api#http": { + "code": 200, + "method": "POST", + "uri": "/get-control" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.controlcatalog#GetControlRequest": { + "type": "structure", + "members": { + "ControlArn": { + "target": "com.amazonaws.controlcatalog#ControlArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the control. It has one of the following formats:

\n

\n Global format\n

\n

\n arn:{PARTITION}:controlcatalog:::control/{CONTROL_CATALOG_OPAQUE_ID}\n

\n

\n Or Regional format\n

\n

\n arn:{PARTITION}:controltower:{REGION}::control/{CONTROL_TOWER_OPAQUE_ID}\n

\n

Here is a more general pattern that covers Amazon Web Services Control Tower and Control Catalog ARNs:

\n

\n ^arn:(aws(?:[-a-z]*)?):(controlcatalog|controltower):[a-zA-Z0-9-]*::control/[0-9a-zA-Z_\\\\-]+$\n

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.controlcatalog#GetControlResponse": { + "type": "structure", + "members": { + "Arn": { + "target": "com.amazonaws.controlcatalog#ControlArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the control.

", + "smithy.api#required": {} + } + }, + "Name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The display name of the control.

", + "smithy.api#required": {} + } + }, + "Description": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

A description of what the control does.

", + "smithy.api#required": {} + } + }, + "Behavior": { + "target": "com.amazonaws.controlcatalog#ControlBehavior", + "traits": { + "smithy.api#documentation": "

A term that identifies the control's functional behavior. One of Preventive, Deteictive, Proactive\n

", + "smithy.api#required": {} + } + }, + "RegionConfiguration": { + "target": "com.amazonaws.controlcatalog#RegionConfiguration", + "traits": { + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.controlcatalog#InternalServerException": { "type": "structure", "members": { @@ -1078,6 +1288,87 @@ "smithy.api#output": {} } }, + "com.amazonaws.controlcatalog#ListControls": { + "type": "operation", + "input": { + "target": "com.amazonaws.controlcatalog#ListControlsRequest" + }, + "output": { + "target": "com.amazonaws.controlcatalog#ListControlsResponse" + }, + "errors": [ + { + "target": "com.amazonaws.controlcatalog#AccessDeniedException" + }, + { + "target": "com.amazonaws.controlcatalog#InternalServerException" + }, + { + "target": "com.amazonaws.controlcatalog#ThrottlingException" + }, + { + "target": "com.amazonaws.controlcatalog#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

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 controlSummary. The ARN is returned in the global controlcatalog format, as shown in the examples.

", + "smithy.api#http": { + "code": 200, + "method": "POST", + "uri": "/list-controls" + }, + "smithy.api#paginated": { + "inputToken": "NextToken", + "outputToken": "NextToken", + "pageSize": "MaxResults", + "items": "Controls" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.controlcatalog#ListControlsRequest": { + "type": "structure", + "members": { + "NextToken": { + "target": "com.amazonaws.controlcatalog#PaginationToken", + "traits": { + "smithy.api#documentation": "

The pagination token that's used to fetch the next set of results.

", + "smithy.api#httpQuery": "nextToken" + } + }, + "MaxResults": { + "target": "com.amazonaws.controlcatalog#MaxListControlsResults", + "traits": { + "smithy.api#documentation": "

The maximum number of results on a page or for an API request call.

", + "smithy.api#httpQuery": "maxResults" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.controlcatalog#ListControlsResponse": { + "type": "structure", + "members": { + "Controls": { + "target": "com.amazonaws.controlcatalog#Controls", + "traits": { + "smithy.api#documentation": "

Returns a list of controls, given as structures of type controlSummary.

", + "smithy.api#required": {} + } + }, + "NextToken": { + "target": "com.amazonaws.controlcatalog#PaginationToken", + "traits": { + "smithy.api#documentation": "

The pagination token that's used to fetch the next set of results.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.controlcatalog#ListDomains": { "type": "operation", "input": { @@ -1255,6 +1546,15 @@ } } }, + "com.amazonaws.controlcatalog#MaxListControlsResults": { + "type": "integer", + "traits": { + "smithy.api#range": { + "min": 1, + "max": 100 + } + } + }, "com.amazonaws.controlcatalog#MaxListDomainsResults": { "type": "integer", "traits": { @@ -1403,6 +1703,46 @@ } } }, + "com.amazonaws.controlcatalog#RegionCode": { + "type": "string", + "traits": { + "smithy.api#pattern": "^[a-zA-Z0-9-]{1,128}$" + } + }, + "com.amazonaws.controlcatalog#RegionConfiguration": { + "type": "structure", + "members": { + "Scope": { + "target": "com.amazonaws.controlcatalog#ControlScope", + "traits": { + "smithy.api#documentation": "

The coverage of the control, if deployed. Scope is an enumerated type, with value Regional, or Global. A control with Global scope is effective in all Amazon Web Services Regions, regardless of the Region from which it is enabled, or to which it is deployed. A control implemented by an SCP is usually Global in scope. A control with Regional scope has operations that are restricted specifically to the Region from which it is enabled and to which it is deployed. Controls implemented by Config rules and CloudFormation hooks usually are Regional in scope. Security Hub controls usually are Regional in scope.

", + "smithy.api#required": {} + } + }, + "DeployableRegions": { + "target": "com.amazonaws.controlcatalog#DeployableRegions", + "traits": { + "smithy.api#documentation": "

Regions in which the control is available to be deployed.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Returns information about the control, including the scope of the control, if enabled, and the Regions in which the control currently is available for deployment.

\n

If you are applying controls through an Amazon Web Services Control Tower landing zone environment, remember that the values returned in the RegionConfiguration API operation are not related to the governed Regions in your landing zone. For example, if you are governing Regions A,B,and C while the control is available in Regions A, B, C, and D, you'd see a response with DeployableRegions of A, B, C, and D for a control with REGIONAL scope, even though you may not intend to deploy the control in Region D, because you do not govern it through your landing zone.

" + } + }, + "com.amazonaws.controlcatalog#ResourceNotFoundException": { + "type": "structure", + "members": { + "Message": { + "target": "smithy.api#String" + } + }, + "traits": { + "smithy.api#documentation": "

The requested resource does not exist.

", + "smithy.api#error": "client", + "smithy.api#httpError": 404 + } + }, "com.amazonaws.controlcatalog#ThrottlingException": { "type": "structure", "members": {