Skip to content

Commit 1d04c01

Browse files
author
awstools
committed
feat(client-ssm): This release adds support for cross account access in CreateOpsItem, UpdateOpsItem and GetOpsItem. It introduces new APIs to setup resource policies for SSM resources: PutResourcePolicy, GetResourcePolicies and DeleteResourcePolicy.
1 parent 2adc9d0 commit 1d04c01

16 files changed

+2060
-732
lines changed

clients/client-ssm/src/SSM.ts

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ import {
116116
DeleteResourceDataSyncCommandInput,
117117
DeleteResourceDataSyncCommandOutput,
118118
} from "./commands/DeleteResourceDataSyncCommand";
119+
import {
120+
DeleteResourcePolicyCommand,
121+
DeleteResourcePolicyCommandInput,
122+
DeleteResourcePolicyCommandOutput,
123+
} from "./commands/DeleteResourcePolicyCommand";
119124
import {
120125
DeregisterManagedInstanceCommand,
121126
DeregisterManagedInstanceCommandInput,
@@ -408,6 +413,11 @@ import {
408413
GetPatchBaselineForPatchGroupCommandInput,
409414
GetPatchBaselineForPatchGroupCommandOutput,
410415
} from "./commands/GetPatchBaselineForPatchGroupCommand";
416+
import {
417+
GetResourcePoliciesCommand,
418+
GetResourcePoliciesCommandInput,
419+
GetResourcePoliciesCommandOutput,
420+
} from "./commands/GetResourcePoliciesCommand";
411421
import {
412422
GetServiceSettingCommand,
413423
GetServiceSettingCommandInput,
@@ -518,6 +528,11 @@ import {
518528
PutParameterCommandInput,
519529
PutParameterCommandOutput,
520530
} from "./commands/PutParameterCommand";
531+
import {
532+
PutResourcePolicyCommand,
533+
PutResourcePolicyCommandInput,
534+
PutResourcePolicyCommandOutput,
535+
} from "./commands/PutResourcePolicyCommand";
521536
import {
522537
RegisterDefaultPatchBaselineCommand,
523538
RegisterDefaultPatchBaselineCommandInput,
@@ -1564,6 +1579,41 @@ export class SSM extends SSMClient {
15641579
}
15651580
}
15661581

1582+
/**
1583+
* <p>Deletes a Systems Manager resource policy. A resource policy helps you to define the IAM entity (for example, an Amazon Web Services account) that can manage your Systems Manager resources. Currently,
1584+
* <code>OpsItemGroup</code> is the only resource that supports Systems Manager resource policies. The
1585+
* resource policy for <code>OpsItemGroup</code> enables Amazon Web Services accounts to view and interact with
1586+
* OpsCenter operational work items (OpsItems).</p>
1587+
*/
1588+
public deleteResourcePolicy(
1589+
args: DeleteResourcePolicyCommandInput,
1590+
options?: __HttpHandlerOptions
1591+
): Promise<DeleteResourcePolicyCommandOutput>;
1592+
public deleteResourcePolicy(
1593+
args: DeleteResourcePolicyCommandInput,
1594+
cb: (err: any, data?: DeleteResourcePolicyCommandOutput) => void
1595+
): void;
1596+
public deleteResourcePolicy(
1597+
args: DeleteResourcePolicyCommandInput,
1598+
options: __HttpHandlerOptions,
1599+
cb: (err: any, data?: DeleteResourcePolicyCommandOutput) => void
1600+
): void;
1601+
public deleteResourcePolicy(
1602+
args: DeleteResourcePolicyCommandInput,
1603+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DeleteResourcePolicyCommandOutput) => void),
1604+
cb?: (err: any, data?: DeleteResourcePolicyCommandOutput) => void
1605+
): Promise<DeleteResourcePolicyCommandOutput> | void {
1606+
const command = new DeleteResourcePolicyCommand(args);
1607+
if (typeof optionsOrCb === "function") {
1608+
this.send(command, optionsOrCb);
1609+
} else if (typeof cb === "function") {
1610+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1611+
this.send(command, optionsOrCb || {}, cb);
1612+
} else {
1613+
return this.send(command, optionsOrCb);
1614+
}
1615+
}
1616+
15671617
/**
15681618
* <p>Removes the server or virtual machine from the list of registered servers. You can
15691619
* reregister the node again at any time. If you don't plan to use Run Command on the server, we
@@ -3660,6 +3710,38 @@ export class SSM extends SSMClient {
36603710
}
36613711
}
36623712

3713+
/**
3714+
* <p>Returns an array of the <code>Policy</code> object.</p>
3715+
*/
3716+
public getResourcePolicies(
3717+
args: GetResourcePoliciesCommandInput,
3718+
options?: __HttpHandlerOptions
3719+
): Promise<GetResourcePoliciesCommandOutput>;
3720+
public getResourcePolicies(
3721+
args: GetResourcePoliciesCommandInput,
3722+
cb: (err: any, data?: GetResourcePoliciesCommandOutput) => void
3723+
): void;
3724+
public getResourcePolicies(
3725+
args: GetResourcePoliciesCommandInput,
3726+
options: __HttpHandlerOptions,
3727+
cb: (err: any, data?: GetResourcePoliciesCommandOutput) => void
3728+
): void;
3729+
public getResourcePolicies(
3730+
args: GetResourcePoliciesCommandInput,
3731+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetResourcePoliciesCommandOutput) => void),
3732+
cb?: (err: any, data?: GetResourcePoliciesCommandOutput) => void
3733+
): Promise<GetResourcePoliciesCommandOutput> | void {
3734+
const command = new GetResourcePoliciesCommand(args);
3735+
if (typeof optionsOrCb === "function") {
3736+
this.send(command, optionsOrCb);
3737+
} else if (typeof cb === "function") {
3738+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
3739+
this.send(command, optionsOrCb || {}, cb);
3740+
} else {
3741+
return this.send(command, optionsOrCb);
3742+
}
3743+
}
3744+
36633745
/**
36643746
* <p>
36653747
* <code>ServiceSetting</code> is an account-level setting for an Amazon Web Services service. This setting
@@ -4489,6 +4571,42 @@ export class SSM extends SSMClient {
44894571
}
44904572
}
44914573

4574+
/**
4575+
* <p>Creates or updates a Systems Manager resource policy. A resource policy helps you to define the
4576+
* IAM entity (for example, an Amazon Web Services account) that can manage your Systems Manager resources.
4577+
* Currently, <code>OpsItemGroup</code> is the only resource that supports Systems Manager resource policies.
4578+
* The resource policy for <code>OpsItemGroup</code> enables Amazon Web Services accounts to view and interact
4579+
* with OpsCenter operational work items (OpsItems).</p>
4580+
*/
4581+
public putResourcePolicy(
4582+
args: PutResourcePolicyCommandInput,
4583+
options?: __HttpHandlerOptions
4584+
): Promise<PutResourcePolicyCommandOutput>;
4585+
public putResourcePolicy(
4586+
args: PutResourcePolicyCommandInput,
4587+
cb: (err: any, data?: PutResourcePolicyCommandOutput) => void
4588+
): void;
4589+
public putResourcePolicy(
4590+
args: PutResourcePolicyCommandInput,
4591+
options: __HttpHandlerOptions,
4592+
cb: (err: any, data?: PutResourcePolicyCommandOutput) => void
4593+
): void;
4594+
public putResourcePolicy(
4595+
args: PutResourcePolicyCommandInput,
4596+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: PutResourcePolicyCommandOutput) => void),
4597+
cb?: (err: any, data?: PutResourcePolicyCommandOutput) => void
4598+
): Promise<PutResourcePolicyCommandOutput> | void {
4599+
const command = new PutResourcePolicyCommand(args);
4600+
if (typeof optionsOrCb === "function") {
4601+
this.send(command, optionsOrCb);
4602+
} else if (typeof cb === "function") {
4603+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
4604+
this.send(command, optionsOrCb || {}, cb);
4605+
} else {
4606+
return this.send(command, optionsOrCb);
4607+
}
4608+
}
4609+
44924610
/**
44934611
* <p>Defines the default patch baseline for the relevant operating system.</p>
44944612
* <p>To reset the Amazon Web Services-predefined patch baseline as the default, specify the full patch baseline

clients/client-ssm/src/SSMClient.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ import {
9797
DeleteResourceDataSyncCommandInput,
9898
DeleteResourceDataSyncCommandOutput,
9999
} from "./commands/DeleteResourceDataSyncCommand";
100+
import {
101+
DeleteResourcePolicyCommandInput,
102+
DeleteResourcePolicyCommandOutput,
103+
} from "./commands/DeleteResourcePolicyCommand";
100104
import {
101105
DeregisterManagedInstanceCommandInput,
102106
DeregisterManagedInstanceCommandOutput,
@@ -295,6 +299,10 @@ import {
295299
GetPatchBaselineForPatchGroupCommandInput,
296300
GetPatchBaselineForPatchGroupCommandOutput,
297301
} from "./commands/GetPatchBaselineForPatchGroupCommand";
302+
import {
303+
GetResourcePoliciesCommandInput,
304+
GetResourcePoliciesCommandOutput,
305+
} from "./commands/GetResourcePoliciesCommand";
298306
import { GetServiceSettingCommandInput, GetServiceSettingCommandOutput } from "./commands/GetServiceSettingCommand";
299307
import {
300308
LabelParameterVersionCommandInput,
@@ -356,6 +364,7 @@ import {
356364
import { PutComplianceItemsCommandInput, PutComplianceItemsCommandOutput } from "./commands/PutComplianceItemsCommand";
357365
import { PutInventoryCommandInput, PutInventoryCommandOutput } from "./commands/PutInventoryCommand";
358366
import { PutParameterCommandInput, PutParameterCommandOutput } from "./commands/PutParameterCommand";
367+
import { PutResourcePolicyCommandInput, PutResourcePolicyCommandOutput } from "./commands/PutResourcePolicyCommand";
359368
import {
360369
RegisterDefaultPatchBaselineCommandInput,
361370
RegisterDefaultPatchBaselineCommandOutput,
@@ -484,6 +493,7 @@ export type ServiceInputTypes =
484493
| DeleteParametersCommandInput
485494
| DeletePatchBaselineCommandInput
486495
| DeleteResourceDataSyncCommandInput
496+
| DeleteResourcePolicyCommandInput
487497
| DeregisterManagedInstanceCommandInput
488498
| DeregisterPatchBaselineForPatchGroupCommandInput
489499
| DeregisterTargetFromMaintenanceWindowCommandInput
@@ -544,6 +554,7 @@ export type ServiceInputTypes =
544554
| GetParametersCommandInput
545555
| GetPatchBaselineCommandInput
546556
| GetPatchBaselineForPatchGroupCommandInput
557+
| GetResourcePoliciesCommandInput
547558
| GetServiceSettingCommandInput
548559
| LabelParameterVersionCommandInput
549560
| ListAssociationVersionsCommandInput
@@ -566,6 +577,7 @@ export type ServiceInputTypes =
566577
| PutComplianceItemsCommandInput
567578
| PutInventoryCommandInput
568579
| PutParameterCommandInput
580+
| PutResourcePolicyCommandInput
569581
| RegisterDefaultPatchBaselineCommandInput
570582
| RegisterPatchBaselineForPatchGroupCommandInput
571583
| RegisterTargetWithMaintenanceWindowCommandInput
@@ -621,6 +633,7 @@ export type ServiceOutputTypes =
621633
| DeleteParametersCommandOutput
622634
| DeletePatchBaselineCommandOutput
623635
| DeleteResourceDataSyncCommandOutput
636+
| DeleteResourcePolicyCommandOutput
624637
| DeregisterManagedInstanceCommandOutput
625638
| DeregisterPatchBaselineForPatchGroupCommandOutput
626639
| DeregisterTargetFromMaintenanceWindowCommandOutput
@@ -681,6 +694,7 @@ export type ServiceOutputTypes =
681694
| GetParametersCommandOutput
682695
| GetPatchBaselineCommandOutput
683696
| GetPatchBaselineForPatchGroupCommandOutput
697+
| GetResourcePoliciesCommandOutput
684698
| GetServiceSettingCommandOutput
685699
| LabelParameterVersionCommandOutput
686700
| ListAssociationVersionsCommandOutput
@@ -703,6 +717,7 @@ export type ServiceOutputTypes =
703717
| PutComplianceItemsCommandOutput
704718
| PutInventoryCommandOutput
705719
| PutParameterCommandOutput
720+
| PutResourcePolicyCommandOutput
706721
| RegisterDefaultPatchBaselineCommandOutput
707722
| RegisterPatchBaselineForPatchGroupCommandOutput
708723
| RegisterTargetWithMaintenanceWindowCommandOutput
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
3+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
5+
import { Command as $Command } from "@aws-sdk/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
} from "@aws-sdk/types";
15+
16+
import {
17+
DeleteResourcePolicyRequest,
18+
DeleteResourcePolicyRequestFilterSensitiveLog,
19+
DeleteResourcePolicyResponse,
20+
DeleteResourcePolicyResponseFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_json1_1DeleteResourcePolicyCommand,
24+
serializeAws_json1_1DeleteResourcePolicyCommand,
25+
} from "../protocols/Aws_json1_1";
26+
import { ServiceInputTypes, ServiceOutputTypes, SSMClientResolvedConfig } from "../SSMClient";
27+
28+
export interface DeleteResourcePolicyCommandInput extends DeleteResourcePolicyRequest {}
29+
export interface DeleteResourcePolicyCommandOutput extends DeleteResourcePolicyResponse, __MetadataBearer {}
30+
31+
/**
32+
* <p>Deletes a Systems Manager resource policy. A resource policy helps you to define the IAM entity (for example, an Amazon Web Services account) that can manage your Systems Manager resources. Currently,
33+
* <code>OpsItemGroup</code> is the only resource that supports Systems Manager resource policies. The
34+
* resource policy for <code>OpsItemGroup</code> enables Amazon Web Services accounts to view and interact with
35+
* OpsCenter operational work items (OpsItems).</p>
36+
* @example
37+
* Use a bare-bones client and the command you need to make an API call.
38+
* ```javascript
39+
* import { SSMClient, DeleteResourcePolicyCommand } from "@aws-sdk/client-ssm"; // ES Modules import
40+
* // const { SSMClient, DeleteResourcePolicyCommand } = require("@aws-sdk/client-ssm"); // CommonJS import
41+
* const client = new SSMClient(config);
42+
* const command = new DeleteResourcePolicyCommand(input);
43+
* const response = await client.send(command);
44+
* ```
45+
*
46+
* @see {@link DeleteResourcePolicyCommandInput} for command's `input` shape.
47+
* @see {@link DeleteResourcePolicyCommandOutput} for command's `response` shape.
48+
* @see {@link SSMClientResolvedConfig | config} for SSMClient's `config` shape.
49+
*
50+
*/
51+
export class DeleteResourcePolicyCommand extends $Command<
52+
DeleteResourcePolicyCommandInput,
53+
DeleteResourcePolicyCommandOutput,
54+
SSMClientResolvedConfig
55+
> {
56+
// Start section: command_properties
57+
// End section: command_properties
58+
59+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
60+
return {
61+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
62+
Endpoint: { type: "builtInParams", name: "endpoint" },
63+
Region: { type: "builtInParams", name: "region" },
64+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
65+
};
66+
}
67+
68+
constructor(readonly input: DeleteResourcePolicyCommandInput) {
69+
// Start section: command_constructor
70+
super();
71+
// End section: command_constructor
72+
}
73+
74+
/**
75+
* @internal
76+
*/
77+
resolveMiddleware(
78+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
79+
configuration: SSMClientResolvedConfig,
80+
options?: __HttpHandlerOptions
81+
): Handler<DeleteResourcePolicyCommandInput, DeleteResourcePolicyCommandOutput> {
82+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
83+
this.middlewareStack.use(
84+
getEndpointPlugin(configuration, DeleteResourcePolicyCommand.getEndpointParameterInstructions())
85+
);
86+
87+
const stack = clientStack.concat(this.middlewareStack);
88+
89+
const { logger } = configuration;
90+
const clientName = "SSMClient";
91+
const commandName = "DeleteResourcePolicyCommand";
92+
const handlerExecutionContext: HandlerExecutionContext = {
93+
logger,
94+
clientName,
95+
commandName,
96+
inputFilterSensitiveLog: DeleteResourcePolicyRequestFilterSensitiveLog,
97+
outputFilterSensitiveLog: DeleteResourcePolicyResponseFilterSensitiveLog,
98+
};
99+
const { requestHandler } = configuration;
100+
return stack.resolve(
101+
(request: FinalizeHandlerArguments<any>) =>
102+
requestHandler.handle(request.request as __HttpRequest, options || {}),
103+
handlerExecutionContext
104+
);
105+
}
106+
107+
private serialize(input: DeleteResourcePolicyCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
108+
return serializeAws_json1_1DeleteResourcePolicyCommand(input, context);
109+
}
110+
111+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DeleteResourcePolicyCommandOutput> {
112+
return deserializeAws_json1_1DeleteResourcePolicyCommand(output, context);
113+
}
114+
115+
// Start section: command_body_extra
116+
// End section: command_body_extra
117+
}

clients/client-ssm/src/commands/DescribeOpsItemsCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
DescribeOpsItemsRequestFilterSensitiveLog,
1919
DescribeOpsItemsResponse,
2020
DescribeOpsItemsResponseFilterSensitiveLog,
21-
} from "../models/models_0";
21+
} from "../models/models_1";
2222
import {
2323
deserializeAws_json1_1DescribeOpsItemsCommand,
2424
serializeAws_json1_1DescribeOpsItemsCommand,

0 commit comments

Comments
 (0)