From 98911d3e77f3d541eaa841252a44905ea4a430ab Mon Sep 17 00:00:00 2001 From: Google APIs Date: Wed, 13 Jan 2021 10:45:45 -0800 Subject: [PATCH] feat: added client library for Workflows Executions V1 API PiperOrigin-RevId: 351618705 --- .../cloud/workflows/executions/v1/BUILD.bazel | 334 ++++++++++++++++++ .../workflows/executions/v1/executions.proto | 253 +++++++++++++ .../executions/v1/executions_gapic.yaml | 18 + .../v1/executions_grpc_service_config.json | 23 ++ .../executions/v1/workflowexecutions_v1.yaml | 23 ++ 5 files changed, 651 insertions(+) create mode 100644 google/cloud/workflows/executions/v1/BUILD.bazel create mode 100644 google/cloud/workflows/executions/v1/executions.proto create mode 100644 google/cloud/workflows/executions/v1/executions_gapic.yaml create mode 100644 google/cloud/workflows/executions/v1/executions_grpc_service_config.json create mode 100644 google/cloud/workflows/executions/v1/workflowexecutions_v1.yaml diff --git a/google/cloud/workflows/executions/v1/BUILD.bazel b/google/cloud/workflows/executions/v1/BUILD.bazel new file mode 100644 index 00000000..3b4088a9 --- /dev/null +++ b/google/cloud/workflows/executions/v1/BUILD.bazel @@ -0,0 +1,334 @@ +# This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * extra_protoc_file_parameters +# The complete list of preserved parameters can be found in the source code. + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "executions_proto", + srcs = [ + "executions.proto", + ], + deps = [ + "//google/api:annotations_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/api:resource_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library_with_info( + name = "executions_proto_with_info", + deps = [ + ":executions_proto", + "//google/cloud:common_resources_proto", + ], +) + +############################################################################## +# Java +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "java_gapic_assembly_gradle_pkg", + "java_gapic_library", + "java_gapic_test", + "java_grpc_library", + "java_proto_library", +) + +java_proto_library( + name = "executions_java_proto", + deps = [":executions_proto"], +) + +java_grpc_library( + name = "executions_java_grpc", + srcs = [":executions_proto"], + deps = [":executions_java_proto"], +) + +java_gapic_library( + name = "executions_java_gapic", + srcs = [":executions_proto_with_info"], + grpc_service_config = "executions_grpc_service_config.json", + package = "google.cloud.workflows.executions.v1", + test_deps = [ + ":executions_java_grpc", + ], + deps = [ + ":executions_java_proto", + ], +) + +java_gapic_test( + name = "executions_java_gapic_test_suite", + test_classes = [ + "com.google.cloud.workflows.executions.v1.ExecutionsClientTest", + ], + runtime_deps = [":executions_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-workflows-executions-v1-java", + deps = [ + ":executions_java_gapic", + ":executions_java_grpc", + ":executions_java_proto", + ":executions_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", + "go_test", +) + +go_proto_library( + name = "executions_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1", + protos = [":executions_proto"], + deps = [ + "//google/api:annotations_go_proto", + ], +) + +go_gapic_library( + name = "executions_go_gapic", + srcs = [":executions_proto_with_info"], + grpc_service_config = "executions_grpc_service_config.json", + importpath = "cloud.google.com/go/workflows/executions/apiv1;executions", + service_yaml = "workflowexecutions_v1.yaml", + deps = [ + ":executions_go_proto", + ], +) + +go_test( + name = "executions_go_gapic_test", + srcs = [":executions_go_gapic_srcjar_test"], + embed = [":executions_go_gapic"], + importpath = "cloud.google.com/go/workflows/executions/apiv1", +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-workflows-executions-v1-go", + deps = [ + ":executions_go_gapic", + ":executions_go_gapic_srcjar-test.srcjar", + ":executions_go_proto", + ], +) + +############################################################################## +# Python +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "py_gapic_assembly_pkg", + "py_gapic_library", +) + +py_gapic_library( + name = "executions_py_gapic", + srcs = [":executions_proto"], + grpc_service_config = "executions_grpc_service_config.json", +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "workflows-executions-v1-py", + deps = [ + ":executions_py_gapic", + ], +) + +############################################################################## +# PHP +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_grpc_library", + "php_proto_library", +) + +php_proto_library( + name = "executions_php_proto", + deps = [":executions_proto"], +) + +php_grpc_library( + name = "executions_php_grpc", + srcs = [":executions_proto"], + deps = [":executions_php_proto"], +) + +php_gapic_library( + name = "executions_php_gapic", + src = ":executions_proto_with_info", + gapic_yaml = "executions_gapic.yaml", + grpc_service_config = "executions_grpc_service_config.json", + package = "google.cloud.workflows.executions.v1", + service_yaml = "workflowexecutions_v1.yaml", + deps = [ + ":executions_php_grpc", + ":executions_php_proto", + ], +) + +# Open Source Packages +php_gapic_assembly_pkg( + name = "google-cloud-workflows-executions-v1-php", + deps = [ + ":executions_php_gapic", + ":executions_php_grpc", + ":executions_php_proto", + ], +) + +############################################################################## +# Node.js +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "nodejs_gapic_assembly_pkg", + "nodejs_gapic_library", +) + +nodejs_gapic_library( + name = "executions_nodejs_gapic", + package_name = "@google-cloud/executions", + src = ":executions_proto_with_info", + extra_protoc_parameters = ["metadata"], + grpc_service_config = "executions_grpc_service_config.json", + package = "google.cloud.workflows.executions.v1", + service_yaml = "workflowexecutions_v1.yaml", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "workflows-executions-v1-nodejs", + deps = [ + ":executions_nodejs_gapic", + ":executions_proto", + ], +) + +############################################################################## +# Ruby +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "ruby_gapic_assembly_pkg", + "ruby_gapic_library", + "ruby_grpc_library", + "ruby_proto_library", +) + +ruby_proto_library( + name = "executions_ruby_proto", + deps = [":executions_proto"], +) + +ruby_grpc_library( + name = "executions_ruby_grpc", + srcs = [":executions_proto"], + deps = [":executions_ruby_proto"], +) + +ruby_gapic_library( + name = "executions_ruby_gapic", + src = ":executions_proto_with_info", + gapic_yaml = "executions_gapic.yaml", + grpc_service_config = "executions_grpc_service_config.json", + package = "google.cloud.workflows.executions.v1", + service_yaml = "workflowexecutions_v1.yaml", + deps = [ + ":executions_ruby_grpc", + ":executions_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-workflows-executions-v1-ruby", + deps = [ + ":executions_ruby_gapic", + ":executions_ruby_grpc", + ":executions_ruby_proto", + ], +) + +############################################################################## +# C# +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "csharp_gapic_assembly_pkg", + "csharp_gapic_library", + "csharp_grpc_library", + "csharp_proto_library", +) + +csharp_proto_library( + name = "executions_csharp_proto", + deps = [":executions_proto"], +) + +csharp_grpc_library( + name = "executions_csharp_grpc", + srcs = [":executions_proto"], + deps = [":executions_csharp_proto"], +) + +csharp_gapic_library( + name = "executions_csharp_gapic", + srcs = [":executions_proto_with_info"], + common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json", + grpc_service_config = "executions_grpc_service_config.json", + deps = [ + ":executions_csharp_grpc", + ":executions_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-workflows-executions-v1-csharp", + deps = [ + ":executions_csharp_gapic", + ":executions_csharp_grpc", + ":executions_csharp_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +# Put your C++ rules here diff --git a/google/cloud/workflows/executions/v1/executions.proto b/google/cloud/workflows/executions/v1/executions.proto new file mode 100644 index 00000000..583a5d90 --- /dev/null +++ b/google/cloud/workflows/executions/v1/executions.proto @@ -0,0 +1,253 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.workflows.executions.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1;executions"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionsProto"; +option java_package = "com.google.cloud.workflows.executions.v1"; +option (google.api.resource_definition) = { + type: "workflows.googleapis.com/Workflow" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}" +}; + +// Executions is used to start and manage running instances of +// [Workflows][google.cloud.workflows.v1.Workflow] called executions. +service Executions { + option (google.api.default_host) = "workflowexecutions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of executions which belong to the workflow with + // the given name. The method returns executions of all workflow + // revisions. Returned executions are ordered by their start time (newest + // first). + rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new execution using the latest revision of the given workflow. + rpc CreateExecution(CreateExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions" + body: "execution" + }; + option (google.api.method_signature) = "parent,execution"; + } + + // Returns an execution of the given name. + rpc GetExecution(GetExecutionRequest) returns (Execution) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Cancels an execution of the given name. + rpc CancelExecution(CancelExecutionRequest) returns (Execution) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// A running instance of a +// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows). +message Execution { + option (google.api.resource) = { + type: "workflowexecutions.googleapis.com/Execution" + pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}" + }; + + // Error describes why the execution was abnormally terminated. + message Error { + // Error payload returned by the execution, represented as a JSON string. + string payload = 1; + + // Human readable error context, helpful for debugging purposes. + string context = 2; + } + + // Describes the current state of the execution. More states may be added + // in the future. + enum State { + // Invalid state. + STATE_UNSPECIFIED = 0; + + // The execution is in progress. + ACTIVE = 1; + + // The execution finished successfully. + SUCCEEDED = 2; + + // The execution failed with an error. + FAILED = 3; + + // The execution was stopped intentionally. + CANCELLED = 4; + } + + // Output only. The resource name of the execution. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the beginning of execution. + google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Marks the end of execution, successful or not. + google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Current state of the execution. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input parameters of the execution represented as a JSON string. + // The size limit is 32KB. + string argument = 5; + + // Output only. Output of the execution represented as a JSON string. The + // value can only be present if the execution's state is `SUCCEEDED`. + string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The error which caused the execution to finish prematurely. + // The value is only present if the execution's state is `FAILED` + // or `CANCELLED`. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision of the workflow this execution is using. + string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for the +// [ListExecutions][] +// method. +message ListExecutionsRequest { + // Required. Name of the workflow for which the executions should be listed. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Maximum number of executions to return per call. + // Max supported value depends on the selected Execution view: it's 10000 for + // BASIC and 100 for FULL. The default value used if the field is not + // specified is 100, regardless of the selected view. Values greater than + // the max value will be coerced down to it. + int32 page_size = 2; + + // A page token, received from a previous `ListExecutions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListExecutions` must + // match the call that provided the page token. + string page_token = 3; + + // Optional. A view defining which fields should be filled in the returned executions. + // The API will default to the BASIC view. + ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for the +// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions] +// method. +message ListExecutionsResponse { + // The executions which match the request. + repeated Execution executions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for the +// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution] +// method. +message CreateExecutionRequest { + // Required. Name of the workflow for which an execution should be created. + // Format: projects/{project}/locations/{location}/workflows/{workflow} + // The latest revision of the workflow will be used. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflows.googleapis.com/Workflow" + } + ]; + + // Required. Execution to be created. + Execution execution = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the +// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution] +// method. +message GetExecutionRequest { + // Required. Name of the execution to be retrieved. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; + + // Optional. A view defining which fields should be filled in the returned execution. + // The API will default to the FULL view. + ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the +// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution] +// method. +message CancelExecutionRequest { + // Required. Name of the execution to be cancelled. + // Format: + // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "workflowexecutions.googleapis.com/Execution" + } + ]; +} + +// Defines possible views for execution resource. +enum ExecutionView { + // The default / unset value. + EXECUTION_VIEW_UNSPECIFIED = 0; + + // Includes only basic metadata about the execution. + // Following fields are returned: name, start_time, end_time, state + // and workflow_revision_id. + BASIC = 1; + + // Includes all data. + FULL = 2; +} diff --git a/google/cloud/workflows/executions/v1/executions_gapic.yaml b/google/cloud/workflows/executions/v1/executions_gapic.yaml new file mode 100644 index 00000000..a034427e --- /dev/null +++ b/google/cloud/workflows/executions/v1/executions_gapic.yaml @@ -0,0 +1,18 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 2.0.0 +language_settings: + java: + package_name: com.google.cloud.workflows.executions.v1 + python: + package_name: google.cloud.workflows.executions_v1.gapic + go: + package_name: cloud.google.com/go/workflows/executions/apiv1 + csharp: + package_name: Google.Cloud.Workflows.Executions.V1 + ruby: + package_name: Google::Cloud::Workflows::Executions::V1 + php: + package_name: Google\Cloud\Workflows\Executions\V1 + nodejs: + package_name: workflows-executions.v1 + domain_layer_location: google-cloud diff --git a/google/cloud/workflows/executions/v1/executions_grpc_service_config.json b/google/cloud/workflows/executions/v1/executions_grpc_service_config.json new file mode 100644 index 00000000..d3a0be98 --- /dev/null +++ b/google/cloud/workflows/executions/v1/executions_grpc_service_config.json @@ -0,0 +1,23 @@ +{ + "methodConfig": [{ + "name": [ + { "service": "google.cloud.workflows.executions.v1", "method": "ListExecutions"}, + { "service": "google.cloud.workflows.executions.v1", "method": "GetExecution"} + ], + "timeout": "60s", + "retryPolicy": { + "maxAttempts": 5, + "initialBackoff": "1s", + "maxBackoff": "10s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": ["UNAVAILABLE"] + } + }, + { + "name": [ + { "service": "google.cloud.workflows.executions.v1", "method": "CreateExecution" }, + { "service": "google.cloud.workflows.executions.v1", "method": "CancelExecution" } + ], + "timeout": "60s" + }] +} diff --git a/google/cloud/workflows/executions/v1/workflowexecutions_v1.yaml b/google/cloud/workflows/executions/v1/workflowexecutions_v1.yaml new file mode 100644 index 00000000..4c481431 --- /dev/null +++ b/google/cloud/workflows/executions/v1/workflowexecutions_v1.yaml @@ -0,0 +1,23 @@ +type: google.api.Service +config_version: 3 +name: workflowexecutions.googleapis.com +title: Workflow Executions API + +apis: +- name: google.cloud.workflows.executions.v1.Executions + +documentation: + summary: 'Execute workflows created with Workflows API.' + overview: 'Manages user-provided workflows.' + +backend: + rules: + - selector: 'google.cloud.workflows.executions.v1.Executions.*' + deadline: 60.0 + +authentication: + rules: + - selector: 'google.cloud.workflows.executions.v1.Executions.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform