Package reference page maintained from the source documentation in src/HealthChecks.Gcp.CloudStorage.

Google Cloud Storage Health Check

This health check verifies the ability to communicate with Google Cloud Storage. It uses the provided StorageClient to list buckets for a project or fetch metadata for a configured bucket.

Defaults

By default, the StorageClient instance is resolved from the service provider. Configure either ProjectId for a service-level check or BucketName for a bucket-level check.

using Google.Cloud.Storage.V1;
using HealthChecks.Gcp.CloudStorage;

void ConfigureServices(IServiceCollection services)
{
    services.AddSingleton(_ => StorageClient.Create());

    services
        .AddHealthChecks()
        .AddCloudStorage(optionsFactory: _ => new CloudStorageHealthCheckOptions
        {
            ProjectId = "my-gcp-project"
        });
}

Bucket check

When BucketName is set, the health check fetches that bucket's metadata. BucketName takes precedence over ProjectId when both values are configured.

using Google.Cloud.Storage.V1;
using HealthChecks.Gcp.CloudStorage;

void ConfigureServices(IServiceCollection services)
{
    services.AddSingleton(_ => StorageClient.Create());

    services
        .AddHealthChecks()
        .AddCloudStorage(optionsFactory: _ => new CloudStorageHealthCheckOptions
        {
            BucketName = "my-bucket"
        });
}

Customization

You can additionally add the following parameters: