createConfigurationSet method

Future<CreateConfigurationSetResult> createConfigurationSet({
  1. required String configurationSetName,
  2. String? clientToken,
  3. List<Tag>? tags,
})

Creates a new configuration set. After you create the configuration set, you can add one or more event destinations to it.

A configuration set is a set of rules that you apply to the SMS and voice messages that you send.

When you send a message, you can optionally specify a single configuration set.

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

Parameter configurationSetName : The name to use for the new configuration set.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.

Parameter tags : An array of key and value pair tags that's associated with the new configuration set.

Implementation

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

  return CreateConfigurationSetResult.fromJson(jsonResponse.body);
}