workflows.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.workflows.v1beta;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/longrunning/operations.proto";
  21. import "google/protobuf/field_mask.proto";
  22. import "google/protobuf/timestamp.proto";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/workflows/v1beta;workflows";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "WorkflowsProto";
  26. option java_package = "com.google.cloud.workflows.v1beta";
  27. // Workflows is used to deploy and execute workflow programs.
  28. // Workflows makes sure the program executes reliably, despite hardware and
  29. // networking interruptions.
  30. service Workflows {
  31. option (google.api.default_host) = "workflows.googleapis.com";
  32. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  33. // Lists Workflows in a given project and location.
  34. // The default order is not specified.
  35. rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) {
  36. option (google.api.http) = {
  37. get: "/v1beta/{parent=projects/*/locations/*}/workflows"
  38. };
  39. option (google.api.method_signature) = "parent";
  40. }
  41. // Gets details of a single Workflow.
  42. rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) {
  43. option (google.api.http) = {
  44. get: "/v1beta/{name=projects/*/locations/*/workflows/*}"
  45. };
  46. option (google.api.method_signature) = "name";
  47. }
  48. // Creates a new workflow. If a workflow with the specified name already
  49. // exists in the specified project and location, the long running operation
  50. // will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
  51. rpc CreateWorkflow(CreateWorkflowRequest) returns (google.longrunning.Operation) {
  52. option (google.api.http) = {
  53. post: "/v1beta/{parent=projects/*/locations/*}/workflows"
  54. body: "workflow"
  55. };
  56. option (google.api.method_signature) = "parent,workflow,workflow_id";
  57. option (google.longrunning.operation_info) = {
  58. response_type: "Workflow"
  59. metadata_type: "OperationMetadata"
  60. };
  61. }
  62. // Deletes a workflow with the specified name.
  63. // This method also cancels and deletes all running executions of the
  64. // workflow.
  65. rpc DeleteWorkflow(DeleteWorkflowRequest) returns (google.longrunning.Operation) {
  66. option (google.api.http) = {
  67. delete: "/v1beta/{name=projects/*/locations/*/workflows/*}"
  68. };
  69. option (google.api.method_signature) = "name";
  70. option (google.longrunning.operation_info) = {
  71. response_type: "google.protobuf.Empty"
  72. metadata_type: "OperationMetadata"
  73. };
  74. }
  75. // Updates an existing workflow.
  76. // Running this method has no impact on already running executions of the
  77. // workflow. A new revision of the workflow may be created as a result of a
  78. // successful update operation. In that case, such revision will be used
  79. // in new workflow executions.
  80. rpc UpdateWorkflow(UpdateWorkflowRequest) returns (google.longrunning.Operation) {
  81. option (google.api.http) = {
  82. patch: "/v1beta/{workflow.name=projects/*/locations/*/workflows/*}"
  83. body: "workflow"
  84. };
  85. option (google.api.method_signature) = "workflow,update_mask";
  86. option (google.longrunning.operation_info) = {
  87. response_type: "Workflow"
  88. metadata_type: "OperationMetadata"
  89. };
  90. }
  91. }
  92. // Workflow program to be executed by Workflows.
  93. message Workflow {
  94. option (google.api.resource) = {
  95. type: "workflows.googleapis.com/Workflow"
  96. pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
  97. };
  98. // Describes the current state of workflow deployment. More states may be
  99. // added in the future.
  100. enum State {
  101. // Invalid state.
  102. STATE_UNSPECIFIED = 0;
  103. // The workflow has been deployed successfully and is serving.
  104. ACTIVE = 1;
  105. }
  106. // The resource name of the workflow.
  107. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  108. string name = 1;
  109. // Description of the workflow provided by the user.
  110. // Must be at most 1000 unicode characters long.
  111. string description = 2;
  112. // Output only. State of the workflow deployment.
  113. State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  114. // Output only. The revision of the workflow.
  115. // A new revision of a workflow is created as a result of updating the
  116. // following fields of a workflow:
  117. // - `source_code`
  118. // - `service_account`
  119. // The format is "000001-a4d", where the first 6 characters define
  120. // the zero-padded revision ordinal number. They are followed by a hyphen and
  121. // 3 hexadecimal random characters.
  122. string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  123. // Output only. The timestamp of when the workflow was created.
  124. google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  125. // Output only. The last update timestamp of the workflow.
  126. google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  127. // Output only. The timestamp that the latest revision of the workflow
  128. // was created.
  129. google.protobuf.Timestamp revision_create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  130. // Labels associated with this workflow.
  131. // Labels can contain at most 64 entries. Keys and values can be no longer
  132. // than 63 characters and can only contain lowercase letters, numeric
  133. // characters, underscores and dashes. Label keys must start with a letter.
  134. // International characters are allowed.
  135. map<string, string> labels = 8;
  136. // Name of the service account associated with the latest workflow version.
  137. // This service account represents the identity of the workflow and determines
  138. // what permissions the workflow has.
  139. // Format: projects/{project}/serviceAccounts/{account}
  140. //
  141. // Using `-` as a wildcard for the `{project}` will infer the project from
  142. // the account. The `{account}` value can be the `email` address or the
  143. // `unique_id` of the service account.
  144. //
  145. // If not provided, workflow will use the project's default service account.
  146. // Modifying this field for an existing workflow results in a new workflow
  147. // revision.
  148. string service_account = 9;
  149. // Required. Location of the workflow source code.
  150. // Modifying this field for an existing workflow results in a new workflow
  151. // revision.
  152. oneof source_code {
  153. // Workflow code to be executed. The size limit is 32KB.
  154. string source_contents = 10;
  155. }
  156. }
  157. // Request for the
  158. // [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows]
  159. // method.
  160. message ListWorkflowsRequest {
  161. // Required. Project and location from which the workflows should be listed.
  162. // Format: projects/{project}/locations/{location}
  163. string parent = 1 [
  164. (google.api.field_behavior) = REQUIRED,
  165. (google.api.resource_reference) = {
  166. type: "locations.googleapis.com/Location"
  167. }
  168. ];
  169. // Maximum number of workflows to return per call. The service may return
  170. // fewer than this value. If the value is not specified, a default value of
  171. // 500 will be used. The maximum permitted value is 1000 and values greater
  172. // than 1000 will be coerced down to 1000.
  173. int32 page_size = 2;
  174. // A page token, received from a previous `ListWorkflows` call.
  175. // Provide this to retrieve the subsequent page.
  176. //
  177. // When paginating, all other parameters provided to `ListWorkflows` must
  178. // match the call that provided the page token.
  179. string page_token = 3;
  180. // Filter to restrict results to specific workflows.
  181. string filter = 4;
  182. // Comma-separated list of fields that that specify the order of the results.
  183. // Default sorting order for a field is ascending. To specify descending order
  184. // for a field, append a " desc" suffix.
  185. // If not specified, the results will be returned in an unspecified order.
  186. string order_by = 5;
  187. }
  188. // Response for the
  189. // [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows]
  190. // method.
  191. message ListWorkflowsResponse {
  192. // The workflows which match the request.
  193. repeated Workflow workflows = 1;
  194. // A token, which can be sent as `page_token` to retrieve the next page.
  195. // If this field is omitted, there are no subsequent pages.
  196. string next_page_token = 2;
  197. // Unreachable resources.
  198. repeated string unreachable = 3;
  199. }
  200. // Request for the
  201. // [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method.
  202. message GetWorkflowRequest {
  203. // Required. Name of the workflow which information should be retrieved.
  204. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  205. string name = 1 [
  206. (google.api.field_behavior) = REQUIRED,
  207. (google.api.resource_reference) = {
  208. type: "workflows.googleapis.com/Workflow"
  209. }
  210. ];
  211. }
  212. // Request for the
  213. // [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow]
  214. // method.
  215. message CreateWorkflowRequest {
  216. // Required. Project and location in which the workflow should be created.
  217. // Format: projects/{project}/locations/{location}
  218. string parent = 1 [
  219. (google.api.field_behavior) = REQUIRED,
  220. (google.api.resource_reference) = {
  221. type: "locations.googleapis.com/Location"
  222. }
  223. ];
  224. // Required. Workflow to be created.
  225. Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED];
  226. // Required. The ID of the workflow to be created. It has to fulfill the
  227. // following requirements:
  228. //
  229. // * Must contain only letters, numbers, underscores and hyphens.
  230. // * Must start with a letter.
  231. // * Must be between 1-64 characters.
  232. // * Must end with a number or a letter.
  233. // * Must be unique within the customer project and location.
  234. string workflow_id = 3 [(google.api.field_behavior) = REQUIRED];
  235. }
  236. // Request for the
  237. // [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow]
  238. // method.
  239. message DeleteWorkflowRequest {
  240. // Required. Name of the workflow to be deleted.
  241. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  242. string name = 1 [
  243. (google.api.field_behavior) = REQUIRED,
  244. (google.api.resource_reference) = {
  245. type: "workflows.googleapis.com/Workflow"
  246. }
  247. ];
  248. }
  249. // Request for the
  250. // [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow]
  251. // method.
  252. message UpdateWorkflowRequest {
  253. // Required. Workflow to be updated.
  254. Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED];
  255. // List of fields to be updated. If not present, the entire workflow
  256. // will be updated.
  257. google.protobuf.FieldMask update_mask = 2;
  258. }
  259. // Represents the metadata of the long-running operation.
  260. message OperationMetadata {
  261. // The time the operation was created.
  262. google.protobuf.Timestamp create_time = 1;
  263. // The time the operation finished running.
  264. google.protobuf.Timestamp end_time = 2;
  265. // Server-defined resource path for the target of the operation.
  266. string target = 3;
  267. // Name of the verb executed by the operation.
  268. string verb = 4;
  269. // API version used to start the operation.
  270. string api_version = 5;
  271. }