feat: added client library for Workflows V1 API

PiperOrigin-RevId: 351656488
This commit is contained in:
Google APIs 2021-01-13 13:42:15 -08:00 committed by Copybara-Service
parent 23e7356f4c
commit 5e5da388f7
5 changed files with 731 additions and 0 deletions

View File

@ -0,0 +1,340 @@
# 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 = "workflows_proto",
srcs = [
"workflows.proto",
],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/longrunning:operations_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library_with_info(
name = "workflows_proto_with_info",
deps = [
":workflows_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 = "workflows_java_proto",
deps = [":workflows_proto"],
)
java_grpc_library(
name = "workflows_java_grpc",
srcs = [":workflows_proto"],
deps = [":workflows_java_proto"],
)
java_gapic_library(
name = "workflows_java_gapic",
srcs = [":workflows_proto_with_info"],
grpc_service_config = "workflows_grpc_service_config.json",
package = "google.cloud.workflows.v1",
test_deps = [
":workflows_java_grpc",
],
deps = [
":workflows_java_proto",
],
)
java_gapic_test(
name = "workflows_java_gapic_test_suite",
test_classes = [
"com.google.cloud.workflows.v1.WorkflowsClientTest",
],
runtime_deps = [":workflows_java_gapic_test"],
)
# Open Source Packages
java_gapic_assembly_gradle_pkg(
name = "google-cloud-workflows-v1-java",
deps = [
":workflows_java_gapic",
":workflows_java_grpc",
":workflows_java_proto",
":workflows_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 = "workflows_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1",
protos = [":workflows_proto"],
deps = [
"//google/api:annotations_go_proto",
"//google/longrunning:longrunning_go_proto",
],
)
go_gapic_library(
name = "workflows_go_gapic",
srcs = [":workflows_proto_with_info"],
grpc_service_config = "workflows_grpc_service_config.json",
importpath = "cloud.google.com/go/workflows/apiv1;workflows",
service_yaml = "workflows_v1.yaml",
deps = [
":workflows_go_proto",
"//google/longrunning:longrunning_go_proto",
"@com_google_cloud_go//longrunning/autogen:go_default_library",
"@com_google_cloud_go//longrunning:go_default_library",
],
)
go_test(
name = "workflows_go_gapic_test",
srcs = [":workflows_go_gapic_srcjar_test"],
embed = [":workflows_go_gapic"],
importpath = "cloud.google.com/go/workflows/apiv1",
)
# Open Source Packages
go_gapic_assembly_pkg(
name = "gapi-cloud-workflows-v1-go",
deps = [
":workflows_go_gapic",
":workflows_go_gapic_srcjar-test.srcjar",
":workflows_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"py_gapic_assembly_pkg",
"py_gapic_library",
)
py_gapic_library(
name = "workflows_py_gapic",
srcs = [":workflows_proto"],
grpc_service_config = "workflows_grpc_service_config.json",
)
# Open Source Packages
py_gapic_assembly_pkg(
name = "workflows-v1-py",
deps = [
":workflows_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 = "workflows_php_proto",
deps = [":workflows_proto"],
)
php_grpc_library(
name = "workflows_php_grpc",
srcs = [":workflows_proto"],
deps = [":workflows_php_proto"],
)
php_gapic_library(
name = "workflows_php_gapic",
src = ":workflows_proto_with_info",
gapic_yaml = "workflows_gapic.yaml",
grpc_service_config = "workflows_grpc_service_config.json",
package = "google.cloud.workflows.v1",
service_yaml = "workflows_v1.yaml",
deps = [
":workflows_php_grpc",
":workflows_php_proto",
],
)
# Open Source Packages
php_gapic_assembly_pkg(
name = "google-cloud-workflows-v1-php",
deps = [
":workflows_php_gapic",
":workflows_php_grpc",
":workflows_php_proto",
],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
nodejs_gapic_library(
name = "workflows_nodejs_gapic",
package_name = "@google-cloud/workflows",
src = ":workflows_proto_with_info",
extra_protoc_parameters = ["metadata"],
grpc_service_config = "workflows_grpc_service_config.json",
package = "google.cloud.workflows.v1",
service_yaml = "workflows_v1.yaml",
deps = [],
)
nodejs_gapic_assembly_pkg(
name = "workflows-v1-nodejs",
deps = [
":workflows_nodejs_gapic",
":workflows_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 = "workflows_ruby_proto",
deps = [":workflows_proto"],
)
ruby_grpc_library(
name = "workflows_ruby_grpc",
srcs = [":workflows_proto"],
deps = [":workflows_ruby_proto"],
)
ruby_gapic_library(
name = "workflows_ruby_gapic",
src = ":workflows_proto_with_info",
gapic_yaml = "workflows_gapic.yaml",
grpc_service_config = "workflows_grpc_service_config.json",
package = "google.cloud.workflows.v1",
service_yaml = "workflows_v1.yaml",
deps = [
":workflows_ruby_grpc",
":workflows_ruby_proto",
],
)
# Open Source Packages
ruby_gapic_assembly_pkg(
name = "google-cloud-workflows-v1-ruby",
deps = [
":workflows_ruby_gapic",
":workflows_ruby_grpc",
":workflows_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 = "workflows_csharp_proto",
deps = [":workflows_proto"],
)
csharp_grpc_library(
name = "workflows_csharp_grpc",
srcs = [":workflows_proto"],
deps = [":workflows_csharp_proto"],
)
csharp_gapic_library(
name = "workflows_csharp_gapic",
srcs = [":workflows_proto_with_info"],
common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
grpc_service_config = "workflows_grpc_service_config.json",
deps = [
":workflows_csharp_grpc",
":workflows_csharp_proto",
],
)
# Open Source Packages
csharp_gapic_assembly_pkg(
name = "google-cloud-workflows-v1-csharp",
deps = [
":workflows_csharp_gapic",
":workflows_csharp_grpc",
":workflows_csharp_proto",
],
)
##############################################################################
# C++
##############################################################################
# Put your C++ rules here

View File

@ -0,0 +1,314 @@
// 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.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
option go_package = "google.golang.org/genproto/googleapis/cloud/workflows/v1;workflows";
option java_multiple_files = true;
option java_outer_classname = "WorkflowsProto";
option java_package = "com.google.cloud.workflows.v1";
// Workflows is used to deploy and execute workflow programs.
// Workflows makes sure the program executes reliably, despite hardware and
// networking interruptions.
service Workflows {
option (google.api.default_host) = "workflows.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
// Lists Workflows in a given project and location.
// The default order is not specified.
rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/workflows"
};
option (google.api.method_signature) = "parent";
}
// Gets details of a single Workflow.
rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/workflows/*}"
};
option (google.api.method_signature) = "name";
}
// Creates a new workflow. If a workflow with the specified name already
// exists in the specified project and location, the long running operation
// will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
rpc CreateWorkflow(CreateWorkflowRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*}/workflows"
body: "workflow"
};
option (google.api.method_signature) = "parent,workflow,workflow_id";
option (google.longrunning.operation_info) = {
response_type: "Workflow"
metadata_type: "OperationMetadata"
};
}
// Deletes a workflow with the specified name.
// This method also cancels and deletes all running executions of the
// workflow.
rpc DeleteWorkflow(DeleteWorkflowRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/workflows/*}"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "OperationMetadata"
};
}
// Updates an existing workflow.
// Running this method has no impact on already running executions of the
// workflow. A new revision of the workflow may be created as a result of a
// successful update operation. In that case, such revision will be used
// in new workflow executions.
rpc UpdateWorkflow(UpdateWorkflowRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1/{workflow.name=projects/*/locations/*/workflows/*}"
body: "workflow"
};
option (google.api.method_signature) = "workflow,update_mask";
option (google.longrunning.operation_info) = {
response_type: "Workflow"
metadata_type: "OperationMetadata"
};
}
}
// Workflow program to be executed by Workflows.
message Workflow {
option (google.api.resource) = {
type: "workflows.googleapis.com/Workflow"
pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
};
// Describes the current state of workflow deployment. More states may be
// added in the future.
enum State {
// Invalid state.
STATE_UNSPECIFIED = 0;
// The workflow has been deployed successfully and is serving.
ACTIVE = 1;
}
// The resource name of the workflow.
// Format: projects/{project}/locations/{location}/workflows/{workflow}
string name = 1;
// Description of the workflow provided by the user.
// Must be at most 1000 unicode characters long.
string description = 2;
// Output only. State of the workflow deployment.
State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The revision of the workflow.
// A new revision of a workflow is created as a result of updating the
// following fields of a workflow:
// - `source_code`
// - `service_account`
// The format is "000001-a4d", where the first 6 characters define
// the zero-padded revision ordinal number. They are followed by a hyphen and
// 3 hexadecimal random characters.
string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp of when the workflow was created.
google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The last update timestamp of the workflow.
google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp that the latest revision of the workflow
// was created.
google.protobuf.Timestamp revision_create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
// Labels associated with this workflow.
// Labels can contain at most 64 entries. Keys and values can be no longer
// than 63 characters and can only contain lowercase letters, numeric
// characters, underscores and dashes. Label keys must start with a letter.
// International characters are allowed.
map<string, string> labels = 8;
// Name of the service account associated with the latest workflow version.
// This service account represents the identity of the workflow and determines
// what permissions the workflow has.
// Format: projects/{project}/serviceAccounts/{account}
//
// Using `-` as a wildcard for the `{project}` will infer the project from
// the account. The `{account}` value can be the `email` address or the
// `unique_id` of the service account.
//
// If not provided, workflow will use the project's default service account.
// Modifying this field for an existing workflow results in a new workflow
// revision.
string service_account = 9;
// Required. Location of the workflow source code.
// Modifying this field for an existing workflow results in a new workflow
// revision.
oneof source_code {
// Workflow code to be executed. The size limit is 32KB.
string source_contents = 10;
}
}
// Request for the
// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
// method.
message ListWorkflowsRequest {
// Required. Project and location from which the workflows should be listed.
// Format: projects/{project}/locations/{location}
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// Maximum number of workflows to return per call. The service may return
// fewer than this value. If the value is not specified, a default value of
// 500 will be used. The maximum permitted value is 1000 and values greater
// than 1000 will be coerced down to 1000.
int32 page_size = 2;
// A page token, received from a previous `ListWorkflows` call.
// Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to `ListWorkflows` must
// match the call that provided the page token.
string page_token = 3;
// Filter to restrict results to specific workflows.
string filter = 4;
// Comma-separated list of fields that that specify the order of the results.
// Default sorting order for a field is ascending. To specify descending order
// for a field, append a " desc" suffix.
// If not specified, the results will be returned in an unspecified order.
string order_by = 5;
}
// Response for the
// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
// method.
message ListWorkflowsResponse {
// The workflows which match the request.
repeated Workflow workflows = 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;
// Unreachable resources.
repeated string unreachable = 3;
}
// Request for the
// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method.
message GetWorkflowRequest {
// Required. Name of the workflow which information should be retrieved.
// Format: projects/{project}/locations/{location}/workflows/{workflow}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "workflows.googleapis.com/Workflow"
}
];
}
// Request for the
// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow]
// method.
message CreateWorkflowRequest {
// Required. Project and location in which the workflow should be created.
// Format: projects/{project}/locations/{location}
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// Required. Workflow to be created.
Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The ID of the workflow to be created. It has to fulfill the
// following requirements:
//
// * Must contain only letters, numbers, underscores and hyphens.
// * Must start with a letter.
// * Must be between 1-64 characters.
// * Must end with a number or a letter.
// * Must be unique within the customer project and location.
string workflow_id = 3 [(google.api.field_behavior) = REQUIRED];
}
// Request for the
// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow]
// method.
message DeleteWorkflowRequest {
// Required. Name of the workflow to be deleted.
// Format: projects/{project}/locations/{location}/workflows/{workflow}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "workflows.googleapis.com/Workflow"
}
];
}
// Request for the
// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow]
// method.
message UpdateWorkflowRequest {
// Required. Workflow to be updated.
Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED];
// List of fields to be updated. If not present, the entire workflow
// will be updated.
google.protobuf.FieldMask update_mask = 2;
}
// Represents the metadata of the long-running operation.
message OperationMetadata {
// The time the operation was created.
google.protobuf.Timestamp create_time = 1;
// The time the operation finished running.
google.protobuf.Timestamp end_time = 2;
// Server-defined resource path for the target of the operation.
string target = 3;
// Name of the verb executed by the operation.
string verb = 4;
// API version used to start the operation.
string api_version = 5;
}

View File

@ -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.v1
python:
package_name: google.cloud.workflows_v1.gapic
go:
package_name: cloud.google.com/go/workflows/apiv1
csharp:
package_name: Google.Cloud.Workflows.V1
ruby:
package_name: Google::Cloud::Workflows::V1
php:
package_name: Google\Cloud\Workflows\V1
nodejs:
package_name: workflows.v1
domain_layer_location: google-cloud

View File

@ -0,0 +1,24 @@
{
"methodConfig": [{
"name": [
{ "service": "google.cloud.workflows.v1", "method": "ListWorkflows"},
{ "service": "google.cloud.workflows.v1", "method": "GetWorkflow"}
],
"timeout": "60s",
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "1s",
"maxBackoff": "10s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": ["UNAVAILABLE"]
}
},
{
"name": [
{ "service": "google.cloud.workflows.v1", "method": "CreateWorkflow" },
{ "service": "google.cloud.workflows.v1", "method": "DeleteWorkflow" },
{ "service": "google.cloud.workflows.v1", "method": "UpdateWorkflow" }
],
"timeout": "60s"
}]
}

View File

@ -0,0 +1,35 @@
type: google.api.Service
config_version: 3
name: workflows.googleapis.com
title: Workflows API
apis:
- name: google.cloud.workflows.v1.Workflows
types:
- name: google.cloud.workflows.v1.OperationMetadata
documentation:
summary: |-
Orchestrate Workflows that invoke Google Cloud APIs, SaaS APIs or private
API endpoints.
backend:
rules:
- selector: 'google.cloud.workflows.v1.Workflows.*'
deadline: 60.0
- selector: 'google.longrunning.Operations.*'
deadline: 60.0
- selector: google.longrunning.Operations.GetOperation
deadline: 5.0
authentication:
rules:
- selector: 'google.cloud.workflows.v1.Workflows.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: 'google.longrunning.Operations.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform