Class AmazonS3Utility
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
s3ClientAmazonS3Clientthe Amazon.S3.AmazonS3Client
requestListObjectsV2Requestthe Amazon.S3.Model.ListObjectsV2Request
loggerILoggerthe ILogger
Returns
GetAmazonS3Client(RestApiMetadata?, string?, string?, out string?, ILogger)
Returns an instance of Amazon.S3.AmazonS3Client,
trying GetAmazonS3ClientWithCredentialsChain(RestApiMetadata?, string?, string?, Action<(string? credentialsProfileName, string? bucketName, string? region, string? uriRoot)>?, ILogger) then GetAmazonS3ClientWithoutCredentialsChain(RestApiMetadata?, string?, string?, EnvironmentVariableTarget?, Action<(bool areAnySecretsMissing, string? bucketName, string? region, string? uriRoot)>?, ILogger),
or null when there is an error
detailed by the ILogger
public static AmazonS3Client? GetAmazonS3Client(RestApiMetadata? restApiMetadata, string? bucketMetaKey, string? clientAppId, out string? s3BucketName, ILogger logger)
Parameters
restApiMetadataRestApiMetadatathe conventional RestApiMetadata
bucketMetaKeystringa key in the ClaimsSet
clientAppIdstringan optional ID to describe the Amazon.S3.AmazonS3Client
s3BucketNamestringreturns the name of the S3 bucket derived from RestApiMetadata
loggerILogger
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
restApiMetadataRestApiMetadatathe conventional RestApiMetadata
bucketMetaKeystringa key in the ClaimsSet
clientAppIdstringan optional ID to describe the Amazon.S3.AmazonS3Client
restApiMetadataActionAction<(string credentialsProfileName, string bucketName, string region, string uriRoot)>the action that reveals RestApiMetadata as a tuple
loggerILoggerthe 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
credentialsProfileNamestringthe AWS credentials profile name
uriRootstringthe base URI of the desired S3 bucket
clientAppIdstringthe value of Amazon.Runtime.ClientConfig.ClientAppId
loggerILoggerthe 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
restApiMetadataRestApiMetadatathe conventional RestApiMetadata
bucketMetaKeystringa key in the ClaimsSet
clientAppIdstringthe value of Amazon.Runtime.ClientConfig.ClientAppId
environmentVariableTargetEnvironmentVariableTarget?specifies that RestApiMetadata should be written with SetEnvironmentVariable(string, string, EnvironmentVariableTarget)
restApiMetadataActionAction<(bool areAnySecretsMissing, string bucketName, string region, string uriRoot)>the action that reveals RestApiMetadata as a tuple
loggerILoggerthe ILogger
Returns
- AmazonS3Client
Remarks
There are security risks associated with this method. See the remarks for ToS3LessSecureTuple(RestApiMetadata?, string?, ILogger) for details.