workflows.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. // Copyright 2021 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.v1;
  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/v1;workflows";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "WorkflowsProto";
  26. option java_package = "com.google.cloud.workflows.v1";
  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: "/v1/{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: "/v1/{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: "/v1/{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: "/v1/{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: "/v1/{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 properties of a workflow:
  117. //
  118. // - [Service account][google.cloud.workflows.v1.Workflow.service_account]
  119. // - [Workflow code to be executed][google.cloud.workflows.v1.Workflow.source_contents]
  120. //
  121. // The format is "000001-a4d", where the first 6 characters define
  122. // the zero-padded revision ordinal number. They are followed by a hyphen and
  123. // 3 hexadecimal random characters.
  124. string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  125. // Output only. The timestamp of when the workflow was created.
  126. google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  127. // Output only. The last update timestamp of the workflow.
  128. google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  129. // Output only. The timestamp that the latest revision of the workflow
  130. // was created.
  131. google.protobuf.Timestamp revision_create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  132. // Labels associated with this workflow.
  133. // Labels can contain at most 64 entries. Keys and values can be no longer
  134. // than 63 characters and can only contain lowercase letters, numeric
  135. // characters, underscores and dashes. Label keys must start with a letter.
  136. // International characters are allowed.
  137. map<string, string> labels = 8;
  138. // The service account associated with the latest workflow version.
  139. // This service account represents the identity of the workflow and determines
  140. // what permissions the workflow has.
  141. // Format: projects/{project}/serviceAccounts/{account} or {account}
  142. //
  143. // Using `-` as a wildcard for the `{project}` or not providing one at all
  144. // will infer the project from the account. The `{account}` value can be the
  145. // `email` address or the `unique_id` of the service account.
  146. //
  147. // If not provided, workflow will use the project's default service account.
  148. // Modifying this field for an existing workflow results in a new workflow
  149. // revision.
  150. string service_account = 9;
  151. // Required. Location of the workflow source code.
  152. // Modifying this field for an existing workflow results in a new workflow
  153. // revision.
  154. oneof source_code {
  155. // Workflow code to be executed. The size limit is 128KB.
  156. string source_contents = 10;
  157. }
  158. }
  159. // Request for the
  160. // [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
  161. // method.
  162. message ListWorkflowsRequest {
  163. // Required. Project and location from which the workflows should be listed.
  164. // Format: projects/{project}/locations/{location}
  165. string parent = 1 [
  166. (google.api.field_behavior) = REQUIRED,
  167. (google.api.resource_reference) = {
  168. type: "locations.googleapis.com/Location"
  169. }
  170. ];
  171. // Maximum number of workflows to return per call. The service may return
  172. // fewer than this value. If the value is not specified, a default value of
  173. // 500 will be used. The maximum permitted value is 1000 and values greater
  174. // than 1000 will be coerced down to 1000.
  175. int32 page_size = 2;
  176. // A page token, received from a previous `ListWorkflows` call.
  177. // Provide this to retrieve the subsequent page.
  178. //
  179. // When paginating, all other parameters provided to `ListWorkflows` must
  180. // match the call that provided the page token.
  181. string page_token = 3;
  182. // Filter to restrict results to specific workflows.
  183. string filter = 4;
  184. // Comma-separated list of fields that that specify the order of the results.
  185. // Default sorting order for a field is ascending. To specify descending order
  186. // for a field, append a " desc" suffix.
  187. // If not specified, the results will be returned in an unspecified order.
  188. string order_by = 5;
  189. }
  190. // Response for the
  191. // [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
  192. // method.
  193. message ListWorkflowsResponse {
  194. // The workflows which match the request.
  195. repeated Workflow workflows = 1;
  196. // A token, which can be sent as `page_token` to retrieve the next page.
  197. // If this field is omitted, there are no subsequent pages.
  198. string next_page_token = 2;
  199. // Unreachable resources.
  200. repeated string unreachable = 3;
  201. }
  202. // Request for the
  203. // [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method.
  204. message GetWorkflowRequest {
  205. // Required. Name of the workflow which information should be retrieved.
  206. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  207. string name = 1 [
  208. (google.api.field_behavior) = REQUIRED,
  209. (google.api.resource_reference) = {
  210. type: "workflows.googleapis.com/Workflow"
  211. }
  212. ];
  213. }
  214. // Request for the
  215. // [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow]
  216. // method.
  217. message CreateWorkflowRequest {
  218. // Required. Project and location in which the workflow should be created.
  219. // Format: projects/{project}/locations/{location}
  220. string parent = 1 [
  221. (google.api.field_behavior) = REQUIRED,
  222. (google.api.resource_reference) = {
  223. type: "locations.googleapis.com/Location"
  224. }
  225. ];
  226. // Required. Workflow to be created.
  227. Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED];
  228. // Required. The ID of the workflow to be created. It has to fulfill the
  229. // following requirements:
  230. //
  231. // * Must contain only letters, numbers, underscores and hyphens.
  232. // * Must start with a letter.
  233. // * Must be between 1-64 characters.
  234. // * Must end with a number or a letter.
  235. // * Must be unique within the customer project and location.
  236. string workflow_id = 3 [(google.api.field_behavior) = REQUIRED];
  237. }
  238. // Request for the
  239. // [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow]
  240. // method.
  241. message DeleteWorkflowRequest {
  242. // Required. Name of the workflow to be deleted.
  243. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  244. string name = 1 [
  245. (google.api.field_behavior) = REQUIRED,
  246. (google.api.resource_reference) = {
  247. type: "workflows.googleapis.com/Workflow"
  248. }
  249. ];
  250. }
  251. // Request for the
  252. // [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow]
  253. // method.
  254. message UpdateWorkflowRequest {
  255. // Required. Workflow to be updated.
  256. Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED];
  257. // List of fields to be updated. If not present, the entire workflow
  258. // will be updated.
  259. google.protobuf.FieldMask update_mask = 2;
  260. }
  261. // Represents the metadata of the long-running operation.
  262. message OperationMetadata {
  263. // The time the operation was created.
  264. google.protobuf.Timestamp create_time = 1;
  265. // The time the operation finished running.
  266. google.protobuf.Timestamp end_time = 2;
  267. // Server-defined resource path for the target of the operation.
  268. string target = 3;
  269. // Name of the verb executed by the operation.
  270. string verb = 4;
  271. // API version used to start the operation.
  272. string api_version = 5;
  273. }