Google Cloud Storage
rustac.store.GCSStore
Interface to Google Cloud Storage.
All constructors will check for environment variables. All environment variables
starting with GOOGLE_
will be evaluated. Names must match keys from
GCSConfig
. Only upper-case environment variables are
accepted.
Some examples of variables extracted from environment:
GOOGLE_SERVICE_ACCOUNT
: location of service account fileGOOGLE_SERVICE_ACCOUNT_PATH
: (alias) location of service account fileSERVICE_ACCOUNT
: (alias) location of service account fileGOOGLE_SERVICE_ACCOUNT_KEY
: JSON serialized service account keyGOOGLE_BUCKET
: bucket nameGOOGLE_BUCKET_NAME
: (alias) bucket name
If no credentials are explicitly provided, they will be sourced from the environment as documented here.
__init__
__init__(
bucket: str | None = None,
*,
prefix: str | None = None,
config: GCSConfig | GCSConfigInput | None = None,
client_options: ClientConfig | None = None,
retry_config: RetryConfig | None = None,
credential_provider: GCSCredentialProvider | None = None,
**kwargs: Unpack[GCSConfigInput],
) -> None
Construct a new GCSStore.
Parameters:
-
bucket
(str | None
, default:None
) –The GCS bucket to use.
Other Parameters:
-
prefix
(str | None
) –A prefix within the bucket to use for all operations.
-
config
(GCSConfig | GCSConfigInput | None
) –GCS Configuration. Values in this config will override values inferred from the environment. Defaults to None.
-
client_options
(ClientConfig | None
) –HTTP Client options. Defaults to None.
-
retry_config
(RetryConfig | None
) –Retry configuration. Defaults to None.
-
credential_provider
(GCSCredentialProvider | None
) –A callback to provide custom Google credentials.
-
kwargs
(Unpack[GCSConfigInput]
) –GCS configuration values. Supports the same values as
config
, but as named keyword args.
Returns:
-
None
–GCSStore
from_url
classmethod
from_url(
url: str,
*,
prefix: str | None = None,
config: GCSConfig | GCSConfigInput | None = None,
client_options: ClientConfig | None = None,
retry_config: RetryConfig | None = None,
credential_provider: GCSCredentialProvider | None = None,
**kwargs: Unpack[GCSConfigInput],
) -> GCSStore
Construct a new GCSStore with values populated from a well-known storage URL.
The supported url schemes are:
gs://<bucket>/<path>
Parameters:
-
url
(str
) –well-known storage URL.
Other Parameters:
-
prefix
(str | None
) –A prefix within the bucket to use for all operations.
-
config
(GCSConfig | GCSConfigInput | None
) –GCS Configuration. Values in this config will override values inferred from the url. Defaults to None.
-
client_options
(ClientConfig | None
) –HTTP Client options. Defaults to None.
-
retry_config
(RetryConfig | None
) –Retry configuration. Defaults to None.
-
credential_provider
(GCSCredentialProvider | None
) –A callback to provide custom Google credentials.
-
kwargs
(Unpack[GCSConfigInput]
) –GCS configuration values. Supports the same values as
config
, but as named keyword args.
Returns:
-
GCSStore
–GCSStore
rustac.store.GCSConfig
Bases: TypedDict
Configuration parameters returned from GCSStore.config.
Note that this is a strict subset of the keys allowed for input into the store, see [GCSConfigInput][obstore.store.GCSConfigInput].
google_application_credentials
instance-attribute
Application credentials path.
See https://cloud.google.com/docs/authentication/provide-credentials-adc.
google_service_account
instance-attribute
Path to the service account file.
rustac.store.GCSCredential
rustac.store.GCSCredentialProvider
Bases: Protocol
A type hint for a synchronous or asynchronous callback to provide custom Google Cloud Storage credentials.
This should be passed into the credential_provider
parameter of GCSStore
.
__call__
staticmethod
__call__() -> GCSCredential | Coroutine[Any, Any, GCSCredential]
Return a GCSCredential
.