createAddonSubscription method

Future<CreateAddonSubscriptionResponse> createAddonSubscription({
  1. required String addonName,
  2. String? clientToken,
  3. List<Tag>? tags,
})

Creates a subscription for an Add On representing the acceptance of its terms of use and additional pricing. The subscription can then be used to create an instance for use in rule sets or traffic policies.

May throw ConflictException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter addonName : The name of the Add On to subscribe to. You can only have one subscription for each Add On name.

Parameter clientToken : A unique token that Amazon SES uses to recognize subsequent retries of the same request.

Parameter tags : The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.

Implementation

Future<CreateAddonSubscriptionResponse> createAddonSubscription({
  required String addonName,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'MailManagerSvc.CreateAddonSubscription'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AddonName': addonName,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateAddonSubscriptionResponse.fromJson(jsonResponse.body);
}