diff --git a/temporal/api/cloud/billing/v1/message.proto b/temporal/api/cloud/billing/v1/message.proto new file mode 100644 index 0000000..3d18888 --- /dev/null +++ b/temporal/api/cloud/billing/v1/message.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; + +package temporal.api.cloud.billing.v1; + +option go_package = "go.temporal.io/api/cloud/billing/v1;billing"; +option java_package = "io.temporal.api.cloud.billing.v1"; +option java_multiple_files = true; +option java_outer_classname = "MessageProto"; +option ruby_package = "Temporalio::Api::Cloud::Billing::V1"; +option csharp_namespace = "Temporalio.Api.Cloud.Billing.V1"; + +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +message BillingReportSpec { + // The start time of the billing report (in UTC). + google.protobuf.Timestamp start_time_inclusive = 1; + // The end time of the billing report (in UTC). + google.protobuf.Timestamp end_time_exclusive = 2; + // The duration after which the download url will expire. + // Optional, default is 5 minutes and maximum is 1 hour. + google.protobuf.Duration download_url_expiration_duration = 3; + // The description for the billing report. + // Optional, default is empty. + string description = 4; +} + +message BillingReport { + // The id of the billing report. + string id = 1; + // The current state of the billing report. + BillingReportState state = 2; + // The spec used to generate this billing report. + BillingReportSpec spec = 3; + // The download information for the billing report. + // For future-proofness this is repeated as we may return multiple files (e.g. csv+meta/json, split by size/date, etc.) + repeated Download download_info = 4; + // The date and time when the billing report was requested. + google.protobuf.Timestamp requested_time = 5; + // The date and time when the billing report generation completed. + google.protobuf.Timestamp generated_time = 6; + // The async operation id associated with the billing report generation. + string async_operation_id = 7; + + message Download { + // The download url. + string url = 1; + // The time when the download url will expire. + google.protobuf.Timestamp url_expiration_time = 2; + // The file format of the billing report + FileFormat file_format = 3; + // The size of the file in bytes. Useful for pre-allocating space, progress indicators, etc. + int64 file_size_bytes = 4; + + enum FileFormat { + FILE_FORMAT_UNSPECIFIED = 0; + FILE_FORMAT_CSV = 1; + } + } + + enum BillingReportState { + BILLING_REPORT_STATE_UNSPECIFIED = 0; + BILLING_REPORT_STATE_IN_PROGRESS = 1; + BILLING_REPORT_STATE_GENERATED = 2; + BILLING_REPORT_STATE_FAILED = 3; + } +} \ No newline at end of file diff --git a/temporal/api/cloud/cloudservice/v1/request_response.proto b/temporal/api/cloud/cloudservice/v1/request_response.proto index 1fe95e8..e9815da 100644 --- a/temporal/api/cloud/cloudservice/v1/request_response.proto +++ b/temporal/api/cloud/cloudservice/v1/request_response.proto @@ -20,6 +20,7 @@ import "temporal/api/cloud/account/v1/message.proto"; import "temporal/api/cloud/usage/v1/message.proto"; import "temporal/api/cloud/connectivityrule/v1/message.proto"; import "temporal/api/cloud/auditlog/v1/message.proto"; +import "temporal/api/cloud/billing/v1/message.proto"; message GetCurrentIdentityRequest { } @@ -1068,4 +1069,28 @@ message GetNamespaceCapacityInfoRequest { message GetNamespaceCapacityInfoResponse { // Capacity information for the namespace. temporal.api.cloud.namespace.v1.NamespaceCapacityInfo capacity_info = 1; +} + +message CreateBillingReportRequest { + // The specification for the billing report. + temporal.api.cloud.billing.v1.BillingReportSpec spec = 1; + // Optional, if not provided a random id will be generated. + string async_operation_id = 2; +} + +message CreateBillingReportResponse { + // The id of the billing report created. + string billing_report_id = 1; + // The async operation. + temporal.api.cloud.operation.v1.AsyncOperation async_operation = 2; +} + +message GetBillingReportRequest { + // The id of the billing report to retrieve. + string billing_report_id = 1; +} + +message GetBillingReportResponse { + // The billing report retrieved. + temporal.api.cloud.billing.v1.BillingReport billing_report = 1; } \ No newline at end of file diff --git a/temporal/api/cloud/cloudservice/v1/service.proto b/temporal/api/cloud/cloudservice/v1/service.proto index 23d9776..d65c958 100644 --- a/temporal/api/cloud/cloudservice/v1/service.proto +++ b/temporal/api/cloud/cloudservice/v1/service.proto @@ -1120,4 +1120,37 @@ service CloudService { }; }; } + + // Create a billing report + rpc CreateBillingReport(CreateBillingReportRequest) returns (CreateBillingReportResponse) { + option (google.api.http) = { + post: "/cloud/billing-reports" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: ["Account"]; + summary: "Create a billing report"; + description: "Creates a billing report for the account"; + external_docs: { + url: "https://docs.temporal.io/cloud/billing-reports"; + description: "Billing report documentation"; + }; + }; + } + + // Get a billing report + rpc GetBillingReport(GetBillingReportRequest) returns (GetBillingReportResponse) { + option (google.api.http) = { + get: "/cloud/billing-reports/{billing_report_id}" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: ["Account"]; + summary: "Get a billing report"; + description: "Gets an existing billing report for the account"; + external_docs: { + url: "https://docs.temporal.io/cloud/billing-reports"; + description: "Billing report documentation"; + }; + }; + } }