Google Cloud Storage¶
async_tiff.store.GCSStore ¶
Interface to Google Cloud Storage.
All constructors will check for environment variables. Refer to
GCSConfig
for valid environment variables.
If no credentials are explicitly provided, they will be sourced from the environment as documented here.
credential_provider
property
¶
credential_provider: GCSCredentialProvider | None
Get the store's credential provider.
prefix
property
¶
prefix: str | None
Get the prefix applied to all operations in this store, if any.
__init__ ¶
__init__(
bucket: str | None = None,
*,
prefix: str | None = None,
config: GCSConfig | None = None,
client_options: ClientConfig | None = None,
retry_config: RetryConfig | None = None,
credential_provider: GCSCredentialProvider | None = None,
**kwargs: Unpack[GCSConfig],
) -> 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 | 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[GCSConfig]
) –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 | None = None,
client_options: ClientConfig | None = None,
retry_config: RetryConfig | None = None,
credential_provider: GCSCredentialProvider | None = None,
**kwargs: Unpack[GCSConfig],
) -> Self
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 | 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[GCSConfig]
) –GCS configuration values. Supports the same values as
config
, but as named keyword args.
Returns:
-
Self
–GCSStore
async_tiff.store.GCSConfig ¶
Bases: TypedDict
Configuration parameters for GCSStore.
Not importable at runtime
To use this type hint in your code, import it within a TYPE_CHECKING
block:
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from obstore.store import GCSConfig
application_credentials
instance-attribute
¶
application_credentials: str
Application credentials path.
See cloud.google.com/docs/authentication/provide-credentials-adc.
Environment variable: GOOGLE_APPLICATION_CREDENTIALS
.
bucket
instance-attribute
¶
bucket: str
Bucket name. (required)
Environment variables:
GOOGLE_BUCKET
GOOGLE_BUCKET_NAME
service_account
instance-attribute
¶
service_account: str
Path to the service account file.
This or service_account_key
must be set.
Example value "/tmp/gcs.json"
. Example contents of gcs.json
:
{
"gcs_base_url": "https://localhost:4443",
"disable_oauth": true,
"client_email": "",
"private_key": ""
}
Environment variables:
GOOGLE_SERVICE_ACCOUNT
GOOGLE_SERVICE_ACCOUNT_PATH
async_tiff.store.GCSCredential ¶
Bases: TypedDict
A Google Cloud Storage Credential.
Not importable at runtime
To use this type hint in your code, import it within a TYPE_CHECKING
block:
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from obstore.store import GCSCredential
async_tiff.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
.
Not importable at runtime
To use this type hint in your code, import it within a TYPE_CHECKING
block:
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from obstore.store import GCSCredentialProvider
__call__
staticmethod
¶
__call__() -> GCSCredential | Coroutine[Any, Any, GCSCredential]
Return a GCSCredential
.