Skip to content

create_email_contact

create_email_contact(
    name: EmailContactName,
    email_address: EmailContactAddress,
    *,
    config_overrides: Optional[NotificationsContactsClientConfig] = None,
    tags: Optional[TagMap] = None,
) -> CreateEmailContactResponse

Creates an email contact for the provided email address.

Parameters:

  • name (EmailContactName) –

    The name of the email contact.

  • email_address (EmailContactAddress) –

    The email address this email contact points to. The activation email and any subscribed emails are sent here.

    This email address can't receive emails until it's activated.

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

    A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.

Raises:

Source code in docs_src/capo_notificationscontacts/_services/notifications_contacts.py
def create_email_contact(
    self,
    name: "capo_notificationscontacts.types.email_contact_name.EmailContactName",
    email_address: "capo_notificationscontacts.types.email_contact_address.EmailContactAddress",
    *,
    config_overrides: Optional[NotificationsContactsClientConfig] = None,
    tags: Optional["capo_notificationscontacts.types.tag_map.TagMap"] = None,
) -> "capo_notificationscontacts.types.create_email_contact_response.CreateEmailContactResponse":
    """<p>Creates an email contact for the provided email address.</p>

    Args:
        name: <p>The name of the email contact.</p>
        email_address: <p>The email address this email contact points to. The activation email and any subscribed emails are sent here.</p> <note> <p>This email address can't receive emails until it's activated.</p> </note>
        tags: <p>A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.</p>

    Raises:
        capo_notificationscontacts.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_notificationscontacts.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_notificationscontacts.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_notificationscontacts.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> Request would cause a service quota to be exceeded.</p>
        capo_notificationscontacts.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_notificationscontacts.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_notificationscontacts.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_notificationscontacts.types.create_email_contact_request.CreateEmailContactRequest]",
    ) -> OperationResponse[
        "capo_notificationscontacts.types.create_email_contact_response.CreateEmailContactResponse"
    ]:
        import capo_notificationscontacts._operations.notifications_contacts.create_email_contact

        output, http_response = (
            capo_notificationscontacts._operations.notifications_contacts.create_email_contact.create_email_contact(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_notificationscontacts.types.create_email_contact_request.CreateEmailContactRequest",
    ) -> dict[str, Any]:
        import capo_notificationscontacts.types.create_email_contact_request

        return capo_notificationscontacts.types.create_email_contact_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateEmailContact", redact_input=_redact_input),
    )
    input_: capo_notificationscontacts.types.create_email_contact_request.CreateEmailContactRequest = {
        "name": name,
        "email_address": email_address,
    }
    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