Google Cloud Storage v1 API - Class StorageClientBuilder (4.9.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
TypeDescription
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
TypeDescription
EncryptionKey

UnauthenticatedAccess

public bool UnauthenticatedAccess { get; set; }

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

Property Value
TypeDescription
bool

Methods

Build()

public override StorageClient Build()

Builds the resulting client.

Returns
TypeDescription
StorageClient
Overrides

BuildAsync(CancellationToken)

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

Builds the resulting client asynchronously.

Parameter
NameDescription
cancellationTokenCancellationToken
Returns
TypeDescription
TaskStorageClient
Overrides

CreateServiceInitializer()

protected override BaseClientService.Initializer CreateServiceInitializer()

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

Returns
TypeDescription
BaseClientServiceInitializer

An initializer for the service.

Overrides

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
NameDescription
cancellationTokenCancellationToken
Returns
TypeDescription
TaskBaseClientServiceInitializer

An initializer for the service.

Overrides

GetDefaultApplicationName()

protected override string GetDefaultApplicationName()

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

Returns
TypeDescription
string
Overrides

GetHttpClientInitializer()

protected override IConfigurableHttpClientInitializer GetHttpClientInitializer()

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

Returns
TypeDescription
IConfigurableHttpClientInitializer
Overrides

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
NameDescription
cancellationTokenCancellationToken
Returns
TypeDescription
TaskIConfigurableHttpClientInitializer
Overrides

GetScopedCredentialProvider()

protected override ScopedCredentialProvider GetScopedCredentialProvider()

Returns the scoped credential provider for this builder.

Returns
TypeDescription
ScopedCredentialProvider
Overrides

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
Exceptions
TypeDescription
InvalidOperationException

The builder is in an invalid state.