JsonProtocol constructor
JsonProtocol({
- Client? client,
- ServiceMetadata? service,
- String? region,
- String? endpointUrl,
- AwsClientCredentials? credentials,
- AwsClientCredentialsProvider? credentialsProvider,
- RequestSigner requestSigner = signAws4HmacSha256,
Implementation
factory JsonProtocol({
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 JsonProtocol._(
client,
endpoint,
credentialsProvider,
requestSigner,
manageHttpClient,
);
}