Google Cloud Storage v1 API - Class StorageClientBuilder (4.11.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, allowing simple client customization.

Inheritance

object > ClientBuilderBaseStorageClient > StorageClientBuilder

Namespace

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
EmulatorDetection
Remarks

This property defaults to 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
EncryptionKey

UnauthenticatedAccess

public bool UnauthenticatedAccess { get; set; }

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

Property Value
Type Description
bool

Methods

Build()

public override StorageClient Build()

Builds the resulting client.

Returns
Type Description
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 CancellationToken
Returns
Type Description
TaskStorageClient
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
BaseClientServiceInitializer

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 CancellationToken
Returns
Type Description
TaskBaseClientServiceInitializer

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
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
IConfigurableHttpClientInitializer
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 CancellationToken
Returns
Type Description
TaskIConfigurableHttpClientInitializer
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
ScopedCredentialProvider
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() 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
InvalidOperationException

The builder is in an invalid state.