createServiceSpecificCredential method

Future<CreateServiceSpecificCredentialResponse> createServiceSpecificCredential({
  1. required String serviceName,
  2. required String userName,
})

Generates a set of credentials consisting of a user name and password that can be used to access the service specified in the request. These credentials are generated by IAM, and can be used only for the specified service.

You can have a maximum of two sets of service-specific credentials for each supported service per user.

The only supported service at this time is AWS CodeCommit.

You can reset the password to a new service-generated value by calling ResetServiceSpecificCredential.

For more information about service-specific credentials, see Using IAM with AWS CodeCommit: Git Credentials, SSH Keys, and AWS Access Keys in the IAM User Guide.

May throw LimitExceededException. May throw NoSuchEntityException. May throw ServiceNotSupportedException.

Parameter serviceName : The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials.

Parameter userName : The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Implementation

Future<CreateServiceSpecificCredentialResponse>
    createServiceSpecificCredential({
  required String serviceName,
  required String userName,
}) async {
  ArgumentError.checkNotNull(serviceName, 'serviceName');
  ArgumentError.checkNotNull(userName, 'userName');
  _s.validateStringLength(
    'userName',
    userName,
    1,
    64,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['ServiceName'] = serviceName;
  $request['UserName'] = userName;
  final $result = await _protocol.send(
    $request,
    action: 'CreateServiceSpecificCredential',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateServiceSpecificCredentialRequest'],
    shapes: shapes,
    resultWrapper: 'CreateServiceSpecificCredentialResult',
  );
  return CreateServiceSpecificCredentialResponse.fromXml($result);
}