all: regen gapics
Predicated on https://github.com/google/go-genproto/pull/117
Change-Id: If1be21b06e5ca9891e176a79d863fc743e4469b1
Reviewed-on: https://code-review.googlesource.com/c/35930
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Eno Compton <enocom@google.com>
diff --git a/asset/apiv1beta1/asset_client.go b/asset/apiv1beta1/asset_client.go
new file mode 100644
index 0000000..4ff3bdb
--- /dev/null
+++ b/asset/apiv1beta1/asset_client.go
@@ -0,0 +1,248 @@
+// Copyright 2018 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
+//
+// https://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.
+
+// AUTO-GENERATED CODE. DO NOT EDIT.
+
+package asset
+
+import (
+ "context"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ gax "github.com/googleapis/gax-go"
+ "google.golang.org/api/option"
+ "google.golang.org/api/transport"
+ assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+// CallOptions contains the retry settings for each method of Client.
+type CallOptions struct {
+ ExportAssets []gax.CallOption
+ BatchGetAssetsHistory []gax.CallOption
+}
+
+func defaultClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ option.WithEndpoint("cloudasset.googleapis.com:443"),
+ option.WithScopes(DefaultAuthScopes()...),
+ }
+}
+
+func defaultCallOptions() *CallOptions {
+ retry := map[[2]string][]gax.CallOption{
+ {"default", "idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ }
+ return &CallOptions{
+ ExportAssets: retry[[2]string{"default", "non_idempotent"}],
+ BatchGetAssetsHistory: retry[[2]string{"default", "idempotent"}],
+ }
+}
+
+// Client is a client for interacting with Cloud Asset API.
+//
+// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
+type Client struct {
+ // The connection to the service.
+ conn *grpc.ClientConn
+
+ // The gRPC API client.
+ client assetpb.AssetServiceClient
+
+ // LROClient is used internally to handle longrunning operations.
+ // It is exposed so that its CallOptions can be modified if required.
+ // Users should not Close this client.
+ LROClient *lroauto.OperationsClient
+
+ // The call options for this service.
+ CallOptions *CallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewClient creates a new asset service client.
+//
+// Asset service definition.
+func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
+ conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ if err != nil {
+ return nil, err
+ }
+ c := &Client{
+ conn: conn,
+ CallOptions: defaultCallOptions(),
+
+ client: assetpb.NewAssetServiceClient(conn),
+ }
+ c.setGoogleClientInfo()
+
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ if err != nil {
+ // This error "should not happen", since we are just reusing old connection
+ // and never actually need to dial.
+ // If this does happen, we could leak conn. However, we cannot close conn:
+ // If the user invoked the function with option.WithGRPCConn,
+ // we would close a connection that's still in use.
+ // TODO(pongad): investigate error conditions.
+ return nil, err
+ }
+ return c, nil
+}
+
+// Connection returns the client's connection to the API service.
+func (c *Client) Connection() *grpc.ClientConn {
+ return c.conn
+}
+
+// Close closes the connection to the API service. The user should invoke this when
+// the client is no longer required.
+func (c *Client) Close() error {
+ return c.conn.Close()
+}
+
+// setGoogleClientInfo sets the name and version of the application in
+// the `x-goog-api-client` header passed on each request. Intended for
+// use by Google-written clients.
+func (c *Client) setGoogleClientInfo(keyval ...string) {
+ kv := append([]string{"gl-go", versionGo()}, keyval...)
+ kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
+ c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
+}
+
+// ExportAssets exports assets with time and resource types to a given Cloud Storage
+// location. The output format is newline-delimited JSON.
+// This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
+// to keep track of the export.
+func (c *Client) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest, opts ...gax.CallOption) (*ExportAssetsOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.ExportAssets[0:len(c.CallOptions.ExportAssets):len(c.CallOptions.ExportAssets)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.ExportAssets(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ExportAssetsOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// BatchGetAssetsHistory batch gets the update history of assets that overlap a time window.
+// For RESOURCE content, this API outputs history with asset in both
+// non-delete or deleted status.
+// For IAM_POLICY content, this API outputs history when the asset and its
+// attached IAM POLICY both exist. This can create gaps in the output history.
+func (c *Client) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest, opts ...gax.CallOption) (*assetpb.BatchGetAssetsHistoryResponse, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.BatchGetAssetsHistory[0:len(c.CallOptions.BatchGetAssetsHistory):len(c.CallOptions.BatchGetAssetsHistory)], opts...)
+ var resp *assetpb.BatchGetAssetsHistoryResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.BatchGetAssetsHistory(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// ExportAssetsOperation manages a long-running operation from ExportAssets.
+type ExportAssetsOperation struct {
+ lro *longrunning.Operation
+}
+
+// ExportAssetsOperation returns a new ExportAssetsOperation from a given name.
+// The name must be that of a previously created ExportAssetsOperation, possibly from a different process.
+func (c *Client) ExportAssetsOperation(name string) *ExportAssetsOperation {
+ return &ExportAssetsOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}),
+ }
+}
+
+// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
+//
+// See documentation of Poll for error-handling information.
+func (op *ExportAssetsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) {
+ var resp assetpb.ExportAssetsResponse
+ if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil {
+ return nil, err
+ }
+ return &resp, nil
+}
+
+// Poll fetches the latest state of the long-running operation.
+//
+// Poll also fetches the latest metadata, which can be retrieved by Metadata.
+//
+// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
+// the operation has completed with failure, the error is returned and op.Done will return true.
+// If Poll succeeds and the operation has completed successfully,
+// op.Done will return true, and the response of the operation is returned.
+// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
+func (op *ExportAssetsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) {
+ var resp assetpb.ExportAssetsResponse
+ if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
+ return nil, err
+ }
+ if !op.Done() {
+ return nil, nil
+ }
+ return &resp, nil
+}
+
+// Metadata returns metadata associated with the long-running operation.
+// Metadata itself does not contact the server, but Poll does.
+// To get the latest metadata, call this method after a successful call to Poll.
+// If the metadata is not available, the returned metadata and error are both nil.
+func (op *ExportAssetsOperation) Metadata() (*assetpb.ExportAssetsRequest, error) {
+ var meta assetpb.ExportAssetsRequest
+ if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
+ return nil, nil
+ } else if err != nil {
+ return nil, err
+ }
+ return &meta, nil
+}
+
+// Done reports whether the long-running operation has completed.
+func (op *ExportAssetsOperation) Done() bool {
+ return op.lro.Done()
+}
+
+// Name returns the name of the long-running operation.
+// The name is assigned by the server and is unique within the service from which the operation is created.
+func (op *ExportAssetsOperation) Name() string {
+ return op.lro.Name()
+}
diff --git a/asset/apiv1beta1/asset_client_example_test.go b/asset/apiv1beta1/asset_client_example_test.go
new file mode 100644
index 0000000..11fb083
--- /dev/null
+++ b/asset/apiv1beta1/asset_client_example_test.go
@@ -0,0 +1,75 @@
+// Copyright 2018 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
+//
+// https://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.
+
+// AUTO-GENERATED CODE. DO NOT EDIT.
+
+package asset_test
+
+import (
+ "context"
+
+ "cloud.google.com/go/asset/apiv1beta1"
+ assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1"
+)
+
+func ExampleNewClient() {
+ ctx := context.Background()
+ c, err := asset.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleClient_ExportAssets() {
+ ctx := context.Background()
+ c, err := asset.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &assetpb.ExportAssetsRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ExportAssets(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_BatchGetAssetsHistory() {
+ ctx := context.Background()
+ c, err := asset.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &assetpb.BatchGetAssetsHistoryRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.BatchGetAssetsHistory(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/asset/apiv1beta1/doc.go b/asset/apiv1beta1/doc.go
new file mode 100644
index 0000000..7ba09af
--- /dev/null
+++ b/asset/apiv1beta1/doc.go
@@ -0,0 +1,89 @@
+// Copyright 2018 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
+//
+// https://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.
+
+// AUTO-GENERATED CODE. DO NOT EDIT.
+
+// Package asset is an auto-generated package for the
+// Cloud Asset API.
+//
+// NOTE: This package is in alpha. It is not stable, and is likely to change.
+//
+// The cloud asset API manages the history and inventory of cloud resources.
+package asset // import "cloud.google.com/go/asset/apiv1beta1"
+
+import (
+ "context"
+ "runtime"
+ "strings"
+ "unicode"
+
+ "google.golang.org/grpc/metadata"
+)
+
+func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
+ out, _ := metadata.FromOutgoingContext(ctx)
+ out = out.Copy()
+ for _, md := range mds {
+ for k, v := range md {
+ out[k] = append(out[k], v...)
+ }
+ }
+ return metadata.NewOutgoingContext(ctx, out)
+}
+
+// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
+func DefaultAuthScopes() []string {
+ return []string{
+ "https://www.googleapis.com/auth/cloud-platform",
+ }
+}
+
+// versionGo returns the Go runtime version. The returned string
+// has no whitespace, suitable for reporting in header.
+func versionGo() string {
+ const develPrefix = "devel +"
+
+ s := runtime.Version()
+ if strings.HasPrefix(s, develPrefix) {
+ s = s[len(develPrefix):]
+ if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
+ s = s[:p]
+ }
+ return s
+ }
+
+ notSemverRune := func(r rune) bool {
+ return strings.IndexRune("0123456789.", r) < 0
+ }
+
+ if strings.HasPrefix(s, "go1") {
+ s = s[2:]
+ var prerelease string
+ if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
+ s, prerelease = s[:p], s[p:]
+ }
+ if strings.HasSuffix(s, ".") {
+ s += "0"
+ } else if strings.Count(s, ".") < 2 {
+ s += ".0"
+ }
+ if prerelease != "" {
+ s += "-" + prerelease
+ }
+ return s
+ }
+ return "UNKNOWN"
+}
+
+const versionClient = "20181129"
diff --git a/asset/apiv1beta1/mock_test.go b/asset/apiv1beta1/mock_test.go
new file mode 100644
index 0000000..7e11118
--- /dev/null
+++ b/asset/apiv1beta1/mock_test.go
@@ -0,0 +1,266 @@
+// Copyright 2018 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
+//
+// https://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.
+
+// AUTO-GENERATED CODE. DO NOT EDIT.
+
+package asset
+
+import (
+ assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+)
+
+import (
+ "context"
+ "flag"
+ "fmt"
+ "io"
+ "log"
+ "net"
+ "os"
+ "strings"
+ "testing"
+
+ "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/ptypes"
+ "google.golang.org/api/option"
+ status "google.golang.org/genproto/googleapis/rpc/status"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+ gstatus "google.golang.org/grpc/status"
+)
+
+var _ = io.EOF
+var _ = ptypes.MarshalAny
+var _ status.Status
+
+type mockAssetServer struct {
+ // Embed for forward compatibility.
+ // Tests will keep working if more methods are added
+ // in the future.
+ assetpb.AssetServiceServer
+
+ reqs []proto.Message
+
+ // If set, all calls return this error.
+ err error
+
+ // responses to return if err == nil
+ resps []proto.Message
+}
+
+func (s *mockAssetServer) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
+func (s *mockAssetServer) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest) (*assetpb.BatchGetAssetsHistoryResponse, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*assetpb.BatchGetAssetsHistoryResponse), nil
+}
+
+// clientOpt is the option tests should use to connect to the test server.
+// It is initialized by TestMain.
+var clientOpt option.ClientOption
+
+var (
+ mockAsset mockAssetServer
+)
+
+func TestMain(m *testing.M) {
+ flag.Parse()
+
+ serv := grpc.NewServer()
+ assetpb.RegisterAssetServiceServer(serv, &mockAsset)
+
+ lis, err := net.Listen("tcp", "localhost:0")
+ if err != nil {
+ log.Fatal(err)
+ }
+ go serv.Serve(lis)
+
+ conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure())
+ if err != nil {
+ log.Fatal(err)
+ }
+ clientOpt = option.WithGRPCConn(conn)
+
+ os.Exit(m.Run())
+}
+
+func TestAssetServiceExportAssets(t *testing.T) {
+ var expectedResponse *assetpb.ExportAssetsResponse = &assetpb.ExportAssetsResponse{}
+
+ mockAsset.err = nil
+ mockAsset.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockAsset.resps = append(mockAsset.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var outputConfig *assetpb.OutputConfig = &assetpb.OutputConfig{}
+ var request = &assetpb.ExportAssetsRequest{
+ Parent: formattedParent,
+ OutputConfig: outputConfig,
+ }
+
+ c, err := NewClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.ExportAssets(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockAsset.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestAssetServiceExportAssetsError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockAsset.err = nil
+ mockAsset.resps = append(mockAsset.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var outputConfig *assetpb.OutputConfig = &assetpb.OutputConfig{}
+ var request = &assetpb.ExportAssetsRequest{
+ Parent: formattedParent,
+ OutputConfig: outputConfig,
+ }
+
+ c, err := NewClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.ExportAssets(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp, err := respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestAssetServiceBatchGetAssetsHistory(t *testing.T) {
+ var expectedResponse *assetpb.BatchGetAssetsHistoryResponse = &assetpb.BatchGetAssetsHistoryResponse{}
+
+ mockAsset.err = nil
+ mockAsset.reqs = nil
+
+ mockAsset.resps = append(mockAsset.resps[:0], expectedResponse)
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var contentType assetpb.ContentType = assetpb.ContentType_CONTENT_TYPE_UNSPECIFIED
+ var readTimeWindow *assetpb.TimeWindow = &assetpb.TimeWindow{}
+ var request = &assetpb.BatchGetAssetsHistoryRequest{
+ Parent: formattedParent,
+ ContentType: contentType,
+ ReadTimeWindow: readTimeWindow,
+ }
+
+ c, err := NewClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.BatchGetAssetsHistory(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockAsset.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestAssetServiceBatchGetAssetsHistoryError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockAsset.err = gstatus.Error(errCode, "test error")
+
+ var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]")
+ var contentType assetpb.ContentType = assetpb.ContentType_CONTENT_TYPE_UNSPECIFIED
+ var readTimeWindow *assetpb.TimeWindow = &assetpb.TimeWindow{}
+ var request = &assetpb.BatchGetAssetsHistoryRequest{
+ Parent: formattedParent,
+ ContentType: contentType,
+ ReadTimeWindow: readTimeWindow,
+ }
+
+ c, err := NewClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.BatchGetAssetsHistory(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
diff --git a/asset/v1beta1/doc.go b/asset/v1beta1/doc.go
index 9e6decd..a2a639b 100644
--- a/asset/v1beta1/doc.go
+++ b/asset/v1beta1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go
index 01a1915..6cd6869 100644
--- a/bigquery/datatransfer/apiv1/doc.go
+++ b/bigquery/datatransfer/apiv1/doc.go
@@ -87,4 +87,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go
index 3b79f57..7553075 100644
--- a/cloudtasks/apiv2beta2/doc.go
+++ b/cloudtasks/apiv2beta2/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go
index 760cdc8..d0a6f7b 100644
--- a/cloudtasks/apiv2beta3/doc.go
+++ b/cloudtasks/apiv2beta3/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go
index 41cba27..1f13e5b 100644
--- a/containeranalysis/apiv1beta1/doc.go
+++ b/containeranalysis/apiv1beta1/doc.go
@@ -88,4 +88,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/dataproc/apiv1/cluster_controller_client.go b/dataproc/apiv1/cluster_controller_client.go
index bcd8ec6..16394c23 100644
--- a/dataproc/apiv1/cluster_controller_client.go
+++ b/dataproc/apiv1/cluster_controller_client.go
@@ -58,6 +58,18 @@
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
+ codes.Internal,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ {"default", "non_idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
@@ -70,7 +82,7 @@
return &ClusterControllerCallOptions{
CreateCluster: retry[[2]string{"default", "non_idempotent"}],
UpdateCluster: retry[[2]string{"default", "non_idempotent"}],
- DeleteCluster: retry[[2]string{"default", "idempotent"}],
+ DeleteCluster: retry[[2]string{"default", "non_idempotent"}],
GetCluster: retry[[2]string{"default", "idempotent"}],
ListClusters: retry[[2]string{"default", "idempotent"}],
DiagnoseCluster: retry[[2]string{"default", "non_idempotent"}],
@@ -102,7 +114,7 @@
// NewClusterControllerClient creates a new cluster controller client.
//
// The ClusterControllerService provides methods to manage clusters
-// of Google Compute Engine instances.
+// of Compute Engine instances.
func NewClusterControllerClient(ctx context.Context, opts ...option.ClientOption) (*ClusterControllerClient, error) {
conn, err := transport.DialGRPC(ctx, append(defaultClusterControllerClientOptions(), opts...)...)
if err != nil {
diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go
index 1d12277..8130fb2 100644
--- a/dataproc/apiv1/doc.go
+++ b/dataproc/apiv1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/dataproc/apiv1/job_controller_client.go b/dataproc/apiv1/job_controller_client.go
index 2c0b9a9..f38ecb5 100644
--- a/dataproc/apiv1/job_controller_client.go
+++ b/dataproc/apiv1/job_controller_client.go
@@ -55,6 +55,18 @@
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
+ codes.Internal,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ {"default", "non_idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
@@ -69,8 +81,8 @@
GetJob: retry[[2]string{"default", "idempotent"}],
ListJobs: retry[[2]string{"default", "idempotent"}],
UpdateJob: retry[[2]string{"default", "non_idempotent"}],
- CancelJob: retry[[2]string{"default", "non_idempotent"}],
- DeleteJob: retry[[2]string{"default", "idempotent"}],
+ CancelJob: retry[[2]string{"default", "idempotent"}],
+ DeleteJob: retry[[2]string{"default", "non_idempotent"}],
}
}
diff --git a/dataproc/apiv1/mock_test.go b/dataproc/apiv1/mock_test.go
index 70d1b81..992af27 100644
--- a/dataproc/apiv1/mock_test.go
+++ b/dataproc/apiv1/mock_test.go
@@ -222,6 +222,105 @@
return s.resps[0].(*emptypb.Empty), nil
}
+type mockWorkflowTemplateServer struct {
+ // Embed for forward compatibility.
+ // Tests will keep working if more methods are added
+ // in the future.
+ dataprocpb.WorkflowTemplateServiceServer
+
+ reqs []proto.Message
+
+ // If set, all calls return this error.
+ err error
+
+ // responses to return if err == nil
+ resps []proto.Message
+}
+
+func (s *mockWorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, req *dataprocpb.CreateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*dataprocpb.WorkflowTemplate), nil
+}
+
+func (s *mockWorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req *dataprocpb.GetWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*dataprocpb.WorkflowTemplate), nil
+}
+
+func (s *mockWorkflowTemplateServer) InstantiateWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateWorkflowTemplateRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
+func (s *mockWorkflowTemplateServer) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
+func (s *mockWorkflowTemplateServer) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*dataprocpb.WorkflowTemplate), nil
+}
+
+func (s *mockWorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, req *dataprocpb.ListWorkflowTemplatesRequest) (*dataprocpb.ListWorkflowTemplatesResponse, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*dataprocpb.ListWorkflowTemplatesResponse), nil
+}
+
+func (s *mockWorkflowTemplateServer) DeleteWorkflowTemplate(ctx context.Context, req *dataprocpb.DeleteWorkflowTemplateRequest) (*emptypb.Empty, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*emptypb.Empty), nil
+}
+
// clientOpt is the option tests should use to connect to the test server.
// It is initialized by TestMain.
var clientOpt option.ClientOption
@@ -229,6 +328,7 @@
var (
mockClusterController mockClusterControllerServer
mockJobController mockJobControllerServer
+ mockWorkflowTemplate mockWorkflowTemplateServer
)
func TestMain(m *testing.M) {
@@ -237,6 +337,7 @@
serv := grpc.NewServer()
dataprocpb.RegisterClusterControllerServer(serv, &mockClusterController)
dataprocpb.RegisterJobControllerServer(serv, &mockJobController)
+ dataprocpb.RegisterWorkflowTemplateServiceServer(serv, &mockWorkflowTemplate)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@@ -777,9 +878,11 @@
func TestJobControllerSubmitJob(t *testing.T) {
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -846,9 +949,11 @@
func TestJobControllerGetJob(t *testing.T) {
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -991,9 +1096,11 @@
func TestJobControllerUpdateJob(t *testing.T) {
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -1068,9 +1175,11 @@
func TestJobControllerCancelJob(t *testing.T) {
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -1194,3 +1303,480 @@
t.Errorf("got error code %q, want %q", c, errCode)
}
}
+func TestWorkflowTemplateServiceCreateWorkflowTemplate(t *testing.T) {
+ var id string = "id3355"
+ var name string = "name3373707"
+ var version int32 = 351608024
+ var expectedResponse = &dataprocpb.WorkflowTemplate{
+ Id: id,
+ Name: name,
+ Version: version,
+ }
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse)
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.CreateWorkflowTemplateRequest{
+ Parent: formattedParent,
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.CreateWorkflowTemplate(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestWorkflowTemplateServiceCreateWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = gstatus.Error(errCode, "test error")
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.CreateWorkflowTemplateRequest{
+ Parent: formattedParent,
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.CreateWorkflowTemplate(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestWorkflowTemplateServiceGetWorkflowTemplate(t *testing.T) {
+ var id string = "id3355"
+ var name2 string = "name2-1052831874"
+ var version int32 = 351608024
+ var expectedResponse = &dataprocpb.WorkflowTemplate{
+ Id: id,
+ Name: name2,
+ Version: version,
+ }
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse)
+
+ var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
+ var request = &dataprocpb.GetWorkflowTemplateRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.GetWorkflowTemplate(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestWorkflowTemplateServiceGetWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = gstatus.Error(errCode, "test error")
+
+ var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
+ var request = &dataprocpb.GetWorkflowTemplateRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.GetWorkflowTemplate(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestWorkflowTemplateServiceInstantiateWorkflowTemplate(t *testing.T) {
+ var expectedResponse *emptypb.Empty = &emptypb.Empty{}
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
+ var request = &dataprocpb.InstantiateWorkflowTemplateRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.InstantiateWorkflowTemplate(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+}
+
+func TestWorkflowTemplateServiceInstantiateWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
+ var request = &dataprocpb.InstantiateWorkflowTemplateRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.InstantiateWorkflowTemplate(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+}
+func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplate(t *testing.T) {
+ var expectedResponse *emptypb.Empty = &emptypb.Empty{}
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ Parent: formattedParent,
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+}
+
+func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ Parent: formattedParent,
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+}
+func TestWorkflowTemplateServiceUpdateWorkflowTemplate(t *testing.T) {
+ var id string = "id3355"
+ var name string = "name3373707"
+ var version int32 = 351608024
+ var expectedResponse = &dataprocpb.WorkflowTemplate{
+ Id: id,
+ Name: name,
+ Version: version,
+ }
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse)
+
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.UpdateWorkflowTemplateRequest{
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.UpdateWorkflowTemplate(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ if want, got := expectedResponse, resp; !proto.Equal(want, got) {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestWorkflowTemplateServiceUpdateWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = gstatus.Error(errCode, "test error")
+
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.UpdateWorkflowTemplateRequest{
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.UpdateWorkflowTemplate(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestWorkflowTemplateServiceListWorkflowTemplates(t *testing.T) {
+ var nextPageToken string = ""
+ var templatesElement *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var templates = []*dataprocpb.WorkflowTemplate{templatesElement}
+ var expectedResponse = &dataprocpb.ListWorkflowTemplatesResponse{
+ NextPageToken: nextPageToken,
+ Templates: templates,
+ }
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse)
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var request = &dataprocpb.ListWorkflowTemplatesRequest{
+ Parent: formattedParent,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.ListWorkflowTemplates(context.Background(), request).Next()
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+ want := (interface{})(expectedResponse.Templates[0])
+ got := (interface{})(resp)
+ var ok bool
+
+ switch want := (want).(type) {
+ case proto.Message:
+ ok = proto.Equal(want, got.(proto.Message))
+ default:
+ ok = want == got
+ }
+ if !ok {
+ t.Errorf("wrong response %q, want %q)", got, want)
+ }
+}
+
+func TestWorkflowTemplateServiceListWorkflowTemplatesError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = gstatus.Error(errCode, "test error")
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var request = &dataprocpb.ListWorkflowTemplatesRequest{
+ Parent: formattedParent,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ resp, err := c.ListWorkflowTemplates(context.Background(), request).Next()
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+ _ = resp
+}
+func TestWorkflowTemplateServiceDeleteWorkflowTemplate(t *testing.T) {
+ var expectedResponse *emptypb.Empty = &emptypb.Empty{}
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse)
+
+ var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
+ var request = &dataprocpb.DeleteWorkflowTemplateRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = c.DeleteWorkflowTemplate(context.Background(), request)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+}
+
+func TestWorkflowTemplateServiceDeleteWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = gstatus.Error(errCode, "test error")
+
+ var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
+ var request = &dataprocpb.DeleteWorkflowTemplateRequest{
+ Name: formattedName,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = c.DeleteWorkflowTemplate(context.Background(), request)
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+}
diff --git a/dataproc/apiv1/workflow_template_client.go b/dataproc/apiv1/workflow_template_client.go
new file mode 100644
index 0000000..c7817a6
--- /dev/null
+++ b/dataproc/apiv1/workflow_template_client.go
@@ -0,0 +1,525 @@
+// Copyright 2018 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
+//
+// https://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.
+
+// AUTO-GENERATED CODE. DO NOT EDIT.
+
+package dataproc
+
+import (
+ "context"
+ "math"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ "github.com/golang/protobuf/proto"
+ gax "github.com/googleapis/gax-go"
+ "google.golang.org/api/iterator"
+ "google.golang.org/api/option"
+ "google.golang.org/api/transport"
+ dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+// WorkflowTemplateCallOptions contains the retry settings for each method of WorkflowTemplateClient.
+type WorkflowTemplateCallOptions struct {
+ CreateWorkflowTemplate []gax.CallOption
+ GetWorkflowTemplate []gax.CallOption
+ InstantiateWorkflowTemplate []gax.CallOption
+ InstantiateInlineWorkflowTemplate []gax.CallOption
+ UpdateWorkflowTemplate []gax.CallOption
+ ListWorkflowTemplates []gax.CallOption
+ DeleteWorkflowTemplate []gax.CallOption
+}
+
+func defaultWorkflowTemplateClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ option.WithEndpoint("dataproc.googleapis.com:443"),
+ option.WithScopes(DefaultAuthScopes()...),
+ }
+}
+
+func defaultWorkflowTemplateCallOptions() *WorkflowTemplateCallOptions {
+ retry := map[[2]string][]gax.CallOption{
+ {"default", "idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Internal,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ {"default", "non_idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ }
+ return &WorkflowTemplateCallOptions{
+ CreateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ GetWorkflowTemplate: retry[[2]string{"default", "idempotent"}],
+ InstantiateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ InstantiateInlineWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ UpdateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ ListWorkflowTemplates: retry[[2]string{"default", "idempotent"}],
+ DeleteWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ }
+}
+
+// WorkflowTemplateClient is a client for interacting with Google Cloud Dataproc API.
+//
+// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
+type WorkflowTemplateClient struct {
+ // The connection to the service.
+ conn *grpc.ClientConn
+
+ // The gRPC API client.
+ workflowTemplateClient dataprocpb.WorkflowTemplateServiceClient
+
+ // LROClient is used internally to handle longrunning operations.
+ // It is exposed so that its CallOptions can be modified if required.
+ // Users should not Close this client.
+ LROClient *lroauto.OperationsClient
+
+ // The call options for this service.
+ CallOptions *WorkflowTemplateCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewWorkflowTemplateClient creates a new workflow template service client.
+//
+// The API interface for managing Workflow Templates in the
+// Cloud Dataproc API.
+func NewWorkflowTemplateClient(ctx context.Context, opts ...option.ClientOption) (*WorkflowTemplateClient, error) {
+ conn, err := transport.DialGRPC(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...)
+ if err != nil {
+ return nil, err
+ }
+ c := &WorkflowTemplateClient{
+ conn: conn,
+ CallOptions: defaultWorkflowTemplateCallOptions(),
+
+ workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(conn),
+ }
+ c.setGoogleClientInfo()
+
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ if err != nil {
+ // This error "should not happen", since we are just reusing old connection
+ // and never actually need to dial.
+ // If this does happen, we could leak conn. However, we cannot close conn:
+ // If the user invoked the function with option.WithGRPCConn,
+ // we would close a connection that's still in use.
+ // TODO(pongad): investigate error conditions.
+ return nil, err
+ }
+ return c, nil
+}
+
+// Connection returns the client's connection to the API service.
+func (c *WorkflowTemplateClient) Connection() *grpc.ClientConn {
+ return c.conn
+}
+
+// Close closes the connection to the API service. The user should invoke this when
+// the client is no longer required.
+func (c *WorkflowTemplateClient) Close() error {
+ return c.conn.Close()
+}
+
+// setGoogleClientInfo sets the name and version of the application in
+// the `x-goog-api-client` header passed on each request. Intended for
+// use by Google-written clients.
+func (c *WorkflowTemplateClient) setGoogleClientInfo(keyval ...string) {
+ kv := append([]string{"gl-go", versionGo()}, keyval...)
+ kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
+ c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
+}
+
+// CreateWorkflowTemplate creates new workflow template.
+func (c *WorkflowTemplateClient) CreateWorkflowTemplate(ctx context.Context, req *dataprocpb.CreateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.CreateWorkflowTemplate[0:len(c.CallOptions.CreateWorkflowTemplate):len(c.CallOptions.CreateWorkflowTemplate)], opts...)
+ var resp *dataprocpb.WorkflowTemplate
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.CreateWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetWorkflowTemplate retrieves the latest workflow template.
+//
+// Can retrieve previously instantiated template by specifying optional
+// version parameter.
+func (c *WorkflowTemplateClient) GetWorkflowTemplate(ctx context.Context, req *dataprocpb.GetWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.GetWorkflowTemplate[0:len(c.CallOptions.GetWorkflowTemplate):len(c.CallOptions.GetWorkflowTemplate)], opts...)
+ var resp *dataprocpb.WorkflowTemplate
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.GetWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// InstantiateWorkflowTemplate instantiates a template and begins execution.
+//
+// The returned Operation can be used to track execution of
+// workflow by polling
+// [operations.get][google.longrunning.Operations.GetOperation].
+// The Operation will complete when entire workflow is finished.
+//
+// The running workflow can be aborted via
+// [operations.cancel][google.longrunning.Operations.CancelOperation].
+// This will cause any inflight jobs to be cancelled and workflow-owned
+// clusters to be deleted.
+//
+// The [Operation.metadata][google.longrunning.Operation.metadata] will be
+// [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
+//
+// On successful completion,
+// [Operation.response][google.longrunning.Operation.response] will be
+// [Empty][google.protobuf.Empty].
+func (c *WorkflowTemplateClient) InstantiateWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateWorkflowTemplateOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.InstantiateWorkflowTemplate[0:len(c.CallOptions.InstantiateWorkflowTemplate):len(c.CallOptions.InstantiateWorkflowTemplate)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.InstantiateWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &InstantiateWorkflowTemplateOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// InstantiateInlineWorkflowTemplate instantiates a template and begins execution.
+//
+// This method is equivalent to executing the sequence
+// [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate],
+// [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
+//
+// The returned Operation can be used to track execution of
+// workflow by polling
+// [operations.get][google.longrunning.Operations.GetOperation].
+// The Operation will complete when entire workflow is finished.
+//
+// The running workflow can be aborted via
+// [operations.cancel][google.longrunning.Operations.CancelOperation].
+// This will cause any inflight jobs to be cancelled and workflow-owned
+// clusters to be deleted.
+//
+// The [Operation.metadata][google.longrunning.Operation.metadata] will be
+// [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata].
+//
+// On successful completion,
+// [Operation.response][google.longrunning.Operation.response] will be
+// [Empty][google.protobuf.Empty].
+func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateInlineWorkflowTemplateOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.InstantiateInlineWorkflowTemplate[0:len(c.CallOptions.InstantiateInlineWorkflowTemplate):len(c.CallOptions.InstantiateInlineWorkflowTemplate)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.InstantiateInlineWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &InstantiateInlineWorkflowTemplateOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// UpdateWorkflowTemplate updates (replaces) workflow template. The updated template
+// must contain version that matches the current server version.
+func (c *WorkflowTemplateClient) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.UpdateWorkflowTemplate[0:len(c.CallOptions.UpdateWorkflowTemplate):len(c.CallOptions.UpdateWorkflowTemplate)], opts...)
+ var resp *dataprocpb.WorkflowTemplate
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.UpdateWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// ListWorkflowTemplates lists workflows that match the specified filter in the request.
+func (c *WorkflowTemplateClient) ListWorkflowTemplates(ctx context.Context, req *dataprocpb.ListWorkflowTemplatesRequest, opts ...gax.CallOption) *WorkflowTemplateIterator {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.ListWorkflowTemplates[0:len(c.CallOptions.ListWorkflowTemplates):len(c.CallOptions.ListWorkflowTemplates)], opts...)
+ it := &WorkflowTemplateIterator{}
+ req = proto.Clone(req).(*dataprocpb.ListWorkflowTemplatesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.WorkflowTemplate, string, error) {
+ var resp *dataprocpb.ListWorkflowTemplatesResponse
+ req.PageToken = pageToken
+ if pageSize > math.MaxInt32 {
+ req.PageSize = math.MaxInt32
+ } else {
+ req.PageSize = int32(pageSize)
+ }
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.ListWorkflowTemplates(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+ return resp.Templates, resp.NextPageToken, nil
+ }
+ fetch := func(pageSize int, pageToken string) (string, error) {
+ items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
+ if err != nil {
+ return "", err
+ }
+ it.items = append(it.items, items...)
+ return nextPageToken, nil
+ }
+ it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
+ it.pageInfo.MaxSize = int(req.PageSize)
+ return it
+}
+
+// DeleteWorkflowTemplate deletes a workflow template. It does not cancel in-progress workflows.
+func (c *WorkflowTemplateClient) DeleteWorkflowTemplate(ctx context.Context, req *dataprocpb.DeleteWorkflowTemplateRequest, opts ...gax.CallOption) error {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.DeleteWorkflowTemplate[0:len(c.CallOptions.DeleteWorkflowTemplate):len(c.CallOptions.DeleteWorkflowTemplate)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.workflowTemplateClient.DeleteWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// WorkflowTemplateIterator manages a stream of *dataprocpb.WorkflowTemplate.
+type WorkflowTemplateIterator struct {
+ items []*dataprocpb.WorkflowTemplate
+ pageInfo *iterator.PageInfo
+ nextFunc func() error
+
+ // InternalFetch is for use by the Google Cloud Libraries only.
+ // It is not part of the stable interface of this package.
+ //
+ // InternalFetch returns results from a single call to the underlying RPC.
+ // The number of results is no greater than pageSize.
+ // If there are no more results, nextPageToken is empty and err is nil.
+ InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.WorkflowTemplate, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *WorkflowTemplateIterator) PageInfo() *iterator.PageInfo {
+ return it.pageInfo
+}
+
+// Next returns the next result. Its second return value is iterator.Done if there are no more
+// results. Once Next returns Done, all subsequent calls will return Done.
+func (it *WorkflowTemplateIterator) Next() (*dataprocpb.WorkflowTemplate, error) {
+ var item *dataprocpb.WorkflowTemplate
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *WorkflowTemplateIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *WorkflowTemplateIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// InstantiateInlineWorkflowTemplateOperation manages a long-running operation from InstantiateInlineWorkflowTemplate.
+type InstantiateInlineWorkflowTemplateOperation struct {
+ lro *longrunning.Operation
+}
+
+// InstantiateInlineWorkflowTemplateOperation returns a new InstantiateInlineWorkflowTemplateOperation from a given name.
+// The name must be that of a previously created InstantiateInlineWorkflowTemplateOperation, possibly from a different process.
+func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplateOperation(name string) *InstantiateInlineWorkflowTemplateOperation {
+ return &InstantiateInlineWorkflowTemplateOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}),
+ }
+}
+
+// Wait blocks until the long-running operation is completed, returning any error encountered.
+//
+// See documentation of Poll for error-handling information.
+func (op *InstantiateInlineWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...)
+}
+
+// Poll fetches the latest state of the long-running operation.
+//
+// Poll also fetches the latest metadata, which can be retrieved by Metadata.
+//
+// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
+// the operation has completed with failure, the error is returned and op.Done will return true.
+// If Poll succeeds and the operation has completed successfully, op.Done will return true.
+func (op *InstantiateInlineWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Poll(ctx, nil, opts...)
+}
+
+// Metadata returns metadata associated with the long-running operation.
+// Metadata itself does not contact the server, but Poll does.
+// To get the latest metadata, call this method after a successful call to Poll.
+// If the metadata is not available, the returned metadata and error are both nil.
+func (op *InstantiateInlineWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) {
+ var meta dataprocpb.WorkflowMetadata
+ if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
+ return nil, nil
+ } else if err != nil {
+ return nil, err
+ }
+ return &meta, nil
+}
+
+// Done reports whether the long-running operation has completed.
+func (op *InstantiateInlineWorkflowTemplateOperation) Done() bool {
+ return op.lro.Done()
+}
+
+// Name returns the name of the long-running operation.
+// The name is assigned by the server and is unique within the service from which the operation is created.
+func (op *InstantiateInlineWorkflowTemplateOperation) Name() string {
+ return op.lro.Name()
+}
+
+// Cancel starts asynchronous cancellation on a long-running operation.
+// The server makes a best effort to cancel the operation, but success is not guaranteed.
+// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation
+// completed despite cancellation. On successful cancellation, the operation is not deleted;
+// instead, op.Poll returns an error with code Canceled.
+func (op *InstantiateInlineWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Cancel(ctx, opts...)
+}
+
+// Delete deletes a long-running operation.
+// This method indicates that the client is no longer interested in the operation result.
+// It does not cancel the operation.
+func (op *InstantiateInlineWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Delete(ctx, opts...)
+}
+
+// InstantiateWorkflowTemplateOperation manages a long-running operation from InstantiateWorkflowTemplate.
+type InstantiateWorkflowTemplateOperation struct {
+ lro *longrunning.Operation
+}
+
+// InstantiateWorkflowTemplateOperation returns a new InstantiateWorkflowTemplateOperation from a given name.
+// The name must be that of a previously created InstantiateWorkflowTemplateOperation, possibly from a different process.
+func (c *WorkflowTemplateClient) InstantiateWorkflowTemplateOperation(name string) *InstantiateWorkflowTemplateOperation {
+ return &InstantiateWorkflowTemplateOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}),
+ }
+}
+
+// Wait blocks until the long-running operation is completed, returning any error encountered.
+//
+// See documentation of Poll for error-handling information.
+func (op *InstantiateWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...)
+}
+
+// Poll fetches the latest state of the long-running operation.
+//
+// Poll also fetches the latest metadata, which can be retrieved by Metadata.
+//
+// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
+// the operation has completed with failure, the error is returned and op.Done will return true.
+// If Poll succeeds and the operation has completed successfully, op.Done will return true.
+func (op *InstantiateWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Poll(ctx, nil, opts...)
+}
+
+// Metadata returns metadata associated with the long-running operation.
+// Metadata itself does not contact the server, but Poll does.
+// To get the latest metadata, call this method after a successful call to Poll.
+// If the metadata is not available, the returned metadata and error are both nil.
+func (op *InstantiateWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) {
+ var meta dataprocpb.WorkflowMetadata
+ if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
+ return nil, nil
+ } else if err != nil {
+ return nil, err
+ }
+ return &meta, nil
+}
+
+// Done reports whether the long-running operation has completed.
+func (op *InstantiateWorkflowTemplateOperation) Done() bool {
+ return op.lro.Done()
+}
+
+// Name returns the name of the long-running operation.
+// The name is assigned by the server and is unique within the service from which the operation is created.
+func (op *InstantiateWorkflowTemplateOperation) Name() string {
+ return op.lro.Name()
+}
+
+// Cancel starts asynchronous cancellation on a long-running operation.
+// The server makes a best effort to cancel the operation, but success is not guaranteed.
+// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation
+// completed despite cancellation. On successful cancellation, the operation is not deleted;
+// instead, op.Poll returns an error with code Canceled.
+func (op *InstantiateWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Cancel(ctx, opts...)
+}
+
+// Delete deletes a long-running operation.
+// This method indicates that the client is no longer interested in the operation result.
+// It does not cancel the operation.
+func (op *InstantiateWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Delete(ctx, opts...)
+}
diff --git a/dataproc/apiv1/workflow_template_client_example_test.go b/dataproc/apiv1/workflow_template_client_example_test.go
new file mode 100644
index 0000000..e2e4375
--- /dev/null
+++ b/dataproc/apiv1/workflow_template_client_example_test.go
@@ -0,0 +1,167 @@
+// Copyright 2018 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
+//
+// https://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.
+
+// AUTO-GENERATED CODE. DO NOT EDIT.
+
+package dataproc_test
+
+import (
+ "context"
+
+ "cloud.google.com/go/dataproc/apiv1"
+ "google.golang.org/api/iterator"
+ dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
+)
+
+func ExampleNewWorkflowTemplateClient() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleWorkflowTemplateClient_CreateWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.CreateWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleWorkflowTemplateClient_GetWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.GetWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleWorkflowTemplateClient_InstantiateWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.InstantiateWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.InstantiateWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ err = op.Wait(ctx)
+ // TODO: Handle error.
+}
+
+func ExampleWorkflowTemplateClient_InstantiateInlineWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.InstantiateInlineWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ err = op.Wait(ctx)
+ // TODO: Handle error.
+}
+
+func ExampleWorkflowTemplateClient_UpdateWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.UpdateWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleWorkflowTemplateClient_ListWorkflowTemplates() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.ListWorkflowTemplatesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListWorkflowTemplates(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleWorkflowTemplateClient_DeleteWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.DeleteWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dataproc/apiv1beta2/cluster_controller_client.go b/dataproc/apiv1beta2/cluster_controller_client.go
index 699c9c2..25c3d57 100644
--- a/dataproc/apiv1beta2/cluster_controller_client.go
+++ b/dataproc/apiv1beta2/cluster_controller_client.go
@@ -58,6 +58,18 @@
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
+ codes.Internal,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ {"default", "non_idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
@@ -70,7 +82,7 @@
return &ClusterControllerCallOptions{
CreateCluster: retry[[2]string{"default", "non_idempotent"}],
UpdateCluster: retry[[2]string{"default", "non_idempotent"}],
- DeleteCluster: retry[[2]string{"default", "idempotent"}],
+ DeleteCluster: retry[[2]string{"default", "non_idempotent"}],
GetCluster: retry[[2]string{"default", "idempotent"}],
ListClusters: retry[[2]string{"default", "idempotent"}],
DiagnoseCluster: retry[[2]string{"default", "non_idempotent"}],
diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go
index e6abfd1..de8a575 100644
--- a/dataproc/apiv1beta2/doc.go
+++ b/dataproc/apiv1beta2/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/dataproc/apiv1beta2/job_controller_client.go b/dataproc/apiv1beta2/job_controller_client.go
index c3e579c..6049a7d 100644
--- a/dataproc/apiv1beta2/job_controller_client.go
+++ b/dataproc/apiv1beta2/job_controller_client.go
@@ -55,6 +55,18 @@
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
+ codes.Internal,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ {"default", "non_idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
@@ -69,8 +81,8 @@
GetJob: retry[[2]string{"default", "idempotent"}],
ListJobs: retry[[2]string{"default", "idempotent"}],
UpdateJob: retry[[2]string{"default", "non_idempotent"}],
- CancelJob: retry[[2]string{"default", "non_idempotent"}],
- DeleteJob: retry[[2]string{"default", "idempotent"}],
+ CancelJob: retry[[2]string{"default", "idempotent"}],
+ DeleteJob: retry[[2]string{"default", "non_idempotent"}],
}
}
diff --git a/dataproc/apiv1beta2/mock_test.go b/dataproc/apiv1beta2/mock_test.go
index 0c33fec..733f2dd 100644
--- a/dataproc/apiv1beta2/mock_test.go
+++ b/dataproc/apiv1beta2/mock_test.go
@@ -273,6 +273,18 @@
return s.resps[0].(*longrunningpb.Operation), nil
}
+func (s *mockWorkflowTemplateServer) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest) (*longrunningpb.Operation, error) {
+ md, _ := metadata.FromIncomingContext(ctx)
+ if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
+ return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg)
+ }
+ s.reqs = append(s.reqs, req)
+ if s.err != nil {
+ return nil, s.err
+ }
+ return s.resps[0].(*longrunningpb.Operation), nil
+}
+
func (s *mockWorkflowTemplateServer) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) {
md, _ := metadata.FromIncomingContext(ctx)
if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") {
@@ -864,11 +876,15 @@
}
}
func TestJobControllerSubmitJob(t *testing.T) {
+ var submittedBy string = "submittedBy-2047729125"
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
+ SubmittedBy: submittedBy,
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -933,11 +949,15 @@
_ = resp
}
func TestJobControllerGetJob(t *testing.T) {
+ var submittedBy string = "submittedBy-2047729125"
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
+ SubmittedBy: submittedBy,
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -1078,11 +1098,15 @@
_ = resp
}
func TestJobControllerUpdateJob(t *testing.T) {
+ var submittedBy string = "submittedBy-2047729125"
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
+ SubmittedBy: submittedBy,
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -1155,11 +1179,15 @@
_ = resp
}
func TestJobControllerCancelJob(t *testing.T) {
+ var submittedBy string = "submittedBy-2047729125"
var driverOutputResourceUri string = "driverOutputResourceUri-542229086"
var driverControlFilesUri string = "driverControlFilesUri207057643"
+ var jobUuid string = "jobUuid-1615012099"
var expectedResponse = &dataprocpb.Job{
+ SubmittedBy: submittedBy,
DriverOutputResourceUri: driverOutputResourceUri,
DriverControlFilesUri: driverControlFilesUri,
+ JobUuid: jobUuid,
}
mockJobController.err = nil
@@ -1491,6 +1519,88 @@
t.Errorf("got error code %q, want %q", c, errCode)
}
}
+func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplate(t *testing.T) {
+ var expectedResponse *emptypb.Empty = &emptypb.Empty{}
+
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.reqs = nil
+
+ any, err := ptypes.MarshalAny(expectedResponse)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Response{Response: any},
+ })
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ Parent: formattedParent,
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = respLRO.Wait(context.Background())
+
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) {
+ t.Errorf("wrong request %q, want %q", got, want)
+ }
+
+}
+
+func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplateError(t *testing.T) {
+ errCode := codes.PermissionDenied
+ mockWorkflowTemplate.err = nil
+ mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{
+ Name: "longrunning-test",
+ Done: true,
+ Result: &longrunningpb.Operation_Error{
+ Error: &status.Status{
+ Code: int32(errCode),
+ Message: "test error",
+ },
+ },
+ })
+
+ var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]")
+ var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{}
+ var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ Parent: formattedParent,
+ Template: template,
+ }
+
+ c, err := NewWorkflowTemplateClient(context.Background(), clientOpt)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = respLRO.Wait(context.Background())
+
+ if st, ok := gstatus.FromError(err); !ok {
+ t.Errorf("got error %v, expected grpc error", err)
+ } else if c := st.Code(); c != errCode {
+ t.Errorf("got error code %q, want %q", c, errCode)
+ }
+}
func TestWorkflowTemplateServiceUpdateWorkflowTemplate(t *testing.T) {
var id string = "id3355"
var name string = "name3373707"
diff --git a/dataproc/apiv1beta2/workflow_template_client.go b/dataproc/apiv1beta2/workflow_template_client.go
index da22912..4af9232 100644
--- a/dataproc/apiv1beta2/workflow_template_client.go
+++ b/dataproc/apiv1beta2/workflow_template_client.go
@@ -37,12 +37,13 @@
// WorkflowTemplateCallOptions contains the retry settings for each method of WorkflowTemplateClient.
type WorkflowTemplateCallOptions struct {
- CreateWorkflowTemplate []gax.CallOption
- GetWorkflowTemplate []gax.CallOption
- InstantiateWorkflowTemplate []gax.CallOption
- UpdateWorkflowTemplate []gax.CallOption
- ListWorkflowTemplates []gax.CallOption
- DeleteWorkflowTemplate []gax.CallOption
+ CreateWorkflowTemplate []gax.CallOption
+ GetWorkflowTemplate []gax.CallOption
+ InstantiateWorkflowTemplate []gax.CallOption
+ InstantiateInlineWorkflowTemplate []gax.CallOption
+ UpdateWorkflowTemplate []gax.CallOption
+ ListWorkflowTemplates []gax.CallOption
+ DeleteWorkflowTemplate []gax.CallOption
}
func defaultWorkflowTemplateClientOptions() []option.ClientOption {
@@ -58,6 +59,18 @@
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
codes.DeadlineExceeded,
+ codes.Internal,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.3,
+ })
+ }),
+ },
+ {"default", "non_idempotent"}: {
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
codes.Unavailable,
}, gax.Backoff{
Initial: 100 * time.Millisecond,
@@ -68,12 +81,13 @@
},
}
return &WorkflowTemplateCallOptions{
- CreateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
- GetWorkflowTemplate: retry[[2]string{"default", "idempotent"}],
- InstantiateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
- UpdateWorkflowTemplate: retry[[2]string{"default", "idempotent"}],
- ListWorkflowTemplates: retry[[2]string{"default", "idempotent"}],
- DeleteWorkflowTemplate: retry[[2]string{"default", "idempotent"}],
+ CreateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ GetWorkflowTemplate: retry[[2]string{"default", "idempotent"}],
+ InstantiateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ InstantiateInlineWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ UpdateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
+ ListWorkflowTemplates: retry[[2]string{"default", "idempotent"}],
+ DeleteWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}],
}
}
@@ -219,6 +233,45 @@
}, nil
}
+// InstantiateInlineWorkflowTemplate instantiates a template and begins execution.
+//
+// This method is equivalent to executing the sequence
+// [CreateWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.InstantiateWorkflowTemplate],
+// [DeleteWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.DeleteWorkflowTemplate].
+//
+// The returned Operation can be used to track execution of
+// workflow by polling
+// [operations.get][google.longrunning.Operations.GetOperation].
+// The Operation will complete when entire workflow is finished.
+//
+// The running workflow can be aborted via
+// [operations.cancel][google.longrunning.Operations.CancelOperation].
+// This will cause any inflight jobs to be cancelled and workflow-owned
+// clusters to be deleted.
+//
+// The [Operation.metadata][google.longrunning.Operation.metadata] will be
+// [WorkflowMetadata][google.cloud.dataproc.v1beta2.WorkflowMetadata].
+//
+// On successful completion,
+// [Operation.response][google.longrunning.Operation.response] will be
+// [Empty][google.protobuf.Empty].
+func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateInlineWorkflowTemplateOperation, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.InstantiateInlineWorkflowTemplate[0:len(c.CallOptions.InstantiateInlineWorkflowTemplate):len(c.CallOptions.InstantiateInlineWorkflowTemplate)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.workflowTemplateClient.InstantiateInlineWorkflowTemplate(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &InstantiateInlineWorkflowTemplateOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
// UpdateWorkflowTemplate updates (replaces) workflow template. The updated template
// must contain version that matches the current server version.
func (c *WorkflowTemplateClient) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) {
@@ -327,6 +380,78 @@
return b
}
+// InstantiateInlineWorkflowTemplateOperation manages a long-running operation from InstantiateInlineWorkflowTemplate.
+type InstantiateInlineWorkflowTemplateOperation struct {
+ lro *longrunning.Operation
+}
+
+// InstantiateInlineWorkflowTemplateOperation returns a new InstantiateInlineWorkflowTemplateOperation from a given name.
+// The name must be that of a previously created InstantiateInlineWorkflowTemplateOperation, possibly from a different process.
+func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplateOperation(name string) *InstantiateInlineWorkflowTemplateOperation {
+ return &InstantiateInlineWorkflowTemplateOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}),
+ }
+}
+
+// Wait blocks until the long-running operation is completed, returning any error encountered.
+//
+// See documentation of Poll for error-handling information.
+func (op *InstantiateInlineWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...)
+}
+
+// Poll fetches the latest state of the long-running operation.
+//
+// Poll also fetches the latest metadata, which can be retrieved by Metadata.
+//
+// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
+// the operation has completed with failure, the error is returned and op.Done will return true.
+// If Poll succeeds and the operation has completed successfully, op.Done will return true.
+func (op *InstantiateInlineWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Poll(ctx, nil, opts...)
+}
+
+// Metadata returns metadata associated with the long-running operation.
+// Metadata itself does not contact the server, but Poll does.
+// To get the latest metadata, call this method after a successful call to Poll.
+// If the metadata is not available, the returned metadata and error are both nil.
+func (op *InstantiateInlineWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) {
+ var meta dataprocpb.WorkflowMetadata
+ if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
+ return nil, nil
+ } else if err != nil {
+ return nil, err
+ }
+ return &meta, nil
+}
+
+// Done reports whether the long-running operation has completed.
+func (op *InstantiateInlineWorkflowTemplateOperation) Done() bool {
+ return op.lro.Done()
+}
+
+// Name returns the name of the long-running operation.
+// The name is assigned by the server and is unique within the service from which the operation is created.
+func (op *InstantiateInlineWorkflowTemplateOperation) Name() string {
+ return op.lro.Name()
+}
+
+// Cancel starts asynchronous cancellation on a long-running operation.
+// The server makes a best effort to cancel the operation, but success is not guaranteed.
+// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation
+// completed despite cancellation. On successful cancellation, the operation is not deleted;
+// instead, op.Poll returns an error with code Canceled.
+func (op *InstantiateInlineWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Cancel(ctx, opts...)
+}
+
+// Delete deletes a long-running operation.
+// This method indicates that the client is no longer interested in the operation result.
+// It does not cancel the operation.
+func (op *InstantiateInlineWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error {
+ return op.lro.Delete(ctx, opts...)
+}
+
// InstantiateWorkflowTemplateOperation manages a long-running operation from InstantiateWorkflowTemplate.
type InstantiateWorkflowTemplateOperation struct {
lro *longrunning.Operation
diff --git a/dataproc/apiv1beta2/workflow_template_client_example_test.go b/dataproc/apiv1beta2/workflow_template_client_example_test.go
index 3bb051f..02a4990 100644
--- a/dataproc/apiv1beta2/workflow_template_client_example_test.go
+++ b/dataproc/apiv1beta2/workflow_template_client_example_test.go
@@ -89,6 +89,25 @@
// TODO: Handle error.
}
+func ExampleWorkflowTemplateClient_InstantiateInlineWorkflowTemplate() {
+ ctx := context.Background()
+ c, err := dataproc.NewWorkflowTemplateClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.InstantiateInlineWorkflowTemplate(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ err = op.Wait(ctx)
+ // TODO: Handle error.
+}
+
func ExampleWorkflowTemplateClient_UpdateWorkflowTemplate() {
ctx := context.Background()
c, err := dataproc.NewWorkflowTemplateClient(ctx)
diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go
index 8580dae..e3d5256 100644
--- a/debugger/apiv2/doc.go
+++ b/debugger/apiv2/doc.go
@@ -90,4 +90,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go
index 1bebdb0..61f42d7 100644
--- a/dialogflow/apiv2/doc.go
+++ b/dialogflow/apiv2/doc.go
@@ -87,4 +87,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go
index 07fafe6..4ee9d0d 100644
--- a/dlp/apiv2/doc.go
+++ b/dlp/apiv2/doc.go
@@ -87,4 +87,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go
index fe131f1..65af379 100644
--- a/errorreporting/apiv1beta1/doc.go
+++ b/errorreporting/apiv1beta1/doc.go
@@ -90,4 +90,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/expr/apiv1alpha1/doc.go b/expr/apiv1alpha1/doc.go
index e70f048..6d9588c 100644
--- a/expr/apiv1alpha1/doc.go
+++ b/expr/apiv1alpha1/doc.go
@@ -84,4 +84,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/firestore/apiv1beta1/doc.go b/firestore/apiv1beta1/doc.go
index 25a867a..a3a68a2 100644
--- a/firestore/apiv1beta1/doc.go
+++ b/firestore/apiv1beta1/doc.go
@@ -88,4 +88,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/firestore/apiv1beta1/firestore_client.go b/firestore/apiv1beta1/firestore_client.go
index df307b8..24404e2 100644
--- a/firestore/apiv1beta1/firestore_client.go
+++ b/firestore/apiv1beta1/firestore_client.go
@@ -93,7 +93,7 @@
BeginTransaction: retry[[2]string{"default", "idempotent"}],
Commit: retry[[2]string{"default", "non_idempotent"}],
Rollback: retry[[2]string{"default", "idempotent"}],
- RunQuery: retry[[2]string{"default", "idempotent"}],
+ RunQuery: retry[[2]string{"streaming", "idempotent"}],
Write: retry[[2]string{"streaming", "non_idempotent"}],
Listen: retry[[2]string{"streaming", "idempotent"}],
ListCollectionIds: retry[[2]string{"default", "idempotent"}],
diff --git a/iam/admin/apiv1/doc.go b/iam/admin/apiv1/doc.go
index 39d7c91..3dea8ce 100644
--- a/iam/admin/apiv1/doc.go
+++ b/iam/admin/apiv1/doc.go
@@ -89,4 +89,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go
index 4e7435c..718b2b4 100644
--- a/iam/credentials/apiv1/doc.go
+++ b/iam/credentials/apiv1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go
index edb12f3..2769e7f 100644
--- a/kms/apiv1/doc.go
+++ b/kms/apiv1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go
index eb394e0..01bfeac 100644
--- a/language/apiv1/doc.go
+++ b/language/apiv1/doc.go
@@ -87,4 +87,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go
index 9f7387d..5c7ee03 100644
--- a/language/apiv1beta2/doc.go
+++ b/language/apiv1beta2/doc.go
@@ -88,4 +88,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go
index 530c39f..6ee4c61 100644
--- a/logging/apiv2/doc.go
+++ b/logging/apiv2/doc.go
@@ -92,4 +92,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go
index 7a3503d..c5849a9 100644
--- a/longrunning/autogen/doc.go
+++ b/longrunning/autogen/doc.go
@@ -85,4 +85,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/monitoring/apiv3/doc.go b/monitoring/apiv3/doc.go
index 482f1b0..eb9ef7f 100644
--- a/monitoring/apiv3/doc.go
+++ b/monitoring/apiv3/doc.go
@@ -91,4 +91,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/monitoring/apiv3/notification_channel_client.go b/monitoring/apiv3/notification_channel_client.go
index 67553dd..eb82cc7 100644
--- a/monitoring/apiv3/notification_channel_client.go
+++ b/monitoring/apiv3/notification_channel_client.go
@@ -245,7 +245,7 @@
}
// CreateNotificationChannel creates a new notification channel, representing a single notification
-// endpoint such as an email address, SMS number, or pagerduty service.
+// endpoint such as an email address, SMS number, or PagerDuty service.
func (c *NotificationChannelClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
ctx = insertMetadata(ctx, c.xGoogMetadata)
opts = append(c.CallOptions.CreateNotificationChannel[0:len(c.CallOptions.CreateNotificationChannel):len(c.CallOptions.CreateNotificationChannel)], opts...)
diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go
index 429502a..0e4e2f9 100644
--- a/oslogin/apiv1/doc.go
+++ b/oslogin/apiv1/doc.go
@@ -89,4 +89,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go
index 29420d5..fa88aff 100644
--- a/oslogin/apiv1beta/doc.go
+++ b/oslogin/apiv1beta/doc.go
@@ -89,4 +89,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go
index 3958040..5081693 100644
--- a/pubsub/apiv1/doc.go
+++ b/pubsub/apiv1/doc.go
@@ -90,4 +90,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go
index 867381a..641394b 100644
--- a/redis/apiv1/doc.go
+++ b/redis/apiv1/doc.go
@@ -87,4 +87,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go
index f794265..951cfb5 100644
--- a/redis/apiv1beta1/doc.go
+++ b/redis/apiv1beta1/doc.go
@@ -88,4 +88,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go
index d30f3b3..1fbb60a 100644
--- a/scheduler/apiv1beta1/doc.go
+++ b/scheduler/apiv1beta1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go
index e39bd06..65c6e99 100644
--- a/securitycenter/apiv1beta1/doc.go
+++ b/securitycenter/apiv1beta1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/securitycenter/apiv1beta1/security_center_client.go b/securitycenter/apiv1beta1/security_center_client.go
index aacbb3d..4318fe8 100644
--- a/securitycenter/apiv1beta1/security_center_client.go
+++ b/securitycenter/apiv1beta1/security_center_client.go
@@ -370,7 +370,7 @@
return it
}
-// ListFindings lists an organization or source's assets.
+// ListFindings lists an organization or source's findings.
//
// To list across all sources provide a - as the source id.
// Example: /v1beta1/organizations/123/sources/-/findings
diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go
index 06d86c7..55fbf1e 100644
--- a/spanner/admin/database/apiv1/doc.go
+++ b/spanner/admin/database/apiv1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go
index e6f2061..49cda55 100644
--- a/spanner/admin/instance/apiv1/doc.go
+++ b/spanner/admin/instance/apiv1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go
index 3685f48..34fdd0b 100644
--- a/spanner/apiv1/doc.go
+++ b/spanner/apiv1/doc.go
@@ -90,4 +90,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/spanner/apiv1/spanner_client.go b/spanner/apiv1/spanner_client.go
index 1a5d662..8db16f2 100644
--- a/spanner/apiv1/spanner_client.go
+++ b/spanner/apiv1/spanner_client.go
@@ -88,9 +88,9 @@
ListSessions: retry[[2]string{"default", "idempotent"}],
DeleteSession: retry[[2]string{"default", "idempotent"}],
ExecuteSql: retry[[2]string{"default", "idempotent"}],
- ExecuteStreamingSql: retry[[2]string{"default", "non_idempotent"}],
+ ExecuteStreamingSql: retry[[2]string{"streaming", "non_idempotent"}],
Read: retry[[2]string{"default", "idempotent"}],
- StreamingRead: retry[[2]string{"default", "non_idempotent"}],
+ StreamingRead: retry[[2]string{"streaming", "non_idempotent"}],
BeginTransaction: retry[[2]string{"default", "idempotent"}],
Commit: retry[[2]string{"long_running", "long_running"}],
Rollback: retry[[2]string{"default", "idempotent"}],
diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go
index f0048f2..550d3bf 100644
--- a/speech/apiv1/doc.go
+++ b/speech/apiv1/doc.go
@@ -85,4 +85,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go
index af741ff..58edeae 100644
--- a/speech/apiv1p1beta1/doc.go
+++ b/speech/apiv1p1beta1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go
index 50b74c6..6eb5375 100644
--- a/texttospeech/apiv1/doc.go
+++ b/texttospeech/apiv1/doc.go
@@ -87,4 +87,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go
index 5cd19b9..005df20 100644
--- a/trace/apiv1/doc.go
+++ b/trace/apiv1/doc.go
@@ -94,4 +94,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go
index 57b3161..553d9de 100644
--- a/trace/apiv2/doc.go
+++ b/trace/apiv2/doc.go
@@ -91,4 +91,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go
index 6d0600b..9c79b9a 100644
--- a/videointelligence/apiv1/doc.go
+++ b/videointelligence/apiv1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/videointelligence/apiv1beta1/doc.go b/videointelligence/apiv1beta1/doc.go
index b8d16fc..00b740e 100644
--- a/videointelligence/apiv1beta1/doc.go
+++ b/videointelligence/apiv1beta1/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go
index 5510ebf..3f72b90 100644
--- a/videointelligence/apiv1beta2/doc.go
+++ b/videointelligence/apiv1beta2/doc.go
@@ -86,4 +86,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go
index 77728e9..4344524 100644
--- a/vision/apiv1/doc.go
+++ b/vision/apiv1/doc.go
@@ -89,4 +89,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"
diff --git a/vision/apiv1/mock_test.go b/vision/apiv1/mock_test.go
index cc4eb0e..5a7cf2e 100644
--- a/vision/apiv1/mock_test.go
+++ b/vision/apiv1/mock_test.go
@@ -758,7 +758,7 @@
mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse)
- var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]")
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
var request = &visionpb.GetReferenceImageRequest{
Name: formattedName,
}
@@ -787,7 +787,7 @@
errCode := codes.PermissionDenied
mockProductSearch.err = gstatus.Error(errCode, "test error")
- var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]")
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
var request = &visionpb.GetReferenceImageRequest{
Name: formattedName,
}
@@ -814,7 +814,7 @@
mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse)
- var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]")
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
var request = &visionpb.DeleteReferenceImageRequest{
Name: formattedName,
}
@@ -840,7 +840,7 @@
errCode := codes.PermissionDenied
mockProductSearch.err = gstatus.Error(errCode, "test error")
- var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]")
+ var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
var request = &visionpb.DeleteReferenceImageRequest{
Name: formattedName,
}
diff --git a/vision/apiv1/product_search_client.go b/vision/apiv1/product_search_client.go
index f83f8e4..2a835ab 100644
--- a/vision/apiv1/product_search_client.go
+++ b/vision/apiv1/product_search_client.go
@@ -554,8 +554,8 @@
return resp, nil
}
-// DeleteProductSet permanently deletes a ProductSet. All Products and ReferenceImages in the
-// ProductSet will be deleted.
+// DeleteProductSet permanently deletes a ProductSet. Products and ReferenceImages in the
+// ProductSet are not deleted.
//
// The actual image files are not deleted from Google Cloud Storage.
//
diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go
index 94f93c8..317f2f6 100644
--- a/vision/apiv1p1beta1/doc.go
+++ b/vision/apiv1p1beta1/doc.go
@@ -90,4 +90,4 @@
return "UNKNOWN"
}
-const versionClient = "20181106"
+const versionClient = "20181129"