Skip to content

create_subscription

create_subscription(
    application_id: ApplicationId,
    principal: SubscriptionPrincipal,
    type: SubscriptionType,
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateSubscriptionResponse

Subscribes an IAM Identity Center user or a group to a pricing tier for an Amazon Q Business application.

Amazon Q Business offers two subscription tiers: Q_LITE and Q_BUSINESS. Subscription tier determines feature access for the user. For more information on subscriptions and pricing tiers, see Amazon Q Business pricing.

For an example IAM role policy for assigning subscriptions, see Set up required permissions in the Amazon Q Business User Guide.

Parameters:

  • application_id (ApplicationId) –

    The identifier of the Amazon Q Business application the subscription should be added to.

  • principal (SubscriptionPrincipal) –

    The IAM Identity Center UserId or GroupId of a user or group in the IAM Identity Center instance connected to the Amazon Q Business application.

  • type (SubscriptionType) –

    The type of Amazon Q Business subscription you want to create.

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

    A token that you provide to identify the request to create a subscription for your Amazon Q Business application.

Raises:

  • AccessDeniedException –

    You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.

  • ConflictException –

    You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again.

  • InternalServerException –

    An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help.

  • ResourceNotFoundException –

    The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.

  • ThrottlingException –

    The request was denied due to throttling. Reduce the number of requests and try again.

  • ValidationException –

    The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_qbusiness/_services/q_business.py
def create_subscription(
    self,
    application_id: "capo_qbusiness.types.application_id.ApplicationId",
    principal: "capo_qbusiness.types.subscription_principal.SubscriptionPrincipal",
    type: "capo_qbusiness.types.subscription_type.SubscriptionType",
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    client_token: Optional["capo_qbusiness.types.client_token.ClientToken"] = None,
) -> "capo_qbusiness.types.create_subscription_response.CreateSubscriptionResponse":
    """<p>Subscribes an IAM Identity Center user or a group to a pricing tier for an Amazon Q Business application.</p> <p>Amazon Q Business offers two subscription tiers: <code>Q_LITE</code> and <code>Q_BUSINESS</code>. Subscription tier determines feature access for the user. For more information on subscriptions and pricing tiers, see <a href="https://aws.amazon.com/q/business/pricing/">Amazon Q Business pricing</a>.</p> <note> <p>For an example IAM role policy for assigning subscriptions, see <a href="https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/setting-up.html#permissions">Set up required permissions</a> in the Amazon Q Business User Guide.</p> </note>

    Args:
        application_id: <p>The identifier of the Amazon Q Business application the subscription should be added to.</p>
        principal: <p>The IAM Identity Center <code>UserId</code> or <code>GroupId</code> of a user or group in the IAM Identity Center instance connected to the Amazon Q Business application.</p>
        type: <p>The type of Amazon Q Business subscription you want to create.</p>
        client_token: <p>A token that you provide to identify the request to create a subscription for your Amazon Q Business application.</p>

    Raises:
        capo_qbusiness.errors.access_denied_exception.AccessDeniedException: <p> You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.</p>
        capo_qbusiness.errors.conflict_exception.ConflictException: <p>You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again.</p>
        capo_qbusiness.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
        capo_qbusiness.errors.resource_not_found_exception.ResourceNotFoundException: <p>The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.</p>
        capo_qbusiness.errors.throttling_exception.ThrottlingException: <p>The request was denied due to throttling. Reduce the number of requests and try again.</p>
        capo_qbusiness.errors.validation_exception.ValidationException: <p>The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.</p>
        capo_qbusiness.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_qbusiness.types.create_subscription_request.CreateSubscriptionRequest]",
    ) -> OperationResponse[
        "capo_qbusiness.types.create_subscription_response.CreateSubscriptionResponse"
    ]:
        import capo_qbusiness._operations.expert_q.create_subscription

        output, http_response = (
            capo_qbusiness._operations.expert_q.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_qbusiness.types.create_subscription_request.CreateSubscriptionRequest = {
        "application_id": application_id,
        "principal": principal,
        "type": type,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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