testIdentityProvider method

Future<TestIdentityProviderResponse> testIdentityProvider({
  1. required String serverId,
  2. required String userName,
  3. Protocol? serverProtocol,
  4. String? sourceIp,
  5. String? userPassword,
})

If the IdentityProviderType of a file transfer protocol-enabled server is API_Gateway, tests whether your API Gateway is set up successfully. We highly recommend that you call this operation to test your authentication method as soon as you create your server. By doing so, you can troubleshoot issues with the API Gateway integration to ensure that your users can successfully use the service.

May throw ServiceUnavailableException. May throw InternalServiceError. May throw InvalidRequestException. May throw ResourceNotFoundException.

Parameter serverId : A system-assigned identifier for a specific server. That server's user authentication method is tested with a user name and password.

Parameter userName : The name of the user account to be tested.

Parameter serverProtocol : The type of file transfer protocol to be tested.

The available protocols are:

  • Secure Shell (SSH) File Transfer Protocol (SFTP)
  • File Transfer Protocol Secure (FTPS)
  • File Transfer Protocol (FTP)

Parameter sourceIp : The source IP address of the user account to be tested.

Parameter userPassword : The password of the user account to be tested.

Implementation

Future<TestIdentityProviderResponse> testIdentityProvider({
  required String serverId,
  required String userName,
  Protocol? serverProtocol,
  String? sourceIp,
  String? userPassword,
}) async {
  ArgumentError.checkNotNull(serverId, 'serverId');
  _s.validateStringLength(
    'serverId',
    serverId,
    19,
    19,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userName, 'userName');
  _s.validateStringLength(
    'userName',
    userName,
    3,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'sourceIp',
    sourceIp,
    0,
    32,
  );
  _s.validateStringLength(
    'userPassword',
    userPassword,
    0,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'TransferService.TestIdentityProvider'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ServerId': serverId,
      'UserName': userName,
      if (serverProtocol != null) 'ServerProtocol': serverProtocol.toValue(),
      if (sourceIp != null) 'SourceIp': sourceIp,
      if (userPassword != null) 'UserPassword': userPassword,
    },
  );

  return TestIdentityProviderResponse.fromJson(jsonResponse.body);
}