From 48d2ad9706888c8febb005771ff1c4d1b849f551 Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 28 Nov 2023 19:07:18 +0000 Subject: [PATCH] feat(client-customer-profiles): This release introduces DetectProfileObjectType API to auto generate object type mapping. --- clients/client-customer-profiles/README.md | 8 + .../src/CustomerProfiles.ts | 23 ++ .../src/CustomerProfilesClient.ts | 6 + .../DetectProfileObjectTypeCommand.ts | 185 +++++++++++++ .../src/commands/index.ts | 1 + .../src/models/models_0.ts | 259 ++++++++++++------ .../src/protocols/Aws_restJson1.ts | 100 +++++++ .../aws-models/customer-profiles.json | 123 ++++++++- 8 files changed, 614 insertions(+), 91 deletions(-) create mode 100644 clients/client-customer-profiles/src/commands/DetectProfileObjectTypeCommand.ts diff --git a/clients/client-customer-profiles/README.md b/clients/client-customer-profiles/README.md index 6b7972543e27..015532a0d084 100644 --- a/clients/client-customer-profiles/README.md +++ b/clients/client-customer-profiles/README.md @@ -328,6 +328,14 @@ DeleteWorkflow [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/customer-profiles/command/DeleteWorkflowCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-customer-profiles/Interface/DeleteWorkflowCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-customer-profiles/Interface/DeleteWorkflowCommandOutput/) + +
+ +DetectProfileObjectType + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/customer-profiles/command/DetectProfileObjectTypeCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-customer-profiles/Interface/DetectProfileObjectTypeCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-customer-profiles/Interface/DetectProfileObjectTypeCommandOutput/) +
diff --git a/clients/client-customer-profiles/src/CustomerProfiles.ts b/clients/client-customer-profiles/src/CustomerProfiles.ts index a7b5bd5269b2..3601f57d686c 100644 --- a/clients/client-customer-profiles/src/CustomerProfiles.ts +++ b/clients/client-customer-profiles/src/CustomerProfiles.ts @@ -77,6 +77,11 @@ import { DeleteWorkflowCommandInput, DeleteWorkflowCommandOutput, } from "./commands/DeleteWorkflowCommand"; +import { + DetectProfileObjectTypeCommand, + DetectProfileObjectTypeCommandInput, + DetectProfileObjectTypeCommandOutput, +} from "./commands/DetectProfileObjectTypeCommand"; import { GetAutoMergingPreviewCommand, GetAutoMergingPreviewCommandInput, @@ -255,6 +260,7 @@ const commands = { DeleteProfileObjectCommand, DeleteProfileObjectTypeCommand, DeleteWorkflowCommand, + DetectProfileObjectTypeCommand, GetAutoMergingPreviewCommand, GetCalculatedAttributeDefinitionCommand, GetCalculatedAttributeForProfileCommand, @@ -516,6 +522,23 @@ export interface CustomerProfiles { cb: (err: any, data?: DeleteWorkflowCommandOutput) => void ): void; + /** + * @see {@link DetectProfileObjectTypeCommand} + */ + detectProfileObjectType( + args: DetectProfileObjectTypeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + detectProfileObjectType( + args: DetectProfileObjectTypeCommandInput, + cb: (err: any, data?: DetectProfileObjectTypeCommandOutput) => void + ): void; + detectProfileObjectType( + args: DetectProfileObjectTypeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: DetectProfileObjectTypeCommandOutput) => void + ): void; + /** * @see {@link GetAutoMergingPreviewCommand} */ diff --git a/clients/client-customer-profiles/src/CustomerProfilesClient.ts b/clients/client-customer-profiles/src/CustomerProfilesClient.ts index 3344ac447138..c6cf559c886b 100644 --- a/clients/client-customer-profiles/src/CustomerProfilesClient.ts +++ b/clients/client-customer-profiles/src/CustomerProfilesClient.ts @@ -80,6 +80,10 @@ import { DeleteProfileObjectTypeCommandOutput, } from "./commands/DeleteProfileObjectTypeCommand"; import { DeleteWorkflowCommandInput, DeleteWorkflowCommandOutput } from "./commands/DeleteWorkflowCommand"; +import { + DetectProfileObjectTypeCommandInput, + DetectProfileObjectTypeCommandOutput, +} from "./commands/DetectProfileObjectTypeCommand"; import { GetAutoMergingPreviewCommandInput, GetAutoMergingPreviewCommandOutput, @@ -194,6 +198,7 @@ export type ServiceInputTypes = | DeleteProfileObjectCommandInput | DeleteProfileObjectTypeCommandInput | DeleteWorkflowCommandInput + | DetectProfileObjectTypeCommandInput | GetAutoMergingPreviewCommandInput | GetCalculatedAttributeDefinitionCommandInput | GetCalculatedAttributeForProfileCommandInput @@ -250,6 +255,7 @@ export type ServiceOutputTypes = | DeleteProfileObjectCommandOutput | DeleteProfileObjectTypeCommandOutput | DeleteWorkflowCommandOutput + | DetectProfileObjectTypeCommandOutput | GetAutoMergingPreviewCommandOutput | GetCalculatedAttributeDefinitionCommandOutput | GetCalculatedAttributeForProfileCommandOutput diff --git a/clients/client-customer-profiles/src/commands/DetectProfileObjectTypeCommand.ts b/clients/client-customer-profiles/src/commands/DetectProfileObjectTypeCommand.ts new file mode 100644 index 000000000000..a38a87e5371b --- /dev/null +++ b/clients/client-customer-profiles/src/commands/DetectProfileObjectTypeCommand.ts @@ -0,0 +1,185 @@ +// smithy-typescript generated code +import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; +import { Command as $Command } from "@smithy/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, + SMITHY_CONTEXT_KEY, +} from "@smithy/types"; + +import { CustomerProfilesClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CustomerProfilesClient"; +import { + DetectProfileObjectTypeRequest, + DetectProfileObjectTypeRequestFilterSensitiveLog, + DetectProfileObjectTypeResponse, + DetectProfileObjectTypeResponseFilterSensitiveLog, +} from "../models/models_0"; +import { de_DetectProfileObjectTypeCommand, se_DetectProfileObjectTypeCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link DetectProfileObjectTypeCommand}. + */ +export interface DetectProfileObjectTypeCommandInput extends DetectProfileObjectTypeRequest {} +/** + * @public + * + * The output of {@link DetectProfileObjectTypeCommand}. + */ +export interface DetectProfileObjectTypeCommandOutput extends DetectProfileObjectTypeResponse, __MetadataBearer {} + +/** + * @public + *

The process of detecting profile object type mapping by using given objects.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { CustomerProfilesClient, DetectProfileObjectTypeCommand } from "@aws-sdk/client-customer-profiles"; // ES Modules import + * // const { CustomerProfilesClient, DetectProfileObjectTypeCommand } = require("@aws-sdk/client-customer-profiles"); // CommonJS import + * const client = new CustomerProfilesClient(config); + * const input = { // DetectProfileObjectTypeRequest + * Objects: [ // Objects // required + * "STRING_VALUE", + * ], + * DomainName: "STRING_VALUE", // required + * }; + * const command = new DetectProfileObjectTypeCommand(input); + * const response = await client.send(command); + * // { // DetectProfileObjectTypeResponse + * // DetectedProfileObjectTypes: [ // DetectedProfileObjectTypes + * // { // DetectedProfileObjectType + * // SourceLastUpdatedTimestampFormat: "STRING_VALUE", + * // Fields: { // FieldMap + * // "": { // ObjectTypeField + * // Source: "STRING_VALUE", + * // Target: "STRING_VALUE", + * // ContentType: "STRING" || "NUMBER" || "PHONE_NUMBER" || "EMAIL_ADDRESS" || "NAME", + * // }, + * // }, + * // Keys: { // KeyMap + * // "": [ // ObjectTypeKeyList + * // { // ObjectTypeKey + * // StandardIdentifiers: [ // StandardIdentifierList + * // "PROFILE" || "ASSET" || "CASE" || "UNIQUE" || "SECONDARY" || "LOOKUP_ONLY" || "NEW_ONLY" || "ORDER", + * // ], + * // FieldNames: [ // FieldNameList + * // "STRING_VALUE", + * // ], + * // }, + * // ], + * // }, + * // }, + * // ], + * // }; + * + * ``` + * + * @param DetectProfileObjectTypeCommandInput - {@link DetectProfileObjectTypeCommandInput} + * @returns {@link DetectProfileObjectTypeCommandOutput} + * @see {@link DetectProfileObjectTypeCommandInput} for command's `input` shape. + * @see {@link DetectProfileObjectTypeCommandOutput} for command's `response` shape. + * @see {@link CustomerProfilesClientResolvedConfig | config} for CustomerProfilesClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient access to perform this action.

+ * + * @throws {@link BadRequestException} (client fault) + *

The input you provided is invalid.

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal service error occurred.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The requested resource does not exist, or access was denied.

+ * + * @throws {@link ThrottlingException} (client fault) + *

You exceeded the maximum number of requests.

+ * + * @throws {@link CustomerProfilesServiceException} + *

Base exception class for all service exceptions from CustomerProfiles service.

+ * + */ +export class DetectProfileObjectTypeCommand extends $Command< + DetectProfileObjectTypeCommandInput, + DetectProfileObjectTypeCommandOutput, + CustomerProfilesClientResolvedConfig +> { + public static getEndpointParameterInstructions(): EndpointParameterInstructions { + return { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, + }; + } + + /** + * @public + */ + constructor(readonly input: DetectProfileObjectTypeCommandInput) { + super(); + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: CustomerProfilesClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + this.middlewareStack.use( + getEndpointPlugin(configuration, DetectProfileObjectTypeCommand.getEndpointParameterInstructions()) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "CustomerProfilesClient"; + const commandName = "DetectProfileObjectTypeCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: DetectProfileObjectTypeRequestFilterSensitiveLog, + outputFilterSensitiveLog: DetectProfileObjectTypeResponseFilterSensitiveLog, + [SMITHY_CONTEXT_KEY]: { + service: "CustomerProfiles_20200815", + operation: "DetectProfileObjectType", + }, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + /** + * @internal + */ + private serialize(input: DetectProfileObjectTypeCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return se_DetectProfileObjectTypeCommand(input, context); + } + + /** + * @internal + */ + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return de_DetectProfileObjectTypeCommand(output, context); + } +} diff --git a/clients/client-customer-profiles/src/commands/index.ts b/clients/client-customer-profiles/src/commands/index.ts index 75ce03b22a09..9f09cb8c2a7b 100644 --- a/clients/client-customer-profiles/src/commands/index.ts +++ b/clients/client-customer-profiles/src/commands/index.ts @@ -14,6 +14,7 @@ export * from "./DeleteProfileKeyCommand"; export * from "./DeleteProfileObjectCommand"; export * from "./DeleteProfileObjectTypeCommand"; export * from "./DeleteWorkflowCommand"; +export * from "./DetectProfileObjectTypeCommand"; export * from "./GetAutoMergingPreviewCommand"; export * from "./GetCalculatedAttributeDefinitionCommand"; export * from "./GetCalculatedAttributeForProfileCommand"; diff --git a/clients/client-customer-profiles/src/models/models_0.ts b/clients/client-customer-profiles/src/models/models_0.ts index 68627c85a853..ad2f40fa429e 100644 --- a/clients/client-customer-profiles/src/models/models_0.ts +++ b/clients/client-customer-profiles/src/models/models_0.ts @@ -2631,6 +2631,147 @@ export interface DeleteWorkflowRequest { */ export interface DeleteWorkflowResponse {} +/** + * @public + */ +export interface DetectProfileObjectTypeRequest { + /** + * @public + *

A string that is serialized from a JSON object.

+ */ + Objects: string[] | undefined; + + /** + * @public + *

The unique name of the domain.

+ */ + DomainName: string | undefined; +} + +/** + * @public + * @enum + */ +export const FieldContentType = { + EMAIL_ADDRESS: "EMAIL_ADDRESS", + NAME: "NAME", + NUMBER: "NUMBER", + PHONE_NUMBER: "PHONE_NUMBER", + STRING: "STRING", +} as const; + +/** + * @public + */ +export type FieldContentType = (typeof FieldContentType)[keyof typeof FieldContentType]; + +/** + * @public + *

Represents a field in a ProfileObjectType.

+ */ +export interface ObjectTypeField { + /** + * @public + *

A field of a ProfileObject. For example: _source.FirstName, where “_source” is a + * ProfileObjectType of a Zendesk user and “FirstName” is a field in that ObjectType.

+ */ + Source?: string; + + /** + * @public + *

The location of the data in the standard ProfileObject model. For example: + * _profile.Address.PostalCode.

+ */ + Target?: string; + + /** + * @public + *

The content type of the field. Used for determining equality when searching.

+ */ + ContentType?: FieldContentType; +} + +/** + * @public + * @enum + */ +export const StandardIdentifier = { + ASSET: "ASSET", + CASE: "CASE", + LOOKUP_ONLY: "LOOKUP_ONLY", + NEW_ONLY: "NEW_ONLY", + ORDER: "ORDER", + PROFILE: "PROFILE", + SECONDARY: "SECONDARY", + UNIQUE: "UNIQUE", +} as const; + +/** + * @public + */ +export type StandardIdentifier = (typeof StandardIdentifier)[keyof typeof StandardIdentifier]; + +/** + * @public + *

An object that defines the Key element of a ProfileObject. A Key is a special element + * that can be used to search for a customer profile.

+ */ +export interface ObjectTypeKey { + /** + * @public + *

The types of keys that a ProfileObject can have. Each ProfileObject can have only 1 + * UNIQUE key but multiple PROFILE keys. PROFILE, ASSET, CASE, or ORDER means that this key can be + * used to tie an object to a PROFILE, ASSET, CASE, or ORDER respectively. UNIQUE means that it can be + * used to uniquely identify an object. If a key a is marked as SECONDARY, it will be used to + * search for profiles after all other PROFILE keys have been searched. A LOOKUP_ONLY key is + * only used to match a profile but is not persisted to be used for searching of the profile. + * A NEW_ONLY key is only used if the profile does not already exist before the object is + * ingested, otherwise it is only used for matching objects to profiles.

+ */ + StandardIdentifiers?: StandardIdentifier[]; + + /** + * @public + *

The reference for the key name of the fields map.

+ */ + FieldNames?: string[]; +} + +/** + * @public + *

Contains ProfileObjectType mapping information from the model.

+ */ +export interface DetectedProfileObjectType { + /** + * @public + *

The format of sourceLastUpdatedTimestamp that was detected in fields.

+ */ + SourceLastUpdatedTimestampFormat?: string; + + /** + * @public + *

A map of the name and the ObjectType field.

+ */ + Fields?: Record; + + /** + * @public + *

A list of unique keys that can be used to map data to a profile.

+ */ + Keys?: Record; +} + +/** + * @public + */ +export interface DetectProfileObjectTypeResponse { + /** + * @public + *

Detected ProfileObjectType mappings from given objects. A maximum of one mapping is supported.

+ */ + DetectedProfileObjectTypes?: DetectedProfileObjectType[]; +} + /** * @public */ @@ -3439,95 +3580,6 @@ export interface GetProfileObjectTypeRequest { ObjectTypeName: string | undefined; } -/** - * @public - * @enum - */ -export const FieldContentType = { - EMAIL_ADDRESS: "EMAIL_ADDRESS", - NAME: "NAME", - NUMBER: "NUMBER", - PHONE_NUMBER: "PHONE_NUMBER", - STRING: "STRING", -} as const; - -/** - * @public - */ -export type FieldContentType = (typeof FieldContentType)[keyof typeof FieldContentType]; - -/** - * @public - *

Represents a field in a ProfileObjectType.

- */ -export interface ObjectTypeField { - /** - * @public - *

A field of a ProfileObject. For example: _source.FirstName, where “_source” is a - * ProfileObjectType of a Zendesk user and “FirstName” is a field in that ObjectType.

- */ - Source?: string; - - /** - * @public - *

The location of the data in the standard ProfileObject model. For example: - * _profile.Address.PostalCode.

- */ - Target?: string; - - /** - * @public - *

The content type of the field. Used for determining equality when searching.

- */ - ContentType?: FieldContentType; -} - -/** - * @public - * @enum - */ -export const StandardIdentifier = { - ASSET: "ASSET", - CASE: "CASE", - LOOKUP_ONLY: "LOOKUP_ONLY", - NEW_ONLY: "NEW_ONLY", - ORDER: "ORDER", - PROFILE: "PROFILE", - SECONDARY: "SECONDARY", - UNIQUE: "UNIQUE", -} as const; - -/** - * @public - */ -export type StandardIdentifier = (typeof StandardIdentifier)[keyof typeof StandardIdentifier]; - -/** - * @public - *

An object that defines the Key element of a ProfileObject. A Key is a special element - * that can be used to search for a customer profile.

- */ -export interface ObjectTypeKey { - /** - * @public - *

The types of keys that a ProfileObject can have. Each ProfileObject can have only 1 - * UNIQUE key but multiple PROFILE keys. PROFILE, ASSET, CASE, or ORDER means that this key can be - * used to tie an object to a PROFILE, ASSET, CASE, or ORDER respectively. UNIQUE means that it can be - * used to uniquely identify an object. If a key a is marked as SECONDARY, it will be used to - * search for profiles after all other PROFILE keys have been searched. A LOOKUP_ONLY key is - * only used to match a profile but is not persisted to be used for searching of the profile. - * A NEW_ONLY key is only used if the profile does not already exist before the object is - * ingested, otherwise it is only used for matching objects to profiles.

- */ - StandardIdentifiers?: StandardIdentifier[]; - - /** - * @public - *

The reference for the key name of the fields map.

- */ - FieldNames?: string[]; -} - /** * @public */ @@ -6322,6 +6374,35 @@ export const CreateProfileRequestFilterSensitiveLog = (obj: CreateProfileRequest ...(obj.GenderString && { GenderString: SENSITIVE_STRING }), }); +/** + * @internal + */ +export const DetectProfileObjectTypeRequestFilterSensitiveLog = (obj: DetectProfileObjectTypeRequest): any => ({ + ...obj, + ...(obj.Objects && { Objects: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const DetectedProfileObjectTypeFilterSensitiveLog = (obj: DetectedProfileObjectType): any => ({ + ...obj, + ...(obj.Fields && { Fields: SENSITIVE_STRING }), + ...(obj.Keys && { Keys: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const DetectProfileObjectTypeResponseFilterSensitiveLog = (obj: DetectProfileObjectTypeResponse): any => ({ + ...obj, + ...(obj.DetectedProfileObjectTypes && { + DetectedProfileObjectTypes: obj.DetectedProfileObjectTypes.map((item) => + DetectedProfileObjectTypeFilterSensitiveLog(item) + ), + }), +}); + /** * @internal */ diff --git a/clients/client-customer-profiles/src/protocols/Aws_restJson1.ts b/clients/client-customer-profiles/src/protocols/Aws_restJson1.ts index c8770ac85639..6f7ba99fc344 100644 --- a/clients/client-customer-profiles/src/protocols/Aws_restJson1.ts +++ b/clients/client-customer-profiles/src/protocols/Aws_restJson1.ts @@ -56,6 +56,10 @@ import { DeleteProfileObjectTypeCommandOutput, } from "../commands/DeleteProfileObjectTypeCommand"; import { DeleteWorkflowCommandInput, DeleteWorkflowCommandOutput } from "../commands/DeleteWorkflowCommand"; +import { + DetectProfileObjectTypeCommandInput, + DetectProfileObjectTypeCommandOutput, +} from "../commands/DetectProfileObjectTypeCommand"; import { GetAutoMergingPreviewCommandInput, GetAutoMergingPreviewCommandOutput, @@ -724,6 +728,37 @@ export const se_DeleteWorkflowCommand = async ( }); }; +/** + * serializeAws_restJson1DetectProfileObjectTypeCommand + */ +export const se_DetectProfileObjectTypeCommand = async ( + input: DetectProfileObjectTypeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/detect/object-types"; + resolvedPath = __resolvedPath(resolvedPath, input, "DomainName", () => input.DomainName!, "{DomainName}", false); + let body: any; + body = JSON.stringify( + take(input, { + Objects: (_) => _json(_), + }) + ); + return new __HttpRequest({ + protocol, + hostname, + port, + method: "POST", + headers, + path: resolvedPath, + body, + }); +}; + /** * serializeAws_restJson1GetAutoMergingPreviewCommand */ @@ -2787,6 +2822,65 @@ const de_DeleteWorkflowCommandError = async ( } }; +/** + * deserializeAws_restJson1DetectProfileObjectTypeCommand + */ +export const de_DetectProfileObjectTypeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_DetectProfileObjectTypeCommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + DetectedProfileObjectTypes: _json, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1DetectProfileObjectTypeCommandError + */ +const de_DetectProfileObjectTypeCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseErrorBody(output.body, context), + }; + const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "AccessDeniedException": + case "com.amazonaws.customerprofiles#AccessDeniedException": + throw await de_AccessDeniedExceptionRes(parsedOutput, context); + case "BadRequestException": + case "com.amazonaws.customerprofiles#BadRequestException": + throw await de_BadRequestExceptionRes(parsedOutput, context); + case "InternalServerException": + case "com.amazonaws.customerprofiles#InternalServerException": + throw await de_InternalServerExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.customerprofiles#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.customerprofiles#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode, + }); + } +}; + /** * deserializeAws_restJson1GetAutoMergingPreviewCommand */ @@ -5243,6 +5337,8 @@ const se_MatchingRequest = (input: MatchingRequest, context: __SerdeContext): an // se_ObjectFilter omitted. +// se_Objects omitted. + // se_ObjectTypeField omitted. // se_ObjectTypeKey omitted. @@ -5407,6 +5503,10 @@ const de_DestinationSummary = (output: any, context: __SerdeContext): Destinatio }) as any; }; +// de_DetectedProfileObjectType omitted. + +// de_DetectedProfileObjectTypes omitted. + /** * deserializeAws_restJson1DomainList */ diff --git a/codegen/sdk-codegen/aws-models/customer-profiles.json b/codegen/sdk-codegen/aws-models/customer-profiles.json index 3cf6fecd9aaf..d070cbfa189b 100644 --- a/codegen/sdk-codegen/aws-models/customer-profiles.json +++ b/codegen/sdk-codegen/aws-models/customer-profiles.json @@ -1500,6 +1500,9 @@ { "target": "com.amazonaws.customerprofiles#DeleteWorkflow" }, + { + "target": "com.amazonaws.customerprofiles#DetectProfileObjectType" + }, { "target": "com.amazonaws.customerprofiles#GetAutoMergingPreview" }, @@ -3085,6 +3088,109 @@ "smithy.api#documentation": "

Summary information about the Kinesis data stream

" } }, + "com.amazonaws.customerprofiles#DetectProfileObjectType": { + "type": "operation", + "input": { + "target": "com.amazonaws.customerprofiles#DetectProfileObjectTypeRequest" + }, + "output": { + "target": "com.amazonaws.customerprofiles#DetectProfileObjectTypeResponse" + }, + "errors": [ + { + "target": "com.amazonaws.customerprofiles#AccessDeniedException" + }, + { + "target": "com.amazonaws.customerprofiles#BadRequestException" + }, + { + "target": "com.amazonaws.customerprofiles#InternalServerException" + }, + { + "target": "com.amazonaws.customerprofiles#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.customerprofiles#ThrottlingException" + } + ], + "traits": { + "smithy.api#documentation": "

The process of detecting profile object type mapping by using given objects.

", + "smithy.api#http": { + "method": "POST", + "uri": "/domains/{DomainName}/detect/object-types", + "code": 200 + } + } + }, + "com.amazonaws.customerprofiles#DetectProfileObjectTypeRequest": { + "type": "structure", + "members": { + "Objects": { + "target": "com.amazonaws.customerprofiles#Objects", + "traits": { + "smithy.api#documentation": "

A string that is serialized from a JSON object.

", + "smithy.api#required": {} + } + }, + "DomainName": { + "target": "com.amazonaws.customerprofiles#name", + "traits": { + "smithy.api#documentation": "

The unique name of the domain.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.customerprofiles#DetectProfileObjectTypeResponse": { + "type": "structure", + "members": { + "DetectedProfileObjectTypes": { + "target": "com.amazonaws.customerprofiles#DetectedProfileObjectTypes", + "traits": { + "smithy.api#documentation": "

Detected ProfileObjectType mappings from given objects. A maximum of one mapping is supported.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.customerprofiles#DetectedProfileObjectType": { + "type": "structure", + "members": { + "SourceLastUpdatedTimestampFormat": { + "target": "com.amazonaws.customerprofiles#string1To255", + "traits": { + "smithy.api#documentation": "

The format of sourceLastUpdatedTimestamp that was detected in fields.

" + } + }, + "Fields": { + "target": "com.amazonaws.customerprofiles#FieldMap", + "traits": { + "smithy.api#documentation": "

A map of the name and the ObjectType field.

" + } + }, + "Keys": { + "target": "com.amazonaws.customerprofiles#KeyMap", + "traits": { + "smithy.api#documentation": "

A list of unique keys that can be used to map data to a profile.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains ProfileObjectType mapping information from the model.

" + } + }, + "com.amazonaws.customerprofiles#DetectedProfileObjectTypes": { + "type": "list", + "member": { + "target": "com.amazonaws.customerprofiles#DetectedProfileObjectType" + } + }, "com.amazonaws.customerprofiles#DomainList": { "type": "list", "member": { @@ -3134,8 +3240,8 @@ "type": "double", "traits": { "smithy.api#range": { - "min": 0, - "max": 1 + "min": 0.0, + "max": 1.0 } } }, @@ -7335,6 +7441,19 @@ "target": "com.amazonaws.customerprofiles#typeName" } }, + "com.amazonaws.customerprofiles#Objects": { + "type": "list", + "member": { + "target": "com.amazonaws.customerprofiles#stringifiedJson" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 5 + }, + "smithy.api#sensitive": {} + } + }, "com.amazonaws.customerprofiles#Operator": { "type": "enum", "members": {