Storage
.NET: also in Python · Node · Go · Rust · Swift · Dart · Java and Kotlin · C++ · Objective-C
Remotes using storage services through the shared native storage library.
Concepts explains the remote and local store.
Each constructor returns an ordinary remote. Pass it to the same open call and close it the same way. The other reference pages apply to these remotes without change.
Storage.FromS3
Section titled “Storage.FromS3”public static Remote FromS3(S3Options options)
public S3Options( string bucket, string namespaceName, string region = null, string endpoint = null, bool forcePathStyle = false, string accessKeyId = null, string secretAccessKey = null, string sessionToken = null, RemoteOptions remote = null)A remote over an S3-compatible bucket.
Credentials come from the AWS chain unless accessKeyId and secretAccessKey are supplied. aws-config resolves the chain itself:
- Environment
- Shared configuration and credentials files
- SSO
- Web identity
- Container and instance metadata
A storage service other than AWS is named by endpoint. The AWS chain still supplies credentials unless accessKeyId and secretAccessKey are supplied, so supply the key pair that the service issues. Cloudflare R2 issues a pair with an account endpoint and requires region set to “auto”. MinIO and most self-hosted gateways require forcePathStyle. This addresses the bucket as a path segment instead of a subdomain.
bucket: The bucket holding the objects.namespaceName: The database’s prefix. One bucket can hold many databases.region: The signing region. If absent, the AWS chain selects it.endpoint: The endpoint of a storage service other than AWS.forcePathStyle: Address the bucket as a path segment instead of a subdomain.accessKeyId: An explicit access key. Supply it together withsecretAccessKey, or supply neither.secretAccessKey: The secret foraccessKeyId.sessionToken: The session token for temporary credentials.remote: Remote concurrency and retention, as elsewhere in the SDK.
Storage.FromGcs
Section titled “Storage.FromGcs”public static Remote FromGcs(GcsOptions options)
public GcsOptions( string bucket, string namespaceName, string endpoint = null, string serviceAccount = null, RemoteOptions remote = null)A remote over a Google Cloud Storage bucket.
Unless serviceAccount is supplied, google-cloud-auth resolves Application Default Credentials in this order:
GOOGLE_APPLICATION_CREDENTIALS- The gcloud user credentials file
- The metadata server
If the process has no such chain, pass Google’s service account JSON as JSON text. A storage service other than Google’s is named by endpoint, including gateways and emulators.
bucket: The bucket holding the objects.namespaceName: The database’s prefix. One bucket can hold many databases.endpoint: The endpoint of a storage service other than Google’s.serviceAccount: Google’s service account JSON, as JSON text.remote: Remote concurrency and retention, as elsewhere in the SDK.
Storage.FromAzure
Section titled “Storage.FromAzure”public static Remote FromAzure(AzureOptions options)
public AzureOptions( string account, string container, string namespaceName, string endpoint = null, string accountKey = null, RemoteOptions remote = null)A remote over an Azure Blob Storage container.
Unless accountKey is supplied, azure-identity resolves the Azure credential chain itself:
- Environment
- Workload identity
- Managed identity
- Azure CLI
- Developer tools
Pass an account key for a storage service without such a chain. Azurite supplies the well-known devstoreaccount1 pair.
A storage service other than Azure’s is named by endpoint, passed to the library as endpoint_url. Azurite provides one account per port, so its endpoint includes the account as a path segment.
account: The storage account holding the container.container: The container holding the objects.namespaceName: The database’s prefix. One container can hold many databases.endpoint: The endpoint of a storage service other than Azure’s.accountKey: An explicit account key.remote: Remote concurrency and retention, as elsewhere in the SDK.