Class ClientOptions (2.19.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
NameDescription
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
NameDescription
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
TypeDescription
std::chrono::seconds

set_download_stall_timeout(std::chrono::seconds)

Parameter
NameDescription
v std::chrono::seconds
Returns
TypeDescription
ClientOptions &

credentials() const

Returns
TypeDescription
std::shared_ptr< oauth2::Credentials >

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

Parameter
NameDescription
c std::shared_ptr< oauth2::Credentials >
Returns
TypeDescription
ClientOptions &

endpoint() const

Returns
TypeDescription
std::string const &

set_endpoint(std::string)

Parameter
NameDescription
endpoint std::string
Returns
TypeDescription
ClientOptions &

iam_endpoint() const

Returns
TypeDescription
std::string const &

set_iam_endpoint(std::string)

Parameter
NameDescription
endpoint std::string
Returns
TypeDescription
ClientOptions &

version() const

Returns
TypeDescription
std::string const &

set_version(std::string)

Parameter
NameDescription
version std::string
Returns
TypeDescription
ClientOptions &

enable_http_tracing() const

Returns
TypeDescription
bool

set_enable_http_tracing(bool)

Parameter
NameDescription
enable bool
Returns
TypeDescription
ClientOptions &

enable_raw_client_tracing() const

Returns
TypeDescription
bool

set_enable_raw_client_tracing(bool)

Parameter
NameDescription
enable bool
Returns
TypeDescription
ClientOptions &

project_id() const

Returns
TypeDescription
std::string const &

set_project_id(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ClientOptions &

connection_pool_size() const

Returns
TypeDescription
std::size_t

set_connection_pool_size(std::size_t)

Parameter
NameDescription
size std::size_t
Returns
TypeDescription
ClientOptions &

download_buffer_size() const

Returns
TypeDescription
std::size_t

SetDownloadBufferSize(std::size_t)

Parameter
NameDescription
size std::size_t
Returns
TypeDescription
ClientOptions &

upload_buffer_size() const

Returns
TypeDescription
std::size_t

SetUploadBufferSize(std::size_t)

Parameter
NameDescription
size std::size_t
Returns
TypeDescription
ClientOptions &

user_agent_prefix() const

Returns
TypeDescription
std::string const &

add_user_agent_prefix(std::string)

Parameter
NameDescription
prefix std::string
Returns
TypeDescription
ClientOptions &

add_user_agent_prefx(std::string const &)

Parameter
NameDescription
v std::string const &
Returns
TypeDescription
ClientOptions &

maximum_simple_upload_size() const

Returns
TypeDescription
std::size_t

set_maximum_simple_upload_size(std::size_t)

Parameter
NameDescription
v std::size_t
Returns
TypeDescription
ClientOptions &

enable_ssl_locking_callbacks() const

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

Returns
TypeDescription
bool

set_enable_ssl_locking_callbacks(bool)

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

Parameter
NameDescription
v bool
Returns
TypeDescription
ClientOptions &

enable_sigpipe_handler() const

Returns
TypeDescription
bool

set_enable_sigpipe_handler(bool)

Parameter
NameDescription
v bool
Returns
TypeDescription
ClientOptions &

maximum_socket_recv_size() const

Returns
TypeDescription
std::size_t

set_maximum_socket_recv_size(std::size_t)

Parameter
NameDescription
v std::size_t
Returns
TypeDescription
ClientOptions &

maximum_socket_send_size() const

Returns
TypeDescription
std::size_t

set_maximum_socket_send_size(std::size_t)

Parameter
NameDescription
v std::size_t
Returns
TypeDescription
ClientOptions &

channel_options()

Returns
TypeDescription
ChannelOptions &

channel_options() const

Returns
TypeDescription
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
TypeDescription
StatusOr< ClientOptions >

static CreateDefaultClientOptions(ChannelOptions const &)

Parameter
NameDescription
channel_options ChannelOptions const &
Returns
TypeDescription
StatusOr< ClientOptions >