Skip to content

Commit da33251

Browse files
author
awstools
committed
feat(client-config-service): Added new APIs GetCustomRulePolicy and GetOrganizationCustomRulePolicy, and updated existing APIs PutConfigRule, DescribeConfigRule, DescribeConfigRuleEvaluationStatus, PutOrganizationConfigRule, DescribeConfigRule to support a new feature for building AWS Config rules with AWS CloudFormation Guard
1 parent c093315 commit da33251

17 files changed

+1271
-320
lines changed

clients/client-config-service/src/ConfigService.ts

Lines changed: 88 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ import {
270270
GetConformancePackComplianceSummaryCommandInput,
271271
GetConformancePackComplianceSummaryCommandOutput,
272272
} from "./commands/GetConformancePackComplianceSummaryCommand";
273+
import {
274+
GetCustomRulePolicyCommand,
275+
GetCustomRulePolicyCommandInput,
276+
GetCustomRulePolicyCommandOutput,
277+
} from "./commands/GetCustomRulePolicyCommand";
273278
import {
274279
GetDiscoveredResourceCountsCommand,
275280
GetDiscoveredResourceCountsCommandInput,
@@ -285,6 +290,11 @@ import {
285290
GetOrganizationConformancePackDetailedStatusCommandInput,
286291
GetOrganizationConformancePackDetailedStatusCommandOutput,
287292
} from "./commands/GetOrganizationConformancePackDetailedStatusCommand";
293+
import {
294+
GetOrganizationCustomRulePolicyCommand,
295+
GetOrganizationCustomRulePolicyCommandInput,
296+
GetOrganizationCustomRulePolicyCommandOutput,
297+
} from "./commands/GetOrganizationCustomRulePolicyCommand";
288298
import {
289299
GetResourceConfigHistoryCommand,
290300
GetResourceConfigHistoryCommandInput,
@@ -800,8 +810,8 @@ export class ConfigService extends ConfigServiceClient {
800810
}
801811

802812
/**
803-
* <p>Deletes the specified organization config rule and all of its evaluation results from all member accounts in that organization. </p>
804-
* <p>Only a master account and a delegated administrator account can delete an organization config rule.
813+
* <p>Deletes the specified organization Config rule and all of its evaluation results from all member accounts in that organization. </p>
814+
* <p>Only a master account and a delegated administrator account can delete an organization Config rule.
805815
* When calling this API with a delegated administrator, you must ensure Organizations
806816
* <code>ListDelegatedAdministrator</code> permissions are added.</p>
807817
* <p>Config sets the state of a rule to DELETE_IN_PROGRESS until the deletion is complete.
@@ -837,7 +847,7 @@ export class ConfigService extends ConfigServiceClient {
837847
}
838848

839849
/**
840-
* <p>Deletes the specified organization conformance pack and all of the config rules and remediation actions from
850+
* <p>Deletes the specified organization conformance pack and all of the Config rules and remediation actions from
841851
* all member accounts in that organization. </p>
842852
* <p> Only a master account or a delegated administrator account can delete an organization conformance pack.
843853
* When calling this API with a delegated administrator, you must ensure Organizations
@@ -1753,12 +1763,12 @@ export class ConfigService extends ConfigServiceClient {
17531763
}
17541764

17551765
/**
1756-
* <p>Returns a list of organization config rules. </p>
1766+
* <p>Returns a list of organization Config rules. </p>
17571767
*
17581768
* <note>
17591769
* <p>When you specify the limit and the next token, you receive a paginated response.
1760-
* Limit and next token are not applicable if you specify organization config rule names.
1761-
* It is only applicable, when you request all the organization config rules.</p>
1770+
* Limit and next token are not applicable if you specify organization Config rule names.
1771+
* It is only applicable, when you request all the organization Config rules.</p>
17621772
* </note>
17631773
*/
17641774
public describeOrganizationConfigRules(
@@ -1791,14 +1801,14 @@ export class ConfigService extends ConfigServiceClient {
17911801
}
17921802

17931803
/**
1794-
* <p>Provides organization config rule deployment status for an organization.</p>
1804+
* <p>Provides organization Config rule deployment status for an organization.</p>
17951805
*
17961806
* <note>
1797-
* <p>The status is not considered successful until organization config rule is successfully deployed in all the member
1807+
* <p>The status is not considered successful until organization Config rule is successfully deployed in all the member
17981808
* accounts with an exception of excluded accounts.</p>
17991809
* <p>When you specify the limit and the next token, you receive a paginated response.
1800-
* Limit and next token are not applicable if you specify organization config rule names.
1801-
* It is only applicable, when you request all the organization config rules.</p>
1810+
* Limit and next token are not applicable if you specify organization Config rule names.
1811+
* It is only applicable, when you request all the organization Config rules.</p>
18021812
* </note>
18031813
*/
18041814
public describeOrganizationConfigRuleStatuses(
@@ -2472,6 +2482,38 @@ export class ConfigService extends ConfigServiceClient {
24722482
}
24732483
}
24742484

2485+
/**
2486+
* <p>Returns the policy definition containing the logic for your Config Custom Policy rule.</p>
2487+
*/
2488+
public getCustomRulePolicy(
2489+
args: GetCustomRulePolicyCommandInput,
2490+
options?: __HttpHandlerOptions
2491+
): Promise<GetCustomRulePolicyCommandOutput>;
2492+
public getCustomRulePolicy(
2493+
args: GetCustomRulePolicyCommandInput,
2494+
cb: (err: any, data?: GetCustomRulePolicyCommandOutput) => void
2495+
): void;
2496+
public getCustomRulePolicy(
2497+
args: GetCustomRulePolicyCommandInput,
2498+
options: __HttpHandlerOptions,
2499+
cb: (err: any, data?: GetCustomRulePolicyCommandOutput) => void
2500+
): void;
2501+
public getCustomRulePolicy(
2502+
args: GetCustomRulePolicyCommandInput,
2503+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetCustomRulePolicyCommandOutput) => void),
2504+
cb?: (err: any, data?: GetCustomRulePolicyCommandOutput) => void
2505+
): Promise<GetCustomRulePolicyCommandOutput> | void {
2506+
const command = new GetCustomRulePolicyCommand(args);
2507+
if (typeof optionsOrCb === "function") {
2508+
this.send(command, optionsOrCb);
2509+
} else if (typeof cb === "function") {
2510+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2511+
this.send(command, optionsOrCb || {}, cb);
2512+
} else {
2513+
return this.send(command, optionsOrCb);
2514+
}
2515+
}
2516+
24752517
/**
24762518
* <p>Returns the resource types, the number of each resource type,
24772519
* and the total number of resources that Config is recording in
@@ -2568,7 +2610,7 @@ export class ConfigService extends ConfigServiceClient {
25682610
}
25692611

25702612
/**
2571-
* <p>Returns detailed status for each member account within an organization for a given organization config rule.</p>
2613+
* <p>Returns detailed status for each member account within an organization for a given organization Config rule.</p>
25722614
*/
25732615
public getOrganizationConfigRuleDetailedStatus(
25742616
args: GetOrganizationConfigRuleDetailedStatusCommandInput,
@@ -2635,6 +2677,38 @@ export class ConfigService extends ConfigServiceClient {
26352677
}
26362678
}
26372679

2680+
/**
2681+
* <p>Returns the policy definition containing the logic for your organization Config Custom Policy rule.</p>
2682+
*/
2683+
public getOrganizationCustomRulePolicy(
2684+
args: GetOrganizationCustomRulePolicyCommandInput,
2685+
options?: __HttpHandlerOptions
2686+
): Promise<GetOrganizationCustomRulePolicyCommandOutput>;
2687+
public getOrganizationCustomRulePolicy(
2688+
args: GetOrganizationCustomRulePolicyCommandInput,
2689+
cb: (err: any, data?: GetOrganizationCustomRulePolicyCommandOutput) => void
2690+
): void;
2691+
public getOrganizationCustomRulePolicy(
2692+
args: GetOrganizationCustomRulePolicyCommandInput,
2693+
options: __HttpHandlerOptions,
2694+
cb: (err: any, data?: GetOrganizationCustomRulePolicyCommandOutput) => void
2695+
): void;
2696+
public getOrganizationCustomRulePolicy(
2697+
args: GetOrganizationCustomRulePolicyCommandInput,
2698+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetOrganizationCustomRulePolicyCommandOutput) => void),
2699+
cb?: (err: any, data?: GetOrganizationCustomRulePolicyCommandOutput) => void
2700+
): Promise<GetOrganizationCustomRulePolicyCommandOutput> | void {
2701+
const command = new GetOrganizationCustomRulePolicyCommand(args);
2702+
if (typeof optionsOrCb === "function") {
2703+
this.send(command, optionsOrCb);
2704+
} else if (typeof cb === "function") {
2705+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2706+
this.send(command, optionsOrCb || {}, cb);
2707+
} else {
2708+
return this.send(command, optionsOrCb);
2709+
}
2710+
}
2711+
26382712
/**
26392713
* <p>Returns a list of <code>ConfigurationItems</code> for the specified resource.
26402714
* The list contains details about each state of the resource
@@ -3210,9 +3284,9 @@ export class ConfigService extends ConfigServiceClient {
32103284
}
32113285

32123286
/**
3213-
* <p>Adds or updates organization config rule for your entire organization evaluating whether your Amazon Web Services resources comply with your
3287+
* <p>Adds or updates organization Config rule for your entire organization evaluating whether your Amazon Web Services resources comply with your
32143288
* desired configurations.</p>
3215-
* <p> Only a master account and a delegated administrator can create or update an organization config rule.
3289+
* <p> Only a master account and a delegated administrator can create or update an organization Config rule.
32163290
* When calling this API with a delegated administrator, you must ensure Organizations
32173291
* <code>ListDelegatedAdministrator</code> permissions are added. </p>
32183292
* <p>This API enables organization service access through the <code>EnableAWSServiceAccess</code> action and creates a service linked
@@ -3227,7 +3301,7 @@ export class ConfigService extends ConfigServiceClient {
32273301
* When you use the <code>PutOrganizationConfigRule</code> action to add the rule to Config, you must
32283302
* specify the Amazon Resource Name (ARN) that Lambda assigns to the function.
32293303
* If you are adding an Config managed rule, specify the rule's identifier for the <code>RuleIdentifier</code> key.</p>
3230-
* <p>The maximum number of organization config rules that Config supports is 150 and 3 delegated administrator per organization. </p>
3304+
* <p>The maximum number of organization Config rules that Config supports is 150 and 3 delegated administrator per organization. </p>
32313305
* <note>
32323306
* <p>Prerequisite: Ensure you call <code>EnableAllFeatures</code> API to enable all features in an organization.</p>
32333307
* <p>Specify either <code>OrganizationCustomRuleMetadata</code> or <code>OrganizationManagedRuleMetadata</code>.</p>

clients/client-config-service/src/ConfigServiceClient.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ import {
261261
GetConformancePackComplianceSummaryCommandInput,
262262
GetConformancePackComplianceSummaryCommandOutput,
263263
} from "./commands/GetConformancePackComplianceSummaryCommand";
264+
import {
265+
GetCustomRulePolicyCommandInput,
266+
GetCustomRulePolicyCommandOutput,
267+
} from "./commands/GetCustomRulePolicyCommand";
264268
import {
265269
GetDiscoveredResourceCountsCommandInput,
266270
GetDiscoveredResourceCountsCommandOutput,
@@ -273,6 +277,10 @@ import {
273277
GetOrganizationConformancePackDetailedStatusCommandInput,
274278
GetOrganizationConformancePackDetailedStatusCommandOutput,
275279
} from "./commands/GetOrganizationConformancePackDetailedStatusCommand";
280+
import {
281+
GetOrganizationCustomRulePolicyCommandInput,
282+
GetOrganizationCustomRulePolicyCommandOutput,
283+
} from "./commands/GetOrganizationCustomRulePolicyCommand";
276284
import {
277285
GetResourceConfigHistoryCommandInput,
278286
GetResourceConfigHistoryCommandOutput,
@@ -416,9 +424,11 @@ export type ServiceInputTypes =
416424
| GetComplianceSummaryByResourceTypeCommandInput
417425
| GetConformancePackComplianceDetailsCommandInput
418426
| GetConformancePackComplianceSummaryCommandInput
427+
| GetCustomRulePolicyCommandInput
419428
| GetDiscoveredResourceCountsCommandInput
420429
| GetOrganizationConfigRuleDetailedStatusCommandInput
421430
| GetOrganizationConformancePackDetailedStatusCommandInput
431+
| GetOrganizationCustomRulePolicyCommandInput
422432
| GetResourceConfigHistoryCommandInput
423433
| GetStoredQueryCommandInput
424434
| ListAggregateDiscoveredResourcesCommandInput
@@ -504,9 +514,11 @@ export type ServiceOutputTypes =
504514
| GetComplianceSummaryByResourceTypeCommandOutput
505515
| GetConformancePackComplianceDetailsCommandOutput
506516
| GetConformancePackComplianceSummaryCommandOutput
517+
| GetCustomRulePolicyCommandOutput
507518
| GetDiscoveredResourceCountsCommandOutput
508519
| GetOrganizationConfigRuleDetailedStatusCommandOutput
509520
| GetOrganizationConformancePackDetailedStatusCommandOutput
521+
| GetOrganizationCustomRulePolicyCommandOutput
510522
| GetResourceConfigHistoryCommandOutput
511523
| GetStoredQueryCommandOutput
512524
| ListAggregateDiscoveredResourcesCommandOutput

clients/client-config-service/src/commands/DeleteOrganizationConfigRuleCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export interface DeleteOrganizationConfigRuleCommandInput extends DeleteOrganiza
2222
export interface DeleteOrganizationConfigRuleCommandOutput extends __MetadataBearer {}
2323

2424
/**
25-
* <p>Deletes the specified organization config rule and all of its evaluation results from all member accounts in that organization. </p>
26-
* <p>Only a master account and a delegated administrator account can delete an organization config rule.
25+
* <p>Deletes the specified organization Config rule and all of its evaluation results from all member accounts in that organization. </p>
26+
* <p>Only a master account and a delegated administrator account can delete an organization Config rule.
2727
* When calling this API with a delegated administrator, you must ensure Organizations
2828
* <code>ListDelegatedAdministrator</code> permissions are added.</p>
2929
* <p>Config sets the state of a rule to DELETE_IN_PROGRESS until the deletion is complete.

clients/client-config-service/src/commands/DeleteOrganizationConformancePackCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface DeleteOrganizationConformancePackCommandInput extends DeleteOrg
2222
export interface DeleteOrganizationConformancePackCommandOutput extends __MetadataBearer {}
2323

2424
/**
25-
* <p>Deletes the specified organization conformance pack and all of the config rules and remediation actions from
25+
* <p>Deletes the specified organization conformance pack and all of the Config rules and remediation actions from
2626
* all member accounts in that organization. </p>
2727
* <p> Only a master account or a delegated administrator account can delete an organization conformance pack.
2828
* When calling this API with a delegated administrator, you must ensure Organizations

clients/client-config-service/src/commands/DescribeOrganizationConfigRuleStatusesCommand.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ export interface DescribeOrganizationConfigRuleStatusesCommandOutput
2828
__MetadataBearer {}
2929

3030
/**
31-
* <p>Provides organization config rule deployment status for an organization.</p>
31+
* <p>Provides organization Config rule deployment status for an organization.</p>
3232
*
3333
* <note>
34-
* <p>The status is not considered successful until organization config rule is successfully deployed in all the member
34+
* <p>The status is not considered successful until organization Config rule is successfully deployed in all the member
3535
* accounts with an exception of excluded accounts.</p>
3636
* <p>When you specify the limit and the next token, you receive a paginated response.
37-
* Limit and next token are not applicable if you specify organization config rule names.
38-
* It is only applicable, when you request all the organization config rules.</p>
37+
* Limit and next token are not applicable if you specify organization Config rule names.
38+
* It is only applicable, when you request all the organization Config rules.</p>
3939
* </note>
4040
* @example
4141
* Use a bare-bones client and the command you need to make an API call.

clients/client-config-service/src/commands/DescribeOrganizationConfigRulesCommand.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export interface DescribeOrganizationConfigRulesCommandOutput
2424
__MetadataBearer {}
2525

2626
/**
27-
* <p>Returns a list of organization config rules. </p>
27+
* <p>Returns a list of organization Config rules. </p>
2828
*
2929
* <note>
3030
* <p>When you specify the limit and the next token, you receive a paginated response.
31-
* Limit and next token are not applicable if you specify organization config rule names.
32-
* It is only applicable, when you request all the organization config rules.</p>
31+
* Limit and next token are not applicable if you specify organization Config rule names.
32+
* It is only applicable, when you request all the organization Config rules.</p>
3333
* </note>
3434
* @example
3535
* Use a bare-bones client and the command you need to make an API call.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
3+
import { Command as $Command } from "@aws-sdk/smithy-client";
4+
import {
5+
FinalizeHandlerArguments,
6+
Handler,
7+
HandlerExecutionContext,
8+
HttpHandlerOptions as __HttpHandlerOptions,
9+
MetadataBearer as __MetadataBearer,
10+
MiddlewareStack,
11+
SerdeContext as __SerdeContext,
12+
} from "@aws-sdk/types";
13+
14+
import { ConfigServiceClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConfigServiceClient";
15+
import { GetCustomRulePolicyRequest, GetCustomRulePolicyResponse } from "../models/models_0";
16+
import {
17+
deserializeAws_json1_1GetCustomRulePolicyCommand,
18+
serializeAws_json1_1GetCustomRulePolicyCommand,
19+
} from "../protocols/Aws_json1_1";
20+
21+
export interface GetCustomRulePolicyCommandInput extends GetCustomRulePolicyRequest {}
22+
export interface GetCustomRulePolicyCommandOutput extends GetCustomRulePolicyResponse, __MetadataBearer {}
23+
24+
/**
25+
* <p>Returns the policy definition containing the logic for your Config Custom Policy rule.</p>
26+
* @example
27+
* Use a bare-bones client and the command you need to make an API call.
28+
* ```javascript
29+
* import { ConfigServiceClient, GetCustomRulePolicyCommand } from "@aws-sdk/client-config-service"; // ES Modules import
30+
* // const { ConfigServiceClient, GetCustomRulePolicyCommand } = require("@aws-sdk/client-config-service"); // CommonJS import
31+
* const client = new ConfigServiceClient(config);
32+
* const command = new GetCustomRulePolicyCommand(input);
33+
* const response = await client.send(command);
34+
* ```
35+
*
36+
* @see {@link GetCustomRulePolicyCommandInput} for command's `input` shape.
37+
* @see {@link GetCustomRulePolicyCommandOutput} for command's `response` shape.
38+
* @see {@link ConfigServiceClientResolvedConfig | config} for ConfigServiceClient's `config` shape.
39+
*
40+
*/
41+
export class GetCustomRulePolicyCommand extends $Command<
42+
GetCustomRulePolicyCommandInput,
43+
GetCustomRulePolicyCommandOutput,
44+
ConfigServiceClientResolvedConfig
45+
> {
46+
// Start section: command_properties
47+
// End section: command_properties
48+
49+
constructor(readonly input: GetCustomRulePolicyCommandInput) {
50+
// Start section: command_constructor
51+
super();
52+
// End section: command_constructor
53+
}
54+
55+
/**
56+
* @internal
57+
*/
58+
resolveMiddleware(
59+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
60+
configuration: ConfigServiceClientResolvedConfig,
61+
options?: __HttpHandlerOptions
62+
): Handler<GetCustomRulePolicyCommandInput, GetCustomRulePolicyCommandOutput> {
63+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
64+
65+
const stack = clientStack.concat(this.middlewareStack);
66+
67+
const { logger } = configuration;
68+
const clientName = "ConfigServiceClient";
69+
const commandName = "GetCustomRulePolicyCommand";
70+
const handlerExecutionContext: HandlerExecutionContext = {
71+
logger,
72+
clientName,
73+
commandName,
74+
inputFilterSensitiveLog: GetCustomRulePolicyRequest.filterSensitiveLog,
75+
outputFilterSensitiveLog: GetCustomRulePolicyResponse.filterSensitiveLog,
76+
};
77+
const { requestHandler } = configuration;
78+
return stack.resolve(
79+
(request: FinalizeHandlerArguments<any>) =>
80+
requestHandler.handle(request.request as __HttpRequest, options || {}),
81+
handlerExecutionContext
82+
);
83+
}
84+
85+
private serialize(input: GetCustomRulePolicyCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
86+
return serializeAws_json1_1GetCustomRulePolicyCommand(input, context);
87+
}
88+
89+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetCustomRulePolicyCommandOutput> {
90+
return deserializeAws_json1_1GetCustomRulePolicyCommand(output, context);
91+
}
92+
93+
// Start section: command_body_extra
94+
// End section: command_body_extra
95+
}

0 commit comments

Comments
 (0)