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