Google Cloud Storage¶
object_store_rs.store.GCSStore ¶
Configure a connection to Google Cloud Storage.
If no credentials are explicitly provided, they will be sourced from the environment as documented here.
from_env
classmethod
¶
from_env(
bucket: str,
*,
config: Dict[GCSConfigKey, str] | None = None,
client_options: Dict[ClientConfigKey, str] | None = None,
retry_config: RetryConfig | None = None
) -> GCSStore
Construct a new GCSStore with values pre-populated from environment variables.
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
Parameters:
-
bucket(str) –The GCS bucket to use.
Other Parameters:
-
config(Dict[GCSConfigKey, str] | None) –GCS Configuration. Values in this config will override values inferred from the environment. Defaults to None.
-
client_options(Dict[ClientConfigKey, str] | None) –HTTP Client options. Defaults to None.
-
retry_config(RetryConfig | None) –Retry configuration. Defaults to None.
Returns:
-
GCSStore–GCSStore
from_url
classmethod
¶
from_url(
url: str,
*,
config: Dict[GCSConfigKey, str] | None = None,
client_options: Dict[ClientConfigKey, str] | None = None,
retry_config: RetryConfig | None = None
) -> 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:
-
config(Dict[GCSConfigKey, str] | None) –GCS Configuration. Values in this config will override values inferred from the url. Defaults to None.
-
client_options(Dict[ClientConfigKey, str] | None) –HTTP Client options. Defaults to None.
-
retry_config(RetryConfig | None) –Retry configuration. Defaults to None.
Returns:
-
GCSStore–GCSStore
object_store_rs.store.GCSConfigKey
module-attribute
¶
GCSConfigKey = Literal[
"bucket_name",
"bucket",
"google_application_credentials",
"google_bucket_name",
"google_bucket",
"google_service_account_key",
"google_service_account_path",
"google_service_account",
"service_account_key",
"service_account_path",
"service_account",
"BUCKET_NAME",
"BUCKET",
"GOOGLE_APPLICATION_CREDENTIALS",
"GOOGLE_BUCKET_NAME",
"GOOGLE_BUCKET",
"GOOGLE_SERVICE_ACCOUNT_KEY",
"GOOGLE_SERVICE_ACCOUNT_PATH",
"GOOGLE_SERVICE_ACCOUNT",
"SERVICE_ACCOUNT_KEY",
"SERVICE_ACCOUNT_PATH",
"SERVICE_ACCOUNT",
]
Valid Google Cloud Storage configuration keys
Either lower case or upper case strings are accepted.
"google_service_account"or"service_account"or"google_service_account_path"or "service_account_path": Path to the service account file."google_service_account_key"or"service_account_key": The serialized service account key"google_bucket"or"google_bucket_name"or"bucket"or"bucket_name": Bucket name."google_application_credentials": Application credentials path. See cloud.google.com/docs/authentication/provide-credentials-adc.