Skip to content

create_subscription

create_subscription(
    domain_id: DomainId, *, config_overrides: Optional[ConnectHealthClientConfig] = 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/connect_health.py
def create_subscription(
    self,
    domain_id: "capo_connecthealth.types.domain_id.DomainId",
    *,
    config_overrides: Optional[ConnectHealthClientConfig] = 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.
    """

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

        output, http_response = (
            capo_connecthealth._operations.connect_health.create_subscription.create_subscription(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output