S3Store constructor

S3Store(
  1. String bucketName, {
  2. String? region,
  3. String getObjectPath(
    1. String name,
    2. String version
    )?,
  4. String? endpoint,
  5. AwsCredentials? credentials,
  6. Minio? minio,
  7. Map<String, String>? environment,
})

Implementation

S3Store(this.bucketName,
    {this.region,
      this.getObjectPath,
      this.endpoint,
      this.credentials,
      this.minio, this.environment}) {

  final env = environment ?? Platform.environment;

  // Check for env vars or container credentials if none were provided.
  credentials ??= AwsCredentials(environment: env);

  // Use a supplied minio instance or create a default
  minio ??= Minio(
    endPoint: endpoint ?? env['AWS_S3_ENDPOINT'] ?? 's3.amazonaws.com',
    region: region ?? env['AWS_DEFAULT_REGION'],
    accessKey: credentials!.awsAccessKeyId ?? '',
    secretKey: credentials!.awsSecretAccessKey ?? '',
  );

  // Check for a region or default region which is required
  if (region == null &&
      (env['AWS_DEFAULT_REGION'] == null ||
          env['AWS_DEFAULT_REGION']!.isEmpty)) {
    throw ArgumentError('Could not determine a default region for aws.');
  }
}