all: regen Change-Id: I37e286fe1944b692b7006e88dd84c381eab5b19b Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/46551 Reviewed-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index 103b9ad..34bbadd 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/asset/apiv1beta1/doc.go b/asset/apiv1beta1/doc.go index 826e590..874e4c9 100644 --- a/asset/apiv1beta1/doc.go +++ b/asset/apiv1beta1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go index 3db4577..128da88 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/automl/apiv1/auto_ml_client.go b/automl/apiv1/auto_ml_client.go index d3f0b34..6dde76e 100644 --- a/automl/apiv1/auto_ml_client.go +++ b/automl/apiv1/auto_ml_client.go
@@ -182,7 +182,7 @@ } // CreateDataset creates a dataset. -func (c *Client) CreateDataset(ctx context.Context, req *automlpb.CreateDatasetRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { +func (c *Client) CreateDataset(ctx context.Context, req *automlpb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error) { md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append(c.CallOptions.CreateDataset[0:len(c.CallOptions.CreateDataset):len(c.CallOptions.CreateDataset)], opts...) @@ -195,7 +195,9 @@ if err != nil { return nil, err } - return resp, nil + return &CreateDatasetOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil } // UpdateDataset updates a dataset. @@ -635,6 +637,75 @@ return b } +// CreateDatasetOperation manages a long-running operation from CreateDataset. +type CreateDatasetOperation struct { + lro *longrunning.Operation +} + +// CreateDatasetOperation returns a new CreateDatasetOperation from a given name. +// The name must be that of a previously created CreateDatasetOperation, possibly from a different process. +func (c *Client) CreateDatasetOperation(name string) *CreateDatasetOperation { + return &CreateDatasetOperation{ + 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 *CreateDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*automlpb.Dataset, error) { + var resp automlpb.Dataset + 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 *CreateDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*automlpb.Dataset, error) { + var resp automlpb.Dataset + 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 *CreateDatasetOperation) Metadata() (*automlpb.OperationMetadata, error) { + var meta automlpb.OperationMetadata + 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 *CreateDatasetOperation) 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 *CreateDatasetOperation) Name() string { + return op.lro.Name() +} + // CreateModelOperation manages a long-running operation from CreateModel. type CreateModelOperation struct { lro *longrunning.Operation
diff --git a/automl/apiv1/auto_ml_client_example_test.go b/automl/apiv1/auto_ml_client_example_test.go index a56623e..405f540 100644 --- a/automl/apiv1/auto_ml_client_example_test.go +++ b/automl/apiv1/auto_ml_client_example_test.go
@@ -44,7 +44,12 @@ req := &automlpb.CreateDatasetRequest{ // TODO: Fill request struct fields. } - resp, err := c.CreateDataset(ctx, req) + op, err := c.CreateDataset(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. }
diff --git a/automl/apiv1/doc.go b/automl/apiv1/doc.go index 0a353c3..c6bfbf8 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go
@@ -16,8 +16,7 @@ // Package automl is an auto-generated package for the // Cloud AutoML API. -// -// NOTE: This package is in alpha. It is not stable, and is likely to change. + // // Train high-quality custom machine learning models with minimum effort and // machine learning expertise. @@ -98,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/automl/apiv1/mock_test.go b/automl/apiv1/mock_test.go index 89229cd..a69c500 100644 --- a/automl/apiv1/mock_test.go +++ b/automl/apiv1/mock_test.go
@@ -290,16 +290,30 @@ func TestAutoMlCreateDataset(t *testing.T) { var name string = "name3373707" - var done bool = true - var expectedResponse = &longrunningpb.Operation{ - Name: name, - Done: done, + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var exampleCount int32 = 1517063674 + var etag string = "etag3123477" + var expectedResponse = &automlpb.Dataset{ + Name: name, + DisplayName: displayName, + Description: description, + ExampleCount: exampleCount, + Etag: etag, } mockAutoMl.err = nil mockAutoMl.reqs = nil - mockAutoMl.resps = append(mockAutoMl.resps[:0], expectedResponse) + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAutoMl.resps = append(mockAutoMl.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") var dataset *automlpb.Dataset = &automlpb.Dataset{} @@ -313,7 +327,11 @@ t.Fatal(err) } - resp, err := c.CreateDataset(context.Background(), request) + respLRO, err := c.CreateDataset(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) if err != nil { t.Fatal(err) @@ -330,7 +348,17 @@ func TestAutoMlCreateDatasetError(t *testing.T) { errCode := codes.PermissionDenied - mockAutoMl.err = gstatus.Error(errCode, "test error") + mockAutoMl.err = nil + mockAutoMl.resps = append(mockAutoMl.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/locations/%s", "[PROJECT]", "[LOCATION]") var dataset *automlpb.Dataset = &automlpb.Dataset{} @@ -344,7 +372,11 @@ t.Fatal(err) } - resp, err := c.CreateDataset(context.Background(), request) + respLRO, err := c.CreateDataset(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)
diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go index 49ceba9..91965cd 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go
@@ -98,4 +98,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go index c4f1d9f..793cf57 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index 3274a6e..7474e70 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go
@@ -98,4 +98,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index dea8394..40a296c 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index 576456f..1b72390 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go index b8dee54..9161761 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go index 7d58c11..f887b8e 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/dataproc/apiv1/cluster_controller_client.go b/dataproc/apiv1/cluster_controller_client.go index ef40eab..4d431ad 100644 --- a/dataproc/apiv1/cluster_controller_client.go +++ b/dataproc/apiv1/cluster_controller_client.go
@@ -163,7 +163,9 @@ c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) } -// CreateCluster creates a cluster in a project. +// CreateCluster creates a cluster in a project. The returned +// [Operation.metadata][google.longrunning.Operation.metadata] will be +// ClusterOperationMetadata (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). func (c *ClusterControllerClient) CreateCluster(ctx context.Context, req *dataprocpb.CreateClusterRequest, opts ...gax.CallOption) (*CreateClusterOperation, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append(c.CallOptions.CreateCluster[0:len(c.CallOptions.CreateCluster):len(c.CallOptions.CreateCluster)], opts...) @@ -181,7 +183,9 @@ }, nil } -// UpdateCluster updates a cluster in a project. +// UpdateCluster updates a cluster in a project. The returned +// [Operation.metadata][google.longrunning.Operation.metadata] will be +// ClusterOperationMetadata (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). func (c *ClusterControllerClient) UpdateCluster(ctx context.Context, req *dataprocpb.UpdateClusterRequest, opts ...gax.CallOption) (*UpdateClusterOperation, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append(c.CallOptions.UpdateCluster[0:len(c.CallOptions.UpdateCluster):len(c.CallOptions.UpdateCluster)], opts...) @@ -199,7 +203,9 @@ }, nil } -// DeleteCluster deletes a cluster in a project. +// DeleteCluster deletes a cluster in a project. The returned +// [Operation.metadata][google.longrunning.Operation.metadata] will be +// ClusterOperationMetadata (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). func (c *ClusterControllerClient) DeleteCluster(ctx context.Context, req *dataprocpb.DeleteClusterRequest, opts ...gax.CallOption) (*DeleteClusterOperation, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append(c.CallOptions.DeleteCluster[0:len(c.CallOptions.DeleteCluster):len(c.CallOptions.DeleteCluster)], opts...) @@ -271,9 +277,13 @@ return it } -// DiagnoseCluster gets cluster diagnostic information. -// After the operation completes, the Operation.response field -// contains DiagnoseClusterOutputLocation. +// DiagnoseCluster gets cluster diagnostic information. The returned +// [Operation.metadata][google.longrunning.Operation.metadata] will be +// ClusterOperationMetadata (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). +// After the operation completes, +// [Operation.response][google.longrunning.Operation.response] +// contains +// DiagnoseClusterResults (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults). func (c *ClusterControllerClient) DiagnoseCluster(ctx context.Context, req *dataprocpb.DiagnoseClusterRequest, opts ...gax.CallOption) (*DiagnoseClusterOperation, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append(c.CallOptions.DiagnoseCluster[0:len(c.CallOptions.DiagnoseCluster):len(c.CallOptions.DiagnoseCluster)], opts...)
diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index c9b0eaa..c0fec5c 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/dataproc/apiv1/workflow_template_client.go b/dataproc/apiv1/workflow_template_client.go index b27dff5..e9959e5 100644 --- a/dataproc/apiv1/workflow_template_client.go +++ b/dataproc/apiv1/workflow_template_client.go
@@ -217,7 +217,9 @@ // clusters to be deleted. // // The [Operation.metadata][google.longrunning.Operation.metadata] will be -// [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata]. +// WorkflowMetadata (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). +// Also see Using +// WorkflowMetadata (at /dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). // // On successful completion, // [Operation.response][google.longrunning.Operation.response] will be @@ -257,7 +259,9 @@ // clusters to be deleted. // // The [Operation.metadata][google.longrunning.Operation.metadata] will be -// [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata]. +// WorkflowMetadata (at /dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). +// Also see Using +// WorkflowMetadata (at /dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). // // On successful completion, // [Operation.response][google.longrunning.Operation.response] will be
diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go index 98a69dc..49bfd69 100644 --- a/dataproc/apiv1beta2/doc.go +++ b/dataproc/apiv1beta2/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index 1f4bb0f..a8d0669 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go
@@ -101,4 +101,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index a642c4d..797b070 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index d234d63..8421255 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go
@@ -98,4 +98,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go index da89fa4..dca4659 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go
@@ -101,4 +101,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/expr/apiv1alpha1/doc.go b/expr/apiv1alpha1/doc.go index 6a60bb4..269a780 100644 --- a/expr/apiv1alpha1/doc.go +++ b/expr/apiv1alpha1/doc.go
@@ -95,4 +95,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go index 8d8ecac..0715dc5 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/firestore/apiv1beta1/doc.go b/firestore/apiv1beta1/doc.go index 76d9c27..e1a7e4a 100644 --- a/firestore/apiv1beta1/doc.go +++ b/firestore/apiv1beta1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/gapics.txt b/gapics.txt index 5234693..2bc89f8 100644 --- a/gapics.txt +++ b/gapics.txt
@@ -35,7 +35,6 @@ google/cloud/tasks/artman_cloudtasks_v2.yaml google/cloud/translate/artman_translate_v3.yaml google/cloud/videointelligence/artman_videointelligence_v1.yaml -google/cloud/videointelligence/artman_videointelligence_v1beta1.yaml google/cloud/videointelligence/artman_videointelligence_v1beta2.yaml google/cloud/vision/artman_vision_v1.yaml google/cloud/vision/artman_vision_v1p1beta1.yaml
diff --git a/go.mod b/go.mod index e68b806..36c0651 100644 --- a/go.mod +++ b/go.mod
@@ -20,9 +20,9 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/text v0.3.2 - golang.org/x/tools v0.0.0-20191002183253-8a18b87bf663 + golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e google.golang.org/api v0.9.0 - google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354 + google.golang.org/genproto v0.0.0-20191007204434-a023cd5227bd google.golang.org/grpc v1.21.1 honnef.co/go/tools v0.0.1-2019.2.3 )
diff --git a/go.sum b/go.sum index 17ad3d2..5fa0c70 100644 --- a/go.sum +++ b/go.sum
@@ -156,9 +156,8 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff h1:On1qIo75ByTwFJ4/W2bIqHcwJ9XAqtSWUs8GwRrIhtc= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e h1:1xWUkZQQ9Z9UuZgNaIR6OQOE7rUFglXUUBZlO+dGg6I= golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191002183253-8a18b87bf663 h1:NqC0oOZtJkiI21TmBjSJTdz/ogOxmI2yaU7Uh9QB+T4= -golang.org/x/tools v0.0.0-20191002183253-8a18b87bf663/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -186,8 +185,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 h1:Ex1mq5jaJof+kRnYi3SlYJ8KKa9Ao3NHyIT5XJ1gF6U= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354 h1:KJxw2DvYTCIxlEY4yqWyLdvFGlci4EKTCbrZwfyxDME= -google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191007204434-a023cd5227bd h1:84VQPzup3IpKLxuIAZjHMhVjJ8fZ4/i3yUnj3k6fUdw= +google.golang.org/genproto v0.0.0-20191007204434-a023cd5227bd/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU=
diff --git a/iam/admin/apiv1/doc.go b/iam/admin/apiv1/doc.go index 2585b4f..8781727 100644 --- a/iam/admin/apiv1/doc.go +++ b/iam/admin/apiv1/doc.go
@@ -100,4 +100,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 3e5ea3c..81db551 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index c1e19d6..74c426a 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/irm/apiv1alpha2/doc.go b/irm/apiv1alpha2/doc.go index 332cd50..6251e0b 100644 --- a/irm/apiv1alpha2/doc.go +++ b/irm/apiv1alpha2/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index a1d44b2..82f27a7 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go
@@ -98,4 +98,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index 1c09461..b0189f6 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go
@@ -100,4 +100,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index 5c318b8..e46acfe 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index bd9af2f..cda8129 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go
@@ -106,4 +106,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index 5b2322f..47c4b6e 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/monitoring/apiv3/doc.go b/monitoring/apiv3/doc.go index 5dfced8..91faec0 100644 --- a/monitoring/apiv3/doc.go +++ b/monitoring/apiv3/doc.go
@@ -102,4 +102,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go index c63c6e1..06c2b5c 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go
@@ -100,4 +100,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go index 3374758..f748d97 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go
@@ -100,4 +100,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go index edf92f9..cee513f 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index c0aa298..7cd9a48 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go
@@ -100,4 +100,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go index 7995de4..3335204 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go index bbb3193..c320f4d 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go index 6a76244..8298f33 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go index 55baa75..c52003b 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go index bb15be6..518201d 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go index 4e4f8c1..5147326 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index 2e4fdc7..0a68251 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go
@@ -98,4 +98,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go index 0d1aac7..0620773 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go
@@ -98,4 +98,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index db6b3f7..882915a 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go index 8247bba..4967f09 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go index a8481d9..e81e155 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go
@@ -100,4 +100,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index 730c11a..b549092 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index 10b6e0a..e711e6a 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go
@@ -97,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go index 2489a76..d62da59 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go index 9783589..6ab7bf2 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go
@@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Code generated by gapic-generator. DO NOT EDIT. +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. // Package texttospeech is an auto-generated package for the // Cloud Text-to-Speech API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. -// // Synthesizes natural-sounding speech by applying powerful neural network // models. // +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -32,6 +32,7 @@ // // For information about setting deadlines, reusing contexts, and more // please visit godoc.org/cloud.google.com/go. + package texttospeech // import "cloud.google.com/go/texttospeech/apiv1" import ( @@ -43,6 +44,8 @@ "google.golang.org/grpc/metadata" ) +const versionClient = "20191007" + func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) out = out.Copy() @@ -76,7 +79,7 @@ } notSemverRune := func(r rune) bool { - return strings.IndexRune("0123456789.", r) < 0 + return !strings.ContainsRune("0123456789.", r) } if strings.HasPrefix(s, "go1") { @@ -97,5 +100,3 @@ } return "UNKNOWN" } - -const versionClient = "20191004"
diff --git a/texttospeech/apiv1/text_to_speech_client.go b/texttospeech/apiv1/text_to_speech_client.go index 13450c2..cd0d36e 100644 --- a/texttospeech/apiv1/text_to_speech_client.go +++ b/texttospeech/apiv1/text_to_speech_client.go
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Code generated by gapic-generator. DO NOT EDIT. +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. package texttospeech @@ -39,6 +39,7 @@ func defaultClientOptions() []option.ClientOption { return []option.ClientOption{ option.WithEndpoint("texttospeech.googleapis.com:443"), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithScopes(DefaultAuthScopes()...), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), @@ -46,23 +47,31 @@ } func defaultCallOptions() *CallOptions { - retry := map[[2]string][]gax.CallOption{ - {"default", "idempotent"}: { + return &CallOptions{ + ListVoices: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ - codes.DeadlineExceeded, codes.Unavailable, + codes.DeadlineExceeded, }, gax.Backoff{ Initial: 100 * time.Millisecond, Max: 60000 * time.Millisecond, - Multiplier: 1.3, + Multiplier: 1.30, }) }), }, - } - return &CallOptions{ - ListVoices: retry[[2]string{"default", "idempotent"}], - SynthesizeSpeech: retry[[2]string{"default", "non_idempotent"}], + SynthesizeSpeech: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, } } @@ -98,6 +107,7 @@ client: texttospeechpb.NewTextToSpeechClient(conn), } c.setGoogleClientInfo() + return c, nil }
diff --git a/texttospeech/apiv1/text_to_speech_client_example_test.go b/texttospeech/apiv1/text_to_speech_client_example_test.go index 4096db7..16e4455 100644 --- a/texttospeech/apiv1/text_to_speech_client_example_test.go +++ b/texttospeech/apiv1/text_to_speech_client_example_test.go
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Code generated by gapic-generator. DO NOT EDIT. +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. package texttospeech_test @@ -34,6 +34,8 @@ } func ExampleClient_ListVoices() { + // import texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1" + ctx := context.Background() c, err := texttospeech.NewClient(ctx) if err != nil { @@ -52,6 +54,8 @@ } func ExampleClient_SynthesizeSpeech() { + // import texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1" + ctx := context.Background() c, err := texttospeech.NewClient(ctx) if err != nil {
diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go index ac2762c..57bf972 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go
@@ -105,4 +105,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go index 42857d3..dda6f18 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go
@@ -102,4 +102,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go index 32fca9c..d35f03a 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go
@@ -16,8 +16,7 @@ // Package translate is an auto-generated package for the // Cloud Translation API. -// -// NOTE: This package is in alpha. It is not stable, and is likely to change. + // // Integrates text translation into your website or application. // @@ -98,4 +97,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go index 9324256..c203dac 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/videointelligence/apiv1beta1/.repo-metadata.json b/videointelligence/apiv1beta1/.repo-metadata.json deleted file mode 100644 index 3cfc2f3..0000000 --- a/videointelligence/apiv1beta1/.repo-metadata.json +++ /dev/null
@@ -1,12 +0,0 @@ -{ - "name": "videointelligence", - "name_pretty": "Translation API", - "product_documentation": "https://cloud.google.com/video-intelligence", - "client_documentation": "https://godoc.org/cloud.google.com/go/videointelligence/apiv1beta1", - "release_level": "beta", - "language": "go", - "repo": "googleapis/google-cloud-go", - "distribution_name": "cloud.google.com/go", - "api_id": "videointelligence.googleapis.com", - "requires_billing": true -}
diff --git a/videointelligence/apiv1beta1/doc.go b/videointelligence/apiv1beta1/doc.go deleted file mode 100644 index 5b74093..0000000 --- a/videointelligence/apiv1beta1/doc.go +++ /dev/null
@@ -1,102 +0,0 @@ -// Copyright 2019 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. - -// Code generated by gapic-generator. DO NOT EDIT. - -// Package videointelligence is an auto-generated package for the -// Google Cloud Video Intelligence API. -// -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// -// Detects objects, explicit content, and scene changes in videos. It also -// specifies the region for annotation and transcribes speech to text. -// Supports both asynchronous API and streaming API. -// -// Use of Context -// -// The ctx passed to NewClient is used for authentication requests and -// for creating the underlying connection, but is not used for subsequent calls. -// Individual methods on the client use the ctx given to them. -// -// To close the open connection, use the Close() method. -// -// For information about setting deadlines, reusing contexts, and more -// please visit godoc.org/cloud.google.com/go. -package videointelligence // import "cloud.google.com/go/videointelligence/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 = "20191004"
diff --git a/videointelligence/apiv1beta1/mock_test.go b/videointelligence/apiv1beta1/mock_test.go deleted file mode 100644 index 61949f5..0000000 --- a/videointelligence/apiv1beta1/mock_test.go +++ /dev/null
@@ -1,191 +0,0 @@ -// Copyright 2019 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. - -// Code generated by gapic-generator. DO NOT EDIT. - -package videointelligence - -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" - videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1" - longrunningpb "google.golang.org/genproto/googleapis/longrunning" - - 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 mockVideoIntelligenceServer struct { - // Embed for forward compatibility. - // Tests will keep working if more methods are added - // in the future. - videointelligencepb.VideoIntelligenceServiceServer - - reqs []proto.Message - - // If set, all calls return this error. - err error - - // responses to return if err == nil - resps []proto.Message -} - -func (s *mockVideoIntelligenceServer) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest) (*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 -} - -// clientOpt is the option tests should use to connect to the test server. -// It is initialized by TestMain. -var clientOpt option.ClientOption - -var ( - mockVideoIntelligence mockVideoIntelligenceServer -) - -func TestMain(m *testing.M) { - flag.Parse() - - serv := grpc.NewServer() - videointelligencepb.RegisterVideoIntelligenceServiceServer(serv, &mockVideoIntelligence) - - 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 TestVideoIntelligenceServiceAnnotateVideo(t *testing.T) { - var expectedResponse *videointelligencepb.AnnotateVideoResponse = &videointelligencepb.AnnotateVideoResponse{} - - mockVideoIntelligence.err = nil - mockVideoIntelligence.reqs = nil - - any, err := ptypes.MarshalAny(expectedResponse) - if err != nil { - t.Fatal(err) - } - mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ - Name: "longrunning-test", - Done: true, - Result: &longrunningpb.Operation_Response{Response: any}, - }) - - var inputUri string = "gs://cloud-samples-data/video/cat.mp4" - var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION - var features = []videointelligencepb.Feature{featuresElement} - var request = &videointelligencepb.AnnotateVideoRequest{ - InputUri: inputUri, - Features: features, - } - - c, err := NewClient(context.Background(), clientOpt) - if err != nil { - t.Fatal(err) - } - - respLRO, err := c.AnnotateVideo(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, mockVideoIntelligence.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 TestVideoIntelligenceServiceAnnotateVideoError(t *testing.T) { - errCode := codes.PermissionDenied - mockVideoIntelligence.err = nil - mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ - Name: "longrunning-test", - Done: true, - Result: &longrunningpb.Operation_Error{ - Error: &status.Status{ - Code: int32(errCode), - Message: "test error", - }, - }, - }) - - var inputUri string = "gs://cloud-samples-data/video/cat.mp4" - var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION - var features = []videointelligencepb.Feature{featuresElement} - var request = &videointelligencepb.AnnotateVideoRequest{ - InputUri: inputUri, - Features: features, - } - - c, err := NewClient(context.Background(), clientOpt) - if err != nil { - t.Fatal(err) - } - - respLRO, err := c.AnnotateVideo(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 -}
diff --git a/videointelligence/apiv1beta1/video_intelligence_client.go b/videointelligence/apiv1beta1/video_intelligence_client.go deleted file mode 100644 index e1d903c..0000000 --- a/videointelligence/apiv1beta1/video_intelligence_client.go +++ /dev/null
@@ -1,229 +0,0 @@ -// Copyright 2019 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. - -// Code generated by gapic-generator. DO NOT EDIT. - -package videointelligence - -import ( - "context" - "math" - "time" - - "cloud.google.com/go/longrunning" - lroauto "cloud.google.com/go/longrunning/autogen" - gax "github.com/googleapis/gax-go/v2" - "google.golang.org/api/option" - "google.golang.org/api/transport" - videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/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 { - AnnotateVideo []gax.CallOption -} - -func defaultClientOptions() []option.ClientOption { - return []option.ClientOption{ - option.WithEndpoint("videointelligence.googleapis.com:443"), - option.WithScopes(DefaultAuthScopes()...), - option.WithGRPCDialOption(grpc.WithDefaultCallOptions( - grpc.MaxCallRecvMsgSize(math.MaxInt32))), - } -} - -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: 1000 * time.Millisecond, - Max: 120000 * time.Millisecond, - Multiplier: 2.5, - }) - }), - }, - } - return &CallOptions{ - AnnotateVideo: retry[[2]string{"default", "idempotent"}], - } -} - -// Client is a client for interacting with Google Cloud Video Intelligence 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 videointelligencepb.VideoIntelligenceServiceClient - - // 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 video intelligence service client. -// -// Service that implements Google Cloud Video Intelligence API. -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: videointelligencepb.NewVideoIntelligenceServiceClient(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...)) -} - -// AnnotateVideo performs asynchronous video annotation. Progress and results can be -// retrieved through the google.longrunning.Operations interface. -// Operation.metadata contains AnnotateVideoProgress (progress). -// Operation.response contains AnnotateVideoResponse (results). -func (c *Client) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest, opts ...gax.CallOption) (*AnnotateVideoOperation, error) { - ctx = insertMetadata(ctx, c.xGoogMetadata) - opts = append(c.CallOptions.AnnotateVideo[0:len(c.CallOptions.AnnotateVideo):len(c.CallOptions.AnnotateVideo)], opts...) - var resp *longrunningpb.Operation - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.AnnotateVideo(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return &AnnotateVideoOperation{ - lro: longrunning.InternalNewOperation(c.LROClient, resp), - }, nil -} - -// AnnotateVideoOperation manages a long-running operation from AnnotateVideo. -type AnnotateVideoOperation struct { - lro *longrunning.Operation -} - -// AnnotateVideoOperation returns a new AnnotateVideoOperation from a given name. -// The name must be that of a previously created AnnotateVideoOperation, possibly from a different process. -func (c *Client) AnnotateVideoOperation(name string) *AnnotateVideoOperation { - return &AnnotateVideoOperation{ - 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 *AnnotateVideoOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { - var resp videointelligencepb.AnnotateVideoResponse - if err := op.lro.WaitWithInterval(ctx, &resp, 45000*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 *AnnotateVideoOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { - var resp videointelligencepb.AnnotateVideoResponse - 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 *AnnotateVideoOperation) Metadata() (*videointelligencepb.AnnotateVideoProgress, error) { - var meta videointelligencepb.AnnotateVideoProgress - 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 *AnnotateVideoOperation) 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 *AnnotateVideoOperation) Name() string { - return op.lro.Name() -}
diff --git a/videointelligence/apiv1beta1/video_intelligence_client_example_test.go b/videointelligence/apiv1beta1/video_intelligence_client_example_test.go deleted file mode 100644 index c50d072..0000000 --- a/videointelligence/apiv1beta1/video_intelligence_client_example_test.go +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2019 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. - -// Code generated by gapic-generator. DO NOT EDIT. - -package videointelligence_test - -import ( - "context" - - videointelligence "cloud.google.com/go/videointelligence/apiv1beta1" - videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1" -) - -func ExampleNewClient() { - ctx := context.Background() - c, err := videointelligence.NewClient(ctx) - if err != nil { - // TODO: Handle error. - } - // TODO: Use client. - _ = c -} - -func ExampleClient_AnnotateVideo() { - ctx := context.Background() - c, err := videointelligence.NewClient(ctx) - if err != nil { - // TODO: Handle error. - } - - req := &videointelligencepb.AnnotateVideoRequest{ - // TODO: Fill request struct fields. - } - op, err := c.AnnotateVideo(ctx, req) - if err != nil { - // TODO: Handle error. - } - - resp, err := op.Wait(ctx) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -}
diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go index 00aad7f..7df0bf3 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go index 0d79373..5832f3b 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go
@@ -99,4 +99,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go index 70c0b56..8c54203 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go
@@ -101,4 +101,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"
diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go index bbc2a0c..5cc97cf 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go
@@ -96,4 +96,4 @@ return "UNKNOWN" } -const versionClient = "20191004" +const versionClient = "20191007"