// Bucket access configuration and client credentials. edition = "2023"; package workflows.v1; import "buf/validate/validate.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; import "tilebox/v1/id.proto"; option features.field_presence = IMPLICIT; // StorageAccessPermission selects the operations requested for a session. enum StorageAccessPermission { STORAGE_ACCESS_PERMISSION_UNSPECIFIED = 0; // Read objects and list keys. STORAGE_ACCESS_PERMISSION_READ = 1; // Also write, delete, and manage multipart uploads. STORAGE_ACCESS_PERMISSION_READ_WRITE = 2; } // AWSRoleStorageAccess configures AWS role assumption. // Require external ID "tilebox::" in the role's trust policy, using the owning organization's UUID. message AWSRoleStorageAccess { string role_arn = 1 [(buf.validate.field).string = { max_bytes: 2048 pattern: "^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$" }]; // Allow read/write sessions. Defaults to read-only. bool allow_write = 2; } // GCSServiceAccountStorageAccess configures temporary GCS access using a service-account key. message GCSServiceAccountStorageAccess { // Service-account JSON key. Required on setup; omit on updates to keep it. Never returned. string service_account_key_json = 1 [ features.field_presence = EXPLICIT, (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).string = { min_bytes: 1 max_bytes: 65536 } ]; // Allow read/write sessions. Defaults to read-only. bool allow_write = 2; } // AzureClientSecretCredentials authenticates a service principal with a client secret. All fields are required. message AzureClientSecretCredentials { string tenant_id = 1 [ (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).string.uuid = true ]; string client_id = 2 [ (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).string.uuid = true ]; string client_secret = 3 [ (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).string.min_bytes = 1 ]; } // AzureUserDelegationSASStorageAccess configures user delegation SAS access to Azure Blob Storage. message AzureUserDelegationSASStorageAccess { // Required on setup. Omit on updates to keep credentials, or supply all fields to replace them. Never returned. AzureClientSecretCredentials credentials = 1 [(google.api.field_behavior) = INPUT_ONLY]; // Allow read/write sessions. Defaults to read-only. bool allow_write = 2; } // AccessKeyCredentials contains an S3-compatible key pair. // Both fields are required on setup. Omitted fields keep their saved values on updates. message AccessKeyCredentials { string access_key_id = 1 [ features.field_presence = EXPLICIT, (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).string.min_bytes = 1 ]; string secret_access_key = 2 [ features.field_presence = EXPLICIT, (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).string.min_bytes = 1 ]; } // StaticS3CredentialsAccess configures access with a saved S3 key pair. message StaticS3CredentialsAccess { AccessKeyCredentials credentials = 1 [(google.api.field_behavior) = INPUT_ONLY]; } // R2TemporaryCredentialsStorageAccess configures temporary R2 credentials using a parent key pair. message R2TemporaryCredentialsStorageAccess { AccessKeyCredentials credentials = 1 [(google.api.field_behavior) = INPUT_ONLY]; // Allow read/write sessions. Defaults to read-only. bool allow_write = 2; } // AWSS3StorageAccess configures access to an AWS bucket. message AWSS3StorageAccess { option (buf.validate.message).oneof = { fields: [ "anonymous", "client_managed", "aws_role", "static_s3" ] required: true }; // Public, unsigned reads. google.protobuf.Empty anonymous = 1; // The client supplies its own credentials. google.protobuf.Empty client_managed = 2; AWSRoleStorageAccess aws_role = 3; StaticS3CredentialsAccess static_s3 = 4; } // GCSStorageAccess configures native GCS access or S3 interoperability through HMAC keys. message GCSStorageAccess { option (buf.validate.message).oneof = { fields: [ "anonymous", "client_managed", "gcs_service_account", "static_s3" ] required: true }; google.protobuf.Empty anonymous = 1; google.protobuf.Empty client_managed = 2; GCSServiceAccountStorageAccess gcs_service_account = 3; StaticS3CredentialsAccess static_s3 = 4; } // AzureBlobStorageAccess configures access to an Azure container. message AzureBlobStorageAccess { option (buf.validate.message).oneof = { fields: [ "anonymous", "client_managed", "azure_user_delegation_sas" ] required: true }; google.protobuf.Empty anonymous = 1; google.protobuf.Empty client_managed = 2; AzureUserDelegationSASStorageAccess azure_user_delegation_sas = 3; } // R2StorageAccess configures access to a Cloudflare R2 bucket. message R2StorageAccess { option (buf.validate.message).oneof = { fields: [ "client_managed", "r2_temporary_credentials", "static_s3" ] required: true }; google.protobuf.Empty client_managed = 1; R2TemporaryCredentialsStorageAccess r2_temporary_credentials = 2; StaticS3CredentialsAccess static_s3 = 3; } // TigrisStorageAccess configures authenticated S3 access to a Tigris bucket. message TigrisStorageAccess { option (buf.validate.message).oneof = { fields: [ "client_managed", "static_s3" ] required: true }; google.protobuf.Empty client_managed = 1; StaticS3CredentialsAccess static_s3 = 2; } // S3CompatibleStorageAccess configures access through a provider's S3 API. message S3CompatibleStorageAccess { option (buf.validate.message).oneof = { fields: [ "anonymous", "client_managed", "static_s3" ] required: true }; google.protobuf.Empty anonymous = 1; google.protobuf.Empty client_managed = 2; StaticS3CredentialsAccess static_s3 = 3; } // StorageS3Connection contains S3-compatible client settings and credentials. message StorageS3Connection { string endpoint = 1; string bucket = 2; string region = 3; bool force_path_style = 4; string access_key_id = 5; string secret_access_key = 6; // Present for temporary credentials. string session_token = 7; } // StorageGCSConnection contains native GCS client settings and credentials. message StorageGCSConnection { string bucket = 1; string access_token = 2; } // StorageAzureConnection contains Azure Blob client settings and credentials. message StorageAzureConnection { string endpoint = 1; string account_name = 2; string container = 3; // SAS query string without a leading '?'. string sas_token = 4; } // CreateStorageAccessSessionRequest fetches or renews credentials for a location. message CreateStorageAccessSessionRequest { tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; // Delegated writes require allow_write. Static keys retain their existing permissions. StorageAccessPermission access = 2 [(buf.validate.field).enum = { defined_only: true not_in: [0] }]; } // StorageAccessSession contains client settings and credentials for a bucket or container. message StorageAccessSession { option (buf.validate.message).oneof = { fields: [ "s3", "gcs", "azure" ] required: true }; // Credential expiration. Request a new session to renew. Absent for static credentials. google.protobuf.Timestamp expires_at = 1; StorageS3Connection s3 = 2; StorageGCSConnection gcs = 3; StorageAzureConnection azure = 4; }