Skip to content

Commit

Permalink
feat(client-connect): This release adds support for more granular bil…
Browse files Browse the repository at this point in the history
…ling using tags (key:value pairs)
  • Loading branch information
awstools committed Dec 14, 2023
1 parent c81ff02 commit 417de03
Show file tree
Hide file tree
Showing 13 changed files with 916 additions and 97 deletions.
16 changes: 16 additions & 0 deletions clients/client-connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,14 @@ SuspendContactRecording

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/connect/command/SuspendContactRecordingCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/SuspendContactRecordingCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/SuspendContactRecordingCommandOutput/)

</details>
<details>
<summary>
TagContact
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/connect/command/TagContactCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/TagContactCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/TagContactCommandOutput/)

</details>
<details>
<summary>
Expand All @@ -1676,6 +1684,14 @@ TransferContact

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/connect/command/TransferContactCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/TransferContactCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/TransferContactCommandOutput/)

</details>
<details>
<summary>
UntagContact
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/connect/command/UntagContactCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/UntagContactCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-connect/Interface/UntagContactCommandOutput/)

</details>
<details>
<summary>
Expand Down
30 changes: 30 additions & 0 deletions clients/client-connect/src/Connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,18 @@ import {
SuspendContactRecordingCommandInput,
SuspendContactRecordingCommandOutput,
} from "./commands/SuspendContactRecordingCommand";
import { TagContactCommand, TagContactCommandInput, TagContactCommandOutput } from "./commands/TagContactCommand";
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import {
TransferContactCommand,
TransferContactCommandInput,
TransferContactCommandOutput,
} from "./commands/TransferContactCommand";
import {
UntagContactCommand,
UntagContactCommandInput,
UntagContactCommandOutput,
} from "./commands/UntagContactCommand";
import {
UntagResourceCommand,
UntagResourceCommandInput,
Expand Down Expand Up @@ -1245,8 +1251,10 @@ const commands = {
StopContactStreamingCommand,
SubmitContactEvaluationCommand,
SuspendContactRecordingCommand,
TagContactCommand,
TagResourceCommand,
TransferContactCommand,
UntagContactCommand,
UntagResourceCommand,
UpdateAgentStatusCommand,
UpdateContactCommand,
Expand Down Expand Up @@ -4137,6 +4145,17 @@ export interface Connect {
cb: (err: any, data?: SuspendContactRecordingCommandOutput) => void
): void;

/**
* @see {@link TagContactCommand}
*/
tagContact(args: TagContactCommandInput, options?: __HttpHandlerOptions): Promise<TagContactCommandOutput>;
tagContact(args: TagContactCommandInput, cb: (err: any, data?: TagContactCommandOutput) => void): void;
tagContact(
args: TagContactCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TagContactCommandOutput) => void
): void;

/**
* @see {@link TagResourceCommand}
*/
Expand All @@ -4162,6 +4181,17 @@ export interface Connect {
cb: (err: any, data?: TransferContactCommandOutput) => void
): void;

/**
* @see {@link UntagContactCommand}
*/
untagContact(args: UntagContactCommandInput, options?: __HttpHandlerOptions): Promise<UntagContactCommandOutput>;
untagContact(args: UntagContactCommandInput, cb: (err: any, data?: UntagContactCommandOutput) => void): void;
untagContact(
args: UntagContactCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UntagContactCommandOutput) => void
): void;

