Cloud.File.Storage.Manager.GoogleCloudStorage
1.0.0
dotnet add package Cloud.File.Storage.Manager.GoogleCloudStorage --version 1.0.0
NuGet\Install-Package Cloud.File.Storage.Manager.GoogleCloudStorage -Version 1.0.0
<PackageReference Include="Cloud.File.Storage.Manager.GoogleCloudStorage" Version="1.0.0" />
<PackageVersion Include="Cloud.File.Storage.Manager.GoogleCloudStorage" Version="1.0.0" />
<PackageReference Include="Cloud.File.Storage.Manager.GoogleCloudStorage" />
paket add Cloud.File.Storage.Manager.GoogleCloudStorage --version 1.0.0
#r "nuget: Cloud.File.Storage.Manager.GoogleCloudStorage, 1.0.0"
#:package Cloud.File.Storage.Manager.GoogleCloudStorage@1.0.0
#addin nuget:?package=Cloud.File.Storage.Manager.GoogleCloudStorage&version=1.0.0
#tool nuget:?package=Cloud.File.Storage.Manager.GoogleCloudStorage&version=1.0.0
Cloud File Storage Manager
Provides complete implementation to handle easily cloud file storage operations like get informations about files, reading, downloadURL generation, file update, file move and delete. Primarily for Google Cloud Storage (GCS) right now.
Google Cloud Storage is a flat object store (there are no real folders, only object keys that contain /). This manager presents the keys as a virtual folder hierarchy, the same way the Azure Blob and Amazon S3 managers do.
Configuration
Let's add a section to the appsettings.json
"GoogleCloudStorageSettings": {
"BucketName": "",
// Service account credentials (client_email + private_key from the key file).
"ClientEmail": "",
"PrivateKey": "",
// Optional
"ProjectId": "",
// Optional - the root folder inside the bucket where files are stored. Leave empty for the bucket root.
"RootDirectoryPath": ""
}
In the application, configure this settings part
services.AddSingleton<ICloudFileStorageManager, GoogleCloudStorageFileStorageManager>(services => new GoogleCloudStorageFileStorageManager(new GoogleCloudStorageFileStorageManagerOptions()
{
BucketName = config.GetSection("GoogleCloudStorageSettings").GetValue<string>("BucketName"),
ClientEmail = config.GetSection("GoogleCloudStorageSettings").GetValue<string>("ClientEmail"),
PrivateKey = config.GetSection("GoogleCloudStorageSettings").GetValue<string>("PrivateKey"),
ProjectId = config.GetSection("GoogleCloudStorageSettings").GetValue<string>("ProjectId"),
RootDirectoryPath = config.GetSection("GoogleCloudStorageSettings").GetValue<string>("RootDirectoryPath")
}));
Authentication
Credentials are resolved in this order, so the same manager works for UI-driven setup, appsettings.json, VMs, and Kubernetes:
- Discrete service account fields — set
ClientEmail+PrivateKey(optionallyProjectId). These come straight from theclient_emailandprivate_keyfields of a service account key. This is the recommended way to wire up a UI form (no JSON blob to paste). - Whole key JSON — set
CredentialsJsonto the entire service account key JSON as one string. Useful when the key is pulled as a single blob from a secret store (Secret Manager / Key Vault). - Application Default Credentials (ADC) — leave every credential field empty. On GKE/GCE this resolves via Workload Identity / the metadata server, which keeps secrets out of the configuration entirely. This is the recommended enterprise setup.
// Whole-JSON alternative
new GoogleCloudStorageFileStorageManagerOptions()
{
BucketName = "my-bucket",
CredentialsJson = config.GetSection("GoogleCloudStorageSettings").GetValue<string>("CredentialsJson")
};
// Workload Identity / ADC - no secret in config
new GoogleCloudStorageFileStorageManagerOptions()
{
BucketName = "my-bucket"
};
Setting up a service account (least privilege)
- Create a dedicated service account (IAM & Admin → Service Accounts).
- Grant it Storage Object Admin (
roles/storage.objectAdmin) on the bucket only (Cloud Storage → bucket → Permissions → Grant access). This is all the manager needs — it never creates buckets, so it requires nothing at project level. - For non-Workload-Identity setups, create a JSON key (Keys → Add key → Create new key → JSON) and read
client_email/private_keyfrom it into the options.
Signed download URLs
GetDownloadUrl / GetDownloadUrlAsync produces a time-limited signed URL. Signing requires a credential that can sign:
- a service account key (options 1/2 above) — signs locally, no extra permission, or
- a Workload Identity / impersonated identity holding
iam.serviceAccounts.signBlob— signs via the IAM API.
var url = await manager.GetDownloadUrlAsync("folder/file.txt", TimeSpan.FromHours(1));
Notes
- Append is emulated (GCS has no native append): the existing object is downloaded, appended to, and re-uploaded.
- Move is a server-side copy followed by a delete.
- Watch is not supported (throws
NotSupportedException), consistent with the Amazon S3 and Azure Blob managers. - Large reads are streamed through a temporary file (deleted on close) to keep memory usage flat.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Cloud.File.Storage.Manager.Common (>= 3.0.0)
- Google.Cloud.Storage.V1 (>= 4.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 105 | 6/15/2026 |
- Initial release: Google Cloud Storage support