Skip to content

create_notify_code_configuration

create_notify_code_configuration(
    notify_code_configuration_name: NotifyCodeConfigurationName,
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
    code_configuration_parameters: Optional[CodeConfigurationParameters] = None,
    channel_parameters: Optional[ChannelParameters] = None,
    deletion_protection_enabled: Optional[bool] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagList] = None,
) -> CreateNotifyCodeConfigurationOutput

Creates a notify code configuration. A notify code configuration is a reusable policy that defines how one-time passcodes are generated and rendered, including the code type, length, validity period, maximum number of attempts, and channel templates.

Parameters:

  • notify_code_configuration_name (NotifyCodeConfigurationName) –

    The name of the notify code configuration.

  • code_configuration_parameters (Optional[CodeConfigurationParameters], default: None ) –

    The passcode policy parameters, including the code type, length, validity period, and maximum number of attempts. Each member is optional. When you omit a member, no value is applied at create time and the default is applied when a passcode is sent.

  • channel_parameters (Optional[ChannelParameters], default: None ) –

    The channel-specific parameters used to render and deliver the one-time passcode. Provide parameters for any subset of channels. Each member configures one delivery route, and the route that is selected at send time uses the matching channel.

  • deletion_protection_enabled (Optional[bool], default: None ) –

    Specifies whether deletion protection is enabled. When enabled, the resource cannot be deleted until deletion protection is turned off.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you do not specify a client token, the AWS SDK automatically generates one.

  • tags (Optional[TagList], default: None ) –

    An array of key and value pair tags that are associated with the resource.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request conflicts with the current state of the resource.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ServiceQuotaExceededException –

    The request would exceed a service quota for your account.

  • ThrottlingException –

    The request was denied because it exceeded the allowed request rate.

  • ValidationException –

    A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Create a notify code configuration

>>> client.create_notify_code_configuration(notify_code_configuration_name='SignupOtp', code_configuration_parameters={'codeType': 'NUMERIC', 'codeLength': 6, 'validityPeriodMinutes': 10, 'maxAttempts': 3}, channel_parameters={'text': {'inlineTemplateBody': 'Your verification code is {{code}}.'}})
Source code in docs_src/capo_endusermessaging/_services/end_user_messaging.py
def create_notify_code_configuration(
    self,
    notify_code_configuration_name: "capo_endusermessaging.types.notify_code_configuration_name.NotifyCodeConfigurationName",
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
    code_configuration_parameters: Optional[
        "capo_endusermessaging.types.code_configuration_parameters.CodeConfigurationParameters"
    ] = None,
    channel_parameters: Optional[
        "capo_endusermessaging.types.channel_parameters.ChannelParameters"
    ] = None,
    deletion_protection_enabled: Optional[bool] = None,
    client_token: Optional[
        "capo_endusermessaging.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_endusermessaging.types.tag_list.TagList"] = None,
) -> "capo_endusermessaging.types.create_notify_code_configuration_output.CreateNotifyCodeConfigurationOutput":
    """<p>Creates a notify code configuration. A notify code configuration is a reusable policy that defines how one-time passcodes are generated and rendered, including the code type, length, validity period, maximum number of attempts, and channel templates.</p>

    Args:
        notify_code_configuration_name: <p>The name of the notify code configuration.</p>
        code_configuration_parameters: <p>The passcode policy parameters, including the code type, length, validity period, and maximum number of attempts. Each member is optional. When you omit a member, no value is applied at create time and the default is applied when a passcode is sent.</p>
        channel_parameters: <p>The channel-specific parameters used to render and deliver the one-time passcode. Provide parameters for any subset of channels. Each member configures one delivery route, and the route that is selected at send time uses the matching channel.</p>
        deletion_protection_enabled: <p>Specifies whether deletion protection is enabled. When enabled, the resource cannot be deleted until deletion protection is turned off.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you do not specify a client token, the AWS SDK automatically generates one.</p>
        tags: <p>An array of key and value pair tags that are associated with the resource.</p>

    Raises:
        capo_endusermessaging.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_endusermessaging.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_endusermessaging.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_endusermessaging.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota for your account.</p>
        capo_endusermessaging.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded the allowed request rate.</p>
        capo_endusermessaging.errors.validation_exception.ValidationException: A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
        capo_endusermessaging.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create a notify code configuration

        >>> client.create_notify_code_configuration(notify_code_configuration_name='SignupOtp', code_configuration_parameters={'codeType': 'NUMERIC', 'codeLength': 6, 'validityPeriodMinutes': 10, 'maxAttempts': 3}, channel_parameters={'text': {'inlineTemplateBody': 'Your verification code is {{code}}.'}})
    """

    def _handler(
        req: "OperationRequest[capo_endusermessaging.types.create_notify_code_configuration_input.CreateNotifyCodeConfigurationInput]",
    ) -> OperationResponse[
        "capo_endusermessaging.types.create_notify_code_configuration_output.CreateNotifyCodeConfigurationOutput"
    ]:
        import capo_endusermessaging._operations.end_user_messaging.create_notify_code_configuration

        output, http_response = (
            capo_endusermessaging._operations.end_user_messaging.create_notify_code_configuration.create_notify_code_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_endusermessaging.types.create_notify_code_configuration_input.CreateNotifyCodeConfigurationInput",
    ) -> dict[str, Any]:
        import capo_endusermessaging.types.create_notify_code_configuration_input

        return capo_endusermessaging.types.create_notify_code_configuration_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_endusermessaging.types.create_notify_code_configuration_output.CreateNotifyCodeConfigurationOutput",
    ) -> dict[str, Any]:
        import capo_endusermessaging.types.create_notify_code_configuration_output

        return capo_endusermessaging.types.create_notify_code_configuration_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateNotifyCodeConfiguration",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_endusermessaging.types.create_notify_code_configuration_input.CreateNotifyCodeConfigurationInput = {
        "notify_code_configuration_name": notify_code_configuration_name
    }
    if code_configuration_parameters is not None:
        input_["code_configuration_parameters"] = code_configuration_parameters
    if channel_parameters is not None:
        input_["channel_parameters"] = channel_parameters
    if deletion_protection_enabled is not None:
        input_["deletion_protection_enabled"] = deletion_protection_enabled
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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