Skip to content

Commit 0e72d32

Browse files
author
awstools
committed
feat(client-ram): Added ListSourceAssociations API. Allows RAM resource share owners to list source associations that determine which sources can access resources through service principal associations. Supports filtering by resource share ARN, source ID, source type, or status, with pagination.
1 parent e14e08b commit 0e72d32

34 files changed

Lines changed: 759 additions & 68 deletions

clients/client-ram/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ ListResourceTypes
402402
</details>
403403
<details>
404404
<summary>
405+
ListSourceAssociations
406+
</summary>
407+
408+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ram/command/ListSourceAssociationsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ram/Interface/ListSourceAssociationsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ram/Interface/ListSourceAssociationsCommandOutput/)
409+
</details>
410+
<details>
411+
<summary>
405412
PromotePermissionCreatedFromPolicy
406413
</summary>
407414

clients/client-ram/src/RAM.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ import {
132132
ListResourceTypesCommandInput,
133133
ListResourceTypesCommandOutput,
134134
} from "./commands/ListResourceTypesCommand";
135+
import {
136+
ListSourceAssociationsCommand,
137+
ListSourceAssociationsCommandInput,
138+
ListSourceAssociationsCommandOutput,
139+
} from "./commands/ListSourceAssociationsCommand";
135140
import {
136141
PromotePermissionCreatedFromPolicyCommand,
137142
PromotePermissionCreatedFromPolicyCommandInput,
@@ -183,6 +188,7 @@ import {
183188
import { paginateListResourceSharePermissions } from "./pagination/ListResourceSharePermissionsPaginator";
184189
import { paginateListResources } from "./pagination/ListResourcesPaginator";
185190
import { paginateListResourceTypes } from "./pagination/ListResourceTypesPaginator";
191+
import { paginateListSourceAssociations } from "./pagination/ListSourceAssociationsPaginator";
186192
import { RAMClient } from "./RAMClient";
187193

188194
const commands = {
@@ -212,6 +218,7 @@ const commands = {
212218
ListResourcesCommand,
213219
ListResourceSharePermissionsCommand,
214220
ListResourceTypesCommand,
221+
ListSourceAssociationsCommand,
215222
PromotePermissionCreatedFromPolicyCommand,
216223
PromoteResourceShareCreatedFromPolicyCommand,
217224
RejectResourceShareInvitationCommand,
@@ -235,6 +242,7 @@ const paginators = {
235242
paginateListResources,
236243
paginateListResourceSharePermissions,
237244
paginateListResourceTypes,
245+
paginateListSourceAssociations,
238246
};
239247

240248
export interface RAM {
@@ -686,6 +694,24 @@ export interface RAM {
686694
cb: (err: any, data?: ListResourceTypesCommandOutput) => void
687695
): void;
688696

697+
/**
698+
* @see {@link ListSourceAssociationsCommand}
699+
*/
700+
listSourceAssociations(): Promise<ListSourceAssociationsCommandOutput>;
701+
listSourceAssociations(
702+
args: ListSourceAssociationsCommandInput,
703+
options?: __HttpHandlerOptions
704+
): Promise<ListSourceAssociationsCommandOutput>;
705+
listSourceAssociations(
706+
args: ListSourceAssociationsCommandInput,
707+
cb: (err: any, data?: ListSourceAssociationsCommandOutput) => void
708+
): void;
709+
listSourceAssociations(
710+
args: ListSourceAssociationsCommandInput,
711+
options: __HttpHandlerOptions,
712+
cb: (err: any, data?: ListSourceAssociationsCommandOutput) => void
713+
): void;
714+
689715
/**
690716
* @see {@link PromotePermissionCreatedFromPolicyCommand}
691717
*/
@@ -964,6 +990,17 @@ export interface RAM {
964990
args?: ListResourceTypesCommandInput,
965991
paginationConfig?: Omit<PaginationConfiguration, "client">
966992
): Paginator<ListResourceTypesCommandOutput>;
993+
994+
/**
995+
* @see {@link ListSourceAssociationsCommand}
996+
* @param args - command input.
997+
* @param paginationConfig - optional pagination config.
998+
* @returns AsyncIterable of {@link ListSourceAssociationsCommandOutput}.
999+
*/
1000+
paginateListSourceAssociations(
1001+
args?: ListSourceAssociationsCommandInput,
1002+
paginationConfig?: Omit<PaginationConfiguration, "client">
1003+
): Paginator<ListSourceAssociationsCommandOutput>;
9671004
}
9681005

9691006
/**

clients/client-ram/src/RAMClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ import {
143143
ListResourceSharePermissionsCommandOutput,
144144
} from "./commands/ListResourceSharePermissionsCommand";
145145
import { ListResourceTypesCommandInput, ListResourceTypesCommandOutput } from "./commands/ListResourceTypesCommand";
146+
import {
147+
ListSourceAssociationsCommandInput,
148+
ListSourceAssociationsCommandOutput,
149+
} from "./commands/ListSourceAssociationsCommand";
146150
import {
147151
PromotePermissionCreatedFromPolicyCommandInput,
148152
PromotePermissionCreatedFromPolicyCommandOutput,
@@ -210,6 +214,7 @@ export type ServiceInputTypes =
210214
| ListResourceSharePermissionsCommandInput
211215
| ListResourceTypesCommandInput
212216
| ListResourcesCommandInput
217+
| ListSourceAssociationsCommandInput
213218
| PromotePermissionCreatedFromPolicyCommandInput
214219
| PromoteResourceShareCreatedFromPolicyCommandInput
215220
| RejectResourceShareInvitationCommandInput
@@ -249,6 +254,7 @@ export type ServiceOutputTypes =
249254
| ListResourceSharePermissionsCommandOutput
250255
| ListResourceTypesCommandOutput
251256
| ListResourcesCommandOutput
257+
| ListSourceAssociationsCommandOutput
252258
| PromotePermissionCreatedFromPolicyCommandOutput
253259
| PromoteResourceShareCreatedFromPolicyCommandOutput
254260
| RejectResourceShareInvitationCommandOutput

clients/client-ram/src/commands/AcceptResourceShareInvitationCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export interface AcceptResourceShareInvitationCommandOutput extends AcceptResour
5858
* // resourceShareArn: "STRING_VALUE",
5959
* // resourceShareName: "STRING_VALUE",
6060
* // associatedEntity: "STRING_VALUE",
61-
* // associationType: "PRINCIPAL" || "RESOURCE",
62-
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED",
61+
* // associationType: "PRINCIPAL" || "RESOURCE" || "SOURCE",
62+
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED" || "SUSPENDED" || "SUSPENDING" || "RESTORING",
6363
* // statusMessage: "STRING_VALUE",
6464
* // creationTime: new Date("TIMESTAMP"),
6565
* // lastUpdatedTime: new Date("TIMESTAMP"),

clients/client-ram/src/commands/AssociateResourceShareCommand.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface AssociateResourceShareCommandInput extends AssociateResourceSha
2727
export interface AssociateResourceShareCommandOutput extends AssociateResourceShareResponse, __MetadataBearer {}
2828

2929
/**
30-
* <p>Adds the specified list of principals and list of resources to a resource share. Principals that
30+
* <p>Adds the specified list of principals, resources, and source constraints to a resource share. Principals that
3131
* already have access to this resource share immediately receive access to the added resources.
3232
* Newly added principals immediately receive access to the resources shared in this resource share. </p>
3333
* @example
@@ -59,8 +59,8 @@ export interface AssociateResourceShareCommandOutput extends AssociateResourceSh
5959
* // resourceShareArn: "STRING_VALUE",
6060
* // resourceShareName: "STRING_VALUE",
6161
* // associatedEntity: "STRING_VALUE",
62-
* // associationType: "PRINCIPAL" || "RESOURCE",
63-
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED",
62+
* // associationType: "PRINCIPAL" || "RESOURCE" || "SOURCE",
63+
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED" || "SUSPENDED" || "SUSPENDING" || "RESTORING",
6464
* // statusMessage: "STRING_VALUE",
6565
* // creationTime: new Date("TIMESTAMP"),
6666
* // lastUpdatedTime: new Date("TIMESTAMP"),
@@ -101,9 +101,10 @@ export interface AssociateResourceShareCommandOutput extends AssociateResourceSh
101101
* <p>The operation failed because the requested operation isn't permitted.</p>
102102
*
103103
* @throws {@link ResourceShareLimitExceededException} (client fault)
104-
* <p>The operation failed because it would exceed the limit for resource shares for your account. To
105-
* view the limits for your Amazon Web Services account, see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in the Service Quotas
106-
* console</a>.</p>
104+
* <p>The operation failed because it would exceed the limit for resource shares for your account. You
105+
* can associate up to 100 resources per call. To view the limits for your Amazon Web Services account,
106+
* see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in
107+
* the Service Quotas console</a>.</p>
107108
*
108109
* @throws {@link ServerInternalException} (server fault)
109110
* <p>The operation failed because the service could not respond to the request due to an

clients/client-ram/src/commands/CreateResourceShareCommand.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export interface CreateResourceShareCommandOutput extends CreateResourceShareRes
2828

2929
/**
3030
* <p>Creates a resource share. You can provide a list of the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> for the resources that you
31-
* want to share, a list of principals you want to share the resources with, and the
32-
* permissions to grant those principals.</p>
31+
* want to share, a list of principals you want to share the resources with, the
32+
* permissions to grant those principals, and optionally source constraints to enhance security for service principal sharing.</p>
3333
* <note>
3434
* <p>Sharing a resource makes it available for use by principals outside of the
3535
* Amazon Web Services account that created the resource. Sharing doesn't change any permissions or
@@ -120,9 +120,10 @@ export interface CreateResourceShareCommandOutput extends CreateResourceShareRes
120120
* <p>The operation failed because the requested operation isn't permitted.</p>
121121
*
122122
* @throws {@link ResourceShareLimitExceededException} (client fault)
123-
* <p>The operation failed because it would exceed the limit for resource shares for your account. To
124-
* view the limits for your Amazon Web Services account, see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in the Service Quotas
125-
* console</a>.</p>
123+
* <p>The operation failed because it would exceed the limit for resource shares for your account. You
124+
* can associate up to 100 resources per call. To view the limits for your Amazon Web Services account,
125+
* see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in
126+
* the Service Quotas console</a>.</p>
126127
*
127128
* @throws {@link ServerInternalException} (server fault)
128129
* <p>The operation failed because the service could not respond to the request due to an
@@ -139,6 +140,10 @@ export interface CreateResourceShareCommandOutput extends CreateResourceShareRes
139140
* <p>The operation failed because the specified tag key is a reserved word and can't be
140141
* used.</p>
141142
*
143+
* @throws {@link ThrottlingException} (client fault)
144+
* <p>The operation failed because it exceeded the rate at which you are allowed to perform
145+
* this operation. Please try again later.</p>
146+
*
142147
* @throws {@link UnknownResourceException} (client fault)
143148
* <p>The operation failed because a specified resource couldn't be found.</p>
144149
*

clients/client-ram/src/commands/DeleteResourceShareCommand.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ export interface DeleteResourceShareCommandOutput extends DeleteResourceShareRes
8888
* @throws {@link ServiceUnavailableException} (server fault)
8989
* <p>The operation failed because the service isn't available. Try again later.</p>
9090
*
91+
* @throws {@link ThrottlingException} (client fault)
92+
* <p>The operation failed because it exceeded the rate at which you are allowed to perform
93+
* this operation. Please try again later.</p>
94+
*
9195
* @throws {@link UnknownResourceException} (client fault)
9296
* <p>The operation failed because a specified resource couldn't be found.</p>
9397
*

clients/client-ram/src/commands/DisassociateResourceShareCommand.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface DisassociateResourceShareCommandInput extends DisassociateResou
2727
export interface DisassociateResourceShareCommandOutput extends DisassociateResourceShareResponse, __MetadataBearer {}
2828

2929
/**
30-
* <p>Removes the specified principals or resources from participating in the specified
30+
* <p>Removes the specified principals, resources, or source constraints from participating in the specified
3131
* resource share.</p>
3232
* @example
3333
* Use a bare-bones client and the command you need to make an API call.
@@ -58,8 +58,8 @@ export interface DisassociateResourceShareCommandOutput extends DisassociateReso
5858
* // resourceShareArn: "STRING_VALUE",
5959
* // resourceShareName: "STRING_VALUE",
6060
* // associatedEntity: "STRING_VALUE",
61-
* // associationType: "PRINCIPAL" || "RESOURCE",
62-
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED",
61+
* // associationType: "PRINCIPAL" || "RESOURCE" || "SOURCE",
62+
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED" || "SUSPENDED" || "SUSPENDING" || "RESTORING",
6363
* // statusMessage: "STRING_VALUE",
6464
* // creationTime: new Date("TIMESTAMP"),
6565
* // lastUpdatedTime: new Date("TIMESTAMP"),
@@ -100,9 +100,10 @@ export interface DisassociateResourceShareCommandOutput extends DisassociateReso
100100
* <p>The operation failed because the requested operation isn't permitted.</p>
101101
*
102102
* @throws {@link ResourceShareLimitExceededException} (client fault)
103-
* <p>The operation failed because it would exceed the limit for resource shares for your account. To
104-
* view the limits for your Amazon Web Services account, see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in the Service Quotas
105-
* console</a>.</p>
103+
* <p>The operation failed because it would exceed the limit for resource shares for your account. You
104+
* can associate up to 100 resources per call. To view the limits for your Amazon Web Services account,
105+
* see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in
106+
* the Service Quotas console</a>.</p>
106107
*
107108
* @throws {@link ServerInternalException} (server fault)
108109
* <p>The operation failed because the service could not respond to the request due to an
@@ -111,6 +112,10 @@ export interface DisassociateResourceShareCommandOutput extends DisassociateReso
111112
* @throws {@link ServiceUnavailableException} (server fault)
112113
* <p>The operation failed because the service isn't available. Try again later.</p>
113114
*
115+
* @throws {@link ThrottlingException} (client fault)
116+
* <p>The operation failed because it exceeded the rate at which you are allowed to perform
117+
* this operation. Please try again later.</p>
118+
*
114119
* @throws {@link UnknownResourceException} (client fault)
115120
* <p>The operation failed because a specified resource couldn't be found.</p>
116121
*

clients/client-ram/src/commands/GetResourcePoliciesCommand.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ export interface GetResourcePoliciesCommandOutput extends GetResourcePoliciesRes
2929
/**
3030
* <p>Retrieves the resource policies for the specified resources that you own and have
3131
* shared.</p>
32+
* <note>
33+
* <p>Always check the <code>NextToken</code> response parameter for a <code>null</code> value
34+
* when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more
35+
* results available. The <code>NextToken</code> response parameter value is <code>null</code>
36+
* <i>only</i>
37+
* when there are no more results to display.</p>
38+
* </note>
3239
* @example
3340
* Use a bare-bones client and the command you need to make an API call.
3441
* ```javascript

clients/client-ram/src/commands/GetResourceShareAssociationsCommand.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ export interface GetResourceShareAssociationsCommandOutput extends GetResourceSh
2929
/**
3030
* <p>Retrieves the lists of resources and principals that associated for resource shares that you
3131
* own.</p>
32+
* <note>
33+
* <p>Always check the <code>NextToken</code> response parameter for a <code>null</code> value
34+
* when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more
35+
* results available. The <code>NextToken</code> response parameter value is <code>null</code>
36+
* <i>only</i>
37+
* when there are no more results to display.</p>
38+
* </note>
3239
* @example
3340
* Use a bare-bones client and the command you need to make an API call.
3441
* ```javascript
@@ -38,13 +45,13 @@ export interface GetResourceShareAssociationsCommandOutput extends GetResourceSh
3845
* const config = {}; // type is RAMClientConfig
3946
* const client = new RAMClient(config);
4047
* const input = { // GetResourceShareAssociationsRequest
41-
* associationType: "PRINCIPAL" || "RESOURCE", // required
48+
* associationType: "PRINCIPAL" || "RESOURCE" || "SOURCE", // required
4249
* resourceShareArns: [ // ResourceShareArnList
4350
* "STRING_VALUE",
4451
* ],
4552
* resourceArn: "STRING_VALUE",
4653
* principal: "STRING_VALUE",
47-
* associationStatus: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED",
54+
* associationStatus: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED" || "SUSPENDED" || "SUSPENDING" || "RESTORING",
4855
* nextToken: "STRING_VALUE",
4956
* maxResults: Number("int"),
5057
* };
@@ -56,8 +63,8 @@ export interface GetResourceShareAssociationsCommandOutput extends GetResourceSh
5663
* // resourceShareArn: "STRING_VALUE",
5764
* // resourceShareName: "STRING_VALUE",
5865
* // associatedEntity: "STRING_VALUE",
59-
* // associationType: "PRINCIPAL" || "RESOURCE",
60-
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED",
66+
* // associationType: "PRINCIPAL" || "RESOURCE" || "SOURCE",
67+
* // status: "ASSOCIATING" || "ASSOCIATED" || "FAILED" || "DISASSOCIATING" || "DISASSOCIATED" || "SUSPENDED" || "SUSPENDING" || "RESTORING",
6168
* // statusMessage: "STRING_VALUE",
6269
* // creationTime: new Date("TIMESTAMP"),
6370
* // lastUpdatedTime: new Date("TIMESTAMP"),

0 commit comments

Comments
 (0)