Gcp Cloud Storage (Google)
Description
Google Cloud Storage can be used as the backing implementation for Flex file operations. Your application code should depend on IFlexFileStore, while Flex provides the provider bridge and wiring.
Important concepts
IFlexFileStoreis the contract: your code uploads/downloads through a shared abstraction.Streaming: uploads use a
Stream; downloads return aStream?.Credentials: prefer service accounts; keep credentials out of source control.
Configuration in DI
Add the provider in your DI composition root (commonly in EndPoints/...CommonConfigs/OtherApplicationServicesConfig.cs).
public static class OtherApplicationServicesConfig
{
public static IServiceCollection AddOtherApplicationServices(
this IServiceCollection services,
IConfiguration configuration)
{
// Registers GCP Cloud Storage as the IFlexFileStore bridge.
services.AddFlexGcpCloudStorageFileStore(configuration);
return services;
}
}appsettings.json
Configuration is read from FlexBase:DataStores:File:GcpCloudStorage.
Examples (template-based)
These examples mirror the generated Query and PostBusHandler templates. You do not register these types manually—Flex discovers and wires generated Queries/Handlers automatically.
Upload file (PostBusHandler)
Download file (Query)
Library-specific considerations
Service account permissions: grant
storage.objects.create,storage.objects.get, andstorage.objects.liston the bucket.Credentials path: prefer mounting the JSON file at runtime (or use workload identity where available).
Last updated