Skip to content

create_subscription async

create_subscription(
    domain_id: DomainId,
    *,
    config_overrides: Optional[AsyncConnectHealthClientConfig] = None,
) -> CreateSubscriptionOutput

Creates a new Subscription within a Domain for billing and user management.

Parameters:

  • domain_id (DomainId) –

    The unique identifier of the parent Domain.

Raises:

Source code in docs_src/capo_connecthealth/_services/async_connect_health.py
async def create_subscription(
    self,
    domain_id: "capo_connecthealth.types.domain_id.DomainId",
    *,
    config_overrides: Optional[AsyncConnectHealthClientConfig] = None,
) -> "capo_connecthealth.types.create_subscription_output.CreateSubscriptionOutput":
    """<p>Creates a new Subscription within a Domain for billing and user management.</p>

    Args:
        domain_id: <p>The unique identifier of the parent Domain.</p>

    Raises:
        capo_connecthealth.errors.access_denied_exception.AccessDeniedException: <p>This error is thrown when the client does not supply proper credentials to the API.</p>
        capo_connecthealth.errors.internal_server_exception.InternalServerException: <p>This error is thrown when a transient error causes our API to fail.</p>
        capo_connecthealth.errors.resource_not_found_exception.ResourceNotFoundException: <p>This error is thrown when the requested resource is not found.</p>
        capo_connecthealth.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request exceeds a service quota.</p>
        capo_connecthealth.errors.validation_exception.ValidationException: <p>This error is thrown when the client supplies invalid input to the API.</p>
        capo_connecthealth.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connecthealth.types.create_subscription_input.CreateSubscriptionInput]",
    ) -> AsyncOperationResponse[
        "capo_connecthealth.types.create_subscription_output.CreateSubscriptionOutput"
    ]:
        import capo_connecthealth._operations.connect_health.create_subscription

        (
            output,
            http_response,
        ) = await capo_connecthealth._operations.connect_health.create_subscription.async_create_subscription(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSubscription")
    )
    input_: capo_connecthealth.types.create_subscription_input.CreateSubscriptionInput = {
        "domain_id": domain_id
    }

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