diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index 037c48ae802..39da82cf998 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/admin/apiv1alpha/doc.go b/analytics/admin/apiv1alpha/doc.go index 589656b3ef9..f3b1e757008 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/data/apiv1alpha/doc.go b/analytics/data/apiv1alpha/doc.go index da728169f32..915105ef5b8 100644 --- a/analytics/data/apiv1alpha/doc.go +++ b/analytics/data/apiv1alpha/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/apigateway/apiv1/doc.go b/apigateway/apiv1/doc.go index 39f114a6b92..f612f83f42e 100644 --- a/apigateway/apiv1/doc.go +++ b/apigateway/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/appengine/apiv1/doc.go b/appengine/apiv1/doc.go index 57a6d02e816..4cbc2883060 100644 --- a/appengine/apiv1/doc.go +++ b/appengine/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go index 3742591b757..c0289c1a0c9 100644 --- a/area120/tables/apiv1alpha1/doc.go +++ b/area120/tables/apiv1alpha1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/artifactregistry/apiv1beta2/doc.go b/artifactregistry/apiv1beta2/doc.go index 2fcbabdf08d..59dbf1af293 100644 --- a/artifactregistry/apiv1beta2/doc.go +++ b/artifactregistry/apiv1beta2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index 98091a1d4d8..cde2a812129 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go index bfa5fb474b5..e36a984b0da 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p5beta1/doc.go b/asset/apiv1p5beta1/doc.go index 5de27dee4d9..31691df7475 100644 --- a/asset/apiv1p5beta1/doc.go +++ b/asset/apiv1p5beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index 61cc5fa73fb..3e1d0c9cd56 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1/doc.go b/automl/apiv1/doc.go index 4e0e524eef9..1321b7ceea0 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go index 049cee11578..6b8af2d7a97 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1/doc.go b/bigquery/connection/apiv1/doc.go index 0d02d97259b..4d76920da72 100644 --- a/bigquery/connection/apiv1/doc.go +++ b/bigquery/connection/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1beta1/doc.go b/bigquery/connection/apiv1beta1/doc.go index f72781fcfeb..77c3a3fadee 100644 --- a/bigquery/connection/apiv1beta1/doc.go +++ b/bigquery/connection/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go index 5e8b721dedf..086def91a37 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/go.mod b/bigquery/go.mod index 2bf38dbe906..6bb895b0be7 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -9,6 +9,6 @@ require ( github.com/google/go-cmp v0.5.5 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 0baf4e0e2d3..e2531bdbb51 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -403,8 +403,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index 5b0dd16c69b..1cf06701358 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1beta1/doc.go b/bigquery/reservation/apiv1beta1/doc.go index c498231f286..30b503a15a8 100644 --- a/bigquery/reservation/apiv1beta1/doc.go +++ b/bigquery/reservation/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index 2a022d16774..24675e0d3e4 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1alpha2/doc.go b/bigquery/storage/apiv1alpha2/doc.go index 7e9b131d0b4..8f503e81251 100644 --- a/bigquery/storage/apiv1alpha2/doc.go +++ b/bigquery/storage/apiv1alpha2/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index 3babccc27e3..a582cdb345f 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index dc1365afe31..e46e62e8cb0 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigtable/go.mod b/bigtable/go.mod index 985231cdeb1..82ff9c5207f 100644 --- a/bigtable/go.mod +++ b/bigtable/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93 golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 google.golang.org/protobuf v1.25.0 rsc.io/binaryregexp v0.2.0 diff --git a/bigtable/go.sum b/bigtable/go.sum index 54447665886..f203772d0f0 100644 --- a/bigtable/go.sum +++ b/bigtable/go.sum @@ -401,8 +401,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go index 0bbc08ed327..a753bb9ea0e 100644 --- a/billing/apiv1/doc.go +++ b/billing/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1/doc.go b/billing/budgets/apiv1/doc.go index 6b5694ce9c1..fd078dcfac3 100644 --- a/billing/budgets/apiv1/doc.go +++ b/billing/budgets/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1beta1/doc.go b/billing/budgets/apiv1beta1/doc.go index 1c6360398f2..8ee1b637e11 100644 --- a/billing/budgets/apiv1beta1/doc.go +++ b/billing/budgets/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/binaryauthorization/apiv1beta1/doc.go b/binaryauthorization/apiv1beta1/doc.go index 2652aed11e7..e3758c020fd 100644 --- a/binaryauthorization/apiv1beta1/doc.go +++ b/binaryauthorization/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index 6fe0b789107..4496a3d149f 100644 --- a/channel/apiv1/doc.go +++ b/channel/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 9bde6959b51..2e40c727638 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index 44f3b886293..12abb5ea2a3 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index 1de6dac9fc7..04067f5f47f 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go index a38e8e448bd..3165224c017 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/container/apiv1/doc.go b/container/apiv1/doc.go index 0c418d213a9..c4fd1b4dd35 100644 --- a/container/apiv1/doc.go +++ b/container/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go index 4043b94d766..c346c180102 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1/doc.go b/datacatalog/apiv1/doc.go index 4c964a6f819..97363aa52f6 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1beta1/doc.go b/datacatalog/apiv1beta1/doc.go index 1c4d7647d91..217066491b2 100644 --- a/datacatalog/apiv1beta1/doc.go +++ b/datacatalog/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datalabeling/apiv1beta1/doc.go b/datalabeling/apiv1beta1/doc.go index d869187c87d..cc7df3a2176 100644 --- a/datalabeling/apiv1beta1/doc.go +++ b/datalabeling/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index c8b532848ef..d34c5661607 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go index 95e5db159c0..c9fe35c78d5 100644 --- a/dataproc/apiv1beta2/doc.go +++ b/dataproc/apiv1beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataqna/apiv1alpha/doc.go b/dataqna/apiv1alpha/doc.go index 81bc8dd26e4..1e5b5b1929d 100644 --- a/dataqna/apiv1alpha/doc.go +++ b/dataqna/apiv1alpha/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/admin/apiv1/doc.go b/datastore/admin/apiv1/doc.go index 6420a44fa94..bc5fc95aa1d 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/go.mod b/datastore/go.mod index afeaf6de79b..3970b2f6fdb 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.5 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 google.golang.org/protobuf v1.25.0 ) diff --git a/datastore/go.sum b/datastore/go.sum index 2f67e19579d..2371d76521f 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -400,8 +400,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index dbd91175cf9..b5455f39335 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/answer_records_client.go b/dialogflow/apiv2/answer_records_client.go new file mode 100644 index 00000000000..ab16ca5b088 --- /dev/null +++ b/dialogflow/apiv2/answer_records_client.go @@ -0,0 +1,271 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newAnswerRecordsClientHook clientHook + +// AnswerRecordsCallOptions contains the retry settings for each method of AnswerRecordsClient. +type AnswerRecordsCallOptions struct { + ListAnswerRecords []gax.CallOption + UpdateAnswerRecord []gax.CallOption +} + +func defaultAnswerRecordsClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultAnswerRecordsCallOptions() *AnswerRecordsCallOptions { + return &AnswerRecordsCallOptions{ + ListAnswerRecords: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateAnswerRecord: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// AnswerRecordsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type AnswerRecordsClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + answerRecordsClient dialogflowpb.AnswerRecordsClient + + // The call options for this service. + CallOptions *AnswerRecordsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewAnswerRecordsClient creates a new answer records client. +// +// Service for managing AnswerRecords. +func NewAnswerRecordsClient(ctx context.Context, opts ...option.ClientOption) (*AnswerRecordsClient, error) { + clientOpts := defaultAnswerRecordsClientOptions() + + if newAnswerRecordsClientHook != nil { + hookOpts, err := newAnswerRecordsClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &AnswerRecordsClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultAnswerRecordsCallOptions(), + + answerRecordsClient: dialogflowpb.NewAnswerRecordsClient(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *AnswerRecordsClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *AnswerRecordsClient) Close() error { + return c.connPool.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 *AnswerRecordsClient) 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...)) +} + +// ListAnswerRecords returns the list of all answer records in the specified project in reverse +// chronological order. +func (c *AnswerRecordsClient) ListAnswerRecords(ctx context.Context, req *dialogflowpb.ListAnswerRecordsRequest, opts ...gax.CallOption) *AnswerRecordIterator { + 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.ListAnswerRecords[0:len(c.CallOptions.ListAnswerRecords):len(c.CallOptions.ListAnswerRecords)], opts...) + it := &AnswerRecordIterator{} + req = proto.Clone(req).(*dialogflowpb.ListAnswerRecordsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.AnswerRecord, string, error) { + var resp *dialogflowpb.ListAnswerRecordsResponse + 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.answerRecordsClient.ListAnswerRecords(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetAnswerRecords(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// UpdateAnswerRecord updates the specified answer record. +func (c *AnswerRecordsClient) UpdateAnswerRecord(ctx context.Context, req *dialogflowpb.UpdateAnswerRecordRequest, opts ...gax.CallOption) (*dialogflowpb.AnswerRecord, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "answer_record.name", url.QueryEscape(req.GetAnswerRecord().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateAnswerRecord[0:len(c.CallOptions.UpdateAnswerRecord):len(c.CallOptions.UpdateAnswerRecord)], opts...) + var resp *dialogflowpb.AnswerRecord + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.answerRecordsClient.UpdateAnswerRecord(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnswerRecordIterator manages a stream of *dialogflowpb.AnswerRecord. +type AnswerRecordIterator struct { + items []*dialogflowpb.AnswerRecord + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.AnswerRecord, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *AnswerRecordIterator) 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 *AnswerRecordIterator) Next() (*dialogflowpb.AnswerRecord, error) { + var item *dialogflowpb.AnswerRecord + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *AnswerRecordIterator) bufLen() int { + return len(it.items) +} + +func (it *AnswerRecordIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dialogflow/apiv2/answer_records_client_example_test.go b/dialogflow/apiv2/answer_records_client_example_test.go new file mode 100644 index 00000000000..c8497a53066 --- /dev/null +++ b/dialogflow/apiv2/answer_records_client_example_test.go @@ -0,0 +1,82 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewAnswerRecordsClient() { + ctx := context.Background() + c, err := dialogflow.NewAnswerRecordsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleAnswerRecordsClient_ListAnswerRecords() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewAnswerRecordsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListAnswerRecordsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListAnswerRecords(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAnswerRecordsClient_UpdateAnswerRecord() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewAnswerRecordsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateAnswerRecordRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateAnswerRecord(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dialogflow/apiv2/conversation_profiles_client.go b/dialogflow/apiv2/conversation_profiles_client.go new file mode 100644 index 00000000000..27d0a64b0fc --- /dev/null +++ b/dialogflow/apiv2/conversation_profiles_client.go @@ -0,0 +1,376 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newConversationProfilesClientHook clientHook + +// ConversationProfilesCallOptions contains the retry settings for each method of ConversationProfilesClient. +type ConversationProfilesCallOptions struct { + ListConversationProfiles []gax.CallOption + GetConversationProfile []gax.CallOption + CreateConversationProfile []gax.CallOption + UpdateConversationProfile []gax.CallOption + DeleteConversationProfile []gax.CallOption +} + +func defaultConversationProfilesClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultConversationProfilesCallOptions() *ConversationProfilesCallOptions { + return &ConversationProfilesCallOptions{ + ListConversationProfiles: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetConversationProfile: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateConversationProfile: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateConversationProfile: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteConversationProfile: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// ConversationProfilesClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ConversationProfilesClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + conversationProfilesClient dialogflowpb.ConversationProfilesClient + + // The call options for this service. + CallOptions *ConversationProfilesCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewConversationProfilesClient creates a new conversation profiles client. +// +// Service for managing ConversationProfiles. +func NewConversationProfilesClient(ctx context.Context, opts ...option.ClientOption) (*ConversationProfilesClient, error) { + clientOpts := defaultConversationProfilesClientOptions() + + if newConversationProfilesClientHook != nil { + hookOpts, err := newConversationProfilesClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &ConversationProfilesClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultConversationProfilesCallOptions(), + + conversationProfilesClient: dialogflowpb.NewConversationProfilesClient(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ConversationProfilesClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ConversationProfilesClient) Close() error { + return c.connPool.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 *ConversationProfilesClient) 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...)) +} + +// ListConversationProfiles returns the list of all conversation profiles in the specified project. +func (c *ConversationProfilesClient) ListConversationProfiles(ctx context.Context, req *dialogflowpb.ListConversationProfilesRequest, opts ...gax.CallOption) *ConversationProfileIterator { + 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.ListConversationProfiles[0:len(c.CallOptions.ListConversationProfiles):len(c.CallOptions.ListConversationProfiles)], opts...) + it := &ConversationProfileIterator{} + req = proto.Clone(req).(*dialogflowpb.ListConversationProfilesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.ConversationProfile, string, error) { + var resp *dialogflowpb.ListConversationProfilesResponse + 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.conversationProfilesClient.ListConversationProfiles(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetConversationProfiles(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetConversationProfile retrieves the specified conversation profile. +func (c *ConversationProfilesClient) GetConversationProfile(ctx context.Context, req *dialogflowpb.GetConversationProfileRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetConversationProfile[0:len(c.CallOptions.GetConversationProfile):len(c.CallOptions.GetConversationProfile)], opts...) + var resp *dialogflowpb.ConversationProfile + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationProfilesClient.GetConversationProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateConversationProfile creates a conversation profile in the specified project. +// +// ConversationProfile.CreateTime and ConversationProfile.UpdateTime +// aren’t populated in the response. You can retrieve them via +// GetConversationProfile API. +func (c *ConversationProfilesClient) CreateConversationProfile(ctx context.Context, req *dialogflowpb.CreateConversationProfileRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateConversationProfile[0:len(c.CallOptions.CreateConversationProfile):len(c.CallOptions.CreateConversationProfile)], opts...) + var resp *dialogflowpb.ConversationProfile + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationProfilesClient.CreateConversationProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateConversationProfile updates the specified conversation profile. +// +// ConversationProfile.CreateTime and ConversationProfile.UpdateTime +// aren’t populated in the response. You can retrieve them via +// GetConversationProfile API. +func (c *ConversationProfilesClient) UpdateConversationProfile(ctx context.Context, req *dialogflowpb.UpdateConversationProfileRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "conversation_profile.name", url.QueryEscape(req.GetConversationProfile().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateConversationProfile[0:len(c.CallOptions.UpdateConversationProfile):len(c.CallOptions.UpdateConversationProfile)], opts...) + var resp *dialogflowpb.ConversationProfile + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationProfilesClient.UpdateConversationProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteConversationProfile deletes the specified conversation profile. +func (c *ConversationProfilesClient) DeleteConversationProfile(ctx context.Context, req *dialogflowpb.DeleteConversationProfileRequest, opts ...gax.CallOption) error { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteConversationProfile[0:len(c.CallOptions.DeleteConversationProfile):len(c.CallOptions.DeleteConversationProfile)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.conversationProfilesClient.DeleteConversationProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ConversationProfileIterator manages a stream of *dialogflowpb.ConversationProfile. +type ConversationProfileIterator struct { + items []*dialogflowpb.ConversationProfile + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.ConversationProfile, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ConversationProfileIterator) 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 *ConversationProfileIterator) Next() (*dialogflowpb.ConversationProfile, error) { + var item *dialogflowpb.ConversationProfile + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ConversationProfileIterator) bufLen() int { + return len(it.items) +} + +func (it *ConversationProfileIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dialogflow/apiv2/conversation_profiles_client_example_test.go b/dialogflow/apiv2/conversation_profiles_client_example_test.go new file mode 100644 index 00000000000..36bacbed383 --- /dev/null +++ b/dialogflow/apiv2/conversation_profiles_client_example_test.go @@ -0,0 +1,138 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewConversationProfilesClient() { + ctx := context.Background() + c, err := dialogflow.NewConversationProfilesClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleConversationProfilesClient_ListConversationProfiles() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewConversationProfilesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListConversationProfilesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConversationProfiles(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleConversationProfilesClient_GetConversationProfile() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationProfilesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetConversationProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConversationProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationProfilesClient_CreateConversationProfile() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationProfilesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateConversationProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateConversationProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationProfilesClient_UpdateConversationProfile() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationProfilesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateConversationProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateConversationProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationProfilesClient_DeleteConversationProfile() { + ctx := context.Background() + c, err := dialogflow.NewConversationProfilesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteConversationProfileRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteConversationProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/dialogflow/apiv2/conversations_client.go b/dialogflow/apiv2/conversations_client.go new file mode 100644 index 00000000000..3653d7356b9 --- /dev/null +++ b/dialogflow/apiv2/conversations_client.go @@ -0,0 +1,624 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newConversationsClientHook clientHook + +// ConversationsCallOptions contains the retry settings for each method of ConversationsClient. +type ConversationsCallOptions struct { + CreateConversation []gax.CallOption + ListConversations []gax.CallOption + GetConversation []gax.CallOption + CompleteConversation []gax.CallOption + CreateCallMatcher []gax.CallOption + ListCallMatchers []gax.CallOption + DeleteCallMatcher []gax.CallOption + ListMessages []gax.CallOption +} + +func defaultConversationsClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultConversationsCallOptions() *ConversationsCallOptions { + return &ConversationsCallOptions{ + CreateConversation: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListConversations: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetConversation: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CompleteConversation: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateCallMatcher: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListCallMatchers: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteCallMatcher: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListMessages: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// ConversationsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ConversationsClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + conversationsClient dialogflowpb.ConversationsClient + + // The call options for this service. + CallOptions *ConversationsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewConversationsClient creates a new conversations client. +// +// Service for managing Conversations. +func NewConversationsClient(ctx context.Context, opts ...option.ClientOption) (*ConversationsClient, error) { + clientOpts := defaultConversationsClientOptions() + + if newConversationsClientHook != nil { + hookOpts, err := newConversationsClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &ConversationsClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultConversationsCallOptions(), + + conversationsClient: dialogflowpb.NewConversationsClient(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ConversationsClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ConversationsClient) Close() error { + return c.connPool.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 *ConversationsClient) 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...)) +} + +// CreateConversation creates a new conversation. Conversations are auto-completed after 24 +// hours. +// +// Conversation Lifecycle: +// There are two stages during a conversation: Automated Agent Stage and +// Assist Stage. +// +// For Automated Agent Stage, there will be a dialogflow agent responding to +// user queries. +// +// For Assist Stage, there’s no dialogflow agent responding to user queries. +// But we will provide suggestions which are generated from conversation. +// +// If Conversation.conversation_profile is configured for a dialogflow +// agent, conversation will start from Automated Agent Stage, otherwise, it +// will start from Assist Stage. And during Automated Agent Stage, once an +// Intent with Intent.live_agent_handoff is triggered, conversation +// will transfer to Assist Stage. +func (c *ConversationsClient) CreateConversation(ctx context.Context, req *dialogflowpb.CreateConversationRequest, opts ...gax.CallOption) (*dialogflowpb.Conversation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateConversation[0:len(c.CallOptions.CreateConversation):len(c.CallOptions.CreateConversation)], opts...) + var resp *dialogflowpb.Conversation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationsClient.CreateConversation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListConversations returns the list of all conversations in the specified project. +func (c *ConversationsClient) ListConversations(ctx context.Context, req *dialogflowpb.ListConversationsRequest, opts ...gax.CallOption) *ConversationIterator { + 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.ListConversations[0:len(c.CallOptions.ListConversations):len(c.CallOptions.ListConversations)], opts...) + it := &ConversationIterator{} + req = proto.Clone(req).(*dialogflowpb.ListConversationsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Conversation, string, error) { + var resp *dialogflowpb.ListConversationsResponse + 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.conversationsClient.ListConversations(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetConversations(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetConversation retrieves the specific conversation. +func (c *ConversationsClient) GetConversation(ctx context.Context, req *dialogflowpb.GetConversationRequest, opts ...gax.CallOption) (*dialogflowpb.Conversation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetConversation[0:len(c.CallOptions.GetConversation):len(c.CallOptions.GetConversation)], opts...) + var resp *dialogflowpb.Conversation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationsClient.GetConversation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CompleteConversation completes the specified conversation. Finished conversations are purged +// from the database after 30 days. +func (c *ConversationsClient) CompleteConversation(ctx context.Context, req *dialogflowpb.CompleteConversationRequest, opts ...gax.CallOption) (*dialogflowpb.Conversation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CompleteConversation[0:len(c.CallOptions.CompleteConversation):len(c.CallOptions.CompleteConversation)], opts...) + var resp *dialogflowpb.Conversation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationsClient.CompleteConversation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateCallMatcher creates a call matcher that links incoming SIP calls to the specified +// conversation if they fulfill specified criteria. +func (c *ConversationsClient) CreateCallMatcher(ctx context.Context, req *dialogflowpb.CreateCallMatcherRequest, opts ...gax.CallOption) (*dialogflowpb.CallMatcher, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateCallMatcher[0:len(c.CallOptions.CreateCallMatcher):len(c.CallOptions.CreateCallMatcher)], opts...) + var resp *dialogflowpb.CallMatcher + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conversationsClient.CreateCallMatcher(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListCallMatchers returns the list of all call matchers in the specified conversation. +func (c *ConversationsClient) ListCallMatchers(ctx context.Context, req *dialogflowpb.ListCallMatchersRequest, opts ...gax.CallOption) *CallMatcherIterator { + 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.ListCallMatchers[0:len(c.CallOptions.ListCallMatchers):len(c.CallOptions.ListCallMatchers)], opts...) + it := &CallMatcherIterator{} + req = proto.Clone(req).(*dialogflowpb.ListCallMatchersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.CallMatcher, string, error) { + var resp *dialogflowpb.ListCallMatchersResponse + 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.conversationsClient.ListCallMatchers(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetCallMatchers(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// DeleteCallMatcher requests deletion of a call matcher. +func (c *ConversationsClient) DeleteCallMatcher(ctx context.Context, req *dialogflowpb.DeleteCallMatcherRequest, opts ...gax.CallOption) error { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteCallMatcher[0:len(c.CallOptions.DeleteCallMatcher):len(c.CallOptions.DeleteCallMatcher)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.conversationsClient.DeleteCallMatcher(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListMessages lists messages that belong to a given conversation. +// messages are ordered by create_time in descending order. To fetch +// updates without duplication, send request with filter +// create_time_epoch_microseconds > [first item's create_time of previous request] and empty page_token. +func (c *ConversationsClient) ListMessages(ctx context.Context, req *dialogflowpb.ListMessagesRequest, opts ...gax.CallOption) *MessageIterator { + 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.ListMessages[0:len(c.CallOptions.ListMessages):len(c.CallOptions.ListMessages)], opts...) + it := &MessageIterator{} + req = proto.Clone(req).(*dialogflowpb.ListMessagesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Message, string, error) { + var resp *dialogflowpb.ListMessagesResponse + 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.conversationsClient.ListMessages(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetMessages(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// CallMatcherIterator manages a stream of *dialogflowpb.CallMatcher. +type CallMatcherIterator struct { + items []*dialogflowpb.CallMatcher + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.CallMatcher, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CallMatcherIterator) 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 *CallMatcherIterator) Next() (*dialogflowpb.CallMatcher, error) { + var item *dialogflowpb.CallMatcher + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CallMatcherIterator) bufLen() int { + return len(it.items) +} + +func (it *CallMatcherIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ConversationIterator manages a stream of *dialogflowpb.Conversation. +type ConversationIterator struct { + items []*dialogflowpb.Conversation + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.Conversation, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ConversationIterator) 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 *ConversationIterator) Next() (*dialogflowpb.Conversation, error) { + var item *dialogflowpb.Conversation + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ConversationIterator) bufLen() int { + return len(it.items) +} + +func (it *ConversationIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// MessageIterator manages a stream of *dialogflowpb.Message. +type MessageIterator struct { + items []*dialogflowpb.Message + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.Message, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MessageIterator) 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 *MessageIterator) Next() (*dialogflowpb.Message, error) { + var item *dialogflowpb.Message + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MessageIterator) bufLen() int { + return len(it.items) +} + +func (it *MessageIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dialogflow/apiv2/conversations_client_example_test.go b/dialogflow/apiv2/conversations_client_example_test.go new file mode 100644 index 00000000000..38a1c8d77e6 --- /dev/null +++ b/dialogflow/apiv2/conversations_client_example_test.go @@ -0,0 +1,212 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewConversationsClient() { + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleConversationsClient_CreateConversation() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateConversationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateConversation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationsClient_ListConversations() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListConversationsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConversations(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleConversationsClient_GetConversation() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetConversationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConversation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationsClient_CompleteConversation() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CompleteConversationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CompleteConversation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationsClient_CreateCallMatcher() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateCallMatcherRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCallMatcher(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConversationsClient_ListCallMatchers() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListCallMatchersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCallMatchers(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleConversationsClient_DeleteCallMatcher() { + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteCallMatcherRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteCallMatcher(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleConversationsClient_ListMessages() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewConversationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListMessagesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListMessages(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index 2d478796935..15e425f147c 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/documents_client.go b/dialogflow/apiv2/documents_client.go new file mode 100644 index 00000000000..d267c7e507a --- /dev/null +++ b/dialogflow/apiv2/documents_client.go @@ -0,0 +1,715 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newDocumentsClientHook clientHook + +// DocumentsCallOptions contains the retry settings for each method of DocumentsClient. +type DocumentsCallOptions struct { + ListDocuments []gax.CallOption + GetDocument []gax.CallOption + CreateDocument []gax.CallOption + DeleteDocument []gax.CallOption + UpdateDocument []gax.CallOption + ReloadDocument []gax.CallOption +} + +func defaultDocumentsClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultDocumentsCallOptions() *DocumentsCallOptions { + return &DocumentsCallOptions{ + ListDocuments: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetDocument: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateDocument: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteDocument: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateDocument: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ReloadDocument: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// DocumentsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type DocumentsClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + documentsClient dialogflowpb.DocumentsClient + + // 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 *DocumentsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewDocumentsClient creates a new documents client. +// +// Service for managing knowledge Documents. +func NewDocumentsClient(ctx context.Context, opts ...option.ClientOption) (*DocumentsClient, error) { + clientOpts := defaultDocumentsClientOptions() + + if newDocumentsClientHook != nil { + hookOpts, err := newDocumentsClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &DocumentsClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultDocumentsCallOptions(), + + documentsClient: dialogflowpb.NewDocumentsClient(connPool), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *DocumentsClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *DocumentsClient) Close() error { + return c.connPool.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 *DocumentsClient) 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...)) +} + +// ListDocuments returns the list of all documents of the knowledge base. +func (c *DocumentsClient) ListDocuments(ctx context.Context, req *dialogflowpb.ListDocumentsRequest, opts ...gax.CallOption) *DocumentIterator { + 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.ListDocuments[0:len(c.CallOptions.ListDocuments):len(c.CallOptions.ListDocuments)], opts...) + it := &DocumentIterator{} + req = proto.Clone(req).(*dialogflowpb.ListDocumentsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Document, string, error) { + var resp *dialogflowpb.ListDocumentsResponse + 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.documentsClient.ListDocuments(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetDocuments(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetDocument retrieves the specified document. +func (c *DocumentsClient) GetDocument(ctx context.Context, req *dialogflowpb.GetDocumentRequest, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetDocument[0:len(c.CallOptions.GetDocument):len(c.CallOptions.GetDocument)], opts...) + var resp *dialogflowpb.Document + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.documentsClient.GetDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateDocument creates a new document. +// +// Operation +func (c *DocumentsClient) CreateDocument(ctx context.Context, req *dialogflowpb.CreateDocumentRequest, opts ...gax.CallOption) (*CreateDocumentOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateDocument[0:len(c.CallOptions.CreateDocument):len(c.CallOptions.CreateDocument)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.documentsClient.CreateDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateDocumentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteDocument deletes the specified document. +// +// Operation +func (c *DocumentsClient) DeleteDocument(ctx context.Context, req *dialogflowpb.DeleteDocumentRequest, opts ...gax.CallOption) (*DeleteDocumentOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteDocument[0:len(c.CallOptions.DeleteDocument):len(c.CallOptions.DeleteDocument)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.documentsClient.DeleteDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteDocumentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateDocument updates the specified document. +// +// Operation +func (c *DocumentsClient) UpdateDocument(ctx context.Context, req *dialogflowpb.UpdateDocumentRequest, opts ...gax.CallOption) (*UpdateDocumentOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "document.name", url.QueryEscape(req.GetDocument().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateDocument[0:len(c.CallOptions.UpdateDocument):len(c.CallOptions.UpdateDocument)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.documentsClient.UpdateDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateDocumentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ReloadDocument reloads the specified document from its specified source, content_uri or +// content. The previously loaded content of the document will be deleted. +// Note: Even when the content of the document has not changed, there still +// may be side effects because of internal implementation changes. +// +// Note: The projects.agent.knowledgeBases.documents resource is deprecated; +// only use projects.knowledgeBases.documents. +// +// Operation +func (c *DocumentsClient) ReloadDocument(ctx context.Context, req *dialogflowpb.ReloadDocumentRequest, opts ...gax.CallOption) (*ReloadDocumentOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ReloadDocument[0:len(c.CallOptions.ReloadDocument):len(c.CallOptions.ReloadDocument)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.documentsClient.ReloadDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ReloadDocumentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// CreateDocumentOperation manages a long-running operation from CreateDocument. +type CreateDocumentOperation struct { + lro *longrunning.Operation +} + +// CreateDocumentOperation returns a new CreateDocumentOperation from a given name. +// The name must be that of a previously created CreateDocumentOperation, possibly from a different process. +func (c *DocumentsClient) CreateDocumentOperation(name string) *CreateDocumentOperation { + return &CreateDocumentOperation{ + 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 *CreateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, 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 *CreateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + 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 *CreateDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, error) { + var meta dialogflowpb.KnowledgeOperationMetadata + 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 *CreateDocumentOperation) 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 *CreateDocumentOperation) Name() string { + return op.lro.Name() +} + +// DeleteDocumentOperation manages a long-running operation from DeleteDocument. +type DeleteDocumentOperation struct { + lro *longrunning.Operation +} + +// DeleteDocumentOperation returns a new DeleteDocumentOperation from a given name. +// The name must be that of a previously created DeleteDocumentOperation, possibly from a different process. +func (c *DocumentsClient) DeleteDocumentOperation(name string) *DeleteDocumentOperation { + return &DeleteDocumentOperation{ + 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 *DeleteDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, 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, 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 *DeleteDocumentOperation) 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 *DeleteDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, error) { + var meta dialogflowpb.KnowledgeOperationMetadata + 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 *DeleteDocumentOperation) 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 *DeleteDocumentOperation) Name() string { + return op.lro.Name() +} + +// ReloadDocumentOperation manages a long-running operation from ReloadDocument. +type ReloadDocumentOperation struct { + lro *longrunning.Operation +} + +// ReloadDocumentOperation returns a new ReloadDocumentOperation from a given name. +// The name must be that of a previously created ReloadDocumentOperation, possibly from a different process. +func (c *DocumentsClient) ReloadDocumentOperation(name string) *ReloadDocumentOperation { + return &ReloadDocumentOperation{ + 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 *ReloadDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, 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 *ReloadDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + 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 *ReloadDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, error) { + var meta dialogflowpb.KnowledgeOperationMetadata + 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 *ReloadDocumentOperation) 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 *ReloadDocumentOperation) Name() string { + return op.lro.Name() +} + +// UpdateDocumentOperation manages a long-running operation from UpdateDocument. +type UpdateDocumentOperation struct { + lro *longrunning.Operation +} + +// UpdateDocumentOperation returns a new UpdateDocumentOperation from a given name. +// The name must be that of a previously created UpdateDocumentOperation, possibly from a different process. +func (c *DocumentsClient) UpdateDocumentOperation(name string) *UpdateDocumentOperation { + return &UpdateDocumentOperation{ + 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 *UpdateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, 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 *UpdateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + 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 *UpdateDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, error) { + var meta dialogflowpb.KnowledgeOperationMetadata + 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 *UpdateDocumentOperation) 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 *UpdateDocumentOperation) Name() string { + return op.lro.Name() +} + +// DocumentIterator manages a stream of *dialogflowpb.Document. +type DocumentIterator struct { + items []*dialogflowpb.Document + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.Document, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DocumentIterator) 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 *DocumentIterator) Next() (*dialogflowpb.Document, error) { + var item *dialogflowpb.Document + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DocumentIterator) bufLen() int { + return len(it.items) +} + +func (it *DocumentIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dialogflow/apiv2/documents_client_example_test.go b/dialogflow/apiv2/documents_client_example_test.go new file mode 100644 index 00000000000..0a31650a548 --- /dev/null +++ b/dialogflow/apiv2/documents_client_example_test.go @@ -0,0 +1,180 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewDocumentsClient() { + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleDocumentsClient_ListDocuments() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListDocumentsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDocuments(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleDocumentsClient_GetDocument() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetDocumentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDocumentsClient_CreateDocument() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateDocumentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDocumentsClient_DeleteDocument() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteDocumentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleDocumentsClient_UpdateDocument() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateDocumentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDocumentsClient_ReloadDocument() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ReloadDocumentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ReloadDocument(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/dialogflow/apiv2/gapic_metadata.json b/dialogflow/apiv2/gapic_metadata.json index 3359b6dcc6d..d0e7d9a1669 100644 --- a/dialogflow/apiv2/gapic_metadata.json +++ b/dialogflow/apiv2/gapic_metadata.json @@ -59,6 +59,25 @@ } } }, + "AnswerRecords": { + "clients": { + "grpc": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "ListAnswerRecords": { + "methods": [ + "ListAnswerRecords" + ] + }, + "UpdateAnswerRecord": { + "methods": [ + "UpdateAnswerRecord" + ] + } + } + } + } + }, "Contexts": { "clients": { "grpc": { @@ -98,6 +117,128 @@ } } }, + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "CreateConversationProfile": { + "methods": [ + "CreateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "DeleteConversationProfile" + ] + }, + "GetConversationProfile": { + "methods": [ + "GetConversationProfile" + ] + }, + "ListConversationProfiles": { + "methods": [ + "ListConversationProfiles" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "UpdateConversationProfile" + ] + } + } + } + } + }, + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CompleteConversation": { + "methods": [ + "CompleteConversation" + ] + }, + "CreateCallMatcher": { + "methods": [ + "CreateCallMatcher" + ] + }, + "CreateConversation": { + "methods": [ + "CreateConversation" + ] + }, + "DeleteCallMatcher": { + "methods": [ + "DeleteCallMatcher" + ] + }, + "GetConversation": { + "methods": [ + "GetConversation" + ] + }, + "ListCallMatchers": { + "methods": [ + "ListCallMatchers" + ] + }, + "ListConversations": { + "methods": [ + "ListConversations" + ] + }, + "ListMessages": { + "methods": [ + "ListMessages" + ] + } + } + } + } + }, + "Documents": { + "clients": { + "grpc": { + "libraryClient": "DocumentsClient", + "rpcs": { + "CreateDocument": { + "methods": [ + "CreateDocument" + ] + }, + "DeleteDocument": { + "methods": [ + "DeleteDocument" + ] + }, + "GetDocument": { + "methods": [ + "GetDocument" + ] + }, + "ListDocuments": { + "methods": [ + "ListDocuments" + ] + }, + "ReloadDocument": { + "methods": [ + "ReloadDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "UpdateDocument" + ] + } + } + } + } + }, "EntityTypes": { "clients": { "grpc": { @@ -215,6 +356,89 @@ } } }, + "KnowledgeBases": { + "clients": { + "grpc": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": { + "CreateKnowledgeBase": { + "methods": [ + "CreateKnowledgeBase" + ] + }, + "DeleteKnowledgeBase": { + "methods": [ + "DeleteKnowledgeBase" + ] + }, + "GetKnowledgeBase": { + "methods": [ + "GetKnowledgeBase" + ] + }, + "ListKnowledgeBases": { + "methods": [ + "ListKnowledgeBases" + ] + }, + "UpdateKnowledgeBase": { + "methods": [ + "UpdateKnowledgeBase" + ] + } + } + } + } + }, + "Participants": { + "clients": { + "grpc": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "AnalyzeContent": { + "methods": [ + "AnalyzeContent" + ] + }, + "CreateParticipant": { + "methods": [ + "CreateParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "GetParticipant" + ] + }, + "ListParticipants": { + "methods": [ + "ListParticipants" + ] + }, + "StreamingAnalyzeContent": { + "methods": [ + "StreamingAnalyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "SuggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "SuggestFaqAnswers" + ] + }, + "UpdateParticipant": { + "methods": [ + "UpdateParticipant" + ] + } + } + } + } + }, "SessionEntityTypes": { "clients": { "grpc": { diff --git a/dialogflow/apiv2/knowledge_bases_client.go b/dialogflow/apiv2/knowledge_bases_client.go new file mode 100644 index 00000000000..7f5b5ef0e95 --- /dev/null +++ b/dialogflow/apiv2/knowledge_bases_client.go @@ -0,0 +1,368 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newKnowledgeBasesClientHook clientHook + +// KnowledgeBasesCallOptions contains the retry settings for each method of KnowledgeBasesClient. +type KnowledgeBasesCallOptions struct { + ListKnowledgeBases []gax.CallOption + GetKnowledgeBase []gax.CallOption + CreateKnowledgeBase []gax.CallOption + DeleteKnowledgeBase []gax.CallOption + UpdateKnowledgeBase []gax.CallOption +} + +func defaultKnowledgeBasesClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultKnowledgeBasesCallOptions() *KnowledgeBasesCallOptions { + return &KnowledgeBasesCallOptions{ + ListKnowledgeBases: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetKnowledgeBase: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateKnowledgeBase: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteKnowledgeBase: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateKnowledgeBase: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// KnowledgeBasesClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type KnowledgeBasesClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + knowledgeBasesClient dialogflowpb.KnowledgeBasesClient + + // The call options for this service. + CallOptions *KnowledgeBasesCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewKnowledgeBasesClient creates a new knowledge bases client. +// +// Service for managing KnowledgeBases. +func NewKnowledgeBasesClient(ctx context.Context, opts ...option.ClientOption) (*KnowledgeBasesClient, error) { + clientOpts := defaultKnowledgeBasesClientOptions() + + if newKnowledgeBasesClientHook != nil { + hookOpts, err := newKnowledgeBasesClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &KnowledgeBasesClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultKnowledgeBasesCallOptions(), + + knowledgeBasesClient: dialogflowpb.NewKnowledgeBasesClient(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *KnowledgeBasesClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *KnowledgeBasesClient) Close() error { + return c.connPool.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 *KnowledgeBasesClient) 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...)) +} + +// ListKnowledgeBases returns the list of all knowledge bases of the specified agent. +func (c *KnowledgeBasesClient) ListKnowledgeBases(ctx context.Context, req *dialogflowpb.ListKnowledgeBasesRequest, opts ...gax.CallOption) *KnowledgeBaseIterator { + 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.ListKnowledgeBases[0:len(c.CallOptions.ListKnowledgeBases):len(c.CallOptions.ListKnowledgeBases)], opts...) + it := &KnowledgeBaseIterator{} + req = proto.Clone(req).(*dialogflowpb.ListKnowledgeBasesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.KnowledgeBase, string, error) { + var resp *dialogflowpb.ListKnowledgeBasesResponse + 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.knowledgeBasesClient.ListKnowledgeBases(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetKnowledgeBases(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetKnowledgeBase retrieves the specified knowledge base. +func (c *KnowledgeBasesClient) GetKnowledgeBase(ctx context.Context, req *dialogflowpb.GetKnowledgeBaseRequest, opts ...gax.CallOption) (*dialogflowpb.KnowledgeBase, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetKnowledgeBase[0:len(c.CallOptions.GetKnowledgeBase):len(c.CallOptions.GetKnowledgeBase)], opts...) + var resp *dialogflowpb.KnowledgeBase + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.knowledgeBasesClient.GetKnowledgeBase(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateKnowledgeBase creates a knowledge base. +func (c *KnowledgeBasesClient) CreateKnowledgeBase(ctx context.Context, req *dialogflowpb.CreateKnowledgeBaseRequest, opts ...gax.CallOption) (*dialogflowpb.KnowledgeBase, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateKnowledgeBase[0:len(c.CallOptions.CreateKnowledgeBase):len(c.CallOptions.CreateKnowledgeBase)], opts...) + var resp *dialogflowpb.KnowledgeBase + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.knowledgeBasesClient.CreateKnowledgeBase(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteKnowledgeBase deletes the specified knowledge base. +func (c *KnowledgeBasesClient) DeleteKnowledgeBase(ctx context.Context, req *dialogflowpb.DeleteKnowledgeBaseRequest, opts ...gax.CallOption) error { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteKnowledgeBase[0:len(c.CallOptions.DeleteKnowledgeBase):len(c.CallOptions.DeleteKnowledgeBase)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.knowledgeBasesClient.DeleteKnowledgeBase(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// UpdateKnowledgeBase updates the specified knowledge base. +func (c *KnowledgeBasesClient) UpdateKnowledgeBase(ctx context.Context, req *dialogflowpb.UpdateKnowledgeBaseRequest, opts ...gax.CallOption) (*dialogflowpb.KnowledgeBase, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "knowledge_base.name", url.QueryEscape(req.GetKnowledgeBase().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateKnowledgeBase[0:len(c.CallOptions.UpdateKnowledgeBase):len(c.CallOptions.UpdateKnowledgeBase)], opts...) + var resp *dialogflowpb.KnowledgeBase + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.knowledgeBasesClient.UpdateKnowledgeBase(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// KnowledgeBaseIterator manages a stream of *dialogflowpb.KnowledgeBase. +type KnowledgeBaseIterator struct { + items []*dialogflowpb.KnowledgeBase + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.KnowledgeBase, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *KnowledgeBaseIterator) 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 *KnowledgeBaseIterator) Next() (*dialogflowpb.KnowledgeBase, error) { + var item *dialogflowpb.KnowledgeBase + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *KnowledgeBaseIterator) bufLen() int { + return len(it.items) +} + +func (it *KnowledgeBaseIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dialogflow/apiv2/knowledge_bases_client_example_test.go b/dialogflow/apiv2/knowledge_bases_client_example_test.go new file mode 100644 index 00000000000..2f8fabe8b41 --- /dev/null +++ b/dialogflow/apiv2/knowledge_bases_client_example_test.go @@ -0,0 +1,138 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewKnowledgeBasesClient() { + ctx := context.Background() + c, err := dialogflow.NewKnowledgeBasesClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleKnowledgeBasesClient_ListKnowledgeBases() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewKnowledgeBasesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListKnowledgeBasesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListKnowledgeBases(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleKnowledgeBasesClient_GetKnowledgeBase() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewKnowledgeBasesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetKnowledgeBaseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetKnowledgeBase(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKnowledgeBasesClient_CreateKnowledgeBase() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewKnowledgeBasesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateKnowledgeBaseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateKnowledgeBase(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKnowledgeBasesClient_DeleteKnowledgeBase() { + ctx := context.Background() + c, err := dialogflow.NewKnowledgeBasesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteKnowledgeBaseRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteKnowledgeBase(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleKnowledgeBasesClient_UpdateKnowledgeBase() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewKnowledgeBasesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateKnowledgeBaseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateKnowledgeBase(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dialogflow/apiv2/participants_client.go b/dialogflow/apiv2/participants_client.go new file mode 100644 index 00000000000..44f54515997 --- /dev/null +++ b/dialogflow/apiv2/participants_client.go @@ -0,0 +1,479 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newParticipantsClientHook clientHook + +// ParticipantsCallOptions contains the retry settings for each method of ParticipantsClient. +type ParticipantsCallOptions struct { + CreateParticipant []gax.CallOption + GetParticipant []gax.CallOption + ListParticipants []gax.CallOption + UpdateParticipant []gax.CallOption + AnalyzeContent []gax.CallOption + StreamingAnalyzeContent []gax.CallOption + SuggestArticles []gax.CallOption + SuggestFaqAnswers []gax.CallOption +} + +func defaultParticipantsClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultParticipantsCallOptions() *ParticipantsCallOptions { + return &ParticipantsCallOptions{ + CreateParticipant: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetParticipant: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListParticipants: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateParticipant: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + AnalyzeContent: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + StreamingAnalyzeContent: []gax.CallOption{}, + SuggestArticles: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + SuggestFaqAnswers: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// ParticipantsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ParticipantsClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + participantsClient dialogflowpb.ParticipantsClient + + // The call options for this service. + CallOptions *ParticipantsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewParticipantsClient creates a new participants client. +// +// Service for managing Participants. +func NewParticipantsClient(ctx context.Context, opts ...option.ClientOption) (*ParticipantsClient, error) { + clientOpts := defaultParticipantsClientOptions() + + if newParticipantsClientHook != nil { + hookOpts, err := newParticipantsClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &ParticipantsClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultParticipantsCallOptions(), + + participantsClient: dialogflowpb.NewParticipantsClient(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ParticipantsClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ParticipantsClient) Close() error { + return c.connPool.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 *ParticipantsClient) 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...)) +} + +// CreateParticipant creates a new participant in a conversation. +func (c *ParticipantsClient) CreateParticipant(ctx context.Context, req *dialogflowpb.CreateParticipantRequest, opts ...gax.CallOption) (*dialogflowpb.Participant, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateParticipant[0:len(c.CallOptions.CreateParticipant):len(c.CallOptions.CreateParticipant)], opts...) + var resp *dialogflowpb.Participant + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.CreateParticipant(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetParticipant retrieves a conversation participant. +func (c *ParticipantsClient) GetParticipant(ctx context.Context, req *dialogflowpb.GetParticipantRequest, opts ...gax.CallOption) (*dialogflowpb.Participant, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetParticipant[0:len(c.CallOptions.GetParticipant):len(c.CallOptions.GetParticipant)], opts...) + var resp *dialogflowpb.Participant + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.GetParticipant(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListParticipants returns the list of all participants in the specified conversation. +func (c *ParticipantsClient) ListParticipants(ctx context.Context, req *dialogflowpb.ListParticipantsRequest, opts ...gax.CallOption) *ParticipantIterator { + 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.ListParticipants[0:len(c.CallOptions.ListParticipants):len(c.CallOptions.ListParticipants)], opts...) + it := &ParticipantIterator{} + req = proto.Clone(req).(*dialogflowpb.ListParticipantsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Participant, string, error) { + var resp *dialogflowpb.ListParticipantsResponse + 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.participantsClient.ListParticipants(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetParticipants(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// UpdateParticipant updates the specified participant. +func (c *ParticipantsClient) UpdateParticipant(ctx context.Context, req *dialogflowpb.UpdateParticipantRequest, opts ...gax.CallOption) (*dialogflowpb.Participant, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "participant.name", url.QueryEscape(req.GetParticipant().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateParticipant[0:len(c.CallOptions.UpdateParticipant):len(c.CallOptions.UpdateParticipant)], opts...) + var resp *dialogflowpb.Participant + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.UpdateParticipant(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeContent adds a text (chat, for example), or audio (phone recording, for example) +// message from a participant into the conversation. +// +// Note: Always use agent versions for production traffic +// sent to virtual agents. See [Versions and +// environments(https://cloud.google.com/dialogflow/es/docs/agents-versions (at https://cloud.google.com/dialogflow/es/docs/agents-versions)). +func (c *ParticipantsClient) AnalyzeContent(ctx context.Context, req *dialogflowpb.AnalyzeContentRequest, opts ...gax.CallOption) (*dialogflowpb.AnalyzeContentResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 220000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "participant", url.QueryEscape(req.GetParticipant()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.AnalyzeContent[0:len(c.CallOptions.AnalyzeContent):len(c.CallOptions.AnalyzeContent)], opts...) + var resp *dialogflowpb.AnalyzeContentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.AnalyzeContent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// StreamingAnalyzeContent adds a text (chat, for example), or audio (phone recording, for example) +// message from a participant into the conversation. +// Note: This method is only available through the gRPC API (not REST). +// +// The top-level message sent to the client by the server is +// StreamingAnalyzeContentResponse. Multiple response messages can be +// returned in order. The first one or more messages contain the +// recognition_result field. Each result represents a more complete +// transcript of what the user said. The next message contains the +// reply_text field and potentially the reply_audio field. The message can +// also contain the automated_agent_reply field. +// +// Note: Always use agent versions for production traffic +// sent to virtual agents. See [Versions and +// environments(https://cloud.google.com/dialogflow/es/docs/agents-versions (at https://cloud.google.com/dialogflow/es/docs/agents-versions)). +func (c *ParticipantsClient) StreamingAnalyzeContent(ctx context.Context, opts ...gax.CallOption) (dialogflowpb.Participants_StreamingAnalyzeContentClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StreamingAnalyzeContent[0:len(c.CallOptions.StreamingAnalyzeContent):len(c.CallOptions.StreamingAnalyzeContent)], opts...) + var resp dialogflowpb.Participants_StreamingAnalyzeContentClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.StreamingAnalyzeContent(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SuggestArticles gets suggested articles for a participant based on specific historical +// messages. +func (c *ParticipantsClient) SuggestArticles(ctx context.Context, req *dialogflowpb.SuggestArticlesRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestArticlesResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.SuggestArticles[0:len(c.CallOptions.SuggestArticles):len(c.CallOptions.SuggestArticles)], opts...) + var resp *dialogflowpb.SuggestArticlesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.SuggestArticles(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SuggestFaqAnswers gets suggested faq answers for a participant based on specific historical +// messages. +func (c *ParticipantsClient) SuggestFaqAnswers(ctx context.Context, req *dialogflowpb.SuggestFaqAnswersRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestFaqAnswersResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.SuggestFaqAnswers[0:len(c.CallOptions.SuggestFaqAnswers):len(c.CallOptions.SuggestFaqAnswers)], opts...) + var resp *dialogflowpb.SuggestFaqAnswersResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.participantsClient.SuggestFaqAnswers(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ParticipantIterator manages a stream of *dialogflowpb.Participant. +type ParticipantIterator struct { + items []*dialogflowpb.Participant + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*dialogflowpb.Participant, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ParticipantIterator) 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 *ParticipantIterator) Next() (*dialogflowpb.Participant, error) { + var item *dialogflowpb.Participant + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ParticipantIterator) bufLen() int { + return len(it.items) +} + +func (it *ParticipantIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dialogflow/apiv2/participants_client_example_test.go b/dialogflow/apiv2/participants_client_example_test.go new file mode 100644 index 00000000000..1748f8b15b0 --- /dev/null +++ b/dialogflow/apiv2/participants_client_example_test.go @@ -0,0 +1,219 @@ +// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + "io" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewParticipantsClient() { + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleParticipantsClient_CreateParticipant() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateParticipantRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateParticipant(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleParticipantsClient_GetParticipant() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetParticipantRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetParticipant(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleParticipantsClient_ListParticipants() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListParticipantsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListParticipants(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleParticipantsClient_UpdateParticipant() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateParticipantRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateParticipant(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleParticipantsClient_AnalyzeContent() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.AnalyzeContentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeContent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleParticipantsClient_StreamingAnalyzeContent() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.StreamingAnalyzeContent(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*dialogflowpb.StreamingAnalyzeContentRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleParticipantsClient_SuggestArticles() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.SuggestArticlesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SuggestArticles(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleParticipantsClient_SuggestFaqAnswers() { + // import dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + + ctx := context.Background() + c, err := dialogflow.NewParticipantsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.SuggestFaqAnswersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SuggestFaqAnswers(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index 7462c26bdca..d8b2493665d 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index 6f6acdd3e21..1f4f98eb36f 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/documentai/apiv1beta3/doc.go b/documentai/apiv1beta3/doc.go index 5391990cdba..cc8373647d3 100644 --- a/documentai/apiv1beta3/doc.go +++ b/documentai/apiv1beta3/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/domains/apiv1beta1/doc.go b/domains/apiv1beta1/doc.go index 447999b007c..f307963e88e 100644 --- a/domains/apiv1beta1/doc.go +++ b/domains/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go index 24370dfc006..45e08ed0ed5 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go index df1d945e54a..1bb00a71891 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/doc.go b/firestore/apiv1/doc.go index 0409f497dc6..ac73ad0bfb2 100644 --- a/firestore/apiv1/doc.go +++ b/firestore/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/go.mod b/firestore/go.mod index e6a82a30b7a..fe75e85a603 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -8,6 +8,6 @@ require ( github.com/google/go-cmp v0.5.5 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/firestore/go.sum b/firestore/go.sum index 2f67e19579d..2371d76521f 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -400,8 +400,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go index d56dde4359a..5618df403a3 100644 --- a/functions/apiv1/doc.go +++ b/functions/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1/doc.go b/gaming/apiv1/doc.go index c9139d949bb..694ae50fa0f 100644 --- a/gaming/apiv1/doc.go +++ b/gaming/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1beta/doc.go b/gaming/apiv1beta/doc.go index 8f92784a640..072ebe283fc 100644 --- a/gaming/apiv1beta/doc.go +++ b/gaming/apiv1beta/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gkehub/apiv1beta1/doc.go b/gkehub/apiv1beta1/doc.go index 3d560fb223a..606161eee24 100644 --- a/gkehub/apiv1beta1/doc.go +++ b/gkehub/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/go.mod b/go.mod index e93a60410a5..ba641a0f177 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,6 @@ require ( golang.org/x/text v0.3.5 golang.org/x/tools v0.1.0 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/go.sum b/go.sum index a49eae7d613..a2ae9688aa4 100644 --- a/go.sum +++ b/go.sum @@ -408,8 +408,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 125c74af46e..72f4d9e1606 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index 34a1a901e90..ad2515c94cb 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -975,14 +975,6 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/texttospeech/apiv1", "release_level": "ga" }, - "cloud.google.com/go/trace": { - "distribution_name": "cloud.google.com/go/trace", - "description": "Stackdriver Trace", - "language": "Go", - "client_library_type": "manual", - "docs_url": "https://pkg.go.dev/cloud.google.com/go/trace", - "release_level": "ga" - }, "cloud.google.com/go/trace/apiv1": { "distribution_name": "cloud.google.com/go/trace/apiv1", "description": "Stackdriver Trace API", diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod index baeed7cf20e..bfd43261ae0 100644 --- a/internal/examples/fake/go.mod +++ b/internal/examples/fake/go.mod @@ -5,6 +5,6 @@ go 1.15 require ( cloud.google.com/go v0.78.0 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum index 1cd25e69104..264a8c60943 100644 --- a/internal/examples/fake/go.sum +++ b/internal/examples/fake/go.sum @@ -396,8 +396,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod index 09b5d60abe9..a0a5710cec9 100644 --- a/internal/examples/mock/go.mod +++ b/internal/examples/mock/go.mod @@ -10,6 +10,6 @@ require ( golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b // indirect golang.org/x/text v0.3.5 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 // indirect ) diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum index bf76ef9e612..0214970347d 100644 --- a/internal/examples/mock/go.sum +++ b/internal/examples/mock/go.sum @@ -74,8 +74,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index b587be35613..e5d4c86a548 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -285,8 +285,9 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200827165113-ac2560b5e952/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index dbdcc6e5df9..5eff5b0c421 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index 06f0bfd7392..09564d12936 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index 445eb3b5696..9ef32d6a0fb 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index 486f905bb47..d002c8801e0 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index 4b2adaa61cc..2148a651ee2 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/go.mod b/logging/go.mod index b690c9f1482..bdc296aa699 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -11,6 +11,6 @@ require ( go.opencensus.io v0.23.0 golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/logging/go.sum b/logging/go.sum index 4a8bd29aded..5058b2fc148 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -404,8 +404,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index d4e95172a61..8c4699b27e4 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/managedidentities/apiv1/doc.go b/managedidentities/apiv1/doc.go index 535a4865a43..53652da6956 100644 --- a/managedidentities/apiv1/doc.go +++ b/managedidentities/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/mediatranslation/apiv1beta1/doc.go b/mediatranslation/apiv1beta1/doc.go index 3ef2d3369f5..2fd68a86601 100644 --- a/mediatranslation/apiv1beta1/doc.go +++ b/mediatranslation/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/memcache/apiv1/doc.go b/memcache/apiv1/doc.go index f67d8e5bb8b..a376fa93b0a 100644 --- a/memcache/apiv1/doc.go +++ b/memcache/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/memcache/apiv1beta2/doc.go b/memcache/apiv1beta2/doc.go index 243730062ab..a35f4b3c6bc 100644 --- a/memcache/apiv1beta2/doc.go +++ b/memcache/apiv1beta2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1alpha/dataproc_metastore_client.go b/metastore/apiv1alpha/dataproc_metastore_client.go index 3ee46e45790..7c27e3488e6 100644 --- a/metastore/apiv1alpha/dataproc_metastore_client.go +++ b/metastore/apiv1alpha/dataproc_metastore_client.go @@ -51,6 +51,12 @@ type DataprocMetastoreCallOptions struct { GetMetadataImport []gax.CallOption CreateMetadataImport []gax.CallOption UpdateMetadataImport []gax.CallOption + ExportMetadata []gax.CallOption + RestoreService []gax.CallOption + ListBackups []gax.CallOption + GetBackup []gax.CallOption + CreateBackup []gax.CallOption + DeleteBackup []gax.CallOption } func defaultDataprocMetastoreClientOptions() []option.ClientOption { @@ -116,6 +122,32 @@ func defaultDataprocMetastoreCallOptions() *DataprocMetastoreCallOptions { }, CreateMetadataImport: []gax.CallOption{}, UpdateMetadataImport: []gax.CallOption{}, + ExportMetadata: []gax.CallOption{}, + RestoreService: []gax.CallOption{}, + ListBackups: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetBackup: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateBackup: []gax.CallOption{}, + DeleteBackup: []gax.CallOption{}, } } @@ -165,7 +197,7 @@ type DataprocMetastoreClient struct { // // Dataproc Metastore services are resources with names of the form: // -// /projects/{project_id}/locations/{location_id}/services/{service_id}. +// /projects/{project_number}/locations/{location_id}/services/{service_id}. func NewDataprocMetastoreClient(ctx context.Context, opts ...option.ClientOption) (*DataprocMetastoreClient, error) { clientOpts := defaultDataprocMetastoreClientOptions() @@ -477,6 +509,234 @@ func (c *DataprocMetastoreClient) UpdateMetadataImport(ctx context.Context, req }, nil } +// ExportMetadata exports metadata from a service. +func (c *DataprocMetastoreClient) ExportMetadata(ctx context.Context, req *metastorepb.ExportMetadataRequest, opts ...gax.CallOption) (*ExportMetadataOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "service", url.QueryEscape(req.GetService()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ExportMetadata[0:len(c.CallOptions.ExportMetadata):len(c.CallOptions.ExportMetadata)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.dataprocMetastoreClient.ExportMetadata(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportMetadataOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// RestoreService restores a service from a backup. +func (c *DataprocMetastoreClient) RestoreService(ctx context.Context, req *metastorepb.RestoreServiceRequest, opts ...gax.CallOption) (*RestoreServiceOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "service", url.QueryEscape(req.GetService()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RestoreService[0:len(c.CallOptions.RestoreService):len(c.CallOptions.RestoreService)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.dataprocMetastoreClient.RestoreService(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RestoreServiceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ListBackups lists backups in a service. +func (c *DataprocMetastoreClient) ListBackups(ctx context.Context, req *metastorepb.ListBackupsRequest, opts ...gax.CallOption) *BackupIterator { + 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.ListBackups[0:len(c.CallOptions.ListBackups):len(c.CallOptions.ListBackups)], opts...) + it := &BackupIterator{} + req = proto.Clone(req).(*metastorepb.ListBackupsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*metastorepb.Backup, string, error) { + var resp *metastorepb.ListBackupsResponse + 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.dataprocMetastoreClient.ListBackups(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetBackups(), resp.GetNextPageToken(), 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.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetBackup gets details of a single backup. +func (c *DataprocMetastoreClient) GetBackup(ctx context.Context, req *metastorepb.GetBackupRequest, opts ...gax.CallOption) (*metastorepb.Backup, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetBackup[0:len(c.CallOptions.GetBackup):len(c.CallOptions.GetBackup)], opts...) + var resp *metastorepb.Backup + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.dataprocMetastoreClient.GetBackup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateBackup creates a new Backup in a given project and location. +func (c *DataprocMetastoreClient) CreateBackup(ctx context.Context, req *metastorepb.CreateBackupRequest, opts ...gax.CallOption) (*CreateBackupOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + 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.CreateBackup[0:len(c.CallOptions.CreateBackup):len(c.CallOptions.CreateBackup)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.dataprocMetastoreClient.CreateBackup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateBackupOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteBackup deletes a single backup. +func (c *DataprocMetastoreClient) DeleteBackup(ctx context.Context, req *metastorepb.DeleteBackupRequest, opts ...gax.CallOption) (*DeleteBackupOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteBackup[0:len(c.CallOptions.DeleteBackup):len(c.CallOptions.DeleteBackup)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.dataprocMetastoreClient.DeleteBackup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteBackupOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// CreateBackupOperation manages a long-running operation from CreateBackup. +type CreateBackupOperation struct { + lro *longrunning.Operation +} + +// CreateBackupOperation returns a new CreateBackupOperation from a given name. +// The name must be that of a previously created CreateBackupOperation, possibly from a different process. +func (c *DataprocMetastoreClient) CreateBackupOperation(name string) *CreateBackupOperation { + return &CreateBackupOperation{ + 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 *CreateBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Backup, error) { + var resp metastorepb.Backup + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, 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 *CreateBackupOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Backup, error) { + var resp metastorepb.Backup + 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 *CreateBackupOperation) Metadata() (*metastorepb.OperationMetadata, error) { + var meta metastorepb.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 *CreateBackupOperation) 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 *CreateBackupOperation) Name() string { + return op.lro.Name() +} + // CreateMetadataImportOperation manages a long-running operation from CreateMetadataImport. type CreateMetadataImportOperation struct { lro *longrunning.Operation @@ -615,6 +875,64 @@ func (op *CreateServiceOperation) Name() string { return op.lro.Name() } +// DeleteBackupOperation manages a long-running operation from DeleteBackup. +type DeleteBackupOperation struct { + lro *longrunning.Operation +} + +// DeleteBackupOperation returns a new DeleteBackupOperation from a given name. +// The name must be that of a previously created DeleteBackupOperation, possibly from a different process. +func (c *DataprocMetastoreClient) DeleteBackupOperation(name string) *DeleteBackupOperation { + return &DeleteBackupOperation{ + 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 *DeleteBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, 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, 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 *DeleteBackupOperation) 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 *DeleteBackupOperation) Metadata() (*metastorepb.OperationMetadata, error) { + var meta metastorepb.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 *DeleteBackupOperation) 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 *DeleteBackupOperation) Name() string { + return op.lro.Name() +} + // DeleteServiceOperation manages a long-running operation from DeleteService. type DeleteServiceOperation struct { lro *longrunning.Operation @@ -673,6 +991,144 @@ func (op *DeleteServiceOperation) Name() string { return op.lro.Name() } +// ExportMetadataOperation manages a long-running operation from ExportMetadata. +type ExportMetadataOperation struct { + lro *longrunning.Operation +} + +// ExportMetadataOperation returns a new ExportMetadataOperation from a given name. +// The name must be that of a previously created ExportMetadataOperation, possibly from a different process. +func (c *DataprocMetastoreClient) ExportMetadataOperation(name string) *ExportMetadataOperation { + return &ExportMetadataOperation{ + 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 *ExportMetadataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataExport, error) { + var resp metastorepb.MetadataExport + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, 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 *ExportMetadataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataExport, error) { + var resp metastorepb.MetadataExport + 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 *ExportMetadataOperation) Metadata() (*metastorepb.OperationMetadata, error) { + var meta metastorepb.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 *ExportMetadataOperation) 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 *ExportMetadataOperation) Name() string { + return op.lro.Name() +} + +// RestoreServiceOperation manages a long-running operation from RestoreService. +type RestoreServiceOperation struct { + lro *longrunning.Operation +} + +// RestoreServiceOperation returns a new RestoreServiceOperation from a given name. +// The name must be that of a previously created RestoreServiceOperation, possibly from a different process. +func (c *DataprocMetastoreClient) RestoreServiceOperation(name string) *RestoreServiceOperation { + return &RestoreServiceOperation{ + 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 *RestoreServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Restore, error) { + var resp metastorepb.Restore + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, 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 *RestoreServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Restore, error) { + var resp metastorepb.Restore + 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 *RestoreServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) { + var meta metastorepb.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 *RestoreServiceOperation) 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 *RestoreServiceOperation) Name() string { + return op.lro.Name() +} + // UpdateMetadataImportOperation manages a long-running operation from UpdateMetadataImport. type UpdateMetadataImportOperation struct { lro *longrunning.Operation @@ -811,6 +1267,53 @@ func (op *UpdateServiceOperation) Name() string { return op.lro.Name() } +// BackupIterator manages a stream of *metastorepb.Backup. +type BackupIterator struct { + items []*metastorepb.Backup + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // 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 []*metastorepb.Backup, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *BackupIterator) 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 *BackupIterator) Next() (*metastorepb.Backup, error) { + var item *metastorepb.Backup + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *BackupIterator) bufLen() int { + return len(it.items) +} + +func (it *BackupIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // MetadataImportIterator manages a stream of *metastorepb.MetadataImport. type MetadataImportIterator struct { items []*metastorepb.MetadataImport diff --git a/metastore/apiv1alpha/dataproc_metastore_client_example_test.go b/metastore/apiv1alpha/dataproc_metastore_client_example_test.go index 8d82522150c..c29a1be9df4 100644 --- a/metastore/apiv1alpha/dataproc_metastore_client_example_test.go +++ b/metastore/apiv1alpha/dataproc_metastore_client_example_test.go @@ -250,3 +250,148 @@ func ExampleDataprocMetastoreClient_UpdateMetadataImport() { // TODO: Use resp. _ = resp } + +func ExampleDataprocMetastoreClient_ExportMetadata() { + // import metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha" + + ctx := context.Background() + c, err := metastore.NewDataprocMetastoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &metastorepb.ExportMetadataRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ExportMetadata(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDataprocMetastoreClient_RestoreService() { + // import metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha" + + ctx := context.Background() + c, err := metastore.NewDataprocMetastoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &metastorepb.RestoreServiceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RestoreService(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDataprocMetastoreClient_ListBackups() { + // import metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := metastore.NewDataprocMetastoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &metastorepb.ListBackupsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListBackups(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleDataprocMetastoreClient_GetBackup() { + // import metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha" + + ctx := context.Background() + c, err := metastore.NewDataprocMetastoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &metastorepb.GetBackupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDataprocMetastoreClient_CreateBackup() { + // import metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha" + + ctx := context.Background() + c, err := metastore.NewDataprocMetastoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &metastorepb.CreateBackupRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDataprocMetastoreClient_DeleteBackup() { + // import metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha" + + ctx := context.Background() + c, err := metastore.NewDataprocMetastoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &metastorepb.DeleteBackupRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} diff --git a/metastore/apiv1alpha/doc.go b/metastore/apiv1alpha/doc.go index 2d90c5b6fde..83508e544f2 100644 --- a/metastore/apiv1alpha/doc.go +++ b/metastore/apiv1alpha/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1alpha/gapic_metadata.json b/metastore/apiv1alpha/gapic_metadata.json index 89b233cd1de..868989b8406 100644 --- a/metastore/apiv1alpha/gapic_metadata.json +++ b/metastore/apiv1alpha/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "DataprocMetastoreClient", "rpcs": { + "CreateBackup": { + "methods": [ + "CreateBackup" + ] + }, "CreateMetadataImport": { "methods": [ "CreateMetadataImport" @@ -20,11 +25,26 @@ "CreateService" ] }, + "DeleteBackup": { + "methods": [ + "DeleteBackup" + ] + }, "DeleteService": { "methods": [ "DeleteService" ] }, + "ExportMetadata": { + "methods": [ + "ExportMetadata" + ] + }, + "GetBackup": { + "methods": [ + "GetBackup" + ] + }, "GetMetadataImport": { "methods": [ "GetMetadataImport" @@ -35,6 +55,11 @@ "GetService" ] }, + "ListBackups": { + "methods": [ + "ListBackups" + ] + }, "ListMetadataImports": { "methods": [ "ListMetadataImports" @@ -45,6 +70,11 @@ "ListServices" ] }, + "RestoreService": { + "methods": [ + "RestoreService" + ] + }, "UpdateMetadataImport": { "methods": [ "UpdateMetadataImport" diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index 558b7437782..91579a9f020 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go index 85c240d9a77..2acb90b0fea 100644 --- a/monitoring/dashboard/apiv1/doc.go +++ b/monitoring/dashboard/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/networkconnectivity/apiv1alpha1/doc.go b/networkconnectivity/apiv1alpha1/doc.go index 212675bfd9b..5114d14f7b8 100644 --- a/networkconnectivity/apiv1alpha1/doc.go +++ b/networkconnectivity/apiv1alpha1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/notebooks/apiv1beta1/doc.go b/notebooks/apiv1beta1/doc.go index 9bbf5aba246..c3a7f1baf1c 100644 --- a/notebooks/apiv1beta1/doc.go +++ b/notebooks/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/orgpolicy/apiv2/doc.go b/orgpolicy/apiv2/doc.go index bb758cf3790..e0202381411 100644 --- a/orgpolicy/apiv2/doc.go +++ b/orgpolicy/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1/doc.go b/osconfig/agentendpoint/apiv1/doc.go index 4212ead5a53..97a52924714 100644 --- a/osconfig/agentendpoint/apiv1/doc.go +++ b/osconfig/agentendpoint/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1beta/doc.go b/osconfig/agentendpoint/apiv1beta/doc.go index 3d3e1c0e164..786345952ad 100644 --- a/osconfig/agentendpoint/apiv1beta/doc.go +++ b/osconfig/agentendpoint/apiv1beta/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1/doc.go b/osconfig/apiv1/doc.go index e030f368e19..6680594eeb7 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1beta/doc.go b/osconfig/apiv1beta/doc.go index bb2c42606fc..1af74a6e7c7 100644 --- a/osconfig/apiv1beta/doc.go +++ b/osconfig/apiv1beta/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go index f5a54bc47bc..bbc25a30b54 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go index 9f78e5715db..79b0b69698f 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go index 094a967dada..bfc14f92e72 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/policytroubleshooter/apiv1/doc.go b/policytroubleshooter/apiv1/doc.go index 5e37161df32..12b142d6c11 100644 --- a/policytroubleshooter/apiv1/doc.go +++ b/policytroubleshooter/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index b82a2ad5e85..644e1a5cf6d 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/schema_client.go b/pubsub/apiv1/schema_client.go index 2110cecd05f..20dc3fb1931 100644 --- a/pubsub/apiv1/schema_client.go +++ b/pubsub/apiv1/schema_client.go @@ -90,6 +90,7 @@ type SchemaClient struct { // NewSchemaClient creates a new schema service client. // +// Service for doing schema-related operations. func NewSchemaClient(ctx context.Context, opts ...option.ClientOption) (*SchemaClient, error) { clientOpts := defaultSchemaClientOptions() diff --git a/pubsub/go.mod b/pubsub/go.mod index d273587e759..a14ee7dff88 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -12,6 +12,6 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index 1e0ca4888c5..d70b41e5633 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -403,8 +403,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index 1b335809c7d..3d35eb236d9 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsublite/apiv1/topic_stats_client.go b/pubsublite/apiv1/topic_stats_client.go index 79c0e9666d5..12f354788a9 100644 --- a/pubsublite/apiv1/topic_stats_client.go +++ b/pubsublite/apiv1/topic_stats_client.go @@ -175,10 +175,10 @@ func (c *TopicStatsClient) ComputeMessageStats(ctx context.Context, req *pubsubl } // ComputeHeadCursor compute the head cursor for the partition. -// The head cursor’s offset is guaranteed to be before or equal to all -// messages which have not yet been acknowledged to be published, and +// The head cursor’s offset is guaranteed to be less than or equal to all +// messages which have not yet been acknowledged as published, and // greater than the offset of any message whose publish has already -// been acknowledged. It is 0 if there have never been messages on the +// been acknowledged. It is zero if there have never been messages in the // partition. func (c *TopicStatsClient) ComputeHeadCursor(ctx context.Context, req *pubsublitepb.ComputeHeadCursorRequest, opts ...gax.CallOption) (*pubsublitepb.ComputeHeadCursorResponse, error) { md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "topic", url.QueryEscape(req.GetTopic()))) diff --git a/pubsublite/go.mod b/pubsublite/go.mod index 16627420116..7ceaa1a94c1 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 google.golang.org/protobuf v1.25.0 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index e155e7fd5e0..565d8c73cf3 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -411,8 +411,9 @@ google.golang.org/genproto v0.0.0-20201209185603-f92720507ed4/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go index 3f5015057fd..64a68264536 100644 --- a/recaptchaenterprise/apiv1/doc.go +++ b/recaptchaenterprise/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go index a38e383baa5..4e7782820a6 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommendationengine/apiv1beta1/doc.go b/recommendationengine/apiv1beta1/doc.go index 71133d6db77..d3bd5ce782b 100644 --- a/recommendationengine/apiv1beta1/doc.go +++ b/recommendationengine/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1/doc.go b/recommender/apiv1/doc.go index 538dcc86073..cc014b02de8 100644 --- a/recommender/apiv1/doc.go +++ b/recommender/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go index acf8cf1ef18..348380e0fad 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go index 762ac93ff3e..7739cb99e60 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go index 0b3053cdce8..d35eaf9eb3a 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcemanager/apiv2/doc.go b/resourcemanager/apiv2/doc.go index cfb7a7c6379..4dbcc1605e0 100644 --- a/resourcemanager/apiv2/doc.go +++ b/resourcemanager/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/retail/apiv2/doc.go b/retail/apiv2/doc.go index 8b547b21693..8205794789c 100644 --- a/retail/apiv2/doc.go +++ b/retail/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go index e1b004e857d..b3ca5e47610 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go index 84b063f872f..76b572330ec 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1/doc.go b/secretmanager/apiv1/doc.go index 35f4a1a43b7..11bb57e0b2a 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1beta1/doc.go b/secretmanager/apiv1beta1/doc.go index 772f8646563..56c23deb40c 100644 --- a/secretmanager/apiv1beta1/doc.go +++ b/secretmanager/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/security/privateca/apiv1beta1/doc.go b/security/privateca/apiv1beta1/doc.go index 81a4faf75ac..cf305f94692 100644 --- a/security/privateca/apiv1beta1/doc.go +++ b/security/privateca/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index f1a7f2ced8f..70f99ddbf95 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go index b69277cc7f3..8f14c99228f 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1p1beta1/doc.go b/securitycenter/apiv1p1beta1/doc.go index cc74f99515b..db553b836ab 100644 --- a/securitycenter/apiv1p1beta1/doc.go +++ b/securitycenter/apiv1p1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/settings/apiv1beta1/doc.go b/securitycenter/settings/apiv1beta1/doc.go index 148abaa6b5d..84f3694404e 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicecontrol/apiv1/doc.go b/servicecontrol/apiv1/doc.go index 2a0df5a44ef..b0a5da8c703 100644 --- a/servicecontrol/apiv1/doc.go +++ b/servicecontrol/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1/doc.go b/servicedirectory/apiv1/doc.go index e634cbaa075..d411ddea90c 100644 --- a/servicedirectory/apiv1/doc.go +++ b/servicedirectory/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1beta1/doc.go b/servicedirectory/apiv1beta1/doc.go index d91ff5e3aeb..5fbbf253431 100644 --- a/servicedirectory/apiv1beta1/doc.go +++ b/servicedirectory/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicemanagement/apiv1/doc.go b/servicemanagement/apiv1/doc.go index 4f9148c6e05..b279d2f22ab 100644 --- a/servicemanagement/apiv1/doc.go +++ b/servicemanagement/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index 09d31f65c00..ebfda63197e 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go index d9e55b76d6c..121efd5b448 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go index a4c9b65ae5c..8bf7d087db8 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/go.mod b/spanner/go.mod index fbbce689327..06f79d8b8dc 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -10,7 +10,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 google.golang.org/protobuf v1.25.0 ) diff --git a/spanner/go.sum b/spanner/go.sum index 2f67e19579d..2371d76521f 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -400,8 +400,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index a0dfece0f23..b7f55a5fb22 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index 8ca697b2a54..38a366456bb 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/storage/go.mod b/storage/go.mod index 73896d42f05..b4ba9843eee 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -9,6 +9,6 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93 google.golang.org/api v0.41.0 - google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb + google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d google.golang.org/grpc v1.36.0 ) diff --git a/storage/go.sum b/storage/go.sum index d6697a723ce..804cafb33af 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -402,8 +402,9 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb h1:hcskBH5qZCOa7WpTUFUFvoebnSFZBYpjykLtjIp9DVk= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d h1:sWOBy5pWexdIILaM1hND+dymU2yY4yvDUbUTQJdek6Q= +google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go index 45e5b31008b..753eb447213 100644 --- a/talent/apiv4/doc.go +++ b/talent/apiv4/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go index 6afa7c4a7c8..206efdc4372 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go index 47179f9531c..6045470d3e6 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go index e8992cf6d0e..6178e120e8d 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go index 58625c1afdd..3587262fcf0 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go index f9cb2031e76..7c6c96c71db 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/video/transcoder/apiv1beta1/doc.go b/video/transcoder/apiv1beta1/doc.go index f54f2ecabd5..6a9794e883a 100644 --- a/video/transcoder/apiv1beta1/doc.go +++ b/video/transcoder/apiv1beta1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go index cbdf9f87eaa..6d950580090 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go index 67f2f06bb29..3125297ac53 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go index 994c3a36ff4..f8bbff13f27 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go index e5bf63bae1b..4971b7c47d8 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1/doc.go b/webrisk/apiv1/doc.go index cb4cba5f321..a2a3cff1146 100644 --- a/webrisk/apiv1/doc.go +++ b/webrisk/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go index 9c17cbbca0e..c5997723a4b 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/websecurityscanner/apiv1/doc.go b/websecurityscanner/apiv1/doc.go index 9f53fb4ebea..955cdd58c64 100644 --- a/websecurityscanner/apiv1/doc.go +++ b/websecurityscanner/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/apiv1beta/doc.go b/workflows/apiv1beta/doc.go index 6b330e9ba79..27ffaf19282 100644 --- a/workflows/apiv1beta/doc.go +++ b/workflows/apiv1beta/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/executions/apiv1beta/doc.go b/workflows/executions/apiv1beta/doc.go index 34c3c68b8eb..8479b1cec5c 100644 --- a/workflows/executions/apiv1beta/doc.go +++ b/workflows/executions/apiv1beta/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210303" +const versionClient = "20210309" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)