Skip to content

create_invitation async

create_invitation(
    environment_arn: EnvironmentArn,
    invitee_account_id: InviteeAccountId,
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
) -> CreateInvitationOutput

Creates a pending invitation for a customer account to connect to an environment. Call this operation from the account that owns the environment.

At most one non-terminal (PENDING or ACTIVE) invitation can exist per (environment, inviteeAccountId) pair. If you call this operation when a non-terminal invitation already exists, the service returns ConflictException.

Parameters:

  • environment_arn (EnvironmentArn) –

    The ARN of this governance environment.

  • invitee_account_id (InviteeAccountId) –

    The ID of the invited AWS account.

Raises:

Examples:

Invite an account to an environment Invites the payments team's member account to connect to the governance environment running the PCI-DSS assessment.

>>> await client.create_invitation(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', invitee_account_id='444455556666')
Source code in docs_src/capo_assurance/_services/async_assurance.py
async def create_invitation(
    self,
    environment_arn: "capo_assurance.types.environment_arn.EnvironmentArn",
    invitee_account_id: "capo_assurance.types.invitee_account_id.InviteeAccountId",
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
) -> "capo_assurance.types.create_invitation_output.CreateInvitationOutput":
    """<p>Creates a pending invitation for a customer account to connect to an environment. Call this operation from the account that owns the environment.</p> <p>At most one non-terminal (PENDING or ACTIVE) invitation can exist per <code>(environment, inviteeAccountId)</code> pair. If you call this operation when a non-terminal invitation already exists, the service returns <code>ConflictException</code>.</p>

    Args:
        environment_arn: <p>The ARN of this governance environment.</p>
        invitee_account_id: <p>The ID of the invited AWS account.</p>

    Raises:
        capo_assurance.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.</p>
        capo_assurance.errors.conflict_exception.ConflictException: <p>A conflict occurred (for example, resource already exists).</p>
        capo_assurance.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred.</p>
        capo_assurance.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_assurance.errors.throttling_exception.ThrottlingException: <p>The request was throttled.</p>
        capo_assurance.errors.validation_exception.ValidationException: <p>The request failed validation.</p>
        capo_assurance.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Invite an account to an environment
        Invites the payments team's member account to connect to the governance environment running the PCI-DSS assessment.

        >>> await client.create_invitation(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', invitee_account_id='444455556666')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_assurance.types.create_invitation_input.CreateInvitationInput]",
    ) -> AsyncOperationResponse[
        "capo_assurance.types.create_invitation_output.CreateInvitationOutput"
    ]:
        import capo_assurance._operations.assurance.create_invitation

        (
            output,
            http_response,
        ) = await capo_assurance._operations.assurance.create_invitation.async_create_invitation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInvitation")
    )
    input_: capo_assurance.types.create_invitation_input.CreateInvitationInput = {
        "environment_arn": environment_arn,
        "invitee_account_id": invitee_account_id,
    }

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