refactor: allow access to S3 bucket region

This is useful if we want to build an AWSCloud instance for the S3
bucket, rather than where we are installing resources.
This commit is contained in:
justinsb 2024-07-04 15:09:12 -04:00
parent 6a642ac752
commit a337ca983b
1 changed files with 9 additions and 0 deletions

View File

@ -77,6 +77,15 @@ func newS3Path(s3Context *S3Context, scheme string, bucket string, key string, s
}
}
func (p *S3Path) Region(ctx context.Context) (string, error) {
bucketDetails, err := p.getBucketDetails(ctx)
if err != nil {
return "", err
}
return bucketDetails.region, nil
}
func (p *S3Path) Path() string {
return p.scheme + "://" + p.bucket + "/" + p.key
}