3.11.0-rc 3.10.0 (latest) 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 2.48.0-rc 2.47.1 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.28.0 2.27.0 2.26.0 2.25.1 2.24.0 2.23.0 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.14.0 2.13.0 2.12.0 2.11.0 2.10.1 The configuration parameters for client connections.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) instead.

## Constructors

### ConnectionOptions()

The default options, using `grpc::GoogleDefaultCredentials()`.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) instead.

### ConnectionOptions(std::shared_ptr\< grpc::ChannelCredentials \>)

The default options, using an explicit credentials object.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) instead.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `credentials` | `std::shared_ptr< grpc::ChannelCredentials >` |

## Functions

### set_credentials(std::shared_ptr\< grpc::ChannelCredentials \>)

Change the gRPC credentials value.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`UnifiedCredentialsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1UnifiedCredentialsOption).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::shared_ptr< grpc::ChannelCredentials >` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### credentials() const

The gRPC credentials used by clients configured with this object.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`UnifiedCredentialsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1UnifiedCredentialsOption).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::shared_ptr< grpc::ChannelCredentials >` |   |

### set_endpoint(std::string)

Change the gRPC endpoint.
In almost all cases the default is the correct endpoint to use. Applications may need to be changed to (1) test against a fake or simulator, or (2) to use a beta or EAP version of the service.

The default value is set by `ConnectionTraits::default_endpoint()`.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`EndpointOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1EndpointOption).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### endpoint() const

The endpoint used by clients configured with this object.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`EndpointOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1EndpointOption).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::string const &` |   |

### num_channels() const

The number of transport channels to create.
Some transports limit the number of simultaneous calls in progress on a channel (for gRPC the limit is 100). Increasing the number of channels thus increases the number of operations that can be in progress in parallel.

The default value is set by `ConnectionTraits::default_num_channels()`.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`GrpcNumChannelsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcNumChannelsOption)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### set_num_channels(int)

Set the value for [`num_channels()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ConnectionOptions#classgoogle_1_1cloud_1_1ConnectionOptions_1a3a6de10c915ca2129c825dc44818b996).

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`GrpcNumChannelsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcNumChannelsOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `num_channels` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### tracing_enabled(std::string const \&) const

Return whether tracing is enabled for the given `component`.
The C++ clients can log interesting events to help library and application developers troubleshoot problems. This flag returns true if tracing should be enabled by clients configured with this option.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`LoggingComponentsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1LoggingComponentsOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `component` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### enable_tracing(std::string const \&)

Enable tracing for `component` in clients configured with this object.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`LoggingComponentsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1LoggingComponentsOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `component` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### disable_tracing(std::string const \&)

Disable tracing for `component` in clients configured with this object.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`LoggingComponentsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1LoggingComponentsOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `component` | `std::string const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### components() const

Return the set of tracing components.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`LoggingComponentsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1LoggingComponentsOption)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::set< std::string > const &` |   |

### tracing_options() const

Return the options for use when tracing RPCs.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and `GrpcTracingOption`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TracingOptions const &` |   |

### channel_pool_domain() const

Define the gRPC channel domain for clients configured with this object.
In some cases applications may want to use a separate gRPC connections for different clients. gRPC may share the connection used by separate channels created with the same configuration. The client objects created with this object will create gRPC channels configured with `grpc.channel_pooling_domain` set to the value returned by [`channel_pool_domain()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ConnectionOptions#classgoogle_1_1cloud_1_1ConnectionOptions_1a071230426369b780e3ab13c29c71f32d). gRPC channels with different values for `grpc.channel_pooling_domain` are guaranteed to use different connections. Note that there is no guarantee that channels with the same value will have the same connection though.

This option might be useful for applications that want to segregate traffic for whatever reason.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and `GrpcChannelsArgumentsOption`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::string const &` |   |

### set_channel_pool_domain(std::string)

Set the value for [`channel_pool_domain()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ConnectionOptions#classgoogle_1_1cloud_1_1ConnectionOptions_1a071230426369b780e3ab13c29c71f32d).

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and `GrpcChannelsArgumentsOption`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `v` | `std::string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### add_user_agent_prefix(std::string)

Prepend `prefix` to the user-agent string.
Libraries or services that use Cloud C++ clients may want to set their own user-agent prefix. This can help them develop telemetry information about number of users running particular versions of their system or library.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`UserAgentProductsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1UserAgentProductsOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `prefix` | `std::string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### user_agent_prefix() const

Return the current value for the user agent string.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`UserAgentProductsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1UserAgentProductsOption).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::string const &` |   |

### CreateChannelArguments() const

Create a new `grpc::ChannelArguments` configured with the options in this object.
The caller would typically pass this argument to `grpc::CreateCustomChannel` and create one more more gRPC channels.

> [!WARNING]
> **Deprecated:** Not intended for use in application code. There is no alternative implemented or planned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `grpc::ChannelArguments` |   |

### set_background_thread_pool_size(std::size_t)

Set the number of background threads.

> [!NOTE]
> **Note:** This value is not used if [`DisableBackgroundThreads()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ConnectionOptions#classgoogle_1_1cloud_1_1ConnectionOptions_1ae6065c5f7db873ad6ac3df86291a573d) is called.

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`GrpcBackgroundThreadPoolSizeOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcBackgroundThreadPoolSizeOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `s` | `std::size_t` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### background_thread_pool_size() const

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`GrpcBackgroundThreadPoolSizeOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcBackgroundThreadPoolSizeOption).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::size_t` |   |

### DisableBackgroundThreads(google::cloud::CompletionQueue const \&)

Configure the connection to use `cq` for all background work.
Connections need to perform background work on behalf of the application. Normally they just create a background thread and a [`CompletionQueue`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1CompletionQueue) for this work, but the application may need more fine-grained control of their threads. In this case the application can provide the [`CompletionQueue`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1CompletionQueue) and it assumes responsibility for creating one or more threads blocked on [`CompletionQueue::Run()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1CompletionQueue#classgoogle_1_1cloud_1_1CompletionQueue_1a9803235c77d3838d14b81f5200b204c4).

> [!WARNING]
> **Deprecated:** Use [`Options`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options) and [`GrpcCompletionQueueOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcCompletionQueueOption)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cq` | `google::cloud::CompletionQueue const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ConnectionOptions &` |   |

### background_threads_factory() const

> [!WARNING]
> **Deprecated:** Not intended for applications to use. There is no alternative implemented or planned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `BackgroundThreadsFactory` |   |

## Type Aliases

### BackgroundThreadsFactory

**Alias Of** : `::google::cloud::BackgroundThreadsFactory`

> [!WARNING]
> **Deprecated:** Prefer using [`google::cloud::BackgroundThreadsFactory`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud).