QueryProtocol constructor

QueryProtocol({
  1. Client? client,
  2. ServiceMetadata? service,
  3. String? region,
  4. String? endpointUrl,
  5. AwsClientCredentials? credentials,
  6. AwsClientCredentialsProvider? credentialsProvider,
  7. RequestSigner requestSigner = signAws4HmacSha256,
})

Implementation

factory QueryProtocol({
  Client? client,
  ServiceMetadata? service,
  String? region,
  String? endpointUrl,
  AwsClientCredentials? credentials,
  AwsClientCredentialsProvider? credentialsProvider,
  RequestSigner requestSigner = signAws4HmacSha256,
}) {
  final manageHttpClient = client == null;
  client ??= Client();

  final endpoint = Endpoint.forProtocol(
      service: service, region: region, endpointUrl: endpointUrl);

  // If credentials are provided, override credentials provider
  if (credentials != null) {
    credentialsProvider = ({Client? client}) => Future.value(credentials);
  } else {
    credentialsProvider ??=
        ({Client? client}) => Future.value(AwsClientCredentials.resolve());
  }

  return QueryProtocol._(
    client,
    endpoint,
    credentialsProvider,
    requestSigner,
    manageHttpClient,
  );
}