Skip to content

Commit 65b66c7

Browse files
author
awstools
committed
feat(client-marketplace-catalog): Added three new APIs to support tagging and tag-based authorization: TagResource, UntagResource, and ListTagsForResource. Added optional parameters to the StartChangeSet API to support tagging a resource while making a request to create it.
1 parent 7151ff1 commit 65b66c7

File tree

12 files changed

+1282
-136
lines changed

12 files changed

+1282
-136
lines changed

clients/client-marketplace-catalog/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
AWS SDK for JavaScript MarketplaceCatalog Client for Node.js, Browser and React Native.
1111

12-
<p>Catalog API actions allow you to manage your entities through list, describe, and update
13-
capabilities. An entity can be a product or an offer on AWS Marketplace. </p>
14-
12+
<p>Catalog API actions allow you to manage your entities through list, describe, and
13+
update capabilities. An entity can be a product or an offer on AWS Marketplace. </p>
1514
<p>You can automate your entity update process by integrating the AWS Marketplace Catalog
1615
API with your AWS Marketplace product build or deployment pipelines. You can also create
1716
your own applications on top of the Catalog API to manage your products on AWS

clients/client-marketplace-catalog/src/MarketplaceCatalog.ts

Lines changed: 114 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,27 @@ import {
2626
ListEntitiesCommandInput,
2727
ListEntitiesCommandOutput,
2828
} from "./commands/ListEntitiesCommand";
29+
import {
30+
ListTagsForResourceCommand,
31+
ListTagsForResourceCommandInput,
32+
ListTagsForResourceCommandOutput,
33+
} from "./commands/ListTagsForResourceCommand";
2934
import {
3035
StartChangeSetCommand,
3136
StartChangeSetCommandInput,
3237
StartChangeSetCommandOutput,
3338
} from "./commands/StartChangeSetCommand";
39+
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
40+
import {
41+
UntagResourceCommand,
42+
UntagResourceCommandInput,
43+
UntagResourceCommandOutput,
44+
} from "./commands/UntagResourceCommand";
3445
import { MarketplaceCatalogClient } from "./MarketplaceCatalogClient";
3546

3647
/**
37-
* <p>Catalog API actions allow you to manage your entities through list, describe, and update
38-
* capabilities. An entity can be a product or an offer on AWS Marketplace. </p>
39-
*
48+
* <p>Catalog API actions allow you to manage your entities through list, describe, and
49+
* update capabilities. An entity can be a product or an offer on AWS Marketplace. </p>
4050
* <p>You can automate your entity update process by integrating the AWS Marketplace Catalog
4151
* API with your AWS Marketplace product build or deployment pipelines. You can also create
4252
* your own applications on top of the Catalog API to manage your products on AWS
@@ -147,7 +157,6 @@ export class MarketplaceCatalog extends MarketplaceCatalogClient {
147157
* can filter this list by providing any combination of <code>entityId</code>,
148158
* <code>ChangeSetName</code>, and status. If you provide more than one filter, the API
149159
* operation applies a logical AND between the filters.</p>
150-
*
151160
* <p>You can describe a change during the 60-day request history retention period for API
152161
* calls.</p>
153162
*/
@@ -210,19 +219,49 @@ export class MarketplaceCatalog extends MarketplaceCatalogClient {
210219
}
211220

