Skip to content

Commit

Permalink
feat(client-marketplace-catalog): This release adds support for Docum…
Browse files Browse the repository at this point in the history
…ent type as an alternative for stringified JSON for StartChangeSet, DescribeChangeSet and DescribeEntity APIs
  • Loading branch information
awstools committed Oct 6, 2023
1 parent 55995ec commit b689c24
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface DeleteResourcePolicyCommandOutput extends DeleteResourcePolicyR

/**
* @public
* <p>Deletes a resource-based policy on an Entity that is identified by its resource
* <p>Deletes a resource-based policy on an entity that is identified by its resource
* ARN.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface DescribeChangeSetCommandOutput extends DescribeChangeSetRespons
* // Identifier: "STRING_VALUE",
* // },
* // Details: "STRING_VALUE",
* // DetailsDocument: "DOCUMENT_VALUE",
* // ErrorDetailList: [ // ErrorDetailList
* // { // ErrorDetail
* // ErrorCode: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface DescribeEntityCommandOutput extends DescribeEntityResponse, __M
* // EntityArn: "STRING_VALUE",
* // LastModifiedDate: "STRING_VALUE",
* // Details: "STRING_VALUE",
* // DetailsDocument: "DOCUMENT_VALUE",
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface GetResourcePolicyCommandOutput extends GetResourcePolicyRespons

/**
* @public
* <p>Gets a resource-based policy of an Entity that is identified by its resource
* <p>Gets a resource-based policy of an entity that is identified by its resource
* ARN.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface PutResourcePolicyCommandOutput extends PutResourcePolicyRespons

/**
* @public
* <p>Attaches a resource-based policy to an Entity. Examples of an entity include:
* <p>Attaches a resource-based policy to an entity. Examples of an entity include:
* <code>AmiProduct</code> and <code>ContainerProduct</code>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export interface StartChangeSetCommandOutput extends StartChangeSetResponse, __M
* <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
* change type (<code>AddRevisions</code>) against the same entity
* (<code>entity-id@1</code>).</p>
* <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>. For information on change types for single-AMI
* products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/ami-products.html#working-with-single-AMI-products">Working with single-AMI products</a>. Als, for more information on change types
* available for container-based products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/container-products.html#working-with-container-products">Working with container products</a>.</p>
* <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>. For information about change types for
* single-AMI products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/ami-products.html#working-with-single-AMI-products">Working with single-AMI products</a>. Also, for more information about change
* types available for container-based products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/container-products.html#working-with-container-products">Working with container products</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -75,7 +75,8 @@ export interface StartChangeSetCommandOutput extends StartChangeSetResponse, __M
* Value: "STRING_VALUE", // required
* },
* ],
* Details: "STRING_VALUE", // required
* Details: "STRING_VALUE",
* DetailsDocument: "DOCUMENT_VALUE",
* ChangeName: "STRING_VALUE",
* },
* ],
Expand Down
51 changes: 40 additions & 11 deletions clients/client-marketplace-catalog/src/models/models_0.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// smithy-typescript generated code
import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
import { DocumentType as __DocumentType } from "@smithy/types";

import { MarketplaceCatalogServiceException as __BaseException } from "./MarketplaceCatalogServiceException";

Expand Down Expand Up @@ -182,7 +183,7 @@ export class ValidationException extends __BaseException {
export interface DeleteResourcePolicyRequest {
/**
* @public
* <p>The Amazon Resource Name (ARN) of the Entity resource that is associated with the
* <p>The Amazon Resource Name (ARN) of the entity resource that is associated with the
* resource policy.</p>
*/
ResourceArn: string | undefined;
Expand Down Expand Up @@ -275,6 +276,12 @@ export interface ChangeSummary {
*/
Details?: string;

/**
* @public
* <p>The JSON value of the details specific to the change type of the requested change.</p>
*/
DetailsDocument?: __DocumentType;

/**
* @public
* <p>An array of <code>ErrorDetail</code> objects associated with the change.</p>
Expand Down Expand Up @@ -442,6 +449,12 @@ export interface DescribeEntityResponse {
* <p>This stringified JSON object includes the details of the entity.</p>
*/
Details?: string;

/**
* @public
* <p>The JSON value of the details specific to the entity.</p>
*/
DetailsDocument?: __DocumentType;
}

