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.
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 0000000000000..a4191e472c784 --- /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 b13889c948a2d..7d1a04b083a15 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 e822283978adf..043267e1c3edc 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_\\-]+$
+ *
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.
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.
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
+ *
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.
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: __ExceptionOptionTypeThe 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 0000000000000..edd7e26c9c8d1 --- /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[] +) => PaginatorThe 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.
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.
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 Or Regional format\n
\n\n arn:{PARTITION}:controltower:{REGION}::control/{CONTROL_TOWER_OPAQUE_ID}
\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
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
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.
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.
\nIf 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.
The requested resource does not exist.
", + "smithy.api#error": "client", + "smithy.api#httpError": 404 + } + }, "com.amazonaws.controlcatalog#ThrottlingException": { "type": "structure", "members": {