Skip to content

update_voice_template async

update_voice_template(
    template_name: __string,
    *,
    config_overrides: Optional[AsyncPinpointClientConfig] = None,
    create_new_version: Optional[__boolean] = None,
    version: Optional[__string] = None,
    voice_template_request: Optional[VoiceTemplateRequest] = None,
) -> UpdateVoiceTemplateResponse

Updates an existing message template for messages that are sent through the voice channel.

Parameters:

  • create_new_version (Optional[__boolean], default: None ) –

    Specifies whether to save the updates as a new version of the message template. Valid values are: true, save the updates as a new version; and, false, save the updates to (overwrite) the latest existing version of the template.

    If you don't specify a value for this parameter, Amazon Pinpoint saves the updates to (overwrites) the latest existing version of the template. If you specify a value of true for this parameter, don't specify a value for the version parameter. Otherwise, an error will occur.

  • template_name (__string) –

    The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.

  • version (Optional[__string], default: None ) –

    The unique identifier for the version of the message template to update, retrieve information about, or delete. To retrieve identifiers and other information for all the versions of a template, use the Template Versions resource.

    If specified, this value must match the identifier for an existing template version. If specified for an update operation, this value must match the identifier for the latest existing version of the template. This restriction helps ensure that race conditions don't occur.

    If you don't specify a value for this parameter, Amazon Pinpoint does the following:

    • For a get operation, retrieves information about the active version of the template.

    • For an update operation, saves the updates to (overwrites) the latest existing version of the template, if the create-new-version parameter isn't used or is set to false.

    • For a delete operation, deletes the template, including all versions of the template.

Raises:

Source code in docs_src/capo_pinpoint/_services/async_pinpoint.py
async def update_voice_template(
    self,
    template_name: "capo_pinpoint.types.__string.__string",
    *,
    config_overrides: Optional[AsyncPinpointClientConfig] = None,
    create_new_version: Optional["capo_pinpoint.types.__boolean.__boolean"] = None,
    version: Optional["capo_pinpoint.types.__string.__string"] = None,
    voice_template_request: Optional[
        "capo_pinpoint.types.voice_template_request.VoiceTemplateRequest"
    ] = None,
) -> (
    "capo_pinpoint.types.update_voice_template_response.UpdateVoiceTemplateResponse"
):
    """<p>Updates an existing message template for messages that are sent through the voice channel.</p>

    Args:
        create_new_version: <p>Specifies whether to save the updates as a new version of the message template. Valid values are: true, save the updates as a new version; and, false, save the updates to (overwrite) the latest existing version of the template.</p> <p>If you don't specify a value for this parameter, Amazon Pinpoint saves the updates to (overwrites) the latest existing version of the template. If you specify a value of true for this parameter, don't specify a value for the version parameter. Otherwise, an error will occur.</p>
        template_name: <p>The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.</p>
        version: <p>The unique identifier for the version of the message template to update, retrieve information about, or delete. To retrieve identifiers and other information for all the versions of a template, use the <link linkend="templates-template-name-template-type-versions">Template Versions</link> resource.</p> <p>If specified, this value must match the identifier for an existing template version. If specified for an update operation, this value must match the identifier for the latest existing version of the template. This restriction helps ensure that race conditions don't occur.</p> <p>If you don't specify a value for this parameter, Amazon Pinpoint does the following:</p> <ul><li><p>For a get operation, retrieves information about the active version of the template.</p></li> <li><p>For an update operation, saves the updates to (overwrites) the latest existing version of the template, if the create-new-version parameter isn't used or is set to false.</p></li> <li><p>For a delete operation, deletes the template, including all versions of the template.</p></li></ul>

    Raises:
        capo_pinpoint.errors.bad_request_exception.BadRequestException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.forbidden_exception.ForbiddenException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.internal_server_error_exception.InternalServerErrorException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.method_not_allowed_exception.MethodNotAllowedException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.not_found_exception.NotFoundException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.payload_too_large_exception.PayloadTooLargeException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.too_many_requests_exception.TooManyRequestsException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint.types.update_voice_template_request.UpdateVoiceTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint.types.update_voice_template_response.UpdateVoiceTemplateResponse"
    ]:
        import capo_pinpoint._operations.pinpoint.update_voice_template

        (
            output,
            http_response,
        ) = await capo_pinpoint._operations.pinpoint.update_voice_template.async_update_voice_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateVoiceTemplate")
    )
    input_: capo_pinpoint.types.update_voice_template_request.UpdateVoiceTemplateRequest = {
        "template_name": template_name
    }
    if create_new_version is not None:
        input_["create_new_version"] = create_new_version
    if version is not None:
        input_["version"] = version
    if voice_template_request is not None:
        input_["voice_template_request"] = voice_template_request

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output