/**
Expand Down Expand Up @@ -472,7 +485,7 @@ export class ResourceNotSupportedException extends __BaseException {
export interface GetResourcePolicyRequest {
/**
* @public
* <p>The Amazon Resource Name (ARN) of the Entity resource that is associated with the
* <p>The Amazon Resource Name (ARN) of the entity resource that is associated with the
* resource policy.</p>
*/
ResourceArn: string | undefined;
Expand Down Expand Up @@ -575,8 +588,9 @@ export interface Sort {
/**
* @public
* <p>For <code>ListEntities</code>, supported attributes include
* <code>LastModifiedDate</code> (default), <code>Visibility</code>,
* <code>EntityId</code>, and <code>Name</code>.</p>
* <code>LastModifiedDate</code> (default) and <code>EntityId</code>. In addition to
* <code>LastModifiedDate</code> and <code>EntityId</code>, each
* <code>EntityType</code> might support additional fields.</p>
* <p>For <code>ListChangeSets</code>, supported attributes include <code>StartTime</code>
* and <code>EndTime</code>.</p>
*/
Expand Down Expand Up @@ -768,6 +782,14 @@ export interface ListEntitiesRequest {
*/
MaxResults?: number;

/**
* @public
* <p>Filters the returned set of entities based on their owner. The default is
* <code>SELF</code>. To list entities shared with you
* through AWS Resource Access Manager (AWS RAM), set to <code>SHARED</code>. Entities shared through the AWS Marketplace
* Catalog API <code>PutResourcePolicy</code> operation can't be discovered through the
* <code>SHARED</code> parameter.</p>
*/
OwnershipType?: OwnershipType | string;
}

Expand Down Expand Up @@ -890,8 +912,8 @@ export interface ListTagsForResourceResponse {
export interface PutResourcePolicyRequest {
/**
* @public
* <p>The Amazon Resource Name (ARN) of the Entity resource you want to associate with a
* resource policy. </p>
* <p>The Amazon Resource Name (ARN) of the entity resource you want to associate with a
* resource policy.</p>
*/
ResourceArn: string | undefined;

Expand Down Expand Up @@ -940,7 +962,7 @@ export interface Change {
* <p>Change types are single string values that describe your intention for the change.
* Each change type is unique for each <code>EntityType</code> provided in the change's
* scope. For more information on change types available for single-AMI products, see
* <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/ami-products.html#working-with-single-AMI-products">Working with single-AMI products</a>. Also, for more information on change
* <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/ami-products.html#working-with-single-AMI-products">Working with single-AMI products</a>. Also, for more information about change
* types available for container-based products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/container-products.html#working-with-container-products">Working with container products</a>.</p>
*/
ChangeType: string | undefined;
Expand All @@ -959,12 +981,19 @@ export interface Change {

/**
* @public
* <p>This object contains details specific to the change type of the requested
* change. For more
* information on change types available for single-AMI products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/ami-products.html#working-with-single-AMI-products">Working with single-AMI products</a>. Also, for more information on change
* <p>This object contains details specific to the change type of the requested change. For
* more information about change types available for single-AMI products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/ami-products.html#working-with-single-AMI-products">Working with single-AMI products</a>. Also, for more information about change
* types available for container-based products, see <a href="https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/container-products.html#working-with-container-products">Working with container products</a>.</p>
*/
Details: string | undefined;
Details?: string;

/**
* @public
* <p>Alternative field that accepts a JSON value instead of a string for
* <code>ChangeType</code> details. You can use either <code>Details</code> or
* <code>DetailsDocument</code>, but not both.</p>
*/
DetailsDocument?: __DocumentType;

/**
* @public
Expand Down
72 changes: 66 additions & 6 deletions clients/client-marketplace-catalog/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
withBaseException,
} from "@smithy/smithy-client";
import {
DocumentType as __DocumentType,
Endpoint as __Endpoint,
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
Expand Down Expand Up @@ -41,6 +42,7 @@ import { MarketplaceCatalogServiceException as __BaseException } from "../models
import {
AccessDeniedException,
Change,
ChangeSummary,
Entity,
Filter,
InternalServiceException,
Expand Down Expand Up @@ -330,7 +332,7 @@ export const se_StartChangeSetCommand = async (
body = JSON.stringify(
take(input, {
Catalog: [],
ChangeSet: (_) => _json(_),
ChangeSet: (_) => se_RequestedChangeList(_, context),
ChangeSetName: [],
ChangeSetTags: (_) => _json(_),
ClientRequestToken: [true, (_) => _ ?? generateIdempotencyToken()],
Expand Down Expand Up @@ -540,7 +542,7 @@ export const de_DescribeChangeSetCommand = async (
});
const data: Record<string, any> = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
const doc = take(data, {
ChangeSet: _json,
ChangeSet: (_) => de_ChangeSetDescription(_, context),
ChangeSetArn: __expectString,
ChangeSetId: __expectString,
ChangeSetName: __expectString,
Expand Down Expand Up @@ -608,6 +610,7 @@ export const de_DescribeEntityCommand = async (
const data: Record<string, any> = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
const doc = take(data, {
Details: __expectString,
DetailsDocument: (_) => de_JsonDocumentType(_, context),
EntityArn: __expectString,
EntityIdentifier: __expectString,
EntityType: __expectString,
Expand Down Expand Up @@ -1280,15 +1283,43 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont
return __decorateServiceException(exception, parsedOutput.body);
};

// se_Change omitted.
/**
* serializeAws_restJson1Change
*/
const se_Change = (input: Change, context: __SerdeContext): any => {
return take(input, {
ChangeName: [],
ChangeType: [],
Details: [],
DetailsDocument: (_) => se_JsonDocumentType(_, context),
Entity: _json,
EntityTags: _json,
});
};

// se_Entity omitted.

// se_Filter omitted.

// se_FilterList omitted.

// se_RequestedChangeList omitted.
/**
* serializeAws_restJson1JsonDocumentType
*/
const se_JsonDocumentType = (input: __DocumentType, context: __SerdeContext): any => {
return input;
};

/**
* serializeAws_restJson1RequestedChangeList
*/
const se_RequestedChangeList = (input: Change[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
.map((entry) => {
return se_Change(entry, context);
});
};

// se_Sort omitted.

Expand All @@ -1300,13 +1331,35 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont

// se_ValueList omitted.

// de_ChangeSetDescription omitted.
/**
* deserializeAws_restJson1ChangeSetDescription
*/
const de_ChangeSetDescription = (output: any, context: __SerdeContext): ChangeSummary[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
return de_ChangeSummary(entry, context);
});
return retVal;
};

// de_ChangeSetSummaryList omitted.

// de_ChangeSetSummaryListItem omitted.

// de_ChangeSummary omitted.
/**
* deserializeAws_restJson1ChangeSummary
*/
const de_ChangeSummary = (output: any, context: __SerdeContext): ChangeSummary => {
return take(output, {
ChangeName: __expectString,
ChangeType: __expectString,
Details: __expectString,
DetailsDocument: (_: any) => de_JsonDocumentType(_, context),
Entity: _json,
ErrorDetailList: _json,
}) as any;
};

// de_Entity omitted.

Expand All @@ -1318,6 +1371,13 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont

// de_ErrorDetailList omitted.

/**
* deserializeAws_restJson1JsonDocumentType
*/
const de_JsonDocumentType = (output: any, context: __SerdeContext): __DocumentType => {
return output;
};

// de_ResourceIdList omitted.

// de_Tag omitted.
Expand Down
Loading

0 comments on commit b689c24

Please sign in to comment.