/**
* @see {@link UntagResourceCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-connect/src/ConnectClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,10 @@ import {
SuspendContactRecordingCommandInput,
SuspendContactRecordingCommandOutput,
} from "./commands/SuspendContactRecordingCommand";
import { TagContactCommandInput, TagContactCommandOutput } from "./commands/TagContactCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { TransferContactCommandInput, TransferContactCommandOutput } from "./commands/TransferContactCommand";
import { UntagContactCommandInput, UntagContactCommandOutput } from "./commands/UntagContactCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import { UpdateAgentStatusCommandInput, UpdateAgentStatusCommandOutput } from "./commands/UpdateAgentStatusCommand";
import {
Expand Down Expand Up @@ -870,8 +872,10 @@ export type ServiceInputTypes =
| StopContactStreamingCommandInput
| SubmitContactEvaluationCommandInput
| SuspendContactRecordingCommandInput
| TagContactCommandInput
| TagResourceCommandInput
| TransferContactCommandInput
| UntagContactCommandInput
| UntagResourceCommandInput
| UpdateAgentStatusCommandInput
| UpdateContactAttributesCommandInput
Expand Down Expand Up @@ -1102,8 +1106,10 @@ export type ServiceOutputTypes =
| StopContactStreamingCommandOutput
| SubmitContactEvaluationCommandOutput
| SuspendContactRecordingCommandOutput
| TagContactCommandOutput
| TagResourceCommandOutput
| TransferContactCommandOutput
| UntagContactCommandOutput
| UntagResourceCommandOutput
| UpdateAgentStatusCommandOutput
| UpdateContactAttributesCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export interface BatchAssociateAnalyticsDataSetCommandOutput
/**
* @public
* <p>This API is in preview release for Amazon Connect and is subject to change.</p>
* <p>Associates a list of analytics datasets for a given Amazon Connect instance to a target account. You can
* associate multiple datasets in a single call.</p>
* <p>Associates a list of analytics datasets for a given Amazon Connect instance to a target
* account. You can associate multiple datasets in a single call.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
3 changes: 3 additions & 0 deletions clients/client-connect/src/commands/DescribeContactCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export interface DescribeContactCommandOutput extends DescribeContactResponse, _
* // WisdomInfo: { // WisdomInfo
* // SessionArn: "STRING_VALUE",
* // },
* // Tags: { // ContactTagMap
* // "<keys>": "STRING_VALUE",
* // },
* // },
* // };
*
Expand Down
156 changes: 156 additions & 0 deletions clients/client-connect/src/commands/TagContactCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// 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 { ConnectClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ConnectClient";
import { TagContactRequest, TagContactResponse } from "../models/models_2";
import { de_TagContactCommand, se_TagContactCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link TagContactCommand}.
*/
export interface TagContactCommandInput extends TagContactRequest {}
/**
* @public
*
* The output of {@link TagContactCommand}.
*/
export interface TagContactCommandOutput extends TagContactResponse, __MetadataBearer {}

/**
* @public
* <p>Adds the specified tags to the contact resource. For more information about this API is used, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/granular-billing.html">Set up granular billing for a detailed
* view of your Amazon Connect usage</a>.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ConnectClient, TagContactCommand } from "@aws-sdk/client-connect"; // ES Modules import
* // const { ConnectClient, TagContactCommand } = require("@aws-sdk/client-connect"); // CommonJS import
* const client = new ConnectClient(config);
* const input = { // TagContactRequest
* ContactId: "STRING_VALUE", // required
* InstanceId: "STRING_VALUE", // required
* Tags: { // ContactTagMap // required
* "<keys>": "STRING_VALUE",
* },
* };
* const command = new TagContactCommand(input);
* const response = await client.send(command);
* // {};
*
* ```
*
* @param TagContactCommandInput - {@link TagContactCommandInput}
* @returns {@link TagContactCommandOutput}
* @see {@link TagContactCommandInput} for command's `input` shape.
* @see {@link TagContactCommandOutput} for command's `response` shape.
* @see {@link ConnectClientResolvedConfig | config} for ConnectClient's `config` shape.
*
* @throws {@link InternalServiceException} (server fault)
* <p>Request processing failed because of an error or failure with the service.</p>
*
* @throws {@link InvalidParameterException} (client fault)
* <p>One or more of the specified parameters are not valid.</p>
*
* @throws {@link InvalidRequestException} (client fault)
* <p>The request is not valid.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource was not found.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The throttling limit has been exceeded.</p>
*
* @throws {@link ConnectServiceException}
* <p>Base exception class for all service exceptions from Connect service.</p>
*
*/
export class TagContactCommand extends $Command<
TagContactCommandInput,
TagContactCommandOutput,
ConnectClientResolvedConfig
> {
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: TagContactCommandInput) {
super();
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: ConnectClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<TagContactCommandInput, TagContactCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(getEndpointPlugin(configuration, TagContactCommand.getEndpointParameterInstructions()));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "ConnectClient";
const commandName = "TagContactCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
[SMITHY_CONTEXT_KEY]: {
service: "AmazonConnectService",
operation: "TagContact",
},
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(input: TagContactCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_TagContactCommand(input, context);
}

/**
* @internal
*/
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TagContactCommandOutput> {
return de_TagContactCommand(output, context);
}
}
Loading

0 comments on commit 417de03

Please sign in to comment.