pub struct GoogleBuilder { /* private fields */ }Expand description
Implementations§
Source§impl GoogleBuilder
impl GoogleBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new GoogleBuilder with default values.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create an instance of GoogleBuilder with values pre-populated from environment variables.
Variables extracted from environment:
- GOOGLE_SERVICE_ACCOUNT: location of service account file
- GOOGLE_SERVICE_ACCOUNT_PATH: (alias) location of service account file
- SERVICE_ACCOUNT: (alias) location of service account file
- GOOGLE_SERVICE_ACCOUNT_KEY: JSON serialized service account key
§Example
use olai_http::gcp::GoogleBuilder;
let gcs = GoogleBuilder::from_env()
.build(None);Sourcepub fn with_config(self, key: GoogleConfigKey, value: impl Into<String>) -> Self
pub fn with_config(self, key: GoogleConfigKey, value: impl Into<String>) -> Self
Set an option on the builder via a key - value pair.
Sourcepub fn get_config_value(&self, key: &GoogleConfigKey) -> Option<String>
pub fn get_config_value(&self, key: &GoogleConfigKey) -> Option<String>
Get config value via a GoogleConfigKey.
§Example
use olai_http::gcp::{GoogleBuilder, GoogleConfigKey};
let builder = GoogleBuilder::from_env()
.with_service_account_key("foo");
let service_account_key = builder.get_config_value(&GoogleConfigKey::ServiceAccountKey).unwrap_or_default();
assert_eq!("foo", &service_account_key);Sourcepub fn with_service_account_path(
self,
service_account_path: impl Into<String>,
) -> Self
pub fn with_service_account_path( self, service_account_path: impl Into<String>, ) -> Self
Set the path to the service account file.
This or GoogleBuilder::with_service_account_key must be
set.
Example "/tmp/gcs.json".
Example contents of gcs.json:
{
"gcs_base_url": "https://localhost:4443",
"disable_oauth": true,
"client_email": "",
"private_key": ""
}Sourcepub fn with_service_account_key(
self,
service_account: impl Into<String>,
) -> Self
pub fn with_service_account_key( self, service_account: impl Into<String>, ) -> Self
Set the service account key. The service account must be in the JSON format.
This or GoogleBuilder::with_service_account_path must be
set.
Sourcepub fn with_application_credentials(
self,
application_credentials_path: impl Into<String>,
) -> Self
pub fn with_application_credentials( self, application_credentials_path: impl Into<String>, ) -> Self
Set the path to the application credentials file.
https://cloud.google.com/docs/authentication/provide-credentials-adc
Sourcepub fn with_credentials(self, credentials: GcpCredentialProvider) -> Self
pub fn with_credentials(self, credentials: GcpCredentialProvider) -> Self
Set the credential provider overriding any other options
Sourcepub fn with_retry(self, retry_config: RetryConfig) -> Self
pub fn with_retry(self, retry_config: RetryConfig) -> Self
Set the retry configuration
Sourcepub fn with_proxy_url(self, proxy_url: impl Into<String>) -> Self
pub fn with_proxy_url(self, proxy_url: impl Into<String>) -> Self
Set the proxy_url to be used by the underlying client
Sourcepub fn with_proxy_ca_certificate(
self,
proxy_ca_certificate: impl Into<String>,
) -> Self
pub fn with_proxy_ca_certificate( self, proxy_ca_certificate: impl Into<String>, ) -> Self
Set a trusted proxy CA certificate
Sourcepub fn with_proxy_excludes(self, proxy_excludes: impl Into<String>) -> Self
pub fn with_proxy_excludes(self, proxy_excludes: impl Into<String>) -> Self
Set a list of hosts to exclude from proxy connections
Sourcepub fn with_client_options(self, options: ClientOptions) -> Self
pub fn with_client_options(self, options: ClientOptions) -> Self
Sets the client options, overriding any already set
Sourcepub fn build(self, runtime: Option<&Handle>) -> Result<GoogleConfig>
pub fn build(self, runtime: Option<&Handle>) -> Result<GoogleConfig>
Configure a connection to Google Cloud Storage, returning a
new GoogleConfig and consuming self
If runtime is provided, all HTTP I/O (including credential refresh)
will be spawned on the given runtime handle.
Trait Implementations§
Source§impl Clone for GoogleBuilder
impl Clone for GoogleBuilder
Source§fn clone(&self) -> GoogleBuilder
fn clone(&self) -> GoogleBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more