From 21b5399b5cc7f035702227da10b7a495e57f6a75 Mon Sep 17 00:00:00 2001 From: awstools Date: Mon, 25 Nov 2024 19:25:54 +0000 Subject: [PATCH] feat(clients): update command documentation examples as of 2024-11-25 --- .../AssociateToConfigurationCommand.ts | 12 +++++ .../src/commands/CreateCustomActionCommand.ts | 45 +++++++++++++++++++ .../src/commands/DeleteCustomActionCommand.ts | 11 +++++ .../DisassociateFromConfigurationCommand.ts | 12 +++++ .../src/commands/GetCustomActionCommand.ts | 22 +++++++++ .../src/commands/ListAssociationsCommand.ts | 20 +++++++++ .../src/commands/ListCustomActionsCommand.ts | 16 +++++++ .../src/commands/UpdateCustomActionCommand.ts | 19 ++++++++ 8 files changed, 157 insertions(+) diff --git a/clients/client-chatbot/src/commands/AssociateToConfigurationCommand.ts b/clients/client-chatbot/src/commands/AssociateToConfigurationCommand.ts index 444da3292fe3..d6176bcae52e 100644 --- a/clients/client-chatbot/src/commands/AssociateToConfigurationCommand.ts +++ b/clients/client-chatbot/src/commands/AssociateToConfigurationCommand.ts @@ -64,6 +64,18 @@ export interface AssociateToConfigurationCommandOutput extends AssociateToConfig *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example Associate a custom action to a configuration + * ```javascript + * // Associate a custom action to a channel configuration, allowing it to be used in that channel + * const input = { + * "ChatConfiguration": "arn:aws:chatbot::1234567890:chat-configuration/slack-channel/my-channel", + * "Resource": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * }; + * const command = new AssociateToConfigurationCommand(input); + * await client.send(command); + * // example id: example-1 + * ``` + * */ export class AssociateToConfigurationCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/CreateCustomActionCommand.ts b/clients/client-chatbot/src/commands/CreateCustomActionCommand.ts index 8a4a84199e1b..18aba35dbc24 100644 --- a/clients/client-chatbot/src/commands/CreateCustomActionCommand.ts +++ b/clients/client-chatbot/src/commands/CreateCustomActionCommand.ts @@ -98,6 +98,51 @@ export interface CreateCustomActionCommandOutput extends CreateCustomActionResul *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example Create an alias that invokes a Lambda function + * ```javascript + * // Creates an alias that invokes a Lambda function from chat channels. You can use this alias by entering 'run invoke', after which you're prompted for the function name. + * const input = { + * "ActionName": "my-custom-action", + * "AliasName": "invoke", + * "Definition": { + * "CommandText": "lambda invoke $functionName" + * } + * }; + * const command = new CreateCustomActionCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * } + * *\/ + * // example id: example-1 + * ``` + * + * @example Create a custom action to list alarms + * ```javascript + * // Creates a button on all Cloudwatch notifications that lists alarms in the ‘ALARM’ state. + * const input = { + * "ActionName": "describe-alarms", + * "Attachments": [ + * { + * "ButtonText": "List alarms", + * "NotificationType": "CloudWatch" + * } + * ], + * "Definition": { + * "CommandText": "cloudwatch describe-alarms --state-value ALARM" + * } + * }; + * const command = new CreateCustomActionCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/describe-alarms" + * } + * *\/ + * // example id: example-2 + * ``` + * */ export class CreateCustomActionCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/DeleteCustomActionCommand.ts b/clients/client-chatbot/src/commands/DeleteCustomActionCommand.ts index 5474e8874ee6..8cfd951461d1 100644 --- a/clients/client-chatbot/src/commands/DeleteCustomActionCommand.ts +++ b/clients/client-chatbot/src/commands/DeleteCustomActionCommand.ts @@ -66,6 +66,17 @@ export interface DeleteCustomActionCommandOutput extends DeleteCustomActionResul *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example Delete a custom action + * ```javascript + * // + * const input = { + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * }; + * const command = new DeleteCustomActionCommand(input); + * await client.send(command); + * // example id: example-1 + * ``` + * */ export class DeleteCustomActionCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/DisassociateFromConfigurationCommand.ts b/clients/client-chatbot/src/commands/DisassociateFromConfigurationCommand.ts index d6525aca9d62..785c626e65e7 100644 --- a/clients/client-chatbot/src/commands/DisassociateFromConfigurationCommand.ts +++ b/clients/client-chatbot/src/commands/DisassociateFromConfigurationCommand.ts @@ -69,6 +69,18 @@ export interface DisassociateFromConfigurationCommandOutput *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example Disassociate a custom action from a configuration + * ```javascript + * // + * const input = { + * "ChatConfiguration": "arn:aws:chatbot::1234567890:chat-configuration/slack-channel/my-channel", + * "Resource": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * }; + * const command = new DisassociateFromConfigurationCommand(input); + * await client.send(command); + * // example id: example-1 + * ``` + * */ export class DisassociateFromConfigurationCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/GetCustomActionCommand.ts b/clients/client-chatbot/src/commands/GetCustomActionCommand.ts index 60ac0752a4bd..74d82f17d236 100644 --- a/clients/client-chatbot/src/commands/GetCustomActionCommand.ts +++ b/clients/client-chatbot/src/commands/GetCustomActionCommand.ts @@ -91,6 +91,28 @@ export interface GetCustomActionCommandOutput extends GetCustomActionResult, __M *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example Get a custom action + * ```javascript + * // + * const input = { + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * }; + * const command = new GetCustomActionCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "CustomAction": { + * "ActionName": "my-custom-action", + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/my-custom-action", + * "Definition": { + * "CommandText": "lambda invoke $functionName" + * } + * } + * } + * *\/ + * // example id: example-1 + * ``` + * */ export class GetCustomActionCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/ListAssociationsCommand.ts b/clients/client-chatbot/src/commands/ListAssociationsCommand.ts index 0de071947b63..edfe137c6063 100644 --- a/clients/client-chatbot/src/commands/ListAssociationsCommand.ts +++ b/clients/client-chatbot/src/commands/ListAssociationsCommand.ts @@ -63,6 +63,26 @@ export interface ListAssociationsCommandOutput extends ListAssociationsResult, _ *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example List custom actions associated with a configuration + * ```javascript + * // + * const input = { + * "ChatConfiguration": "arn:aws:chatbot::1234567890:chat-configuration/slack-channel/my-channel" + * }; + * const command = new ListAssociationsCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "Associations": [ + * { + * "Resource": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * } + * ] + * } + * *\/ + * // example id: example-1 + * ``` + * */ export class ListAssociationsCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/ListCustomActionsCommand.ts b/clients/client-chatbot/src/commands/ListCustomActionsCommand.ts index 444a8d2937c0..337e54faf2f0 100644 --- a/clients/client-chatbot/src/commands/ListCustomActionsCommand.ts +++ b/clients/client-chatbot/src/commands/ListCustomActionsCommand.ts @@ -69,6 +69,22 @@ export interface ListCustomActionsCommandOutput extends ListCustomActionsResult, *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example List custom actions + * ```javascript + * // + * const input = {}; + * const command = new ListCustomActionsCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "CustomActions": [ + * "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * ] + * } + * *\/ + * // example id: example-1 + * ``` + * */ export class ListCustomActionsCommand extends $Command .classBuilder< diff --git a/clients/client-chatbot/src/commands/UpdateCustomActionCommand.ts b/clients/client-chatbot/src/commands/UpdateCustomActionCommand.ts index 18abe0380dfb..d507149c5078 100644 --- a/clients/client-chatbot/src/commands/UpdateCustomActionCommand.ts +++ b/clients/client-chatbot/src/commands/UpdateCustomActionCommand.ts @@ -88,6 +88,25 @@ export interface UpdateCustomActionCommandOutput extends UpdateCustomActionResul *

Base exception class for all service exceptions from Chatbot service.

* * @public + * @example Update the command definition of an existing action + * ```javascript + * // Updates the command text of a custom action without altering the existing alias name or attachment criteria + * const input = { + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/my-custom-action", + * "Definition": { + * "CommandText": "lambda invoke MyNewFunction" + * } + * }; + * const command = new UpdateCustomActionCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "CustomActionArn": "arn:aws:chatbot::1234567890:custom-action/my-custom-action" + * } + * *\/ + * // example id: example-1 + * ``` + * */ export class UpdateCustomActionCommand extends $Command .classBuilder<