Class ClientOptions (2.12.0)

Describes the configuration for a storage::Client object.

By default, several environment variables are read to configure the client:

  • CLOUD_STORAGE_EMULATOR_ENDPOINT: if set, use this http endpoint to make all http requests instead of the production GCS service. Also, if set, the CreateDefaultClientOptions() function will use an AnonymousCredentials object instead of loading Application Default Credentials.
  • CLOUD_STORAGE_ENABLE_CLOG: if set, enable std::clog as a backend for google::cloud::LogSink.
  • CLOUD_STORAGE_ENABLE_TRACING: if set, this is the list of components that will have logging enabled, the component this is:

    • http: trace all http request / responses.

Please use google::cloud::Options instead.

Constructors

ClientOptions(std::shared_ptr< oauth2::Credentials >)

Constructor with channel options.

Parameter
Name Description
credentials std::shared_ptr< oauth2::Credentials >

how to authenticate to the client. Using a nullptr for credentials results in undefined behavior.

ClientOptions(std::shared_ptr< oauth2::Credentials >, ChannelOptions)

Constructor with channel options.

Parameters
Name Description
credentials std::shared_ptr< oauth2::Credentials >

how to authenticate to the client. Using a nullptr for credentials results in undefined behavior.

channel_options ChannelOptions

the configuration for SSL certificate validation.

Functions

download_stall_timeout() const

Control the maximum amount of time allowed for "stalls" during a download.

A download that receives no data is considered "stalled". If the download remains stalled for more than the time set in this option then the download is aborted.

The default value is 2 minutes. Can be disabled by setting the value to 0.

Returns
Type Description
std::chrono::seconds

set_download_stall_timeout(std::chrono::seconds)

Parameter
Name Description
v std::chrono::seconds
Returns
Type Description
ClientOptions &

credentials() const

Returns
Type Description
std::shared_ptr< oauth2::Credentials >

set_credentials(std::shared_ptr< oauth2::Credentials >)

Parameter
Name Description
c std::shared_ptr< oauth2::Credentials >
Returns
Type Description
ClientOptions &

endpoint() const

Returns
Type Description
std::string const &

set_endpoint(std::string)

Parameter
Name Description
endpoint std::string
Returns
Type Description
ClientOptions &

iam_endpoint() const

Returns
Type Description
std::string const &

set_iam_endpoint(std::string)

Parameter
Name Description
endpoint std::string
Returns
Type Description
ClientOptions &

version() const

Returns
Type Description
std::string const &

set_version(std::string)

Parameter
Name Description
version std::string
Returns
Type Description
ClientOptions &

enable_http_tracing() const

Returns
Type Description
bool

set_enable_http_tracing(bool)

Parameter
Name Description
enable bool
Returns
Type Description
ClientOptions &

enable_raw_client_tracing() const

Returns
Type Description
bool

set_enable_raw_client_tracing(bool)

Parameter
Name Description
enable bool
Returns
Type Description
ClientOptions &

project_id() const

Returns
Type Description
std::string const &

set_project_id(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ClientOptions &

connection_pool_size() const

Returns
Type Description
std::size_t

set_connection_pool_size(std::size_t)

Parameter
Name Description
size std::size_t
Returns
Type Description
ClientOptions &

download_buffer_size() const

Returns
Type Description
std::size_t

SetDownloadBufferSize(std::size_t)

Parameter
Name Description
size std::size_t
Returns
Type Description
ClientOptions &

upload_buffer_size() const

Returns
Type Description
std::size_t

SetUploadBufferSize(std::size_t)

Parameter
Name Description
size std::size_t
Returns
Type Description
ClientOptions &

user_agent_prefix() const

Returns
Type Description
std::string const &

add_user_agent_prefix(std::string)

Parameter
Name Description
prefix std::string
Returns
Type Description
ClientOptions &

add_user_agent_prefx(std::string const &)

Parameter
Name Description
v std::string const &
Returns
Type Description
ClientOptions &

maximum_simple_upload_size() const

Returns
Type Description
std::size_t

set_maximum_simple_upload_size(std::size_t)

Parameter
Name Description
v std::size_t
Returns
Type Description
ClientOptions &

enable_ssl_locking_callbacks() const

If true and using OpenSSL 1.0.2 the library configures the OpenSSL callbacks for locking.

Returns
Type Description
bool

set_enable_ssl_locking_callbacks(bool)

If true and using OpenSSL 1.0.2 the library configures the OpenSSL callbacks for locking.

Parameter
Name Description
v bool
Returns
Type Description
ClientOptions &

enable_sigpipe_handler() const

Returns
Type Description
bool

set_enable_sigpipe_handler(bool)

Parameter
Name Description
v bool
Returns
Type Description
ClientOptions &

maximum_socket_recv_size() const

Returns
Type Description
std::size_t

set_maximum_socket_recv_size(std::size_t)

Parameter
Name Description
v std::size_t
Returns
Type Description
ClientOptions &

maximum_socket_send_size() const

Returns
Type Description
std::size_t

set_maximum_socket_send_size(std::size_t)

Parameter
Name Description
v std::size_t
Returns
Type Description
ClientOptions &

channel_options()

Returns
Type Description
ChannelOptions &

channel_options() const

Returns
Type Description
ChannelOptions const &

static CreateDefaultClientOptions()

Creates a ClientOptions with Google Application Default Credentials.

If Application Default Credentials could not be loaded, this returns a Status with failure details. If the CLOUD_STORAGE_EMULATOR_ENDPOINT environment variable is set, this function instead uses an AnonymousCredentials to configure the client.

Returns
Type Description
StatusOr< ClientOptions >

static CreateDefaultClientOptions(ChannelOptions const &)

Parameter
Name Description
channel_options ChannelOptions const &
Returns
Type Description
StatusOr< ClientOptions >