212221
/**
213-
* <p>This operation allows you to request changes for your entities. Within a single
214-
* ChangeSet, you cannot start the same change type against the same entity multiple times.
215-
* Additionally, when a ChangeSet is running, all the entities targeted by the different
216-
* changes are locked until the ChangeSet has completed (either succeeded, cancelled, or failed). If
217-
* you try to start a ChangeSet containing a change against an entity that is already
218-
* locked, you will receive a <code>ResourceInUseException</code>.</p>
219-
*
220-
* <p>For example, you cannot start the ChangeSet described in the <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/API_StartChangeSet.html#API_StartChangeSet_Examples">example</a> later in this topic, because it contains two changes to execute the same change
221-
* type (<code>AddRevisions</code>) against the same entity
222-
* (<code>entity-id@1)</code>.</p>
223-
*
224-
* <p>For more information about working with change sets, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets">
225-
* Working with change sets</a>.</p>
222+
* <p>Lists all tags that have been added to a resource (either an <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#catalog-api-entities">entity</a> or <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets">change set</a>).</p>
223+
*/
224+
public listTagsForResource(
225+
args: ListTagsForResourceCommandInput,
226+
options?: __HttpHandlerOptions
227+
): Promise<ListTagsForResourceCommandOutput>;
228+
public listTagsForResource(
229+
args: ListTagsForResourceCommandInput,
230+
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
231+
): void;
232+
public listTagsForResource(
233+
args: ListTagsForResourceCommandInput,
234+
options: __HttpHandlerOptions,
235+
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
236+
): void;
237+
public listTagsForResource(
238+
args: ListTagsForResourceCommandInput,
239+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListTagsForResourceCommandOutput) => void),
240+
cb?: (err: any, data?: ListTagsForResourceCommandOutput) => void
241+
): Promise<ListTagsForResourceCommandOutput> | void {
242+
const command = new ListTagsForResourceCommand(args);
243+
if (typeof optionsOrCb === "function") {
244+
this.send(command, optionsOrCb);
245+
} else if (typeof cb === "function") {
246+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
247+
this.send(command, optionsOrCb || {}, cb);
248+
} else {
249+
return this.send(command, optionsOrCb);
250+
}
251+
}
252+
253+
/**
254+
* <p>Allows you to request changes for your entities. Within a single
255+
* <code>ChangeSet</code>, you can't start the same change type against the same entity
256+
* multiple times. Additionally, when a <code>ChangeSet</code> is running, all the entities
257+
* targeted by the different changes are locked until the change set has completed (either
258+
* succeeded, cancelled, or failed). If you try to start a change set containing a change
259+
* against an entity that is already locked, you will receive a
260+
* <code>ResourceInUseException</code> error.</p>
261+
* <p>For example, you can't start the <code>ChangeSet</code> described in the <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/API_StartChangeSet.html#API_StartChangeSet_Examples">example</a> later in this topic because it contains two changes to run the same
262+
* change type (<code>AddRevisions</code>) against the same entity
263+
* (<code>entity-id@1</code>).</p>
264+
* <p>For more information about working with change sets, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets"> Working with change sets</a>.</p>
226265
*/
227266
public startChangeSet(
228267
args: StartChangeSetCommandInput,
@@ -252,4 +291,62 @@ export class MarketplaceCatalog extends MarketplaceCatalogClient {
252291
return this.send(command, optionsOrCb);
253292
}
254293
}
294+
295+
/**
296+
* <p>Tags a resource (either an <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#catalog-api-entities">entity</a> or <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets">change set</a>).</p>
297+
*/
298+
public tagResource(args: TagResourceCommandInput, options?: __HttpHandlerOptions): Promise<TagResourceCommandOutput>;
299+
public tagResource(args: TagResourceCommandInput, cb: (err: any, data?: TagResourceCommandOutput) => void): void;
300+
public tagResource(
301+
args: TagResourceCommandInput,
302+
options: __HttpHandlerOptions,
303+
cb: (err: any, data?: TagResourceCommandOutput) => void
304+
): void;
305+
public tagResource(
306+
args: TagResourceCommandInput,
307+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TagResourceCommandOutput) => void),
308+
cb?: (err: any, data?: TagResourceCommandOutput) => void
309+
): Promise<TagResourceCommandOutput> | void {
310+
const command = new TagResourceCommand(args);
311+
if (typeof optionsOrCb === "function") {
312+
this.send(command, optionsOrCb);
313+
} else if (typeof cb === "function") {
314+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
315+
this.send(command, optionsOrCb || {}, cb);
316+
} else {
317+
return this.send(command, optionsOrCb);
318+
}
319+
}
320+
321+
/**
322+
* <p>Removes a tag or list of tags from a resource (either an <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#catalog-api-entities">entity</a> or <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets">change set</a>).</p>
323+
*/
324+
public untagResource(
325+
args: UntagResourceCommandInput,
326+
options?: __HttpHandlerOptions
327+
): Promise<UntagResourceCommandOutput>;
328+
public untagResource(
329+
args: UntagResourceCommandInput,
330+
cb: (err: any, data?: UntagResourceCommandOutput) => void
331+
): void;
332+
public untagResource(
333+
args: UntagResourceCommandInput,
334+
options: __HttpHandlerOptions,
335+
cb: (err: any, data?: UntagResourceCommandOutput) => void
336+
): void;
337+
public untagResource(
338+
args: UntagResourceCommandInput,
339+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UntagResourceCommandOutput) => void),
340+
cb?: (err: any, data?: UntagResourceCommandOutput) => void
341+
): Promise<UntagResourceCommandOutput> | void {
342+
const command = new UntagResourceCommand(args);
343+
if (typeof optionsOrCb === "function") {
344+
this.send(command, optionsOrCb);
345+
} else if (typeof cb === "function") {
346+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
347+
this.send(command, optionsOrCb || {}, cb);
348+
} else {
349+
return this.send(command, optionsOrCb);
350+
}
351+
}
255352
}

