createApiKeyCredentialProvider method

Future<CreateApiKeyCredentialProviderResponse> createApiKeyCredentialProvider({
  1. required String name,
  2. String? apiKey,
  3. SecretReference? apiKeySecretConfig,
  4. SecretSourceType? apiKeySecretSource,
  5. Map<String, String>? tags,
})

Creates a new API key credential provider.

May throw AccessDeniedException. May throw ConflictException. May throw DecryptionFailure. May throw EncryptionFailure. May throw InternalServerException. May throw ResourceLimitExceededException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw UnauthorizedException. May throw ValidationException.

Parameter name : The name of the API key credential provider. The name must be unique within your account.

Parameter apiKey : The API key to use for authentication. This value is encrypted and stored securely.

Parameter apiKeySecretConfig : A reference to the AWS Secrets Manager secret that stores the API key. This includes the secret ID and the JSON key used to extract the API key value from the secret. Required when apiKeySecretSource is set to EXTERNAL.

Parameter apiKeySecretSource : The source type of the API key secret. Use MANAGED if the secret is managed by the service, or EXTERNAL if you manage the secret yourself in AWS Secrets Manager.

Parameter tags : A map of tag keys and values to assign to the API key credential provider. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment.

Implementation

Future<CreateApiKeyCredentialProviderResponse>
    createApiKeyCredentialProvider({
  required String name,
  String? apiKey,
  SecretReference? apiKeySecretConfig,
  SecretSourceType? apiKeySecretSource,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    if (apiKey != null) 'apiKey': apiKey,
    if (apiKeySecretConfig != null) 'apiKeySecretConfig': apiKeySecretConfig,
    if (apiKeySecretSource != null)
      'apiKeySecretSource': apiKeySecretSource.value,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/identities/CreateApiKeyCredentialProvider',
    exceptionFnMap: _exceptionFns,
  );
  return CreateApiKeyCredentialProviderResponse.fromJson(response);
}