5.0.0 (latest) 4.16.0 4.15.0 4.14.0 4.13.0 4.11.0 4.10.0 4.9.0 4.8.0 4.7.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.7.0 3.6.0 3.5.0 3.4.0

    public sealed class StorageClientBuilder : ClientBuilderBase<StorageClient>

Reference documentation and code samples for the Google Cloud Storage v1 API class StorageClientBuilder.

A builder for [StorageClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.StorageClient), allowing simple client customization.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [ClientBuilderBase](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html)[StorageClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.StorageClient) \> StorageClientBuilder

## Inherited Members

[ClientBuilderBase\<StorageClient\>.CredentialsPath](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_CredentialsPath) [ClientBuilderBase\<StorageClient\>.JsonCredentials](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_JsonCredentials) [ClientBuilderBase\<StorageClient\>.ApplicationName](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_ApplicationName) [ClientBuilderBase\<StorageClient\>.BaseUri](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_BaseUri) [ClientBuilderBase\<StorageClient\>.UniverseDomain](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_UniverseDomain) [ClientBuilderBase\<StorageClient\>.Credential](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_Credential) [ClientBuilderBase\<StorageClient\>.GoogleCredential](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_GoogleCredential) [ClientBuilderBase\<StorageClient\>.ApiKey](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_ApiKey) [ClientBuilderBase\<StorageClient\>.QuotaProject](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_QuotaProject) [ClientBuilderBase\<StorageClient\>.HttpClientFactory](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_HttpClientFactory) [ClientBuilderBase\<StorageClient\>.UseJwtAccessWithScopes](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_UseJwtAccessWithScopes) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Storage.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1)

## Assembly

Google.Cloud.Storage.V1.dll

## Constructors

### StorageClientBuilder()

    public StorageClientBuilder()

Creates a new builder with default settings.

## Properties

### EmulatorDetection

    public EmulatorDetection EmulatorDetection { get; set; }

Specifies how the builder responds to the presence of the STORAGE_EMULATOR_HOST emulator environment variable.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.EmulatorDetection.html` |   |

**Remarks** This property defaults to [None](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.EmulatorDetection.html#Google_Api_Gax_EmulatorDetection_None), meaning that the environment variable is
ignored.

### EncryptionKey

    public EncryptionKey EncryptionKey { get; set; }

The customer-supplied encryption key used by default for all relevant object-based operations.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.EncryptionKey` |   |

### UnauthenticatedAccess

    public bool UnauthenticatedAccess { get; set; }

If set to true, no credentials are created when the client is built.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

## Methods

### Build()

    public override StorageClient Build()

Builds the resulting client.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.StorageClient` |   |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.Build()

### BuildAsync(CancellationToken)

    public override Task<StorageClient> BuildAsync(CancellationToken cancellationToken = default)

Builds the resulting client asynchronously.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest/Google.Cloud.Storage.V1.StorageClient` |   |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.BuildAsync(System.Threading.CancellationToken)

### CreateServiceInitializer()

    protected override BaseClientService.Initializer CreateServiceInitializer()

Creates an initializer for the service. This method does not perform any validation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.BaseClientService.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.BaseClientService.Initializer.html` | An initializer for the service. |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.CreateServiceInitializer()

### CreateServiceInitializerAsync(CancellationToken)

    protected override Task<BaseClientService.Initializer> CreateServiceInitializerAsync(CancellationToken cancellationToken)

Creates an initializer for the service asynchronously. This method does not perform any validation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.BaseClientService.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.BaseClientService.Initializer.html` | An initializer for the service. |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.CreateServiceInitializerAsync(System.Threading.CancellationToken)

### GetDefaultApplicationName()

    protected override string GetDefaultApplicationName()

Returns the default application name, used if no custom name is otherwise specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.GetDefaultApplicationName()

### GetHttpClientInitializer()

    protected override IConfigurableHttpClientInitializer GetHttpClientInitializer()

Obtains credentials synchronously. Override this method in a concrete builder type if more
credential mechanisms are supported.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IConfigurableHttpClientInitializer.html` |   |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.GetHttpClientInitializer()

### GetHttpClientInitializerAsync(CancellationToken)

    protected override Task<IConfigurableHttpClientInitializer> GetHttpClientInitializerAsync(CancellationToken cancellationToken)

Obtains credentials asynchronously. Override this method in a concrete builder type if more
credential mechanisms are supported.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IConfigurableHttpClientInitializer.html` |   |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.GetHttpClientInitializerAsync(System.Threading.CancellationToken)

### GetScopedCredentialProvider()

    protected override ScopedCredentialProvider GetScopedCredentialProvider()

Returns the scoped credential provider for this builder.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ScopedCredentialProvider.html` |   |

**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.GetScopedCredentialProvider()

### Validate()

    protected override void Validate()

Validates that the builder is in a consistent state for building. For example, it's invalid to call
[Build()](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.ClientBuilderBase-1.html#Google_Api_Gax_Rest_ClientBuilderBase_1_Build) on an instance which has both JSON credentials and a credentials path specified.
**Overrides** Google.Api.Gax.Rest.ClientBuilderBase\<Google.Cloud.Storage.V1.StorageClient\>.Validate()

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.invalidoperationexception` | The builder is in an invalid state. |