api/v1/proto/operationcontainer.proto (71 lines of code) (raw):

syntax = "proto3"; package OperationContainer; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "buf/validate/validate.proto"; import "proto/log.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; import "google/protobuf/timestamp.proto"; // https://protobuf.dev/reference/go/go-generated/#package option go_package = "github.com/Azure/OperationContainer/api"; // More info on how to use REST api // https://cloud.google.com/endpoints/docs/grpc/transcoding#map_a_get_method // The greeting service definition. service OperationContainer { // Creates a new operation status in the database. rpc CreateOperationStatus (CreateOperationStatusRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/operation/{operationId}" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Create a new Operation Status" description: "This operation creates a new operation status." }; } // Gets the status of an operation. rpc GetOperationStatus (GetOperationStatusRequest) returns (GetOperationStatusResponse) { option (google.api.http) = { get: "/v1/operation/{operationId}" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Get Operation Status" description: "This operation gets the operation status." }; } // Updates the status of an operation. rpc UpdateOperationStatus (UpdateOperationStatusRequest) returns (google.protobuf.Empty) { option (google.api.http) = { put: "/v1/operation/{operationId}" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Update Operation Status" description: "This operation updates the operation status." }; } } message CreateOperationStatusRequest { string operationName = 1 [(buf.validate.field).string.min_len = 1]; string entityId = 2 [(buf.validate.field).string.min_len = 1]; google.protobuf.Timestamp expirationTimestamp = 3 [(buf.validate.field).timestamp.gt_now = true]; string operationId = 4 [(buf.validate.field).string.min_len = 1]; } message UpdateOperationStatusRequest { string operationId = 1 [(buf.validate.field).string.min_len = 1]; Status status = 2; } message GetOperationStatusRequest { string operationId = 1 [(buf.validate.field).string.min_len = 1]; } message GetOperationStatusResponse { Status status = 1; } enum Status { UNKNOWN = 0; // Use when the status of the operation is not known. PENDING = 1; // Use when an operation has been scheduled and is waiting to be picked up and processed. IN_PROGRESS = 2; // Use when an operation has been picked up by a processor and is being processed. COMPLETED = 3; // Use when an operation has run successfully. FAILED = 4; // Use when an operation had a catastrophic failure and can't be completed. CANCELLED = 5; // Use when an operation was intentionally stopped before completion. }