pub struct ClientBuilder { /* private fields */ }Expand description
Configures a Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn credentials(self, credentials: impl Credentials + 'static) -> Self
pub fn credentials(self, credentials: impl Credentials + 'static) -> Self
Sets the credentials, instead of taking them from the environment or the CLI’s session.
Sourcepub fn region(self, region: impl Into<String>) -> Self
pub fn region(self, region: impl Into<String>) -> Self
Sends calls to a region’s front door,
{service}.{region}.origincloudapis.eu, for the services that have
one. It overrides ORIGINCLOUD_REGION; an empty region uses the
regionless endpoint. A region, from either, is [a-z0-9-]+, such as
eu-central1: ClientBuilder::build refuses any other.
Sourcepub fn endpoint(self, endpoint: impl Into<String>) -> Self
pub fn endpoint(self, endpoint: impl Into<String>) -> Self
Sends the calls of every service to one base URL, such as a test
server’s, instead of the service’s own host. ClientBuilder::build
refuses one that isn’t an absolute URL with a host.
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Sets the HTTP client calls are sent with. Its timeout, if any, bounds each attempt.
Sourcepub fn user_agent(self, product: impl Into<String>) -> Self
pub fn user_agent(self, product: impl Into<String>) -> Self
Adds a product, such as my-tool/1.2, to the User-Agent header.
Sourcepub fn max_attempts(self, attempts: u32) -> Self
pub fn max_attempts(self, attempts: u32) -> Self
Sets how often a retryable call is sent at most, the first attempt included; 1 turns retries off. The default is 5.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Bounds each attempt of a call by timeout; an attempt that takes
longer fails as a transport error, which a safe call retries. By
default, only the HTTP client’s own timeout, if any, bounds it.
Waiting on an operation asks the API to wait less than this, so that
a wait call doesn’t time out on the way; see
ClientBuilder::operation_wait.
Sourcepub fn operation_wait(self, wait: Duration) -> Self
pub fn operation_wait(self, wait: Duration) -> Self
Sets how long one call of Operation::wait
asks the API to wait for the operation before answering with it as
it is, in whole seconds, at least one; the default, and the most the
API waits, is a minute. With a ClientBuilder::timeout, a call
asks for a second less than it at most. A wait call that times out
all the same, such as under the HTTP client’s own timeout, counts as
the operation not being done yet, and the next one is sent.
Sourcepub fn consistency_token_store(
self,
store: Arc<dyn ConsistencyTokenStore>,
) -> Self
pub fn consistency_token_store( self, store: Arc<dyn ConsistencyTokenStore>, ) -> Self
Keeps the consistency token in store instead of in a
ConsistencyTokenCell of the client’s own. Clients given the same
store share one token: each presents the token the store holds, and
each answer carrying a token replaces it there, so a read through
any of them shows the writes made through all of them, as through
one client (see Client::set_consistency_token for concurrent
writes).