createSubscription method

Future<CreateSubscriptionResponse> createSubscription({
  1. required String applicationId,
  2. required SubscriptionPrincipal principal,
  3. required SubscriptionType type,
  4. String? clientToken,
})

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.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

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

Parameter principal : 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.

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

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

Implementation

Future<CreateSubscriptionResponse> createSubscription({
  required String applicationId,
  required SubscriptionPrincipal principal,
  required SubscriptionType type,
  String? clientToken,
}) async {
  final $payload = <String, dynamic>{
    'principal': principal,
    'type': type.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/subscriptions',
    exceptionFnMap: _exceptionFns,
  );
  return CreateSubscriptionResponse.fromJson(response);
}