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.
Namespace
Google.Cloud.Storage.V1Assembly
Google.Cloud.Storage.V1.dll
Constructors
StorageClientBuilder()
public StorageClientBuilder()
Creates a new builder with default settings.
Properties
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 |
BuildAsync(CancellationToken)
public override Task<StorageClient> BuildAsync(CancellationToken cancellationToken = default)
Builds the resulting client asynchronously.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken |
Returns | |
---|---|
Type | Description |
TaskStorageClient |
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. |
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. |
GetDefaultApplicationName()
protected override string GetDefaultApplicationName()
Returns the default application name, used if no custom name is otherwise specified.
Returns | |
---|---|
Type | Description |
string |
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 |
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 |
GetScopedCredentialProvider()
protected override ScopedCredentialProvider GetScopedCredentialProvider()
Returns the scoped credential provider for this builder.
Returns | |
---|---|
Type | Description |
ScopedCredentialProvider |
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.
Exceptions | |
---|---|
Type | Description |
InvalidOperationException | The builder is in an invalid state. |