Skip to main content

gcs

14 configuration options · available in Rust, Python, Node.js, Java

Quick start
use opendal::Operator;

let op = Operator::via_iter("gcs", [
("bucket".to_string(), "my-bucket".to_string()),
])?;
All configuration options (copy & trim)
Full reference
use opendal::Operator;

let op = Operator::via_iter("gcs", [
// --- General ---
// root URI, all operations happens under `root`
// ("root".to_string(), "/".to_string()),

// bucket name
("bucket".to_string(), "my-bucket".to_string()),

// endpoint URI of GCS service,
// default is `https://storage.googleapis.com`
// ("endpoint".to_string(), "https://storage.googleapis.com".to_string()),

// Scope for gcs.
// ("scope".to_string(), "...".to_string()),

// --- Credentials ---
// Service Account for gcs.
// ("service_account".to_string(), "...".to_string()),

// Credentials string for GCS service OAuth2 authentication.
// ("credential".to_string(), "...".to_string()),

// Local path to credentials file for GCS service OAuth2 authentication.
// ("credential_path".to_string(), "...".to_string()),

// Skip signature will skip loading credentials and signing requests.
// ("skip_signature".to_string(), "true".to_string()),

// Disable attempting to load credentials from the GCE metadata server when
// running within Google Cloud.
// ("disable_vm_metadata".to_string(), "true".to_string()),

// Disable loading configuration from the environment.
// ("disable_config_load".to_string(), "true".to_string()),

// A Google Cloud OAuth2 token.
//
// Takes precedence over `credential` and `credential_path`.
// ("token".to_string(), "...".to_string()),

// --- Behavior ---
// The predefined acl for GCS.
// ("predefined_acl".to_string(), "...".to_string()),

// The default storage class used by gcs.
// ("default_storage_class".to_string(), "...".to_string()),

])?;

Every option is passed as a string key; OpenDAL parses it into the right type. Some services may require building the binding with the matching services-* feature enabled.

Configuration reference

General4
KeyTypeRequiredDescription
rootdefault /stringnoroot URI, all operations happens under root
buckete.g. my-bucketstringyesbucket name
endpointdefault https://storage.googleapis.comstringnoendpoint URI of GCS service, default is https://storage.googleapis.com
scopestringnoScope for gcs.
Credentials7
KeyTypeRequiredDescription
service_accountstringnoService Account for gcs.
credentialstringnoCredentials string for GCS service OAuth2 authentication.
credential_pathstringnoLocal path to credentials file for GCS service OAuth2 authentication.
skip_signatureboolnoSkip signature will skip loading credentials and signing requests.
disable_vm_metadataboolnoDisable attempting to load credentials from the GCE metadata server when running within Google Cloud.
disable_config_loadboolnoDisable loading configuration from the environment.
tokenstringnoA Google Cloud OAuth2 token. Takes precedence over credential and credential_path.
Behavior2
KeyTypeRequiredDescription
predefined_aclstringnoThe predefined acl for GCS.
default_storage_classstringnoThe default storage class used by gcs.
Deprecated1
KeyTypeRequiredDescription
allow_anonymousdeprecatedboolnoAllow opendal to send requests without signing when credentials are not loaded.
Deprecated since 0.57.0: Please use skip_signature instead of allow_anonymous