Skip to content

update_custom_action

update_custom_action(
    custom_action_arn: CustomActionArn,
    definition: CustomActionDefinition,
    *,
    config_overrides: Optional[chatbotClientConfig] = None,
    alias_name: Optional[CustomActionAliasName] = None,
    attachments: Optional[CustomActionAttachmentList] = None,
) -> UpdateCustomActionResult

Updates a custom action.

Parameters:

  • custom_action_arn (CustomActionArn) –

    The fully defined Amazon Resource Name (ARN) of the custom action.

  • definition (CustomActionDefinition) –

    The definition of the command to run when invoked as an alias or as an action button.

  • alias_name (Optional[CustomActionAliasName], default: None ) –

    The name used to invoke this action in the chat channel. For example, @aws run my-alias.

  • attachments (Optional[CustomActionAttachmentList], default: None ) –

    Defines when this custom action button should be attached to a notification.

Raises:

Examples:

Update the command definition of an existing action Updates the command text of a custom action without altering the existing alias name or attachment criteria

>>> client.update_custom_action(custom_action_arn='arn:aws:chatbot::1234567890:custom-action/my-custom-action', definition={'CommandText': 'lambda invoke MyNewFunction'})
Source code in docs_src/capo_chatbot/_services/chatbot.py
def update_custom_action(
    self,
    custom_action_arn: "capo_chatbot.types.custom_action_arn.CustomActionArn",
    definition: "capo_chatbot.types.custom_action_definition.CustomActionDefinition",
    *,
    config_overrides: Optional[chatbotClientConfig] = None,
    alias_name: Optional[
        "capo_chatbot.types.custom_action_alias_name.CustomActionAliasName"
    ] = None,
    attachments: Optional[
        "capo_chatbot.types.custom_action_attachment_list.CustomActionAttachmentList"
    ] = None,
) -> "capo_chatbot.types.update_custom_action_result.UpdateCustomActionResult":
    """<p>Updates a custom action.</p>

    Args:
        custom_action_arn: <p>The fully defined Amazon Resource Name (ARN) of the custom action.</p>
        definition: <p>The definition of the command to run when invoked as an alias or as an action button.</p>
        alias_name: <p>The name used to invoke this action in the chat channel. For example, <code>@aws run my-alias</code>.</p>
        attachments: <p>Defines when this custom action button should be attached to a notification.</p>

    Raises:
        capo_chatbot.errors.internal_service_error.InternalServiceError: <p>Unexpected error during processing of request.</p>
        capo_chatbot.errors.invalid_request_exception.InvalidRequestException: <p>Your request input doesn't meet the constraints required by AWS Chatbot.</p>
        capo_chatbot.errors.resource_not_found_exception.ResourceNotFoundException: <p>We were unable to find the resource for your request</p>
        capo_chatbot.errors.unauthorized_exception.UnauthorizedException: <p>The request was rejected because it doesn't have valid credentials for the target resource.</p>
        capo_chatbot.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Update the command definition of an existing action
        Updates the command text of a custom action without altering the existing alias name or attachment criteria

        >>> client.update_custom_action(custom_action_arn='arn:aws:chatbot::1234567890:custom-action/my-custom-action', definition={'CommandText': 'lambda invoke MyNewFunction'})
    """

    def _handler(
        req: "OperationRequest[capo_chatbot.types.update_custom_action_request.UpdateCustomActionRequest]",
    ) -> OperationResponse[
        "capo_chatbot.types.update_custom_action_result.UpdateCustomActionResult"
    ]:
        import capo_chatbot._operations.wheatley_orchestration_20171011.update_custom_action

        output, http_response = (
            capo_chatbot._operations.wheatley_orchestration_20171011.update_custom_action.update_custom_action(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateCustomAction")
    )
    input_: capo_chatbot.types.update_custom_action_request.UpdateCustomActionRequest = {
        "custom_action_arn": custom_action_arn,
        "definition": definition,
    }
    if alias_name is not None:
        input_["alias_name"] = alias_name
    if attachments is not None:
        input_["attachments"] = attachments

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output