Table of Contents

Class AmazonS3Utility

Namespace
Songhay.S3
Assembly
SonghayCore.S3.dll

Shared routines for Amazon.S3

public static class AmazonS3Utility
Inheritance
AmazonS3Utility
Inherited Members

Methods

CollectS3ObjectsFromPaginationAsync(AmazonS3Client?, ListObjectsV2Request?, ILogger)

Collects the Amazon.S3.Model.S3Object responses from paginating through a bucker based on the specified Amazon.S3.Model.ListObjectsV2Request.MaxKeys.

public static Task<EndpointContentResult<IReadOnlyCollection<StorageObject>>> CollectS3ObjectsFromPaginationAsync(AmazonS3Client? s3Client, ListObjectsV2Request? request, ILogger logger)

Parameters

s3Client AmazonS3Client

the Amazon.S3.AmazonS3Client

request ListObjectsV2Request

the Amazon.S3.Model.ListObjectsV2Request

logger ILogger

the ILogger

Returns

Task<EndpointContentResult<IReadOnlyCollection<StorageObject>>>

GetAmazonS3Client(RestApiMetadata?, string?, string?, out string?, ILogger)

public static AmazonS3Client? GetAmazonS3Client(RestApiMetadata? restApiMetadata, string? bucketMetaKey, string? clientAppId, out string? s3BucketName, ILogger logger)

Parameters

restApiMetadata RestApiMetadata

the conventional RestApiMetadata

bucketMetaKey string

a key in the ClaimsSet

clientAppId string

an optional ID to describe the Amazon.S3.AmazonS3Client

s3BucketName string

returns the name of the S3 bucket derived from RestApiMetadata

logger ILogger

Returns

AmazonS3Client

GetAmazonS3ClientWithCredentialsChain(RestApiMetadata?, string?, string?, Action<(string? credentialsProfileName, string? bucketName, string? region, string? uriRoot)>?, ILogger)

Returns an instance of Amazon.S3.AmazonS3Client or null when there is an error detailed by the ILogger

public static AmazonS3Client? GetAmazonS3ClientWithCredentialsChain(RestApiMetadata? restApiMetadata, string? bucketMetaKey, string? clientAppId, Action<(string? credentialsProfileName, string? bucketName, string? region, string? uriRoot)>? restApiMetadataAction, ILogger logger)

Parameters

restApiMetadata RestApiMetadata

the conventional RestApiMetadata

bucketMetaKey string

a key in the ClaimsSet

clientAppId string

an optional ID to describe the Amazon.S3.AmazonS3Client

restApiMetadataAction Action<(string credentialsProfileName, string bucketName, string region, string uriRoot)>

the action that reveals RestApiMetadata as a tuple

logger ILogger

the ILogger

Returns

AmazonS3Client

GetAmazonS3ClientWithCredentialsChain(string?, string?, string?, ILogger)

Returns an instance of Amazon.S3.AmazonS3Client or null when there is an error detailed by the ILogger

public static AmazonS3Client? GetAmazonS3ClientWithCredentialsChain(string? credentialsProfileName, string? uriRoot, string? clientAppId, ILogger logger)

Parameters

credentialsProfileName string

the AWS credentials profile name

uriRoot string

the base URI of the desired S3 bucket

clientAppId string

the value of Amazon.Runtime.ClientConfig.ClientAppId

logger ILogger

the ILogger

Returns

AmazonS3Client

GetAmazonS3ClientWithoutCredentialsChain(RestApiMetadata?, string?, string?, EnvironmentVariableTarget?, Action<(bool areAnySecretsMissing, string? bucketName, string? region, string? uriRoot)>?, ILogger)

Returns an instance of Amazon.S3.AmazonS3Client or null when there is an error detailed by the ILogger

public static AmazonS3Client? GetAmazonS3ClientWithoutCredentialsChain(RestApiMetadata? restApiMetadata, string? bucketMetaKey, string? clientAppId, EnvironmentVariableTarget? environmentVariableTarget, Action<(bool areAnySecretsMissing, string? bucketName, string? region, string? uriRoot)>? restApiMetadataAction, ILogger logger)

Parameters

restApiMetadata RestApiMetadata

the conventional RestApiMetadata

bucketMetaKey string

a key in the ClaimsSet

clientAppId string

the value of Amazon.Runtime.ClientConfig.ClientAppId

environmentVariableTarget EnvironmentVariableTarget?

specifies that RestApiMetadata should be written with SetEnvironmentVariable(string, string, EnvironmentVariableTarget)

restApiMetadataAction Action<(bool areAnySecretsMissing, string bucketName, string region, string uriRoot)>

the action that reveals RestApiMetadata as a tuple

logger ILogger

the ILogger

Returns

AmazonS3Client

Remarks

There are security risks associated with this method. See the remarks for ToS3LessSecureTuple(RestApiMetadata?, string?, ILogger) for details.