// The external API for managing storage locations, object access, and notifications. 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"; import "tilebox/v1/query.proto"; import "workflows/v1/storage_access.proto"; option features.field_presence = IMPLICIT; // StorageType identifies the storage provider and resource kind. enum StorageType { STORAGE_TYPE_UNSPECIFIED = 0; // Google Cloud Storage bucket STORAGE_TYPE_GCS = 1; // Amazon Web Services S3 bucket STORAGE_TYPE_AWS_S3 = 2; // Local directory STORAGE_TYPE_LOCAL = 3; // Azure Blob Storage container STORAGE_TYPE_AZURE_BLOB = 4; // Cloudflare R2 bucket STORAGE_TYPE_CLOUDFLARE_R2 = 5; // Tigris bucket STORAGE_TYPE_TIGRIS = 6; // Bucket served by another S3-compatible provider STORAGE_TYPE_S3_COMPATIBLE = 7; } // StorageLocation identifies a bucket, container, or local directory. message StorageLocation { // Unique identifier of the storage location. tilebox.v1.ID id = 1; // Use reference for the provider coordinates. string location = 2 [deprecated = true]; // Use reference.type for the storage type. StorageType type = 3 [deprecated = true]; // Display name of the storage location. string name = 4 [(buf.validate.field).string.max_bytes = 1024]; // Provider coordinates and optional object access. Responses omit stored credentials. StorageLocationReference reference = 5; } // StorageLocationReference identifies a resource and its access settings. Set the field matching type. // Resource coordinates cannot change after creation. Omit access for notification-only use. message StorageLocationReference { option (buf.validate.message).oneof = { fields: [ "aws_s3_bucket", "gcs_bucket", "azure_blob", "local", "s3_compatible_bucket", "r2_bucket", "tigris_bucket" ] required: true }; option (buf.validate.message).cel = { id: "storage_location_reference.type" message: "The storage type must match the provider reference." expression: "(this.type == 1 && has(this.gcs_bucket)) || (this.type == 2 && has(this.aws_s3_bucket)) || (this.type == 3 && has(this.local)) || (this.type == 4 && has(this.azure_blob)) || (this.type == 5 && has(this.r2_bucket)) || (this.type == 6 && has(this.tigris_bucket)) || (this.type == 7 && has(this.s3_compatible_bucket))" }; AWSS3BucketReference aws_s3_bucket = 1; GCSBucketReference gcs_bucket = 2; AzureBlobReference azure_blob = 3; LocalReference local = 4; StorageType type = 5 [(buf.validate.field).enum = { defined_only: true not_in: [0] }]; S3CompatibleBucketReference s3_compatible_bucket = 6; R2BucketReference r2_bucket = 7; TigrisBucketReference tigris_bucket = 8; } // S3CompatibleBucketReference identifies a bucket at an S3 endpoint. message S3CompatibleBucketReference { string bucket = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 255 }]; // HTTP or HTTPS origin without credentials, path, query, or fragment. string endpoint = 2 [(buf.validate.field).string = { uri: true max_bytes: 2048 pattern: "^https?://[^/?#@]+/?$" }]; // Signing region. Defaults to "auto". string region = 3 [(buf.validate.field).string.max_bytes = 128]; bool force_path_style = 4; S3CompatibleStorageAccess access = 5; } // R2BucketReference identifies a Cloudflare R2 bucket. message R2BucketReference { string bucket = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 63 }]; // R2 S3 endpoint, including jurisdiction if applicable. string endpoint = 2 [(buf.validate.field).string = { uri: true max_bytes: 2048 pattern: "^https://[^/?#@]+/?$" }]; R2StorageAccess access = 3; } // TigrisBucketReference identifies a Tigris bucket using its standard S3 endpoint. message TigrisBucketReference { string bucket = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 63 }]; TigrisStorageAccess access = 2; } // AWSS3BucketReference identifies an Amazon Web Services S3 bucket and its region. message AWSS3BucketReference { string bucket = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 63 }]; string region = 2 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 128 }]; AWSS3StorageAccess access = 3; } // GCSBucketReference identifies a Google Cloud Storage bucket and its project. message GCSBucketReference { string bucket = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 222 }]; // ID of the Google Cloud project that owns the bucket. string project_id = 2 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 128 }]; // Optional bucket location, such as europe-west2, EUR4, or EU. string location = 3 [(buf.validate.field).string.max_bytes = 128]; GCSStorageAccess access = 4; } // AzureBlobReference identifies a container in an Azure storage account. message AzureBlobReference { // Full ARM resource ID of the storage account. string storage_account_resource_id = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 2048 }]; string container = 2 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 63 }]; // Optional storage account region, such as westeurope. string region = 3 [(buf.validate.field).string.max_bytes = 128]; AzureBlobStorageAccess access = 4; } // LocalReference identifies a local directory monitored by the Tilebox CLI. message LocalReference { string path = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 512 }]; } // TriggeredJob identifies a job submitted by an automation for a matching object path. message TriggeredJob { tilebox.v1.ID job_id = 1; tilebox.v1.ID automation_id = 2; string glob_pattern = 3; } // TriggeredJobs contains the jobs submitted for an event. message TriggeredJobs { repeated TriggeredJob triggered_jobs = 1; } // CreateStorageLocationRequest registers an existing bucket, container, or directory. // Supply complete credentials when selecting a credential-backed access method. message CreateStorageLocationRequest { string name = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 1024 }]; StorageLocationReference reference = 2 [(buf.validate.field).required = true]; } // TestStorageAccessRequest tests a saved location or an unsaved configuration without storing it. message TestStorageAccessRequest { option (buf.validate.message).oneof = { fields: [ "storage_location_id", "create_request" ] required: true }; tilebox.v1.ID storage_location_id = 1; // Read this object without listing. If omitted, list one page and read a nonempty object when available. string object_key = 2 [ features.field_presence = EXPLICIT, (buf.validate.field).string = { min_bytes: 1 max_bytes: 4096 not_contains: "\x00" }, (buf.validate.field).cel = { id: "storage_access_test.object_key" message: "Use a relative object key without empty, '.' or '..' components." expression: "this.split('/').all(p, p != '' && p != '.' && p != '..')" } ]; // The same input as creation, including complete credentials for the selected access method. CreateStorageLocationRequest create_request = 3 [(google.api.field_behavior) = INPUT_ONLY]; // Also create and delete a temporary object. A failed cleanup may leave it behind. bool verify_write = 4; } // TestStorageAccessResponse reports each check: absent means skipped, true means passed, and false means failed. // Invalid requests, authorization failures, and failures to obtain credentials return RPC errors. message TestStorageAccessResponse { bool list = 1 [features.field_presence = EXPLICIT]; bool read = 2 [features.field_presence = EXPLICIT]; bool write = 3 [features.field_presence = EXPLICIT]; bool delete = 4 [features.field_presence = EXPLICIT]; } // ListStorageObjectsRequest lists objects in a saved storage location. message ListStorageObjectsRequest { tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; // Match keys starting with this string. Use a trailing slash to select a folder. string prefix = 2 [(buf.validate.field).string = { max_bytes: 4096 not_contains: "\x00" }]; // Empty lists all matching objects; "/" groups nested keys into common_prefixes. string delimiter = 3 [(buf.validate.field).string = { in: [ "", "/" ] }]; // Maximum combined number of objects and common prefixes. Zero defaults to 100. int32 page_size = 4 [(buf.validate.field).int32 = { gte: 0 lte: 1000 }]; // Opaque token from the previous response. Empty starts a new listing. // Keep storage_location_id, prefix, and delimiter unchanged between pages. string page_token = 5; } // StorageObject contains metadata returned by an object listing. message StorageObject { // Full object key relative to the bucket or container root, including the requested prefix. string key = 1; // Object size in bytes. int64 size = 2; // Last modification time, absent when unavailable. google.protobuf.Timestamp last_modified = 3; } // ListStorageObjectsResponse contains one page of objects and grouped prefixes. // Results may change between pages; listing does not provide a snapshot. message ListStorageObjectsResponse { repeated StorageObject objects = 1; // Full prefixes ending in "/", returned when delimiter is "/". Use one as prefix to browse it. repeated string common_prefixes = 2; // Empty when finished. A short or empty page may still have a next token. string next_page_token = 3; } // UpdateStorageLocationRequest changes supplied fields and leaves the rest unchanged. message UpdateStorageLocationRequest { option (buf.validate.message).cel = { id: "update_storage_location.fields" message: "At least one update field is required." expression: "has(this.name) || has(this.reference)" }; tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; string name = 2 [ features.field_presence = EXPLICIT, (buf.validate.field).string = { min_bytes: 1 max_bytes: 1024 } ]; // Supply the complete reference with unchanged resource coordinates to replace access settings. // Only omitted credentials are retained within the same method; other omitted settings use their defaults. // Switching methods requires complete credentials. // Omitting access removes saved credentials. Issued credentials may remain valid. StorageLocationReference reference = 3; } // StorageSubscriptionType identifies the notification delivery provider. enum StorageSubscriptionType { STORAGE_SUBSCRIPTION_TYPE_UNSPECIFIED = 0; // Amazon SNS delivering object notifications from an AWS S3 bucket, or custom SNS message formats configured via message_format. STORAGE_SUBSCRIPTION_TYPE_AWS_SNS = 1; // Google Cloud Pub/Sub delivering notifications from a GCS bucket. STORAGE_SUBSCRIPTION_TYPE_GOOGLE_PUBSUB = 2; // Azure Event Grid delivering notifications from an Azure Blob Storage container. STORAGE_SUBSCRIPTION_TYPE_AZURE_EVENT_GRID = 3; // Storage notifications sent by the Tilebox CLI. Typically for local storage locations. No delivery configuration is required. // Use StorageLocationService.NotifyObjectCreated, or POST JSON containing object_path and optional RFC3339 event_time // to /v1/storage-notifications/tilebox-cli/. // object_path is relative to the directory root and uses slash separators, without dot or parent components. // Authenticate with Authorization: Bearer ; the organization must manage the storage location. // The standalone on-orbit runtime does not require authentication. // Successful HTTP deliveries return 204 after jobs and history are committed. Retries can create duplicate jobs. STORAGE_SUBSCRIPTION_TYPE_TILEBOX_CLI = 4; } // AWSSNSStorageSubscription identifies the SNS topic whose signed notifications are accepted. // Configure an HTTPS subscription with raw message delivery disabled. Tilebox verifies and confirms signed SNS requests. message AWSSNSStorageSubscription { string topic_arn = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 2048 }]; // Payload format: s3, earthsearch_stac, or usgs_landsat_c2. If omitted, s3 is assumed. string message_format = 2 [ (buf.validate.field).string.in = "", (buf.validate.field).string.in = "s3", (buf.validate.field).string.in = "earthsearch_stac", (buf.validate.field).string.in = "usgs_landsat_c2" ]; } // GooglePubSubStorageSubscription identifies the delivery subscription and authenticated push identity. // Use authenticated push with wrapped JSON and the returned audience. message GooglePubSubStorageSubscription { // Full resource name: projects/{project}/subscriptions/{subscription}. string subscription = 1 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 1024 }]; // Expected Google-authenticated service account email. No service account key is accepted. string service_account_email = 2 [(buf.validate.field).string = { email: true max_bytes: 320 }]; // OIDC audience to configure for authenticated push, equal to the subscription's endpoint. string audience = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; } // AzureEventGridStorageSubscription configures Event Grid delivery with a secret header. // Subscribe to Microsoft.Storage.BlobCreated with the location's container subject prefix. // Use Event Grid schema, not CloudEvents schema. message AzureEventGridStorageSubscription { // Delivery header to configure in Event Grid: X-Tilebox-Webhook-Secret. string webhook_secret_header = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Secret delivery header value, returned only when the subscription is created. // Copy it into Event Grid's secret delivery header configuration; it cannot be retrieved later. string webhook_secret = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // Server-managed verifier; never returned by the API. bytes webhook_secret_hash = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; } // StorageSubscription receives object notifications for a storage location. // To change delivery configuration, create a replacement subscription and delete the old one. message StorageSubscription { option (buf.validate.message).oneof = { fields: [ "aws_sns", "google_pubsub", "azure_event_grid" ] }; option (buf.validate.message).cel = { id: "storage_subscription.type" message: "The subscription type must match the delivery configuration." expression: "(this.type == 1 && has(this.aws_sns)) || (this.type == 2 && has(this.google_pubsub)) || (this.type == 3 && has(this.azure_event_grid)) || (this.type == 4 && !has(this.aws_sns) && !has(this.google_pubsub) && !has(this.azure_event_grid))" }; tilebox.v1.ID id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; tilebox.v1.ID storage_location_id = 2; StorageSubscriptionType type = 3 [(buf.validate.field).enum = { defined_only: true not_in: [0] }]; // Notification delivery URL: HTTPS for the hosted API, HTTP for standalone on-orbit. // With a Unix-socket listener, on-orbit returns a relative path to use over that socket. string endpoint = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; google.protobuf.Timestamp created_at = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; AWSSNSStorageSubscription aws_sns = 7; GooglePubSubStorageSubscription google_pubsub = 8; AzureEventGridStorageSubscription azure_event_grid = 9; } // CreateStorageSubscriptionRequest registers notification delivery for a storage location. It enables the // Tilebox webhook endpoint to receive object notifications from the provider. Infrastructure on the provider side // must then be configured to send notifications to the returned endpoint. message CreateStorageSubscriptionRequest { option (buf.validate.message).oneof = { fields: [ "aws_sns", "google_pubsub", "azure_event_grid" ] }; option (buf.validate.message).cel = { id: "create_storage_subscription_request.type" message: "The subscription type must match the delivery configuration." expression: "(this.type == 1 && has(this.aws_sns)) || (this.type == 2 && has(this.google_pubsub)) || (this.type == 3 && has(this.azure_event_grid)) || (this.type == 4 && !has(this.aws_sns) && !has(this.google_pubsub) && !has(this.azure_event_grid))" }; tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; StorageSubscriptionType type = 2 [(buf.validate.field).enum = { defined_only: true not_in: [0] }]; AWSSNSStorageSubscription aws_sns = 3; GooglePubSubStorageSubscription google_pubsub = 4; AzureEventGridStorageSubscription azure_event_grid = 5; } // ListStorageSubscriptionsRequest lists subscriptions for a storage location. message ListStorageSubscriptionsRequest { tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; } // NotifyObjectCreatedRequest sends a file-ready event to a TILEBOX_CLI subscription. message NotifyObjectCreatedRequest { // Subscription through which to deliver the event. It must have type TILEBOX_CLI. tilebox.v1.ID storage_subscription_id = 1 [(buf.validate.field).required = true]; // Path relative to the location root, using slash separators without dot or parent components. Must not include // a leading slash. For example, "subdir/file.txt" or "file.txt". string object_path = 2 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 4096 }]; // Time the object was observed, absent when unavailable. google.protobuf.Timestamp event_time = 3; } // StorageSubscriptions contains notification subscriptions for a storage location. message StorageSubscriptions { repeated StorageSubscription subscriptions = 1; } // StorageSubscriptionEvent is an object notification received for a storage location. message StorageSubscriptionEvent { // Unique identifier of the received event. tilebox.v1.ID id = 1; // Object key within the bucket or container, or path relative to the local directory root. string object_key = 2 [(buf.validate.field).string = { min_bytes: 1 max_bytes: 4096 }]; StorageEventType type = 3 [(buf.validate.field).enum = { defined_only: true not_in: [0] }]; // Provider event time, absent when unavailable. google.protobuf.Timestamp event_time = 4; // Time Tilebox received the notification. google.protobuf.Timestamp received_at = 5; // Jobs triggered by this event. repeated TriggeredJob triggered_jobs = 6; // Subscription through which the event was received. tilebox.v1.ID storage_subscription_id = 7; } // ListStorageSubscriptionEventsRequest requests events received for a storage location. message ListStorageSubscriptionEventsRequest { tilebox.v1.ID storage_location_id = 1 [(buf.validate.field).required = true]; // Pagination in descending receipt order; the default and maximum limit is 100. tilebox.v1.Pagination page = 2 [features.field_presence = EXPLICIT]; } // StorageSubscriptionEvents contains one page of received events, newest first. message StorageSubscriptionEvents { repeated StorageSubscriptionEvent events = 1; // Pagination parameters for the next page, absent when there are no more events. tilebox.v1.Pagination next_page = 2 [features.field_presence = EXPLICIT]; } // StorageLocations contains locations available to the caller. message StorageLocations { repeated StorageLocation locations = 1; } // StorageEventType specifies the type of event that triggered the task. enum StorageEventType { STORAGE_EVENT_TYPE_UNSPECIFIED = 0; STORAGE_EVENT_TYPE_CREATED = 1; } // TriggeredStorageEvent contains the details of the concrete event that triggered a storage event trigger. message TriggeredStorageEvent { // The storage location that triggered the task tilebox.v1.ID storage_location_id = 1; // The type of the storage event, e.g. created StorageEventType type = 2; // Object key within the bucket or container, or path relative to the local directory root. string location = 3; } // StorageLocationService manages storage locations, object access, and notifications. service StorageLocationService { // ListStorageLocations lists locations available to the caller. rpc ListStorageLocations(google.protobuf.Empty) returns (StorageLocations); // GetStorageLocation gets a storage location by its ID. rpc GetStorageLocation(tilebox.v1.ID) returns (StorageLocation); // CreateStorageLocation registers an existing resource with optional object access. rpc CreateStorageLocation(CreateStorageLocationRequest) returns (StorageLocation); // UpdateStorageLocation changes the name or access settings. Access changes require ownership. rpc UpdateStorageLocation(UpdateStorageLocationRequest) returns (StorageLocation); // DeleteStorageLocation removes the location and its subscriptions from Tilebox without deleting cloud resources. rpc DeleteStorageLocation(tilebox.v1.ID) returns (google.protobuf.Empty); // TestStorageAccess checks object access. A page without nonempty objects skips the read check. // Saved locations require read permission; drafts require creation access. // Server tests require public HTTPS endpoints on port 443. Local and client-managed access cannot be tested. rpc TestStorageAccess(TestStorageAccessRequest) returns (TestStorageAccessResponse); // CreateStorageAccessSession returns client credentials. Location readers may request read or read/write access. // Returns FAILED_PRECONDITION for absent, anonymous, or client-managed access. rpc CreateStorageAccessSession(CreateStorageAccessSessionRequest) returns (StorageAccessSession); // ListStorageObjects lists bucket or container contents. Requires read permission on the location. // Returns FAILED_PRECONDITION for absent or client-managed access, or local locations. rpc ListStorageObjects(ListStorageObjectsRequest) returns (ListStorageObjectsResponse); // CreateStorageSubscription registers notification delivery and returns the provider setup values. rpc CreateStorageSubscription(CreateStorageSubscriptionRequest) returns (StorageSubscription); // ListStorageSubscriptions lists notification subscriptions for a storage location. rpc ListStorageSubscriptions(ListStorageSubscriptionsRequest) returns (StorageSubscriptions); // GetStorageSubscription gets a subscription by its ID. rpc GetStorageSubscription(tilebox.v1.ID) returns (StorageSubscription); // DeleteStorageSubscription stops accepting notifications at its endpoint without deleting cloud resources. rpc DeleteStorageSubscription(tilebox.v1.ID) returns (google.protobuf.Empty); // ListStorageSubscriptionEvents lists received object notifications and the jobs they triggered. rpc ListStorageSubscriptionEvents(ListStorageSubscriptionEventsRequest) returns (StorageSubscriptionEvents); // NotifyObjectCreated delivers a storage event of a local storage location. Typically called by the Tilebox CLI // during the `tilebox storage-location watch` command. The subscription must be of type TILEBOX_CLI. rpc NotifyObjectCreated(NotifyObjectCreatedRequest) returns (google.protobuf.Empty); }