clients/client-marketplace-catalog/src/MarketplaceCatalogClient.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ import { DescribeChangeSetCommandInput, DescribeChangeSetCommandOutput } from ".
5252
import { DescribeEntityCommandInput, DescribeEntityCommandOutput } from "./commands/DescribeEntityCommand";
5353
import { ListChangeSetsCommandInput, ListChangeSetsCommandOutput } from "./commands/ListChangeSetsCommand";
5454
import { ListEntitiesCommandInput, ListEntitiesCommandOutput } from "./commands/ListEntitiesCommand";
55+
import {
56+
ListTagsForResourceCommandInput,
57+
ListTagsForResourceCommandOutput,
58+
} from "./commands/ListTagsForResourceCommand";
5559
import { StartChangeSetCommandInput, StartChangeSetCommandOutput } from "./commands/StartChangeSetCommand";
60+
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
61+
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
5662
import {
5763
ClientInputEndpointParameters,
5864
ClientResolvedEndpointParameters,
@@ -67,15 +73,21 @@ export type ServiceInputTypes =
6773
| DescribeEntityCommandInput
6874
| ListChangeSetsCommandInput
6975
| ListEntitiesCommandInput
70-
| StartChangeSetCommandInput;
76+
| ListTagsForResourceCommandInput
77+
| StartChangeSetCommandInput
78+
| TagResourceCommandInput
79+
| UntagResourceCommandInput;
7180

7281
export type ServiceOutputTypes =
7382
| CancelChangeSetCommandOutput
7483
| DescribeChangeSetCommandOutput
7584
| DescribeEntityCommandOutput
7685
| ListChangeSetsCommandOutput
7786
| ListEntitiesCommandOutput
78-
| StartChangeSetCommandOutput;
87+
| ListTagsForResourceCommandOutput
88+
| StartChangeSetCommandOutput
89+
| TagResourceCommandOutput
90+
| UntagResourceCommandOutput;
7991

8092
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
8193
/**
@@ -227,9 +239,8 @@ type MarketplaceCatalogClientResolvedConfigType = __SmithyResolvedConfiguration<
227239
export interface MarketplaceCatalogClientResolvedConfig extends MarketplaceCatalogClientResolvedConfigType {}
228240

229241
/**
230-
* <p>Catalog API actions allow you to manage your entities through list, describe, and update
231-
* capabilities. An entity can be a product or an offer on AWS Marketplace. </p>
232-
*
242+
* <p>Catalog API actions allow you to manage your entities through list, describe, and
243+
* update capabilities. An entity can be a product or an offer on AWS Marketplace. </p>
233244
* <p>You can automate your entity update process by integrating the AWS Marketplace Catalog
234245
* API with your AWS Marketplace product build or deployment pipelines. You can also create
235246
* your own applications on top of the Catalog API to manage your products on AWS

clients/client-marketplace-catalog/src/commands/ListChangeSetsCommand.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export interface ListChangeSetsCommandOutput extends ListChangeSetsResponse, __M
3737
* can filter this list by providing any combination of <code>entityId</code>,
3838
* <code>ChangeSetName</code>, and status. If you provide more than one filter, the API
3939
* operation applies a logical AND between the filters.</p>
40-
*
4140
* <p>You can describe a change during the 60-day request history retention period for API
4241
* calls.</p>
4342
* @example
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
MarketplaceCatalogClientResolvedConfig,
18+
ServiceInputTypes,
19+
ServiceOutputTypes,
20+
} from "../MarketplaceCatalogClient";
21+
import {
22+
ListTagsForResourceRequest,
23+
ListTagsForResourceRequestFilterSensitiveLog,
24+
ListTagsForResourceResponse,
25+
ListTagsForResourceResponseFilterSensitiveLog,
26+
} from "../models/models_0";
27+
import {
28+
deserializeAws_restJson1ListTagsForResourceCommand,
29+
serializeAws_restJson1ListTagsForResourceCommand,
30+
} from "../protocols/Aws_restJson1";
31+
32+
export interface ListTagsForResourceCommandInput extends ListTagsForResourceRequest {}
33+
export interface ListTagsForResourceCommandOutput extends ListTagsForResourceResponse, __MetadataBearer {}
34+
35+
/**
36+
* <p>Lists all tags that have been added to a resource (either an <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#catalog-api-entities">entity</a> or <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets">change set</a>).</p>
37+
* @example
38+
* Use a bare-bones client and the command you need to make an API call.
39+
* ```javascript
40+
* import { MarketplaceCatalogClient, ListTagsForResourceCommand } from "@aws-sdk/client-marketplace-catalog"; // ES Modules import
41+
* // const { MarketplaceCatalogClient, ListTagsForResourceCommand } = require("@aws-sdk/client-marketplace-catalog"); // CommonJS import
42+
* const client = new MarketplaceCatalogClient(config);
43+
* const command = new ListTagsForResourceCommand(input);
44+
* const response = await client.send(command);
45+
* ```
46+
*
47+
* @see {@link ListTagsForResourceCommandInput} for command's `input` shape.
48+
* @see {@link ListTagsForResourceCommandOutput} for command's `response` shape.
49+
* @see {@link MarketplaceCatalogClientResolvedConfig | config} for MarketplaceCatalogClient's `config` shape.
50+
*
51+
*/
52+
export class ListTagsForResourceCommand extends $Command<
53+
ListTagsForResourceCommandInput,
54+
ListTagsForResourceCommandOutput,
55+
MarketplaceCatalogClientResolvedConfig
56+
> {
57+
// Start section: command_properties
58+
// End section: command_properties
59+
60+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
61+
return {
62+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
63+
Endpoint: { type: "builtInParams", name: "endpoint" },
64+
Region: { type: "builtInParams", name: "region" },
65+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
66+
};
67+
}
68+
69+
constructor(readonly input: ListTagsForResourceCommandInput) {
70+
// Start section: command_constructor
71+
super();
72+
// End section: command_constructor
73+
}
74+
75+
/**
76+
* @internal
77+
*/
78+
resolveMiddleware(
79+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
80+
configuration: MarketplaceCatalogClientResolvedConfig,
81+
options?: __HttpHandlerOptions
82+
): Handler<ListTagsForResourceCommandInput, ListTagsForResourceCommandOutput> {
83+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
84+
this.middlewareStack.use(
85+
getEndpointPlugin(configuration, ListTagsForResourceCommand.getEndpointParameterInstructions())
86+
);
87+
88+
const stack = clientStack.concat(this.middlewareStack);
89+
90+
const { logger } = configuration;
91+
const clientName = "MarketplaceCatalogClient";
92+
const commandName = "ListTagsForResourceCommand";
93+
const handlerExecutionContext: HandlerExecutionContext = {
94+
logger,
95+
clientName,
96+
commandName,
97+
inputFilterSensitiveLog: ListTagsForResourceRequestFilterSensitiveLog,
98+
outputFilterSensitiveLog: ListTagsForResourceResponseFilterSensitiveLog,
99+
};
100+
const { requestHandler } = configuration;
101+
return stack.resolve(
102+
(request: FinalizeHandlerArguments<any>) =>
103+
requestHandler.handle(request.request as __HttpRequest, options || {}),
104+
handlerExecutionContext
105+
);
106+
}
107+
108+
private serialize(input: ListTagsForResourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
109+
return serializeAws_restJson1ListTagsForResourceCommand(input, context);
110+
}
111+
112+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<ListTagsForResourceCommandOutput> {
113+
return deserializeAws_restJson1ListTagsForResourceCommand(output, context);
114+
}
115+
116+
// Start section: command_body_extra
117+
// End section: command_body_extra
118+
}

0 commit comments

Comments
 (0)