createApiKey method

Future<ApiKey> createApiKey({
  1. String? customerId,
  2. String? description,
  3. bool? enabled,
  4. bool? generateDistinctId,
  5. String? name,
  6. List<StageKey>? stageKeys,
  7. Map<String, String>? tags,
  8. String? value,
})

Create an ApiKey resource.

AWS CLI

May throw UnauthorizedException. May throw NotFoundException. May throw TooManyRequestsException. May throw LimitExceededException. May throw BadRequestException. May throw ConflictException.

Parameter customerId : An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace.

Parameter description : The description of the ApiKey.

Parameter enabled : Specifies whether the ApiKey can be used by callers.

Parameter generateDistinctId : Specifies whether (true) or not (false) the key identifier is distinct from the created API key value. This parameter is deprecated and should not be used.

Parameter name : The name of the ApiKey.

Parameter stageKeys : DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.

Parameter tags : The key-value map of strings. The valid character set is a-zA-Z+-=._:/. The tag key can be up to 128 characters and must not start with aws:. The tag value can be up to 256 characters.

Parameter value : Specifies a value of the API key.

Implementation

Future<ApiKey> createApiKey({
  String? customerId,
  String? description,
  bool? enabled,
  bool? generateDistinctId,
  String? name,
  List<StageKey>? stageKeys,
  Map<String, String>? tags,
  String? value,
}) async {
  final $payload = <String, dynamic>{
    if (customerId != null) 'customerId': customerId,
    if (description != null) 'description': description,
    if (enabled != null) 'enabled': enabled,
    if (generateDistinctId != null) 'generateDistinctId': generateDistinctId,
    if (name != null) 'name': name,
    if (stageKeys != null) 'stageKeys': stageKeys,
    if (tags != null) 'tags': tags,
    if (value != null) 'value': value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/apikeys',
    exceptionFnMap: _exceptionFns,
  );
  return ApiKey.fromJson(response);
}