feat(pubsub): add schema support (#3820)
* feat(pubsub): add schema support
diff --git a/CHANGES.md b/CHANGES.md
index 4b704c4..d38b3a4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,35 @@
# Changes
+## [0.80.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.79.0...v0.80.0) (2021-03-23)
+
+
+### ⚠ BREAKING CHANGES
+
+* **all:** This is a breaking change in dialogflow
+
+### Features
+
+* **appengine:** added vm_liveness, search_api_available, network_settings, service_account, build_env_variables, kms_key_reference to v1 API ([fd04a55](https://www.github.com/googleapis/google-cloud-go/commit/fd04a552213f99619c714b5858548f61f4948493))
+* **assuredworkloads:** Add 'resource_settings' field to provide custom properties (ids) for the provisioned projects. ([ab4824a](https://www.github.com/googleapis/google-cloud-go/commit/ab4824a7914864228e59b244d6382de862139524))
+* **assuredworkloads:** add HIPAA and HITRUST compliance regimes ([ab4824a](https://www.github.com/googleapis/google-cloud-go/commit/ab4824a7914864228e59b244d6382de862139524))
+* **dialogflow/cx:** added fallback option when restoring an agent docs: clarified experiment length ([cd70aa9](https://www.github.com/googleapis/google-cloud-go/commit/cd70aa9cc1a5dccfe4e49d2d6ca6db2119553c86))
+* **dialogflow/cx:** start generating apiv3 ([#3850](https://www.github.com/googleapis/google-cloud-go/issues/3850)) ([febbdcf](https://www.github.com/googleapis/google-cloud-go/commit/febbdcf13fcea3f5d8186c3d3dface1c0d27ef9e)), refs [#3634](https://www.github.com/googleapis/google-cloud-go/issues/3634)
+* **documentai:** add EVAL_SKIPPED value to the Provenance.OperationType enum in document.proto. ([cb43066](https://www.github.com/googleapis/google-cloud-go/commit/cb4306683926843f6e977f207fa6070bb9242a61))
+* **documentai:** start generating apiv1 ([#3853](https://www.github.com/googleapis/google-cloud-go/issues/3853)) ([d68e604](https://www.github.com/googleapis/google-cloud-go/commit/d68e604c953eea90489f6134e71849b24dd0fcbf))
+* **internal/godocfx:** add prettyprint class to code blocks ([#3819](https://www.github.com/googleapis/google-cloud-go/issues/3819)) ([6e49f21](https://www.github.com/googleapis/google-cloud-go/commit/6e49f2148b116ee439c8a882dcfeefb6e7647c57))
+* **internal/godocfx:** handle Markdown content ([#3816](https://www.github.com/googleapis/google-cloud-go/issues/3816)) ([56d5d0a](https://www.github.com/googleapis/google-cloud-go/commit/56d5d0a900197fb2de46120a0eda649f2c17448f))
+* **kms:** Add maxAttempts to retry policy for KMS gRPC service config feat: Add Bazel exports_files entry for KMS gRPC service config ([fd04a55](https://www.github.com/googleapis/google-cloud-go/commit/fd04a552213f99619c714b5858548f61f4948493))
+* **resourcesettings:** start generating apiv1 ([#3854](https://www.github.com/googleapis/google-cloud-go/issues/3854)) ([3b288b4](https://www.github.com/googleapis/google-cloud-go/commit/3b288b4fa593c6cb418f696b5b26768967c20b9e))
+* **speech:** Support output transcript to GCS for LongRunningRecognize. ([fd04a55](https://www.github.com/googleapis/google-cloud-go/commit/fd04a552213f99619c714b5858548f61f4948493))
+* **speech:** Support output transcript to GCS for LongRunningRecognize. ([cd70aa9](https://www.github.com/googleapis/google-cloud-go/commit/cd70aa9cc1a5dccfe4e49d2d6ca6db2119553c86))
+* **speech:** Support output transcript to GCS for LongRunningRecognize. ([35a8706](https://www.github.com/googleapis/google-cloud-go/commit/35a870662df8bf63c4ec10a0233d1d7a708007ee))
+
+
+### Miscellaneous Chores
+
+* **all:** auto-regenerate gapics ([#3837](https://www.github.com/googleapis/google-cloud-go/issues/3837)) ([ab4824a](https://www.github.com/googleapis/google-cloud-go/commit/ab4824a7914864228e59b244d6382de862139524))
+
## [0.79.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.78.0...v0.79.0) (2021-03-10)
diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go
index 57ad3c9..822b4b6 100644
--- a/accessapproval/apiv1/doc.go
+++ b/accessapproval/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 a7b622b..07c1248 100644
--- a/analytics/admin/apiv1alpha/doc.go
+++ b/analytics/admin/apiv1alpha/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2850add..d477411 100644
--- a/analytics/data/apiv1alpha/doc.go
+++ b/analytics/data/apiv1alpha/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 95631b0..0fad6e9 100644
--- a/apigateway/apiv1/doc.go
+++ b/apigateway/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/appengine/apiv1/applications_client.go b/appengine/apiv1/applications_client.go
index 1c4812a..8a50b21 100644
--- a/appengine/apiv1/applications_client.go
+++ b/appengine/apiv1/applications_client.go
@@ -66,7 +66,7 @@
}
}
-// ApplicationsClient is a client for interacting with App Engine Audit Data.
+// ApplicationsClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ApplicationsClient struct {
diff --git a/appengine/apiv1/authorized_certificates_client.go b/appengine/apiv1/authorized_certificates_client.go
index 2b36651..db30bfc 100644
--- a/appengine/apiv1/authorized_certificates_client.go
+++ b/appengine/apiv1/authorized_certificates_client.go
@@ -66,7 +66,7 @@
}
}
-// AuthorizedCertificatesClient is a client for interacting with App Engine Audit Data.
+// AuthorizedCertificatesClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type AuthorizedCertificatesClient struct {
diff --git a/appengine/apiv1/authorized_domains_client.go b/appengine/apiv1/authorized_domains_client.go
index cf95e5f..087e037 100644
--- a/appengine/apiv1/authorized_domains_client.go
+++ b/appengine/apiv1/authorized_domains_client.go
@@ -58,7 +58,7 @@
}
}
-// AuthorizedDomainsClient is a client for interacting with App Engine Audit Data.
+// AuthorizedDomainsClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type AuthorizedDomainsClient struct {
diff --git a/appengine/apiv1/doc.go b/appengine/apiv1/doc.go
index b5557f0..22e77e2 100644
--- a/appengine/apiv1/doc.go
+++ b/appengine/apiv1/doc.go
@@ -15,7 +15,7 @@
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
// Package appengine is an auto-generated package for the
-// App Engine Audit Data.
+// App Engine Admin API.
//
// Provisions and manages developers' App Engine applications.
//
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/appengine/apiv1/domain_mappings_client.go b/appengine/apiv1/domain_mappings_client.go
index 71db9a3..b8814b9 100644
--- a/appengine/apiv1/domain_mappings_client.go
+++ b/appengine/apiv1/domain_mappings_client.go
@@ -70,7 +70,7 @@
}
}
-// DomainMappingsClient is a client for interacting with App Engine Audit Data.
+// DomainMappingsClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type DomainMappingsClient struct {
diff --git a/appengine/apiv1/firewall_client.go b/appengine/apiv1/firewall_client.go
index 196ef3e..c241c2b 100644
--- a/appengine/apiv1/firewall_client.go
+++ b/appengine/apiv1/firewall_client.go
@@ -68,7 +68,7 @@
}
}
-// FirewallClient is a client for interacting with App Engine Audit Data.
+// FirewallClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type FirewallClient struct {
diff --git a/appengine/apiv1/instances_client.go b/appengine/apiv1/instances_client.go
index 8ac56dd..09c2956 100644
--- a/appengine/apiv1/instances_client.go
+++ b/appengine/apiv1/instances_client.go
@@ -68,7 +68,7 @@
}
}
-// InstancesClient is a client for interacting with App Engine Audit Data.
+// InstancesClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type InstancesClient struct {
diff --git a/appengine/apiv1/services_client.go b/appengine/apiv1/services_client.go
index 6deadc2..d377518 100644
--- a/appengine/apiv1/services_client.go
+++ b/appengine/apiv1/services_client.go
@@ -68,7 +68,7 @@
}
}
-// ServicesClient is a client for interacting with App Engine Audit Data.
+// ServicesClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ServicesClient struct {
diff --git a/appengine/apiv1/versions_client.go b/appengine/apiv1/versions_client.go
index a1c3146..f9052f4 100644
--- a/appengine/apiv1/versions_client.go
+++ b/appengine/apiv1/versions_client.go
@@ -70,7 +70,7 @@
}
}
-// VersionsClient is a client for interacting with App Engine Audit Data.
+// VersionsClient is a client for interacting with App Engine Admin API.
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type VersionsClient struct {
diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go
index 55b6640..37974e3 100644
--- a/area120/tables/apiv1alpha1/doc.go
+++ b/area120/tables/apiv1alpha1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 d4674cf..09df5f9 100644
--- a/artifactregistry/apiv1beta2/doc.go
+++ b/artifactregistry/apiv1beta2/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 3df2b6d..806805f 100644
--- a/asset/apiv1/doc.go
+++ b/asset/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 bc83d8a..134a4cf 100644
--- a/asset/apiv1p2beta1/doc.go
+++ b/asset/apiv1p2beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 f42eb5d..9df3d5d 100644
--- a/asset/apiv1p5beta1/doc.go
+++ b/asset/apiv1p5beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 331538e..3f36ca9 100644
--- a/assuredworkloads/apiv1beta1/doc.go
+++ b/assuredworkloads/apiv1beta1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 5c79333..7ded33c 100644
--- a/automl/apiv1/doc.go
+++ b/automl/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 255db37..4c0f780 100644
--- a/automl/apiv1beta1/doc.go
+++ b/automl/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 a68868d..3c5a807 100644
--- a/bigquery/connection/apiv1/doc.go
+++ b/bigquery/connection/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 472f5df..8ea5a35 100644
--- a/bigquery/connection/apiv1beta1/doc.go
+++ b/bigquery/connection/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2c9bcd2..fa03c9b 100644
--- a/bigquery/datatransfer/apiv1/doc.go
+++ b/bigquery/datatransfer/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 27a91e5..959fafd 100644
--- a/bigquery/go.mod
+++ b/bigquery/go.mod
@@ -5,10 +5,10 @@
require (
cloud.google.com/go v0.79.0
cloud.google.com/go/storage v1.10.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
)
diff --git a/bigquery/go.sum b/bigquery/go.sum
index 9fb8dd7..7a98d0e 100644
--- a/bigquery/go.sum
+++ b/bigquery/go.sum
@@ -83,8 +83,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -221,8 +223,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -279,8 +282,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -365,8 +369,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -412,9 +416,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -442,8 +446,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go
index 1715e6e..dfa762f 100644
--- a/bigquery/reservation/apiv1/doc.go
+++ b/bigquery/reservation/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 a3b6e87..9cc0973 100644
--- a/bigquery/reservation/apiv1beta1/doc.go
+++ b/bigquery/reservation/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 98e2904..57a7814 100644
--- a/bigquery/storage/apiv1/doc.go
+++ b/bigquery/storage/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 111051a..6197d1b 100644
--- a/bigquery/storage/apiv1alpha2/doc.go
+++ b/bigquery/storage/apiv1alpha2/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 eafb447..5ac2c8f 100644
--- a/bigquery/storage/apiv1beta1/doc.go
+++ b/bigquery/storage/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 898f088..809c569 100644
--- a/bigquery/storage/apiv1beta2/doc.go
+++ b/bigquery/storage/apiv1beta2/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigtable/bttest/inmem.go b/bigtable/bttest/inmem.go
index e1752da..56e6d76 100644
--- a/bigtable/bttest/inmem.go
+++ b/bigtable/bttest/inmem.go
@@ -67,9 +67,7 @@
maxValidMilliSeconds = math.MaxInt64 - math.MaxInt64%1000
)
-var (
- validLabelTransformer = regexp.MustCompile(`[a-z0-9\-]{1,15}`)
-)
+var validLabelTransformer = regexp.MustCompile(`[a-z0-9\-]{1,15}`)
// Server is an in-memory Cloud Bigtable fake.
// It is unauthenticated, and only a rough approximation.
@@ -326,9 +324,11 @@
func (s *server) GetSnapshot(context.Context, *btapb.GetSnapshotRequest) (*btapb.Snapshot, error) {
return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots")
}
+
func (s *server) ListSnapshots(context.Context, *btapb.ListSnapshotsRequest) (*btapb.ListSnapshotsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots")
}
+
func (s *server) DeleteSnapshot(context.Context, *btapb.DeleteSnapshotRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots")
}
@@ -747,8 +747,35 @@
}
}
+// escapeUTF is used to escape non-ASCII characters in pattern strings passed
+// to binaryregexp. This makes regexp column and row key matching work more
+// closely to what's seen with the real BigTable.
+func escapeUTF(in []byte) []byte {
+ var toEsc int
+ for _, c := range in {
+ if c > 127 {
+ toEsc++
+ }
+ }
+ if toEsc == 0 {
+ return in
+ }
+ // Each escaped byte becomes 4 bytes (byte a1 becomes \xA1)
+ out := make([]byte, 0, len(in)+3*toEsc)
+ for _, c := range in {
+ if c > 127 {
+ h, l := c>>4, c&0xF
+ const conv = "0123456789ABCDEF"
+ out = append(out, '\\', 'x', conv[h], conv[l])
+ } else {
+ out = append(out, c)
+ }
+ }
+ return out
+}
+
func newRegexp(pat []byte) (*binaryregexp.Regexp, error) {
- re, err := binaryregexp.Compile("^(?:" + string(pat) + ")$") // match entire target
+ re, err := binaryregexp.Compile("^(?:" + string(escapeUTF(pat)) + ")$") // match entire target
if err != nil {
log.Printf("Bad pattern %q: %v", pat, err)
}
diff --git a/bigtable/bttest/inmem_test.go b/bigtable/bttest/inmem_test.go
index 09aa627..5b8e644 100644
--- a/bigtable/bttest/inmem_test.go
+++ b/bigtable/bttest/inmem_test.go
@@ -461,6 +461,7 @@
t.Fatalf("want TimestampMicros rejection, got acceptance: %v", err)
}
}
+
func TestReadRows(t *testing.T) {
ctx := context.Background()
s := &server{
@@ -542,8 +543,10 @@
}
mock := &MockReadRowsServer{}
- req := &btpb.ReadRowsRequest{TableName: tblInfo.Name, Filter: &btpb.RowFilter{
- Filter: &btpb.RowFilter_RowKeyRegexFilter{RowKeyRegexFilter: []byte("[")}}, // Invalid regex.
+ req := &btpb.ReadRowsRequest{
+ TableName: tblInfo.Name, Filter: &btpb.RowFilter{
+ Filter: &btpb.RowFilter_RowKeyRegexFilter{RowKeyRegexFilter: []byte("[")},
+ }, // Invalid regex.
}
if err = s.ReadRows(req, mock); err == nil {
t.Fatal("ReadRows got no error, want error")
@@ -1173,7 +1176,6 @@
}
got, err := s.ReadModifyWriteRow(ctx, req)
-
if err != nil {
t.Fatalf("ReadModifyWriteRow error: %v", err)
}
@@ -1483,8 +1485,10 @@
{&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte("[")}}},
{&btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("[")}}},
{&btpb.RowFilter{Filter: &btpb.RowFilter_Chain_{
- Chain: &btpb.RowFilter_Chain{Filters: []*btpb.RowFilter{
- {Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("[")}}},
+ Chain: &btpb.RowFilter_Chain{
+ Filters: []*btpb.RowFilter{
+ {Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("[")}},
+ },
},
}}},
{&btpb.RowFilter{Filter: &btpb.RowFilter_Condition_{
@@ -1561,6 +1565,45 @@
}
}
+func TestFilterRowWithUnicodeColumnQualifier(t *testing.T) {
+ rs := []byte("a§b")
+ row := &row{
+ key: string(rs),
+ families: map[string]*family{
+ "fam": {
+ name: "fam",
+ cells: map[string][]cell{
+ string(rs): {{ts: 1000, value: []byte("val")}},
+ },
+ },
+ },
+ }
+ for _, test := range []struct {
+ filter string
+ want bool
+ }{
+ {`a§b`, true}, // succeeds, exact match
+ {`a\xC2\xA7b`, true}, // succeeds, exact match
+ {`a\xC2.+`, true}, // succeeds, prefix match
+ {`a\xC2\C{2}`, true}, // succeeds, prefix match
+ {`a\xC.+`, false}, // fails, prefix match, bad escape
+ {`a§.+`, true}, // succeeds, prefix match
+ {`.+§b`, true}, // succeeds, suffix match
+ {`.§b`, true}, // succeeds
+ {`a§c`, false}, // fails
+ {`§b`, false}, // fails, because the regexp must match the entire input
+ {`.*§.*`, true}, // succeeds: anything with a §
+ {`.+§.+`, true}, // succeeds: anything with a § in the middle
+ {`a\C{2}b`, true}, // succeeds: § is two bytes
+ {`\C{4}`, true}, // succeeds: four bytes
+ } {
+ got, _ := filterRow(&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte(test.filter)}}, row.copy())
+ if got != test.want {
+ t.Errorf("%v: got %t, want %t", test.filter, got, test.want)
+ }
+ }
+}
+
// Test that a single column qualifier with the interleave filter returns
// the correct result and not return every single row.
// See Issue https://github.com/googleapis/google-cloud-go/issues/1399
diff --git a/bigtable/go.mod b/bigtable/go.mod
index 48c9e22..bfe0de1 100644
--- a/bigtable/go.mod
+++ b/bigtable/go.mod
@@ -4,15 +4,15 @@
require (
cloud.google.com/go v0.79.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/btree v1.0.0
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
- golang.org/x/sys v0.0.0-20210314195730-07df6a141424
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
- google.golang.org/protobuf v1.25.0
+ google.golang.org/protobuf v1.26.0
rsc.io/binaryregexp v0.2.0
)
diff --git a/bigtable/go.sum b/bigtable/go.sum
index 584ff28..0daa639 100644
--- a/bigtable/go.sum
+++ b/bigtable/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
@@ -219,8 +221,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -277,8 +280,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -363,8 +367,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -410,9 +414,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -440,8 +444,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/bigtable/integration_test.go b/bigtable/integration_test.go
index 9045bdd..9d17a6e 100644
--- a/bigtable/integration_test.go
+++ b/bigtable/integration_test.go
@@ -53,9 +53,9 @@
var (
presidentsSocialGraph = map[string][]string{
"wmckinley": {"tjefferson"},
- "gwashington": {"jadams"},
- "tjefferson": {"gwashington", "jadams"},
- "jadams": {"gwashington", "tjefferson"},
+ "gwashington": {"j§adams"},
+ "tjefferson": {"gwashington", "j§adams"},
+ "j§adams": {"gwashington", "tjefferson"},
}
tableNameSpace = uid.NewSpace("cbt-test", &uid.Options{Short: true})
@@ -75,13 +75,15 @@
return nil
}
-var instanceToCreate string
-var instanceToCreateZone string
-var instanceToCreateZone2 string
-var blackholeDpv6Cmd string
-var blackholeDpv4Cmd string
-var allowDpv6Cmd string
-var allowDpv4Cmd string
+var (
+ instanceToCreate string
+ instanceToCreateZone string
+ instanceToCreateZone2 string
+ blackholeDpv6Cmd string
+ blackholeDpv4Cmd string
+ allowDpv6Cmd string
+ allowDpv4Cmd string
+)
func init() {
// Don't test instance creation by default, as quota is necessary and aborted tests could strand resources.
@@ -131,15 +133,15 @@
verifyDirectPathRemoteAddress(testEnv, t)
// Fetch a row.
- row, err := table.ReadRow(ctx, "jadams")
+ row, err := table.ReadRow(ctx, "j§adams")
if err != nil {
t.Fatalf("Reading a row: %v", err)
}
verifyDirectPathRemoteAddress(testEnv, t)
wantRow := Row{
"follows": []ReadItem{
- {Row: "jadams", Column: "follows:gwashington", Timestamp: 1000, Value: []byte("1")},
- {Row: "jadams", Column: "follows:tjefferson", Timestamp: 1000, Value: []byte("1")},
+ {Row: "j§adams", Column: "follows:gwashington", Timestamp: 1000, Value: []byte("1")},
+ {Row: "j§adams", Column: "follows:tjefferson", Timestamp: 1000, Value: []byte("1")},
},
}
if !testutil.Equal(row, wantRow) {
@@ -192,8 +194,8 @@
// Read a RowList
var elt []string
- keys := RowList{"wmckinley", "gwashington", "jadams"}
- want := "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,wmckinley-tjefferson-1"
+ keys := RowList{"wmckinley", "gwashington", "j§adams"}
+ want := "gwashington-j§adams-1,j§adams-gwashington-1,j§adams-tjefferson-1,wmckinley-tjefferson-1"
err = table.ReadRows(ctx, keys, func(r Row) bool {
for _, ris := range r {
for _, ri := range ris {
@@ -808,9 +810,9 @@
// Insert some data.
initialData := map[string][]string{
"wmckinley": {"tjefferson"},
- "gwashington": {"jadams"},
- "tjefferson": {"gwashington", "jadams", "wmckinley"},
- "jadams": {"gwashington", "tjefferson"},
+ "gwashington": {"j§adams"},
+ "tjefferson": {"gwashington", "j§adams", "wmckinley"},
+ "j§adams": {"gwashington", "tjefferson"},
}
for row, ss := range initialData {
mut := NewMutation()
@@ -837,22 +839,22 @@
{
desc: "read all, unfiltered",
rr: RowRange{},
- want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,tjefferson-gwashington-1,tjefferson-jadams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-gwashington-1,j§adams-tjefferson-1,tjefferson-gwashington-1,tjefferson-j§adams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1",
},
{
desc: "read with InfiniteRange, unfiltered",
rr: InfiniteRange("tjefferson"),
- want: "tjefferson-gwashington-1,tjefferson-jadams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1",
+ want: "tjefferson-gwashington-1,tjefferson-j§adams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1",
},
{
desc: "read with NewRange, unfiltered",
rr: NewRange("gargamel", "hubbard"),
- want: "gwashington-jadams-1",
+ want: "gwashington-j§adams-1",
},
{
desc: "read with PrefixRange, unfiltered",
- rr: PrefixRange("jad"),
- want: "jadams-gwashington-1,jadams-tjefferson-1",
+ rr: PrefixRange("j§ad"),
+ want: "j§adams-gwashington-1,j§adams-tjefferson-1",
},
{
desc: "read with SingleRow, unfiltered",
@@ -862,8 +864,8 @@
{
desc: "read all, with ColumnFilter",
rr: RowRange{},
- filter: ColumnFilter(".*j.*"), // matches "jadams" and "tjefferson"
- want: "gwashington-jadams-1,jadams-tjefferson-1,tjefferson-jadams-1,wmckinley-tjefferson-1",
+ filter: ColumnFilter(".*j.*"), // matches "j§adams" and "tjefferson"
+ want: "gwashington-j§adams-1,j§adams-tjefferson-1,tjefferson-j§adams-1,wmckinley-tjefferson-1",
},
{
desc: "read all, with ColumnFilter, prefix",
@@ -875,25 +877,37 @@
desc: "read range, with ColumnRangeFilter",
rr: RowRange{},
filter: ColumnRangeFilter("follows", "h", "k"),
- want: "gwashington-jadams-1,tjefferson-jadams-1",
+ want: "gwashington-j§adams-1,tjefferson-j§adams-1",
},
{
desc: "read range from empty, with ColumnRangeFilter",
rr: RowRange{},
filter: ColumnRangeFilter("follows", "", "u"),
- want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,tjefferson-gwashington-1,tjefferson-jadams-1,wmckinley-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-gwashington-1,j§adams-tjefferson-1,tjefferson-gwashington-1,tjefferson-j§adams-1,wmckinley-tjefferson-1",
},
{
desc: "read range from start to empty, with ColumnRangeFilter",
rr: RowRange{},
filter: ColumnRangeFilter("follows", "h", ""),
- want: "gwashington-jadams-1,jadams-tjefferson-1,tjefferson-jadams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-tjefferson-1,tjefferson-j§adams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1",
},
{
desc: "read with RowKeyFilter",
rr: RowRange{},
filter: RowKeyFilter(".*wash.*"),
- want: "gwashington-jadams-1",
+ want: "gwashington-j§adams-1",
+ },
+ {
+ desc: "read with RowKeyFilter unicode",
+ rr: RowRange{},
+ filter: RowKeyFilter(".*j§.*"),
+ want: "j§adams-gwashington-1,j§adams-tjefferson-1",
+ },
+ {
+ desc: "read with RowKeyFilter escaped",
+ rr: RowRange{},
+ filter: RowKeyFilter(`.*j\xC2\xA7.*`),
+ want: "j§adams-gwashington-1,j§adams-tjefferson-1",
},
{
desc: "read with RowKeyFilter, prefix",
@@ -916,49 +930,49 @@
{
desc: "read with ColumnFilter + row limit",
rr: RowRange{},
- filter: ColumnFilter(".*j.*"), // matches "jadams" and "tjefferson"
+ filter: ColumnFilter(".*j.*"), // matches "j§adams" and "tjefferson"
limit: LimitRows(2),
- want: "gwashington-jadams-1,jadams-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-tjefferson-1",
},
{
desc: "apply labels to the result rows",
rr: RowRange{},
filter: LabelFilter("test-label"),
limit: LimitRows(2),
- want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-gwashington-1,j§adams-tjefferson-1",
wantLabels: []string{"test-label", "test-label", "test-label"},
},
{
desc: "read all, strip values",
rr: RowRange{},
filter: StripValueFilter(),
- want: "gwashington-jadams-,jadams-gwashington-,jadams-tjefferson-,tjefferson-gwashington-,tjefferson-jadams-,tjefferson-wmckinley-,wmckinley-tjefferson-",
+ want: "gwashington-j§adams-,j§adams-gwashington-,j§adams-tjefferson-,tjefferson-gwashington-,tjefferson-j§adams-,tjefferson-wmckinley-,wmckinley-tjefferson-",
},
{
desc: "read with ColumnFilter + row limit + strip values",
rr: RowRange{},
- filter: ChainFilters(ColumnFilter(".*j.*"), StripValueFilter()), // matches "jadams" and "tjefferson"
+ filter: ChainFilters(ColumnFilter(".*j.*"), StripValueFilter()), // matches "j§adams" and "tjefferson"
limit: LimitRows(2),
- want: "gwashington-jadams-,jadams-tjefferson-",
+ want: "gwashington-j§adams-,j§adams-tjefferson-",
},
{
desc: "read with condition, strip values on true",
rr: RowRange{},
filter: ConditionFilter(ColumnFilter(".*j.*"), StripValueFilter(), nil),
- want: "gwashington-jadams-,jadams-gwashington-,jadams-tjefferson-,tjefferson-gwashington-,tjefferson-jadams-,tjefferson-wmckinley-,wmckinley-tjefferson-",
+ want: "gwashington-j§adams-,j§adams-gwashington-,j§adams-tjefferson-,tjefferson-gwashington-,tjefferson-j§adams-,tjefferson-wmckinley-,wmckinley-tjefferson-",
},
{
desc: "read with condition, strip values on false",
rr: RowRange{},
filter: ConditionFilter(ColumnFilter(".*xxx.*"), nil, StripValueFilter()),
- want: "gwashington-jadams-,jadams-gwashington-,jadams-tjefferson-,tjefferson-gwashington-,tjefferson-jadams-,tjefferson-wmckinley-,wmckinley-tjefferson-",
+ want: "gwashington-j§adams-,j§adams-gwashington-,j§adams-tjefferson-,tjefferson-gwashington-,tjefferson-j§adams-,tjefferson-wmckinley-,wmckinley-tjefferson-",
},
{
desc: "read with ValueRangeFilter + row limit",
rr: RowRange{},
filter: ValueRangeFilter([]byte("1"), []byte("5")), // matches our value of "1"
limit: LimitRows(2),
- want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-gwashington-1,j§adams-tjefferson-1",
},
{
desc: "read with ValueRangeFilter, no match on exclusive end",
@@ -982,18 +996,18 @@
desc: "read with InterleaveFilter, no duplicate cells",
rr: RowRange{},
filter: InterleaveFilters(ColumnFilter(".*g.*"), ColumnFilter(".*j.*")),
- want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,tjefferson-gwashington-1,tjefferson-jadams-1,wmckinley-tjefferson-1",
+ want: "gwashington-j§adams-1,j§adams-gwashington-1,j§adams-tjefferson-1,tjefferson-gwashington-1,tjefferson-j§adams-1,wmckinley-tjefferson-1",
},
{
desc: "read with InterleaveFilter, with duplicate cells",
rr: RowRange{},
filter: InterleaveFilters(ColumnFilter(".*g.*"), ColumnFilter(".*g.*")),
- want: "jadams-gwashington-1,jadams-gwashington-1,tjefferson-gwashington-1,tjefferson-gwashington-1",
+ want: "j§adams-gwashington-1,j§adams-gwashington-1,tjefferson-gwashington-1,tjefferson-gwashington-1",
},
{
desc: "read with a RowRangeList and no filter",
rr: RowRangeList{NewRange("gargamel", "hubbard"), InfiniteRange("wmckinley")},
- want: "gwashington-jadams-1,wmckinley-tjefferson-1",
+ want: "gwashington-j§adams-1,wmckinley-tjefferson-1",
},
{
desc: "chain that excludes rows and matches nothing, in a condition",
@@ -1051,8 +1065,8 @@
// Insert some data.
initialData := map[string][]string{
"wmckinley11": {"tjefferson11"},
- "gwashington77": {"jadams77"},
- "tjefferson0": {"gwashington0", "jadams0"},
+ "gwashington77": {"j§adams77"},
+ "tjefferson0": {"gwashington0", "j§adams0"},
}
for row, ss := range initialData {
@@ -1405,7 +1419,8 @@
InstanceType: PRODUCTION,
Labels: map[string]string{"new-label-key": "new-label-value"},
Clusters: []ClusterConfig{
- {ClusterID: clusterID, NumNodes: 5}},
+ {ClusterID: clusterID, NumNodes: 5},
+ },
}
if err = iAdminClient.UpdateInstanceWithClusters(ctx, confWithClusters); err != nil {
@@ -1438,7 +1453,6 @@
}
func TestIntegration_AdminUpdateInstanceLabels(t *testing.T) {
-
// Check the environments
if instanceToCreate == "" {
t.Skip("instanceToCreate not set, skipping instance creation testing")
@@ -1590,7 +1604,8 @@
InstanceType: PRODUCTION,
Labels: map[string]string{"new-label-key": "new-label-value"},
Clusters: []ClusterConfig{
- {ClusterID: clusterID, NumNodes: 5}},
+ {ClusterID: clusterID, NumNodes: 5},
+ },
}
results, err := UpdateInstanceAndSyncClusters(ctx, iAdminClient, confWithClusters)
@@ -1637,7 +1652,8 @@
InstanceID: instanceToCreate,
Clusters: []ClusterConfig{
{ClusterID: clusterID},
- {ClusterID: clusterID2, NumNodes: 3, StorageType: SSD, Zone: instanceToCreateZone2}},
+ {ClusterID: clusterID2, NumNodes: 3, StorageType: SSD, Zone: instanceToCreateZone2},
+ },
}
results, err = UpdateInstanceAndSyncClusters(ctx, iAdminClient, confWithClusters)
@@ -1657,7 +1673,8 @@
confWithClusters = &InstanceWithClustersConfig{
InstanceID: instanceToCreate,
Clusters: []ClusterConfig{
- {ClusterID: clusterID, NumNodes: 4}},
+ {ClusterID: clusterID, NumNodes: 4},
+ },
}
results, err = UpdateInstanceAndSyncClusters(ctx, iAdminClient, confWithClusters)
@@ -1830,54 +1847,71 @@
func (iacm *instanceAdminClientMock) CreateInstance(ctx context.Context, in *btapb.CreateInstanceRequest, opts ...grpc.CallOption) (*longrunning.Operation, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) GetInstance(ctx context.Context, in *btapb.GetInstanceRequest, opts ...grpc.CallOption) (*btapb.Instance, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) ListInstances(ctx context.Context, in *btapb.ListInstancesRequest, opts ...grpc.CallOption) (*btapb.ListInstancesResponse, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) UpdateInstance(ctx context.Context, in *btapb.Instance, opts ...grpc.CallOption) (*btapb.Instance, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) PartialUpdateInstance(ctx context.Context, in *btapb.PartialUpdateInstanceRequest, opts ...grpc.CallOption) (*longrunning.Operation, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) DeleteInstance(ctx context.Context, in *btapb.DeleteInstanceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) CreateCluster(ctx context.Context, in *btapb.CreateClusterRequest, opts ...grpc.CallOption) (*longrunning.Operation, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) GetCluster(ctx context.Context, in *btapb.GetClusterRequest, opts ...grpc.CallOption) (*btapb.Cluster, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) UpdateCluster(ctx context.Context, in *btapb.Cluster, opts ...grpc.CallOption) (*longrunning.Operation, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) DeleteCluster(ctx context.Context, in *btapb.DeleteClusterRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) CreateAppProfile(ctx context.Context, in *btapb.CreateAppProfileRequest, opts ...grpc.CallOption) (*btapb.AppProfile, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) GetAppProfile(ctx context.Context, in *btapb.GetAppProfileRequest, opts ...grpc.CallOption) (*btapb.AppProfile, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) ListAppProfiles(ctx context.Context, in *btapb.ListAppProfilesRequest, opts ...grpc.CallOption) (*btapb.ListAppProfilesResponse, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) UpdateAppProfile(ctx context.Context, in *btapb.UpdateAppProfileRequest, opts ...grpc.CallOption) (*longrunning.Operation, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) DeleteAppProfile(ctx context.Context, in *btapb.DeleteAppProfileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) GetIamPolicy(ctx context.Context, in *v1.GetIamPolicyRequest, opts ...grpc.CallOption) (*v1.Policy, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) SetIamPolicy(ctx context.Context, in *v1.SetIamPolicyRequest, opts ...grpc.CallOption) (*v1.Policy, error) {
return nil, nil
}
+
func (iacm *instanceAdminClientMock) TestIamPermissions(ctx context.Context, in *v1.TestIamPermissionsRequest, opts ...grpc.CallOption) (*v1.TestIamPermissionsResponse, error) {
return nil, nil
}
@@ -2037,18 +2071,15 @@
createdProfile, err := iAdminClient.CreateAppProfile(ctx, profile)
if err != nil {
t.Fatalf("Creating app profile: %v", err)
-
}
gotProfile, err := iAdminClient.GetAppProfile(ctx, adminClient.instance, "app_profile1")
-
if err != nil {
t.Fatalf("Get app profile: %v", err)
}
if !proto.Equal(createdProfile, gotProfile) {
t.Fatalf("created profile: %s, got profile: %s", createdProfile.Name, gotProfile.Name)
-
}
list := func(instanceID string) ([]*btapb.AppProfile, error) {
@@ -2095,7 +2126,8 @@
Name: gotProfile.Name,
Description: "",
RoutingPolicy: gotProfile.RoutingPolicy,
- Etag: gotProfile.Etag},
+ Etag: gotProfile.Etag,
+ },
},
{
desc: "routing update",
@@ -2110,7 +2142,8 @@
RoutingPolicy: &btapb.AppProfile_SingleClusterRouting_{
SingleClusterRouting: &btapb.AppProfile_SingleClusterRouting{
ClusterId: testEnv.Config().Cluster,
- }},
+ },
+ },
},
},
} {
@@ -2138,7 +2171,6 @@
if err != nil {
t.Fatalf("Delete app profile: %v", err)
}
-
}
func TestIntegration_InstanceUpdate(t *testing.T) {
@@ -2397,7 +2429,7 @@
start := time.Now()
for time.Since(start) < 2*time.Minute {
for i := 0; i < numRPCsToSend; i++ {
- _, _ = table.ReadRow(ctx, "jadams")
+ _, _ = table.ReadRow(ctx, "j§adams")
if _, useDP := isDirectPathRemoteAddress(testEnv); useDP != blackholeDP {
numCount++
if numCount >= minCompleteRPC {
diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go
index 4a46dda..aba94b9 100644
--- a/billing/apiv1/doc.go
+++ b/billing/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 ed368ef..36405d3 100644
--- a/billing/budgets/apiv1/doc.go
+++ b/billing/budgets/apiv1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 5932d0f..644a0d9 100644
--- a/billing/budgets/apiv1beta1/doc.go
+++ b/billing/budgets/apiv1beta1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 e69c69c..2049c46 100644
--- a/binaryauthorization/apiv1beta1/doc.go
+++ b/binaryauthorization/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 84c01a0..7eda209 100644
--- a/channel/apiv1/doc.go
+++ b/channel/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/cloudbuild/apiv1/v2/cloud_build_client.go b/cloudbuild/apiv1/v2/cloud_build_client.go
index 17db5e0..16657ff 100644
--- a/cloudbuild/apiv1/v2/cloud_build_client.go
+++ b/cloudbuild/apiv1/v2/cloud_build_client.go
@@ -42,22 +42,23 @@
// CallOptions contains the retry settings for each method of Client.
type CallOptions struct {
- CreateBuild []gax.CallOption
- GetBuild []gax.CallOption
- ListBuilds []gax.CallOption
- CancelBuild []gax.CallOption
- RetryBuild []gax.CallOption
- CreateBuildTrigger []gax.CallOption
- GetBuildTrigger []gax.CallOption
- ListBuildTriggers []gax.CallOption
- DeleteBuildTrigger []gax.CallOption
- UpdateBuildTrigger []gax.CallOption
- RunBuildTrigger []gax.CallOption
- CreateWorkerPool []gax.CallOption
- GetWorkerPool []gax.CallOption
- DeleteWorkerPool []gax.CallOption
- UpdateWorkerPool []gax.CallOption
- ListWorkerPools []gax.CallOption
+ CreateBuild []gax.CallOption
+ GetBuild []gax.CallOption
+ ListBuilds []gax.CallOption
+ CancelBuild []gax.CallOption
+ RetryBuild []gax.CallOption
+ CreateBuildTrigger []gax.CallOption
+ GetBuildTrigger []gax.CallOption
+ ListBuildTriggers []gax.CallOption
+ DeleteBuildTrigger []gax.CallOption
+ UpdateBuildTrigger []gax.CallOption
+ RunBuildTrigger []gax.CallOption
+ ReceiveTriggerWebhook []gax.CallOption
+ CreateWorkerPool []gax.CallOption
+ GetWorkerPool []gax.CallOption
+ DeleteWorkerPool []gax.CallOption
+ UpdateWorkerPool []gax.CallOption
+ ListWorkerPools []gax.CallOption
}
func defaultClientOptions() []option.ClientOption {
@@ -138,9 +139,10 @@
})
}),
},
- UpdateBuildTrigger: []gax.CallOption{},
- RunBuildTrigger: []gax.CallOption{},
- CreateWorkerPool: []gax.CallOption{},
+ UpdateBuildTrigger: []gax.CallOption{},
+ RunBuildTrigger: []gax.CallOption{},
+ ReceiveTriggerWebhook: []gax.CallOption{},
+ CreateWorkerPool: []gax.CallOption{},
GetWorkerPool: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
@@ -599,6 +601,24 @@
}, nil
}
+// ReceiveTriggerWebhook receiveTriggerWebhook [Experimental] is called when the API receives a
+// webhook request targeted at a specific trigger.
+func (c *Client) ReceiveTriggerWebhook(ctx context.Context, req *cloudbuildpb.ReceiveTriggerWebhookRequest, opts ...gax.CallOption) (*cloudbuildpb.ReceiveTriggerWebhookResponse, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger", url.QueryEscape(req.GetTrigger())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.ReceiveTriggerWebhook[0:len(c.CallOptions.ReceiveTriggerWebhook):len(c.CallOptions.ReceiveTriggerWebhook)], opts...)
+ var resp *cloudbuildpb.ReceiveTriggerWebhookResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.ReceiveTriggerWebhook(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
// CreateWorkerPool creates a WorkerPool to run the builds, and returns the new worker pool.
//
// This API is experimental.
diff --git a/cloudbuild/apiv1/v2/cloud_build_client_example_test.go b/cloudbuild/apiv1/v2/cloud_build_client_example_test.go
index cf19805..a880aeb 100644
--- a/cloudbuild/apiv1/v2/cloud_build_client_example_test.go
+++ b/cloudbuild/apiv1/v2/cloud_build_client_example_test.go
@@ -279,6 +279,26 @@
_ = resp
}
+func ExampleClient_ReceiveTriggerWebhook() {
+ // import cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
+
+ ctx := context.Background()
+ c, err := cloudbuild.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cloudbuildpb.ReceiveTriggerWebhookRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.ReceiveTriggerWebhook(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
func ExampleClient_CreateWorkerPool() {
// import cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go
index 679368a..3eef194 100644
--- a/cloudbuild/apiv1/v2/doc.go
+++ b/cloudbuild/apiv1/v2/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/cloudbuild/apiv1/v2/gapic_metadata.json b/cloudbuild/apiv1/v2/gapic_metadata.json
index b308a6c..a5ee7a2 100644
--- a/cloudbuild/apiv1/v2/gapic_metadata.json
+++ b/cloudbuild/apiv1/v2/gapic_metadata.json
@@ -70,6 +70,11 @@
"ListWorkerPools"
]
},
+ "ReceiveTriggerWebhook": {
+ "methods": [
+ "ReceiveTriggerWebhook"
+ ]
+ },
"RetryBuild": {
"methods": [
"RetryBuild"
diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go
index 3b2ed0f..6440f86 100644
--- a/cloudtasks/apiv2/doc.go
+++ b/cloudtasks/apiv2/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 402d4ea..b39e6a7 100644
--- a/cloudtasks/apiv2beta2/doc.go
+++ b/cloudtasks/apiv2beta2/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 e32d93b..5a11946 100644
--- a/cloudtasks/apiv2beta3/doc.go
+++ b/cloudtasks/apiv2beta3/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 bf03d57..8a41a20 100644
--- a/container/apiv1/doc.go
+++ b/container/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 184093c..8bae1c8 100644
--- a/containeranalysis/apiv1beta1/doc.go
+++ b/containeranalysis/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 83f5287..da5ba2b 100644
--- a/datacatalog/apiv1/doc.go
+++ b/datacatalog/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2539815..9435f88 100644
--- a/datacatalog/apiv1beta1/doc.go
+++ b/datacatalog/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 4a980b5..7bd9591 100644
--- a/datalabeling/apiv1beta1/doc.go
+++ b/datalabeling/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 5aa6a0d..c0a30a3 100644
--- a/dataproc/apiv1/doc.go
+++ b/dataproc/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 4d3c28d..5557134 100644
--- a/dataproc/apiv1beta2/doc.go
+++ b/dataproc/apiv1beta2/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 274bcc5..452627f 100644
--- a/dataqna/apiv1alpha/doc.go
+++ b/dataqna/apiv1alpha/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 ece9930..9b7932f 100644
--- a/datastore/admin/apiv1/doc.go
+++ b/datastore/admin/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 6e6190e..456c0ec 100644
--- a/datastore/go.mod
+++ b/datastore/go.mod
@@ -4,11 +4,11 @@
require (
cloud.google.com/go v0.79.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
- google.golang.org/protobuf v1.25.0
+ google.golang.org/protobuf v1.26.0
)
diff --git a/datastore/go.sum b/datastore/go.sum
index c0f155b..ff8b42e 100644
--- a/datastore/go.sum
+++ b/datastore/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -218,8 +220,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -276,8 +279,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -362,8 +366,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -409,9 +413,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -439,8 +443,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go
index 0244ad3..ea98fb1 100644
--- a/debugger/apiv2/doc.go
+++ b/debugger/apiv2/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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
index ab16ca5..02c1fb9 100644
--- a/dialogflow/apiv2/answer_records_client.go
+++ b/dialogflow/apiv2/answer_records_client.go
@@ -104,7 +104,8 @@
// NewAnswerRecordsClient creates a new answer records client.
//
-// Service for managing AnswerRecords.
+// Service for managing
+// AnswerRecords.
func NewAnswerRecordsClient(ctx context.Context, opts ...option.ClientOption) (*AnswerRecordsClient, error) {
clientOpts := defaultAnswerRecordsClientOptions()
diff --git a/dialogflow/apiv2/conversations_client.go b/dialogflow/apiv2/conversations_client.go
index 3653d73..d937188 100644
--- a/dialogflow/apiv2/conversations_client.go
+++ b/dialogflow/apiv2/conversations_client.go
@@ -43,9 +43,6 @@
ListConversations []gax.CallOption
GetConversation []gax.CallOption
CompleteConversation []gax.CallOption
- CreateCallMatcher []gax.CallOption
- ListCallMatchers []gax.CallOption
- DeleteCallMatcher []gax.CallOption
ListMessages []gax.CallOption
}
@@ -107,39 +104,6 @@
})
}),
},
- 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{
@@ -356,88 +320,6 @@
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
@@ -482,53 +364,6 @@
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
diff --git a/dialogflow/apiv2/conversations_client_example_test.go b/dialogflow/apiv2/conversations_client_example_test.go
index 38a1c8d..dc7051c 100644
--- a/dialogflow/apiv2/conversations_client_example_test.go
+++ b/dialogflow/apiv2/conversations_client_example_test.go
@@ -121,69 +121,6 @@
_ = 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"
diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go
index 42eb613..a6a4a3e 100644
--- a/dialogflow/apiv2/doc.go
+++ b/dialogflow/apiv2/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/dialogflow/apiv2/gapic_metadata.json b/dialogflow/apiv2/gapic_metadata.json
index d0e7d9a..5931cf1 100644
--- a/dialogflow/apiv2/gapic_metadata.json
+++ b/dialogflow/apiv2/gapic_metadata.json
@@ -161,31 +161,16 @@
"CompleteConversation"
]
},
- "CreateCallMatcher": {
- "methods": [
- "CreateCallMatcher"
- ]
- },
"CreateConversation": {
"methods": [
"CreateConversation"
]
},
- "DeleteCallMatcher": {
- "methods": [
- "DeleteCallMatcher"
- ]
- },
"GetConversation": {
"methods": [
"GetConversation"
]
},
- "ListCallMatchers": {
- "methods": [
- "ListCallMatchers"
- ]
- },
"ListConversations": {
"methods": [
"ListConversations"
@@ -415,11 +400,6 @@
"ListParticipants"
]
},
- "StreamingAnalyzeContent": {
- "methods": [
- "StreamingAnalyzeContent"
- ]
- },
"SuggestArticles": {
"methods": [
"SuggestArticles"
diff --git a/dialogflow/apiv2/participants_client.go b/dialogflow/apiv2/participants_client.go
index 44f5451..966527a 100644
--- a/dialogflow/apiv2/participants_client.go
+++ b/dialogflow/apiv2/participants_client.go
@@ -39,14 +39,13 @@
// 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
+ CreateParticipant []gax.CallOption
+ GetParticipant []gax.CallOption
+ ListParticipants []gax.CallOption
+ UpdateParticipant []gax.CallOption
+ AnalyzeContent []gax.CallOption
+ SuggestArticles []gax.CallOption
+ SuggestFaqAnswers []gax.CallOption
}
func defaultParticipantsClientOptions() []option.ClientOption {
@@ -118,7 +117,6 @@
})
}),
},
- StreamingAnalyzeContent: []gax.CallOption{},
SuggestArticles: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
@@ -332,8 +330,8 @@
// 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)).
+// sent to virtual agents. See Versions and
+// environments (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)
@@ -355,36 +353,6 @@
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) {
diff --git a/dialogflow/apiv2/participants_client_example_test.go b/dialogflow/apiv2/participants_client_example_test.go
index 1748f8b..17723b2 100644
--- a/dialogflow/apiv2/participants_client_example_test.go
+++ b/dialogflow/apiv2/participants_client_example_test.go
@@ -18,7 +18,6 @@
import (
"context"
- "io"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
@@ -142,42 +141,6 @@
_ = 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"
diff --git a/dialogflow/cx/apiv3/agents_client.go b/dialogflow/cx/apiv3/agents_client.go
new file mode 100644
index 0000000..645d586
--- /dev/null
+++ b/dialogflow/cx/apiv3/agents_client.go
@@ -0,0 +1,660 @@
+// 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 cx
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ "github.com/golang/protobuf/proto"
+ structpb "github.com/golang/protobuf/ptypes/struct"
+ 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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newAgentsClientHook clientHook
+
+// AgentsCallOptions contains the retry settings for each method of AgentsClient.
+type AgentsCallOptions struct {
+ ListAgents []gax.CallOption
+ GetAgent []gax.CallOption
+ CreateAgent []gax.CallOption
+ UpdateAgent []gax.CallOption
+ DeleteAgent []gax.CallOption
+ ExportAgent []gax.CallOption
+ RestoreAgent []gax.CallOption
+ ValidateAgent []gax.CallOption
+ GetAgentValidationResult []gax.CallOption
+}
+
+func defaultAgentsClientOptions() []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 defaultAgentsCallOptions() *AgentsCallOptions {
+ return &AgentsCallOptions{
+ ListAgents: []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,
+ })
+ }),
+ },
+ GetAgent: []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,
+ })
+ }),
+ },
+ CreateAgent: []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,
+ })
+ }),
+ },
+ UpdateAgent: []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,
+ })
+ }),
+ },
+ DeleteAgent: []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,
+ })
+ }),
+ },
+ ExportAgent: []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,
+ })
+ }),
+ },
+ RestoreAgent: []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,
+ })
+ }),
+ },
+ ValidateAgent: []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,
+ })
+ }),
+ },
+ GetAgentValidationResult: []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,
+ })
+ }),
+ },
+ }
+}
+
+// AgentsClient 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 AgentsClient 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.
+ agentsClient cxpb.AgentsClient
+
+ // 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 *AgentsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewAgentsClient creates a new agents client.
+//
+// Service for managing Agents.
+func NewAgentsClient(ctx context.Context, opts ...option.ClientOption) (*AgentsClient, error) {
+ clientOpts := defaultAgentsClientOptions()
+
+ if newAgentsClientHook != nil {
+ hookOpts, err := newAgentsClientHook(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 := &AgentsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultAgentsCallOptions(),
+
+ agentsClient: cxpb.NewAgentsClient(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 *AgentsClient) 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 *AgentsClient) 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 *AgentsClient) 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...))
+}
+
+// ListAgents returns the list of all agents in the specified location.
+func (c *AgentsClient) ListAgents(ctx context.Context, req *cxpb.ListAgentsRequest, opts ...gax.CallOption) *AgentIterator {
+ 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.ListAgents[0:len(c.CallOptions.ListAgents):len(c.CallOptions.ListAgents)], opts...)
+ it := &AgentIterator{}
+ req = proto.Clone(req).(*cxpb.ListAgentsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Agent, string, error) {
+ var resp *cxpb.ListAgentsResponse
+ 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.agentsClient.ListAgents(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetAgents(), 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
+}
+
+// GetAgent retrieves the specified agent.
+func (c *AgentsClient) GetAgent(ctx context.Context, req *cxpb.GetAgentRequest, opts ...gax.CallOption) (*cxpb.Agent, 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.GetAgent[0:len(c.CallOptions.GetAgent):len(c.CallOptions.GetAgent)], opts...)
+ var resp *cxpb.Agent
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.GetAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateAgent creates an agent in the specified location.
+func (c *AgentsClient) CreateAgent(ctx context.Context, req *cxpb.CreateAgentRequest, opts ...gax.CallOption) (*cxpb.Agent, 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.CreateAgent[0:len(c.CallOptions.CreateAgent):len(c.CallOptions.CreateAgent)], opts...)
+ var resp *cxpb.Agent
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.CreateAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateAgent updates the specified agent.
+func (c *AgentsClient) UpdateAgent(ctx context.Context, req *cxpb.UpdateAgentRequest, opts ...gax.CallOption) (*cxpb.Agent, 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", "agent.name", url.QueryEscape(req.GetAgent().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateAgent[0:len(c.CallOptions.UpdateAgent):len(c.CallOptions.UpdateAgent)], opts...)
+ var resp *cxpb.Agent
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.UpdateAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteAgent deletes the specified agent.
+func (c *AgentsClient) DeleteAgent(ctx context.Context, req *cxpb.DeleteAgentRequest, 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.DeleteAgent[0:len(c.CallOptions.DeleteAgent):len(c.CallOptions.DeleteAgent)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.agentsClient.DeleteAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// ExportAgent exports the specified agent to a binary file.
+func (c *AgentsClient) ExportAgent(ctx context.Context, req *cxpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, 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.ExportAgent[0:len(c.CallOptions.ExportAgent):len(c.CallOptions.ExportAgent)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.ExportAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ExportAgentOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// RestoreAgent restores the specified agent from a binary file.
+//
+// Replaces the current agent with a new one. Note that all existing resources
+// in agent (e.g. intents, entity types, flows) will be removed.
+func (c *AgentsClient) RestoreAgent(ctx context.Context, req *cxpb.RestoreAgentRequest, opts ...gax.CallOption) (*RestoreAgentOperation, 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.RestoreAgent[0:len(c.CallOptions.RestoreAgent):len(c.CallOptions.RestoreAgent)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.RestoreAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &RestoreAgentOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// ValidateAgent validates the specified agent and creates or updates validation results.
+// The agent in draft version is validated. Please call this API after the
+// training is completed to get the complete validation results.
+func (c *AgentsClient) ValidateAgent(ctx context.Context, req *cxpb.ValidateAgentRequest, opts ...gax.CallOption) (*cxpb.AgentValidationResult, 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.ValidateAgent[0:len(c.CallOptions.ValidateAgent):len(c.CallOptions.ValidateAgent)], opts...)
+ var resp *cxpb.AgentValidationResult
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.ValidateAgent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetAgentValidationResult gets the latest agent validation result. Agent validation is performed
+// when ValidateAgent is called.
+func (c *AgentsClient) GetAgentValidationResult(ctx context.Context, req *cxpb.GetAgentValidationResultRequest, opts ...gax.CallOption) (*cxpb.AgentValidationResult, 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.GetAgentValidationResult[0:len(c.CallOptions.GetAgentValidationResult):len(c.CallOptions.GetAgentValidationResult)], opts...)
+ var resp *cxpb.AgentValidationResult
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.agentsClient.GetAgentValidationResult(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// ExportAgentOperation manages a long-running operation from ExportAgent.
+type ExportAgentOperation struct {
+ lro *longrunning.Operation
+}
+
+// ExportAgentOperation returns a new ExportAgentOperation from a given name.
+// The name must be that of a previously created ExportAgentOperation, possibly from a different process.
+func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation {
+ return &ExportAgentOperation{
+ 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 *ExportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.ExportAgentResponse, error) {
+ var resp cxpb.ExportAgentResponse
+ 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 *ExportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.ExportAgentResponse, error) {
+ var resp cxpb.ExportAgentResponse
+ 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 *ExportAgentOperation) Metadata() (*structpb.Struct, error) {
+ var meta structpb.Struct
+ 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 *ExportAgentOperation) 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 *ExportAgentOperation) Name() string {
+ return op.lro.Name()
+}
+
+// RestoreAgentOperation manages a long-running operation from RestoreAgent.
+type RestoreAgentOperation struct {
+ lro *longrunning.Operation
+}
+
+// RestoreAgentOperation returns a new RestoreAgentOperation from a given name.
+// The name must be that of a previously created RestoreAgentOperation, possibly from a different process.
+func (c *AgentsClient) RestoreAgentOperation(name string) *RestoreAgentOperation {
+ return &RestoreAgentOperation{
+ 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 *RestoreAgentOperation) 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 *RestoreAgentOperation) 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 *RestoreAgentOperation) Metadata() (*structpb.Struct, error) {
+ var meta structpb.Struct
+ 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 *RestoreAgentOperation) 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 *RestoreAgentOperation) Name() string {
+ return op.lro.Name()
+}
+
+// AgentIterator manages a stream of *cxpb.Agent.
+type AgentIterator struct {
+ items []*cxpb.Agent
+ 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 []*cxpb.Agent, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *AgentIterator) 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 *AgentIterator) Next() (*cxpb.Agent, error) {
+ var item *cxpb.Agent
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *AgentIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *AgentIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/agents_client_example_test.go b/dialogflow/cx/apiv3/agents_client_example_test.go
new file mode 100644
index 0000000..848ab2d
--- /dev/null
+++ b/dialogflow/cx/apiv3/agents_client_example_test.go
@@ -0,0 +1,226 @@
+// 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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewAgentsClient() {
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleAgentsClient_ListAgents() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListAgentsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListAgents(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleAgentsClient_GetAgent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleAgentsClient_CreateAgent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleAgentsClient_UpdateAgent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleAgentsClient_DeleteAgent() {
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleAgentsClient_ExportAgent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ExportAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ExportAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleAgentsClient_RestoreAgent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.RestoreAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.RestoreAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ err = op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleAgentsClient_ValidateAgent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ValidateAgentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.ValidateAgent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleAgentsClient_GetAgentValidationResult() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewAgentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetAgentValidationResultRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetAgentValidationResult(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/dialogflow/cx/apiv3/doc.go b/dialogflow/cx/apiv3/doc.go
new file mode 100644
index 0000000..a135435
--- /dev/null
+++ b/dialogflow/cx/apiv3/doc.go
@@ -0,0 +1,118 @@
+// 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 cx is an auto-generated package for the
+// Dialogflow API.
+//
+// Builds conversational interfaces (for example, chatbots, and voice-powered
+// apps and devices).
+//
+// Use of Context
+//
+// The ctx passed to NewClient is used for authentication requests and
+// for creating the underlying connection, but is not used for subsequent calls.
+// Individual methods on the client use the ctx given to them.
+//
+// To close the open connection, use the Close() method.
+//
+// For information about setting deadlines, reusing contexts, and more
+// please visit pkg.go.dev/cloud.google.com/go.
+package cx // import "cloud.google.com/go/dialogflow/cx/apiv3"
+
+import (
+ "context"
+ "os"
+ "runtime"
+ "strconv"
+ "strings"
+ "unicode"
+
+ "google.golang.org/api/option"
+ "google.golang.org/grpc/metadata"
+)
+
+// For more information on implementing a client constructor hook, see
+// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
+type clientHookParams struct{}
+type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
+
+const versionClient = "20210325"
+
+func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
+ out, _ := metadata.FromOutgoingContext(ctx)
+ out = out.Copy()
+ for _, md := range mds {
+ for k, v := range md {
+ out[k] = append(out[k], v...)
+ }
+ }
+ return metadata.NewOutgoingContext(ctx, out)
+}
+
+func checkDisableDeadlines() (bool, error) {
+ raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE")
+ if !ok {
+ return false, nil
+ }
+
+ b, err := strconv.ParseBool(raw)
+ return b, err
+}
+
+// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
+func DefaultAuthScopes() []string {
+ return []string{
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/dialogflow",
+ }
+}
+
+// versionGo returns the Go runtime version. The returned string
+// has no whitespace, suitable for reporting in header.
+func versionGo() string {
+ const develPrefix = "devel +"
+
+ s := runtime.Version()
+ if strings.HasPrefix(s, develPrefix) {
+ s = s[len(develPrefix):]
+ if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
+ s = s[:p]
+ }
+ return s
+ }
+
+ notSemverRune := func(r rune) bool {
+ return !strings.ContainsRune("0123456789.", r)
+ }
+
+ if strings.HasPrefix(s, "go1") {
+ s = s[2:]
+ var prerelease string
+ if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
+ s, prerelease = s[:p], s[p:]
+ }
+ if strings.HasSuffix(s, ".") {
+ s += "0"
+ } else if strings.Count(s, ".") < 2 {
+ s += ".0"
+ }
+ if prerelease != "" {
+ s += "-" + prerelease
+ }
+ return s
+ }
+ return "UNKNOWN"
+}
diff --git a/dialogflow/cx/apiv3/entity_types_client.go b/dialogflow/cx/apiv3/entity_types_client.go
new file mode 100644
index 0000000..1283b1a
--- /dev/null
+++ b/dialogflow/cx/apiv3/entity_types_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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newEntityTypesClientHook clientHook
+
+// EntityTypesCallOptions contains the retry settings for each method of EntityTypesClient.
+type EntityTypesCallOptions struct {
+ ListEntityTypes []gax.CallOption
+ GetEntityType []gax.CallOption
+ CreateEntityType []gax.CallOption
+ UpdateEntityType []gax.CallOption
+ DeleteEntityType []gax.CallOption
+}
+
+func defaultEntityTypesClientOptions() []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 defaultEntityTypesCallOptions() *EntityTypesCallOptions {
+ return &EntityTypesCallOptions{
+ ListEntityTypes: []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,
+ })
+ }),
+ },
+ GetEntityType: []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,
+ })
+ }),
+ },
+ CreateEntityType: []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,
+ })
+ }),
+ },
+ UpdateEntityType: []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,
+ })
+ }),
+ },
+ DeleteEntityType: []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,
+ })
+ }),
+ },
+ }
+}
+
+// EntityTypesClient 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 EntityTypesClient 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.
+ entityTypesClient cxpb.EntityTypesClient
+
+ // The call options for this service.
+ CallOptions *EntityTypesCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewEntityTypesClient creates a new entity types client.
+//
+// Service for managing EntityTypes.
+func NewEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error) {
+ clientOpts := defaultEntityTypesClientOptions()
+
+ if newEntityTypesClientHook != nil {
+ hookOpts, err := newEntityTypesClientHook(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 := &EntityTypesClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultEntityTypesCallOptions(),
+
+ entityTypesClient: cxpb.NewEntityTypesClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *EntityTypesClient) 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 *EntityTypesClient) 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 *EntityTypesClient) 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...))
+}
+
+// ListEntityTypes returns the list of all entity types in the specified agent.
+func (c *EntityTypesClient) ListEntityTypes(ctx context.Context, req *cxpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator {
+ 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.ListEntityTypes[0:len(c.CallOptions.ListEntityTypes):len(c.CallOptions.ListEntityTypes)], opts...)
+ it := &EntityTypeIterator{}
+ req = proto.Clone(req).(*cxpb.ListEntityTypesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.EntityType, string, error) {
+ var resp *cxpb.ListEntityTypesResponse
+ 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.entityTypesClient.ListEntityTypes(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetEntityTypes(), 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
+}
+
+// GetEntityType retrieves the specified entity type.
+func (c *EntityTypesClient) GetEntityType(ctx context.Context, req *cxpb.GetEntityTypeRequest, opts ...gax.CallOption) (*cxpb.EntityType, 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.GetEntityType[0:len(c.CallOptions.GetEntityType):len(c.CallOptions.GetEntityType)], opts...)
+ var resp *cxpb.EntityType
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.entityTypesClient.GetEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateEntityType creates an entity type in the specified agent.
+func (c *EntityTypesClient) CreateEntityType(ctx context.Context, req *cxpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*cxpb.EntityType, 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.CreateEntityType[0:len(c.CallOptions.CreateEntityType):len(c.CallOptions.CreateEntityType)], opts...)
+ var resp *cxpb.EntityType
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.entityTypesClient.CreateEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateEntityType updates the specified entity type.
+func (c *EntityTypesClient) UpdateEntityType(ctx context.Context, req *cxpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*cxpb.EntityType, 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", "entity_type.name", url.QueryEscape(req.GetEntityType().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateEntityType[0:len(c.CallOptions.UpdateEntityType):len(c.CallOptions.UpdateEntityType)], opts...)
+ var resp *cxpb.EntityType
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.entityTypesClient.UpdateEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteEntityType deletes the specified entity type.
+func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *cxpb.DeleteEntityTypeRequest, 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.DeleteEntityType[0:len(c.CallOptions.DeleteEntityType):len(c.CallOptions.DeleteEntityType)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.entityTypesClient.DeleteEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// EntityTypeIterator manages a stream of *cxpb.EntityType.
+type EntityTypeIterator struct {
+ items []*cxpb.EntityType
+ 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 []*cxpb.EntityType, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *EntityTypeIterator) 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 *EntityTypeIterator) Next() (*cxpb.EntityType, error) {
+ var item *cxpb.EntityType
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *EntityTypeIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *EntityTypeIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/entity_types_client_example_test.go b/dialogflow/cx/apiv3/entity_types_client_example_test.go
new file mode 100644
index 0000000..8f54b09
--- /dev/null
+++ b/dialogflow/cx/apiv3/entity_types_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewEntityTypesClient() {
+ ctx := context.Background()
+ c, err := cx.NewEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleEntityTypesClient_ListEntityTypes() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListEntityTypesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListEntityTypes(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleEntityTypesClient_GetEntityType() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleEntityTypesClient_CreateEntityType() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleEntityTypesClient_UpdateEntityType() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleEntityTypesClient_DeleteEntityType() {
+ ctx := context.Background()
+ c, err := cx.NewEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/environments_client.go b/dialogflow/cx/apiv3/environments_client.go
new file mode 100644
index 0000000..3aeeb5e
--- /dev/null
+++ b/dialogflow/cx/apiv3/environments_client.go
@@ -0,0 +1,582 @@
+// 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 cx
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ "github.com/golang/protobuf/proto"
+ structpb "github.com/golang/protobuf/ptypes/struct"
+ 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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newEnvironmentsClientHook clientHook
+
+// EnvironmentsCallOptions contains the retry settings for each method of EnvironmentsClient.
+type EnvironmentsCallOptions struct {
+ ListEnvironments []gax.CallOption
+ GetEnvironment []gax.CallOption
+ CreateEnvironment []gax.CallOption
+ UpdateEnvironment []gax.CallOption
+ DeleteEnvironment []gax.CallOption
+ LookupEnvironmentHistory []gax.CallOption
+}
+
+func defaultEnvironmentsClientOptions() []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 defaultEnvironmentsCallOptions() *EnvironmentsCallOptions {
+ return &EnvironmentsCallOptions{
+ ListEnvironments: []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,
+ })
+ }),
+ },
+ GetEnvironment: []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,
+ })
+ }),
+ },
+ CreateEnvironment: []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,
+ })
+ }),
+ },
+ UpdateEnvironment: []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,
+ })
+ }),
+ },
+ DeleteEnvironment: []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,
+ })
+ }),
+ },
+ LookupEnvironmentHistory: []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,
+ })
+ }),
+ },
+ }
+}
+
+// EnvironmentsClient 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 EnvironmentsClient 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.
+ environmentsClient cxpb.EnvironmentsClient
+
+ // 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 *EnvironmentsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewEnvironmentsClient creates a new environments client.
+//
+// Service for managing Environments.
+func NewEnvironmentsClient(ctx context.Context, opts ...option.ClientOption) (*EnvironmentsClient, error) {
+ clientOpts := defaultEnvironmentsClientOptions()
+
+ if newEnvironmentsClientHook != nil {
+ hookOpts, err := newEnvironmentsClientHook(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 := &EnvironmentsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultEnvironmentsCallOptions(),
+
+ environmentsClient: cxpb.NewEnvironmentsClient(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 *EnvironmentsClient) 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 *EnvironmentsClient) 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 *EnvironmentsClient) 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...))
+}
+
+// ListEnvironments returns the list of all environments in the specified Agent.
+func (c *EnvironmentsClient) ListEnvironments(ctx context.Context, req *cxpb.ListEnvironmentsRequest, opts ...gax.CallOption) *EnvironmentIterator {
+ 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.ListEnvironments[0:len(c.CallOptions.ListEnvironments):len(c.CallOptions.ListEnvironments)], opts...)
+ it := &EnvironmentIterator{}
+ req = proto.Clone(req).(*cxpb.ListEnvironmentsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Environment, string, error) {
+ var resp *cxpb.ListEnvironmentsResponse
+ 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.environmentsClient.ListEnvironments(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetEnvironments(), 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
+}
+
+// GetEnvironment retrieves the specified Environment.
+func (c *EnvironmentsClient) GetEnvironment(ctx context.Context, req *cxpb.GetEnvironmentRequest, opts ...gax.CallOption) (*cxpb.Environment, 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.GetEnvironment[0:len(c.CallOptions.GetEnvironment):len(c.CallOptions.GetEnvironment)], opts...)
+ var resp *cxpb.Environment
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.environmentsClient.GetEnvironment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateEnvironment creates an Environment in the specified Agent.
+func (c *EnvironmentsClient) CreateEnvironment(ctx context.Context, req *cxpb.CreateEnvironmentRequest, opts ...gax.CallOption) (*CreateEnvironmentOperation, 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.CreateEnvironment[0:len(c.CallOptions.CreateEnvironment):len(c.CallOptions.CreateEnvironment)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.environmentsClient.CreateEnvironment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &CreateEnvironmentOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// UpdateEnvironment updates the specified Environment.
+func (c *EnvironmentsClient) UpdateEnvironment(ctx context.Context, req *cxpb.UpdateEnvironmentRequest, opts ...gax.CallOption) (*UpdateEnvironmentOperation, 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", "environment.name", url.QueryEscape(req.GetEnvironment().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateEnvironment[0:len(c.CallOptions.UpdateEnvironment):len(c.CallOptions.UpdateEnvironment)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.environmentsClient.UpdateEnvironment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &UpdateEnvironmentOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// DeleteEnvironment deletes the specified Environment.
+func (c *EnvironmentsClient) DeleteEnvironment(ctx context.Context, req *cxpb.DeleteEnvironmentRequest, 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.DeleteEnvironment[0:len(c.CallOptions.DeleteEnvironment):len(c.CallOptions.DeleteEnvironment)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.environmentsClient.DeleteEnvironment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// LookupEnvironmentHistory looks up the history of the specified Environment.
+func (c *EnvironmentsClient) LookupEnvironmentHistory(ctx context.Context, req *cxpb.LookupEnvironmentHistoryRequest, opts ...gax.CallOption) *EnvironmentIterator {
+ 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.LookupEnvironmentHistory[0:len(c.CallOptions.LookupEnvironmentHistory):len(c.CallOptions.LookupEnvironmentHistory)], opts...)
+ it := &EnvironmentIterator{}
+ req = proto.Clone(req).(*cxpb.LookupEnvironmentHistoryRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Environment, string, error) {
+ var resp *cxpb.LookupEnvironmentHistoryResponse
+ 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.environmentsClient.LookupEnvironmentHistory(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetEnvironments(), 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
+}
+
+// CreateEnvironmentOperation manages a long-running operation from CreateEnvironment.
+type CreateEnvironmentOperation struct {
+ lro *longrunning.Operation
+}
+
+// CreateEnvironmentOperation returns a new CreateEnvironmentOperation from a given name.
+// The name must be that of a previously created CreateEnvironmentOperation, possibly from a different process.
+func (c *EnvironmentsClient) CreateEnvironmentOperation(name string) *CreateEnvironmentOperation {
+ return &CreateEnvironmentOperation{
+ 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 *CreateEnvironmentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.Environment, error) {
+ var resp cxpb.Environment
+ 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 *CreateEnvironmentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.Environment, error) {
+ var resp cxpb.Environment
+ 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 *CreateEnvironmentOperation) Metadata() (*structpb.Struct, error) {
+ var meta structpb.Struct
+ 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 *CreateEnvironmentOperation) 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 *CreateEnvironmentOperation) Name() string {
+ return op.lro.Name()
+}
+
+// UpdateEnvironmentOperation manages a long-running operation from UpdateEnvironment.
+type UpdateEnvironmentOperation struct {
+ lro *longrunning.Operation
+}
+
+// UpdateEnvironmentOperation returns a new UpdateEnvironmentOperation from a given name.
+// The name must be that of a previously created UpdateEnvironmentOperation, possibly from a different process.
+func (c *EnvironmentsClient) UpdateEnvironmentOperation(name string) *UpdateEnvironmentOperation {
+ return &UpdateEnvironmentOperation{
+ 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 *UpdateEnvironmentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.Environment, error) {
+ var resp cxpb.Environment
+ 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 *UpdateEnvironmentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.Environment, error) {
+ var resp cxpb.Environment
+ 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 *UpdateEnvironmentOperation) Metadata() (*structpb.Struct, error) {
+ var meta structpb.Struct
+ 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 *UpdateEnvironmentOperation) 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 *UpdateEnvironmentOperation) Name() string {
+ return op.lro.Name()
+}
+
+// EnvironmentIterator manages a stream of *cxpb.Environment.
+type EnvironmentIterator struct {
+ items []*cxpb.Environment
+ 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 []*cxpb.Environment, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *EnvironmentIterator) 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 *EnvironmentIterator) Next() (*cxpb.Environment, error) {
+ var item *cxpb.Environment
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *EnvironmentIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *EnvironmentIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/environments_client_example_test.go b/dialogflow/cx/apiv3/environments_client_example_test.go
new file mode 100644
index 0000000..d948246
--- /dev/null
+++ b/dialogflow/cx/apiv3/environments_client_example_test.go
@@ -0,0 +1,175 @@
+// 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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewEnvironmentsClient() {
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleEnvironmentsClient_ListEnvironments() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListEnvironmentsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListEnvironments(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleEnvironmentsClient_GetEnvironment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetEnvironmentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetEnvironment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleEnvironmentsClient_CreateEnvironment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateEnvironmentRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.CreateEnvironment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleEnvironmentsClient_UpdateEnvironment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateEnvironmentRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.UpdateEnvironment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleEnvironmentsClient_DeleteEnvironment() {
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteEnvironmentRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteEnvironment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleEnvironmentsClient_LookupEnvironmentHistory() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewEnvironmentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.LookupEnvironmentHistoryRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.LookupEnvironmentHistory(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/cx/apiv3/experiments_client.go b/dialogflow/cx/apiv3/experiments_client.go
new file mode 100644
index 0000000..390c542
--- /dev/null
+++ b/dialogflow/cx/apiv3/experiments_client.go
@@ -0,0 +1,438 @@
+// 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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newExperimentsClientHook clientHook
+
+// ExperimentsCallOptions contains the retry settings for each method of ExperimentsClient.
+type ExperimentsCallOptions struct {
+ ListExperiments []gax.CallOption
+ GetExperiment []gax.CallOption
+ CreateExperiment []gax.CallOption
+ UpdateExperiment []gax.CallOption
+ DeleteExperiment []gax.CallOption
+ StartExperiment []gax.CallOption
+ StopExperiment []gax.CallOption
+}
+
+func defaultExperimentsClientOptions() []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 defaultExperimentsCallOptions() *ExperimentsCallOptions {
+ return &ExperimentsCallOptions{
+ ListExperiments: []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,
+ })
+ }),
+ },
+ GetExperiment: []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,
+ })
+ }),
+ },
+ CreateExperiment: []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,
+ })
+ }),
+ },
+ UpdateExperiment: []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,
+ })
+ }),
+ },
+ DeleteExperiment: []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,
+ })
+ }),
+ },
+ StartExperiment: []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,
+ })
+ }),
+ },
+ StopExperiment: []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,
+ })
+ }),
+ },
+ }
+}
+
+// ExperimentsClient 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 ExperimentsClient 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.
+ experimentsClient cxpb.ExperimentsClient
+
+ // The call options for this service.
+ CallOptions *ExperimentsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewExperimentsClient creates a new experiments client.
+//
+// Service for managing Experiments.
+func NewExperimentsClient(ctx context.Context, opts ...option.ClientOption) (*ExperimentsClient, error) {
+ clientOpts := defaultExperimentsClientOptions()
+
+ if newExperimentsClientHook != nil {
+ hookOpts, err := newExperimentsClientHook(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 := &ExperimentsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultExperimentsCallOptions(),
+
+ experimentsClient: cxpb.NewExperimentsClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *ExperimentsClient) 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 *ExperimentsClient) 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 *ExperimentsClient) 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...))
+}
+
+// ListExperiments returns the list of all experiments in the specified Environment.
+func (c *ExperimentsClient) ListExperiments(ctx context.Context, req *cxpb.ListExperimentsRequest, opts ...gax.CallOption) *ExperimentIterator {
+ 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.ListExperiments[0:len(c.CallOptions.ListExperiments):len(c.CallOptions.ListExperiments)], opts...)
+ it := &ExperimentIterator{}
+ req = proto.Clone(req).(*cxpb.ListExperimentsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Experiment, string, error) {
+ var resp *cxpb.ListExperimentsResponse
+ 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.experimentsClient.ListExperiments(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetExperiments(), 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
+}
+
+// GetExperiment retrieves the specified Experiment.
+func (c *ExperimentsClient) GetExperiment(ctx context.Context, req *cxpb.GetExperimentRequest, opts ...gax.CallOption) (*cxpb.Experiment, 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.GetExperiment[0:len(c.CallOptions.GetExperiment):len(c.CallOptions.GetExperiment)], opts...)
+ var resp *cxpb.Experiment
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.experimentsClient.GetExperiment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateExperiment creates an Experiment in the specified Environment.
+func (c *ExperimentsClient) CreateExperiment(ctx context.Context, req *cxpb.CreateExperimentRequest, opts ...gax.CallOption) (*cxpb.Experiment, 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.CreateExperiment[0:len(c.CallOptions.CreateExperiment):len(c.CallOptions.CreateExperiment)], opts...)
+ var resp *cxpb.Experiment
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.experimentsClient.CreateExperiment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateExperiment updates the specified Experiment.
+func (c *ExperimentsClient) UpdateExperiment(ctx context.Context, req *cxpb.UpdateExperimentRequest, opts ...gax.CallOption) (*cxpb.Experiment, 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", "experiment.name", url.QueryEscape(req.GetExperiment().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateExperiment[0:len(c.CallOptions.UpdateExperiment):len(c.CallOptions.UpdateExperiment)], opts...)
+ var resp *cxpb.Experiment
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.experimentsClient.UpdateExperiment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteExperiment deletes the specified Experiment.
+func (c *ExperimentsClient) DeleteExperiment(ctx context.Context, req *cxpb.DeleteExperimentRequest, 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.DeleteExperiment[0:len(c.CallOptions.DeleteExperiment):len(c.CallOptions.DeleteExperiment)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.experimentsClient.DeleteExperiment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// StartExperiment starts the specified Experiment. This rpc only changes the state of
+// experiment from PENDING to RUNNING.
+func (c *ExperimentsClient) StartExperiment(ctx context.Context, req *cxpb.StartExperimentRequest, opts ...gax.CallOption) (*cxpb.Experiment, 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.StartExperiment[0:len(c.CallOptions.StartExperiment):len(c.CallOptions.StartExperiment)], opts...)
+ var resp *cxpb.Experiment
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.experimentsClient.StartExperiment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// StopExperiment stops the specified Experiment. This rpc only changes the state of
+// experiment from RUNNING to DONE.
+func (c *ExperimentsClient) StopExperiment(ctx context.Context, req *cxpb.StopExperimentRequest, opts ...gax.CallOption) (*cxpb.Experiment, 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.StopExperiment[0:len(c.CallOptions.StopExperiment):len(c.CallOptions.StopExperiment)], opts...)
+ var resp *cxpb.Experiment
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.experimentsClient.StopExperiment(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// ExperimentIterator manages a stream of *cxpb.Experiment.
+type ExperimentIterator struct {
+ items []*cxpb.Experiment
+ 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 []*cxpb.Experiment, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *ExperimentIterator) 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 *ExperimentIterator) Next() (*cxpb.Experiment, error) {
+ var item *cxpb.Experiment
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *ExperimentIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *ExperimentIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/experiments_client_example_test.go b/dialogflow/cx/apiv3/experiments_client_example_test.go
new file mode 100644
index 0000000..bc8efcc
--- /dev/null
+++ b/dialogflow/cx/apiv3/experiments_client_example_test.go
@@ -0,0 +1,178 @@
+// 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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewExperimentsClient() {
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleExperimentsClient_ListExperiments() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListExperimentsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListExperiments(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleExperimentsClient_GetExperiment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetExperimentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetExperiment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleExperimentsClient_CreateExperiment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateExperimentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateExperiment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleExperimentsClient_UpdateExperiment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateExperimentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateExperiment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleExperimentsClient_DeleteExperiment() {
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteExperimentRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteExperiment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleExperimentsClient_StartExperiment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.StartExperimentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.StartExperiment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleExperimentsClient_StopExperiment() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewExperimentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.StopExperimentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.StopExperiment(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/dialogflow/cx/apiv3/flows_client.go b/dialogflow/cx/apiv3/flows_client.go
new file mode 100644
index 0000000..83f713d
--- /dev/null
+++ b/dialogflow/cx/apiv3/flows_client.go
@@ -0,0 +1,553 @@
+// 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 cx
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ "github.com/golang/protobuf/proto"
+ structpb "github.com/golang/protobuf/ptypes/struct"
+ 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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newFlowsClientHook clientHook
+
+// FlowsCallOptions contains the retry settings for each method of FlowsClient.
+type FlowsCallOptions struct {
+ CreateFlow []gax.CallOption
+ DeleteFlow []gax.CallOption
+ ListFlows []gax.CallOption
+ GetFlow []gax.CallOption
+ UpdateFlow []gax.CallOption
+ TrainFlow []gax.CallOption
+ ValidateFlow []gax.CallOption
+ GetFlowValidationResult []gax.CallOption
+}
+
+func defaultFlowsClientOptions() []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 defaultFlowsCallOptions() *FlowsCallOptions {
+ return &FlowsCallOptions{
+ CreateFlow: []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,
+ })
+ }),
+ },
+ DeleteFlow: []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,
+ })
+ }),
+ },
+ ListFlows: []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,
+ })
+ }),
+ },
+ GetFlow: []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,
+ })
+ }),
+ },
+ UpdateFlow: []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,
+ })
+ }),
+ },
+ TrainFlow: []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,
+ })
+ }),
+ },
+ ValidateFlow: []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,
+ })
+ }),
+ },
+ GetFlowValidationResult: []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,
+ })
+ }),
+ },
+ }
+}
+
+// FlowsClient 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 FlowsClient 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.
+ flowsClient cxpb.FlowsClient
+
+ // 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 *FlowsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewFlowsClient creates a new flows client.
+//
+// Service for managing Flows.
+func NewFlowsClient(ctx context.Context, opts ...option.ClientOption) (*FlowsClient, error) {
+ clientOpts := defaultFlowsClientOptions()
+
+ if newFlowsClientHook != nil {
+ hookOpts, err := newFlowsClientHook(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 := &FlowsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultFlowsCallOptions(),
+
+ flowsClient: cxpb.NewFlowsClient(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 *FlowsClient) 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 *FlowsClient) 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 *FlowsClient) 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...))
+}
+
+// CreateFlow creates a flow in the specified agent.
+func (c *FlowsClient) CreateFlow(ctx context.Context, req *cxpb.CreateFlowRequest, opts ...gax.CallOption) (*cxpb.Flow, 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.CreateFlow[0:len(c.CallOptions.CreateFlow):len(c.CallOptions.CreateFlow)], opts...)
+ var resp *cxpb.Flow
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.flowsClient.CreateFlow(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteFlow deletes a specified flow.
+func (c *FlowsClient) DeleteFlow(ctx context.Context, req *cxpb.DeleteFlowRequest, 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.DeleteFlow[0:len(c.CallOptions.DeleteFlow):len(c.CallOptions.DeleteFlow)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.flowsClient.DeleteFlow(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// ListFlows returns the list of all flows in the specified agent.
+func (c *FlowsClient) ListFlows(ctx context.Context, req *cxpb.ListFlowsRequest, opts ...gax.CallOption) *FlowIterator {
+ 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.ListFlows[0:len(c.CallOptions.ListFlows):len(c.CallOptions.ListFlows)], opts...)
+ it := &FlowIterator{}
+ req = proto.Clone(req).(*cxpb.ListFlowsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Flow, string, error) {
+ var resp *cxpb.ListFlowsResponse
+ 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.flowsClient.ListFlows(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetFlows(), 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
+}
+
+// GetFlow retrieves the specified flow.
+func (c *FlowsClient) GetFlow(ctx context.Context, req *cxpb.GetFlowRequest, opts ...gax.CallOption) (*cxpb.Flow, 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.GetFlow[0:len(c.CallOptions.GetFlow):len(c.CallOptions.GetFlow)], opts...)
+ var resp *cxpb.Flow
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.flowsClient.GetFlow(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateFlow updates the specified flow.
+func (c *FlowsClient) UpdateFlow(ctx context.Context, req *cxpb.UpdateFlowRequest, opts ...gax.CallOption) (*cxpb.Flow, 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", "flow.name", url.QueryEscape(req.GetFlow().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateFlow[0:len(c.CallOptions.UpdateFlow):len(c.CallOptions.UpdateFlow)], opts...)
+ var resp *cxpb.Flow
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.flowsClient.UpdateFlow(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// TrainFlow trains the specified flow. Note that only the flow in ‘draft’ environment
+// is trained.
+func (c *FlowsClient) TrainFlow(ctx context.Context, req *cxpb.TrainFlowRequest, opts ...gax.CallOption) (*TrainFlowOperation, 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.TrainFlow[0:len(c.CallOptions.TrainFlow):len(c.CallOptions.TrainFlow)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.flowsClient.TrainFlow(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &TrainFlowOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// ValidateFlow validates the specified flow and creates or updates validation results.
+// Please call this API after the training is completed to get the complete
+// validation results.
+func (c *FlowsClient) ValidateFlow(ctx context.Context, req *cxpb.ValidateFlowRequest, opts ...gax.CallOption) (*cxpb.FlowValidationResult, 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.ValidateFlow[0:len(c.CallOptions.ValidateFlow):len(c.CallOptions.ValidateFlow)], opts...)
+ var resp *cxpb.FlowValidationResult
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.flowsClient.ValidateFlow(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetFlowValidationResult gets the latest flow validation result. Flow validation is performed
+// when ValidateFlow is called.
+func (c *FlowsClient) GetFlowValidationResult(ctx context.Context, req *cxpb.GetFlowValidationResultRequest, opts ...gax.CallOption) (*cxpb.FlowValidationResult, 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.GetFlowValidationResult[0:len(c.CallOptions.GetFlowValidationResult):len(c.CallOptions.GetFlowValidationResult)], opts...)
+ var resp *cxpb.FlowValidationResult
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.flowsClient.GetFlowValidationResult(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// TrainFlowOperation manages a long-running operation from TrainFlow.
+type TrainFlowOperation struct {
+ lro *longrunning.Operation
+}
+
+// TrainFlowOperation returns a new TrainFlowOperation from a given name.
+// The name must be that of a previously created TrainFlowOperation, possibly from a different process.
+func (c *FlowsClient) TrainFlowOperation(name string) *TrainFlowOperation {
+ return &TrainFlowOperation{
+ 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 *TrainFlowOperation) 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 *TrainFlowOperation) 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 *TrainFlowOperation) Metadata() (*structpb.Struct, error) {
+ var meta structpb.Struct
+ 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 *TrainFlowOperation) 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 *TrainFlowOperation) Name() string {
+ return op.lro.Name()
+}
+
+// FlowIterator manages a stream of *cxpb.Flow.
+type FlowIterator struct {
+ items []*cxpb.Flow
+ 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 []*cxpb.Flow, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *FlowIterator) 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 *FlowIterator) Next() (*cxpb.Flow, error) {
+ var item *cxpb.Flow
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *FlowIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *FlowIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/flows_client_example_test.go b/dialogflow/cx/apiv3/flows_client_example_test.go
new file mode 100644
index 0000000..f2464ee
--- /dev/null
+++ b/dialogflow/cx/apiv3/flows_client_example_test.go
@@ -0,0 +1,201 @@
+// 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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewFlowsClient() {
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleFlowsClient_CreateFlow() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateFlowRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateFlow(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleFlowsClient_DeleteFlow() {
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteFlowRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteFlow(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleFlowsClient_ListFlows() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListFlowsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListFlows(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleFlowsClient_GetFlow() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetFlowRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetFlow(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleFlowsClient_UpdateFlow() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateFlowRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateFlow(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleFlowsClient_TrainFlow() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.TrainFlowRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.TrainFlow(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ err = op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleFlowsClient_ValidateFlow() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ValidateFlowRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.ValidateFlow(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleFlowsClient_GetFlowValidationResult() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewFlowsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetFlowValidationResultRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetFlowValidationResult(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/dialogflow/cx/apiv3/gapic_metadata.json b/dialogflow/cx/apiv3/gapic_metadata.json
new file mode 100644
index 0000000..f2febe9
--- /dev/null
+++ b/dialogflow/cx/apiv3/gapic_metadata.json
@@ -0,0 +1,570 @@
+{
+ "schema": "1.0",
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.",
+ "language": "go",
+ "protoPackage": "google.cloud.dialogflow.cx.v3",
+ "libraryPackage": "cloud.google.com/go/dialogflow/cx/apiv3",
+ "services": {
+ "Agents": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "AgentsClient",
+ "rpcs": {
+ "CreateAgent": {
+ "methods": [
+ "CreateAgent"
+ ]
+ },
+ "DeleteAgent": {
+ "methods": [
+ "DeleteAgent"
+ ]
+ },
+ "ExportAgent": {
+ "methods": [
+ "ExportAgent"
+ ]
+ },
+ "GetAgent": {
+ "methods": [
+ "GetAgent"
+ ]
+ },
+ "GetAgentValidationResult": {
+ "methods": [
+ "GetAgentValidationResult"
+ ]
+ },
+ "ListAgents": {
+ "methods": [
+ "ListAgents"
+ ]
+ },
+ "RestoreAgent": {
+ "methods": [
+ "RestoreAgent"
+ ]
+ },
+ "UpdateAgent": {
+ "methods": [
+ "UpdateAgent"
+ ]
+ },
+ "ValidateAgent": {
+ "methods": [
+ "ValidateAgent"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "EntityTypes": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "EntityTypesClient",
+ "rpcs": {
+ "CreateEntityType": {
+ "methods": [
+ "CreateEntityType"
+ ]
+ },
+ "DeleteEntityType": {
+ "methods": [
+ "DeleteEntityType"
+ ]
+ },
+ "GetEntityType": {
+ "methods": [
+ "GetEntityType"
+ ]
+ },
+ "ListEntityTypes": {
+ "methods": [
+ "ListEntityTypes"
+ ]
+ },
+ "UpdateEntityType": {
+ "methods": [
+ "UpdateEntityType"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Environments": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "EnvironmentsClient",
+ "rpcs": {
+ "CreateEnvironment": {
+ "methods": [
+ "CreateEnvironment"
+ ]
+ },
+ "DeleteEnvironment": {
+ "methods": [
+ "DeleteEnvironment"
+ ]
+ },
+ "GetEnvironment": {
+ "methods": [
+ "GetEnvironment"
+ ]
+ },
+ "ListEnvironments": {
+ "methods": [
+ "ListEnvironments"
+ ]
+ },
+ "LookupEnvironmentHistory": {
+ "methods": [
+ "LookupEnvironmentHistory"
+ ]
+ },
+ "UpdateEnvironment": {
+ "methods": [
+ "UpdateEnvironment"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Experiments": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "ExperimentsClient",
+ "rpcs": {
+ "CreateExperiment": {
+ "methods": [
+ "CreateExperiment"
+ ]
+ },
+ "DeleteExperiment": {
+ "methods": [
+ "DeleteExperiment"
+ ]
+ },
+ "GetExperiment": {
+ "methods": [
+ "GetExperiment"
+ ]
+ },
+ "ListExperiments": {
+ "methods": [
+ "ListExperiments"
+ ]
+ },
+ "StartExperiment": {
+ "methods": [
+ "StartExperiment"
+ ]
+ },
+ "StopExperiment": {
+ "methods": [
+ "StopExperiment"
+ ]
+ },
+ "UpdateExperiment": {
+ "methods": [
+ "UpdateExperiment"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Flows": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "FlowsClient",
+ "rpcs": {
+ "CreateFlow": {
+ "methods": [
+ "CreateFlow"
+ ]
+ },
+ "DeleteFlow": {
+ "methods": [
+ "DeleteFlow"
+ ]
+ },
+ "GetFlow": {
+ "methods": [
+ "GetFlow"
+ ]
+ },
+ "GetFlowValidationResult": {
+ "methods": [
+ "GetFlowValidationResult"
+ ]
+ },
+ "ListFlows": {
+ "methods": [
+ "ListFlows"
+ ]
+ },
+ "TrainFlow": {
+ "methods": [
+ "TrainFlow"
+ ]
+ },
+ "UpdateFlow": {
+ "methods": [
+ "UpdateFlow"
+ ]
+ },
+ "ValidateFlow": {
+ "methods": [
+ "ValidateFlow"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Intents": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "IntentsClient",
+ "rpcs": {
+ "CreateIntent": {
+ "methods": [
+ "CreateIntent"
+ ]
+ },
+ "DeleteIntent": {
+ "methods": [
+ "DeleteIntent"
+ ]
+ },
+ "GetIntent": {
+ "methods": [
+ "GetIntent"
+ ]
+ },
+ "ListIntents": {
+ "methods": [
+ "ListIntents"
+ ]
+ },
+ "UpdateIntent": {
+ "methods": [
+ "UpdateIntent"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Pages": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "PagesClient",
+ "rpcs": {
+ "CreatePage": {
+ "methods": [
+ "CreatePage"
+ ]
+ },
+ "DeletePage": {
+ "methods": [
+ "DeletePage"
+ ]
+ },
+ "GetPage": {
+ "methods": [
+ "GetPage"
+ ]
+ },
+ "ListPages": {
+ "methods": [
+ "ListPages"
+ ]
+ },
+ "UpdatePage": {
+ "methods": [
+ "UpdatePage"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "SecuritySettingsService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "SecuritySettingsClient",
+ "rpcs": {
+ "CreateSecuritySettings": {
+ "methods": [
+ "CreateSecuritySettings"
+ ]
+ },
+ "DeleteSecuritySettings": {
+ "methods": [
+ "DeleteSecuritySettings"
+ ]
+ },
+ "GetSecuritySettings": {
+ "methods": [
+ "GetSecuritySettings"
+ ]
+ },
+ "ListSecuritySettings": {
+ "methods": [
+ "ListSecuritySettings"
+ ]
+ },
+ "UpdateSecuritySettings": {
+ "methods": [
+ "UpdateSecuritySettings"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "SessionEntityTypes": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "SessionEntityTypesClient",
+ "rpcs": {
+ "CreateSessionEntityType": {
+ "methods": [
+ "CreateSessionEntityType"
+ ]
+ },
+ "DeleteSessionEntityType": {
+ "methods": [
+ "DeleteSessionEntityType"
+ ]
+ },
+ "GetSessionEntityType": {
+ "methods": [
+ "GetSessionEntityType"
+ ]
+ },
+ "ListSessionEntityTypes": {
+ "methods": [
+ "ListSessionEntityTypes"
+ ]
+ },
+ "UpdateSessionEntityType": {
+ "methods": [
+ "UpdateSessionEntityType"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Sessions": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "SessionsClient",
+ "rpcs": {
+ "DetectIntent": {
+ "methods": [
+ "DetectIntent"
+ ]
+ },
+ "FulfillIntent": {
+ "methods": [
+ "FulfillIntent"
+ ]
+ },
+ "MatchIntent": {
+ "methods": [
+ "MatchIntent"
+ ]
+ },
+ "StreamingDetectIntent": {
+ "methods": [
+ "StreamingDetectIntent"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "TestCases": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "TestCasesClient",
+ "rpcs": {
+ "BatchDeleteTestCases": {
+ "methods": [
+ "BatchDeleteTestCases"
+ ]
+ },
+ "BatchRunTestCases": {
+ "methods": [
+ "BatchRunTestCases"
+ ]
+ },
+ "CalculateCoverage": {
+ "methods": [
+ "CalculateCoverage"
+ ]
+ },
+ "CreateTestCase": {
+ "methods": [
+ "CreateTestCase"
+ ]
+ },
+ "ExportTestCases": {
+ "methods": [
+ "ExportTestCases"
+ ]
+ },
+ "GetTestCase": {
+ "methods": [
+ "GetTestCase"
+ ]
+ },
+ "GetTestCaseResult": {
+ "methods": [
+ "GetTestCaseResult"
+ ]
+ },
+ "ImportTestCases": {
+ "methods": [
+ "ImportTestCases"
+ ]
+ },
+ "ListTestCaseResults": {
+ "methods": [
+ "ListTestCaseResults"
+ ]
+ },
+ "ListTestCases": {
+ "methods": [
+ "ListTestCases"
+ ]
+ },
+ "RunTestCase": {
+ "methods": [
+ "RunTestCase"
+ ]
+ },
+ "UpdateTestCase": {
+ "methods": [
+ "UpdateTestCase"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "TransitionRouteGroups": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "TransitionRouteGroupsClient",
+ "rpcs": {
+ "CreateTransitionRouteGroup": {
+ "methods": [
+ "CreateTransitionRouteGroup"
+ ]
+ },
+ "DeleteTransitionRouteGroup": {
+ "methods": [
+ "DeleteTransitionRouteGroup"
+ ]
+ },
+ "GetTransitionRouteGroup": {
+ "methods": [
+ "GetTransitionRouteGroup"
+ ]
+ },
+ "ListTransitionRouteGroups": {
+ "methods": [
+ "ListTransitionRouteGroups"
+ ]
+ },
+ "UpdateTransitionRouteGroup": {
+ "methods": [
+ "UpdateTransitionRouteGroup"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Versions": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "VersionsClient",
+ "rpcs": {
+ "CreateVersion": {
+ "methods": [
+ "CreateVersion"
+ ]
+ },
+ "DeleteVersion": {
+ "methods": [
+ "DeleteVersion"
+ ]
+ },
+ "GetVersion": {
+ "methods": [
+ "GetVersion"
+ ]
+ },
+ "ListVersions": {
+ "methods": [
+ "ListVersions"
+ ]
+ },
+ "LoadVersion": {
+ "methods": [
+ "LoadVersion"
+ ]
+ },
+ "UpdateVersion": {
+ "methods": [
+ "UpdateVersion"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "Webhooks": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "WebhooksClient",
+ "rpcs": {
+ "CreateWebhook": {
+ "methods": [
+ "CreateWebhook"
+ ]
+ },
+ "DeleteWebhook": {
+ "methods": [
+ "DeleteWebhook"
+ ]
+ },
+ "GetWebhook": {
+ "methods": [
+ "GetWebhook"
+ ]
+ },
+ "ListWebhooks": {
+ "methods": [
+ "ListWebhooks"
+ ]
+ },
+ "UpdateWebhook": {
+ "methods": [
+ "UpdateWebhook"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/dialogflow/cx/apiv3/intents_client.go b/dialogflow/cx/apiv3/intents_client.go
new file mode 100644
index 0000000..10774e8
--- /dev/null
+++ b/dialogflow/cx/apiv3/intents_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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newIntentsClientHook clientHook
+
+// IntentsCallOptions contains the retry settings for each method of IntentsClient.
+type IntentsCallOptions struct {
+ ListIntents []gax.CallOption
+ GetIntent []gax.CallOption
+ CreateIntent []gax.CallOption
+ UpdateIntent []gax.CallOption
+ DeleteIntent []gax.CallOption
+}
+
+func defaultIntentsClientOptions() []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 defaultIntentsCallOptions() *IntentsCallOptions {
+ return &IntentsCallOptions{
+ ListIntents: []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,
+ })
+ }),
+ },
+ GetIntent: []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,
+ })
+ }),
+ },
+ CreateIntent: []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,
+ })
+ }),
+ },
+ UpdateIntent: []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,
+ })
+ }),
+ },
+ DeleteIntent: []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,
+ })
+ }),
+ },
+ }
+}
+
+// IntentsClient 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 IntentsClient 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.
+ intentsClient cxpb.IntentsClient
+
+ // The call options for this service.
+ CallOptions *IntentsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewIntentsClient creates a new intents client.
+//
+// Service for managing Intents.
+func NewIntentsClient(ctx context.Context, opts ...option.ClientOption) (*IntentsClient, error) {
+ clientOpts := defaultIntentsClientOptions()
+
+ if newIntentsClientHook != nil {
+ hookOpts, err := newIntentsClientHook(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 := &IntentsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultIntentsCallOptions(),
+
+ intentsClient: cxpb.NewIntentsClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *IntentsClient) 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 *IntentsClient) 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 *IntentsClient) 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...))
+}
+
+// ListIntents returns the list of all intents in the specified agent.
+func (c *IntentsClient) ListIntents(ctx context.Context, req *cxpb.ListIntentsRequest, opts ...gax.CallOption) *IntentIterator {
+ 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.ListIntents[0:len(c.CallOptions.ListIntents):len(c.CallOptions.ListIntents)], opts...)
+ it := &IntentIterator{}
+ req = proto.Clone(req).(*cxpb.ListIntentsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Intent, string, error) {
+ var resp *cxpb.ListIntentsResponse
+ 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.intentsClient.ListIntents(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetIntents(), 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
+}
+
+// GetIntent retrieves the specified intent.
+func (c *IntentsClient) GetIntent(ctx context.Context, req *cxpb.GetIntentRequest, opts ...gax.CallOption) (*cxpb.Intent, 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.GetIntent[0:len(c.CallOptions.GetIntent):len(c.CallOptions.GetIntent)], opts...)
+ var resp *cxpb.Intent
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.intentsClient.GetIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateIntent creates an intent in the specified agent.
+func (c *IntentsClient) CreateIntent(ctx context.Context, req *cxpb.CreateIntentRequest, opts ...gax.CallOption) (*cxpb.Intent, 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.CreateIntent[0:len(c.CallOptions.CreateIntent):len(c.CallOptions.CreateIntent)], opts...)
+ var resp *cxpb.Intent
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.intentsClient.CreateIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateIntent updates the specified intent.
+func (c *IntentsClient) UpdateIntent(ctx context.Context, req *cxpb.UpdateIntentRequest, opts ...gax.CallOption) (*cxpb.Intent, 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", "intent.name", url.QueryEscape(req.GetIntent().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateIntent[0:len(c.CallOptions.UpdateIntent):len(c.CallOptions.UpdateIntent)], opts...)
+ var resp *cxpb.Intent
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.intentsClient.UpdateIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteIntent deletes the specified intent.
+func (c *IntentsClient) DeleteIntent(ctx context.Context, req *cxpb.DeleteIntentRequest, 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.DeleteIntent[0:len(c.CallOptions.DeleteIntent):len(c.CallOptions.DeleteIntent)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.intentsClient.DeleteIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// IntentIterator manages a stream of *cxpb.Intent.
+type IntentIterator struct {
+ items []*cxpb.Intent
+ 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 []*cxpb.Intent, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *IntentIterator) 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 *IntentIterator) Next() (*cxpb.Intent, error) {
+ var item *cxpb.Intent
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *IntentIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *IntentIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/intents_client_example_test.go b/dialogflow/cx/apiv3/intents_client_example_test.go
new file mode 100644
index 0000000..804ebd2
--- /dev/null
+++ b/dialogflow/cx/apiv3/intents_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewIntentsClient() {
+ ctx := context.Background()
+ c, err := cx.NewIntentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleIntentsClient_ListIntents() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewIntentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListIntentsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListIntents(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleIntentsClient_GetIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewIntentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleIntentsClient_CreateIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewIntentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleIntentsClient_UpdateIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewIntentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleIntentsClient_DeleteIntent() {
+ ctx := context.Background()
+ c, err := cx.NewIntentsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/pages_client.go b/dialogflow/cx/apiv3/pages_client.go
new file mode 100644
index 0000000..8df429c
--- /dev/null
+++ b/dialogflow/cx/apiv3/pages_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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newPagesClientHook clientHook
+
+// PagesCallOptions contains the retry settings for each method of PagesClient.
+type PagesCallOptions struct {
+ ListPages []gax.CallOption
+ GetPage []gax.CallOption
+ CreatePage []gax.CallOption
+ UpdatePage []gax.CallOption
+ DeletePage []gax.CallOption
+}
+
+func defaultPagesClientOptions() []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 defaultPagesCallOptions() *PagesCallOptions {
+ return &PagesCallOptions{
+ ListPages: []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,
+ })
+ }),
+ },
+ GetPage: []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,
+ })
+ }),
+ },
+ CreatePage: []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,
+ })
+ }),
+ },
+ UpdatePage: []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,
+ })
+ }),
+ },
+ DeletePage: []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,
+ })
+ }),
+ },
+ }
+}
+
+// PagesClient 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 PagesClient 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.
+ pagesClient cxpb.PagesClient
+
+ // The call options for this service.
+ CallOptions *PagesCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewPagesClient creates a new pages client.
+//
+// Service for managing [Pages][google.cloud.dialogflow.cx.v3.Page (at http://google.cloud.dialogflow.cx.v3.Page)].
+func NewPagesClient(ctx context.Context, opts ...option.ClientOption) (*PagesClient, error) {
+ clientOpts := defaultPagesClientOptions()
+
+ if newPagesClientHook != nil {
+ hookOpts, err := newPagesClientHook(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 := &PagesClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultPagesCallOptions(),
+
+ pagesClient: cxpb.NewPagesClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *PagesClient) 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 *PagesClient) 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 *PagesClient) 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...))
+}
+
+// ListPages returns the list of all pages in the specified flow.
+func (c *PagesClient) ListPages(ctx context.Context, req *cxpb.ListPagesRequest, opts ...gax.CallOption) *PageIterator {
+ 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.ListPages[0:len(c.CallOptions.ListPages):len(c.CallOptions.ListPages)], opts...)
+ it := &PageIterator{}
+ req = proto.Clone(req).(*cxpb.ListPagesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Page, string, error) {
+ var resp *cxpb.ListPagesResponse
+ 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.pagesClient.ListPages(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetPages(), 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
+}
+
+// GetPage retrieves the specified page.
+func (c *PagesClient) GetPage(ctx context.Context, req *cxpb.GetPageRequest, opts ...gax.CallOption) (*cxpb.Page, 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.GetPage[0:len(c.CallOptions.GetPage):len(c.CallOptions.GetPage)], opts...)
+ var resp *cxpb.Page
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.pagesClient.GetPage(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreatePage creates a page in the specified flow.
+func (c *PagesClient) CreatePage(ctx context.Context, req *cxpb.CreatePageRequest, opts ...gax.CallOption) (*cxpb.Page, 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.CreatePage[0:len(c.CallOptions.CreatePage):len(c.CallOptions.CreatePage)], opts...)
+ var resp *cxpb.Page
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.pagesClient.CreatePage(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdatePage updates the specified page.
+func (c *PagesClient) UpdatePage(ctx context.Context, req *cxpb.UpdatePageRequest, opts ...gax.CallOption) (*cxpb.Page, 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", "page.name", url.QueryEscape(req.GetPage().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdatePage[0:len(c.CallOptions.UpdatePage):len(c.CallOptions.UpdatePage)], opts...)
+ var resp *cxpb.Page
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.pagesClient.UpdatePage(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeletePage deletes the specified page.
+func (c *PagesClient) DeletePage(ctx context.Context, req *cxpb.DeletePageRequest, 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.DeletePage[0:len(c.CallOptions.DeletePage):len(c.CallOptions.DeletePage)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.pagesClient.DeletePage(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// PageIterator manages a stream of *cxpb.Page.
+type PageIterator struct {
+ items []*cxpb.Page
+ 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 []*cxpb.Page, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *PageIterator) 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 *PageIterator) Next() (*cxpb.Page, error) {
+ var item *cxpb.Page
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *PageIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *PageIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/pages_client_example_test.go b/dialogflow/cx/apiv3/pages_client_example_test.go
new file mode 100644
index 0000000..51f8840
--- /dev/null
+++ b/dialogflow/cx/apiv3/pages_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewPagesClient() {
+ ctx := context.Background()
+ c, err := cx.NewPagesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExamplePagesClient_ListPages() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewPagesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListPagesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListPages(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExamplePagesClient_GetPage() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewPagesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetPageRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetPage(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExamplePagesClient_CreatePage() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewPagesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreatePageRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreatePage(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExamplePagesClient_UpdatePage() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewPagesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdatePageRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdatePage(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExamplePagesClient_DeletePage() {
+ ctx := context.Background()
+ c, err := cx.NewPagesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeletePageRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeletePage(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/security_settings_client.go b/dialogflow/cx/apiv3/security_settings_client.go
new file mode 100644
index 0000000..e548a1c
--- /dev/null
+++ b/dialogflow/cx/apiv3/security_settings_client.go
@@ -0,0 +1,369 @@
+// 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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newSecuritySettingsClientHook clientHook
+
+// SecuritySettingsCallOptions contains the retry settings for each method of SecuritySettingsClient.
+type SecuritySettingsCallOptions struct {
+ CreateSecuritySettings []gax.CallOption
+ GetSecuritySettings []gax.CallOption
+ UpdateSecuritySettings []gax.CallOption
+ ListSecuritySettings []gax.CallOption
+ DeleteSecuritySettings []gax.CallOption
+}
+
+func defaultSecuritySettingsClientOptions() []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 defaultSecuritySettingsCallOptions() *SecuritySettingsCallOptions {
+ return &SecuritySettingsCallOptions{
+ CreateSecuritySettings: []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,
+ })
+ }),
+ },
+ GetSecuritySettings: []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,
+ })
+ }),
+ },
+ UpdateSecuritySettings: []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,
+ })
+ }),
+ },
+ ListSecuritySettings: []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,
+ })
+ }),
+ },
+ DeleteSecuritySettings: []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,
+ })
+ }),
+ },
+ }
+}
+
+// SecuritySettingsClient 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 SecuritySettingsClient 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.
+ securitySettingsClient cxpb.SecuritySettingsServiceClient
+
+ // The call options for this service.
+ CallOptions *SecuritySettingsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewSecuritySettingsClient creates a new security settings service client.
+//
+// Service for managing security settings for Dialogflow.
+func NewSecuritySettingsClient(ctx context.Context, opts ...option.ClientOption) (*SecuritySettingsClient, error) {
+ clientOpts := defaultSecuritySettingsClientOptions()
+
+ if newSecuritySettingsClientHook != nil {
+ hookOpts, err := newSecuritySettingsClientHook(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 := &SecuritySettingsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultSecuritySettingsCallOptions(),
+
+ securitySettingsClient: cxpb.NewSecuritySettingsServiceClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *SecuritySettingsClient) 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 *SecuritySettingsClient) 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 *SecuritySettingsClient) 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...))
+}
+
+// CreateSecuritySettings create security settings in the specified location.
+func (c *SecuritySettingsClient) CreateSecuritySettings(ctx context.Context, req *cxpb.CreateSecuritySettingsRequest, opts ...gax.CallOption) (*cxpb.SecuritySettings, 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.CreateSecuritySettings[0:len(c.CallOptions.CreateSecuritySettings):len(c.CallOptions.CreateSecuritySettings)], opts...)
+ var resp *cxpb.SecuritySettings
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.securitySettingsClient.CreateSecuritySettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetSecuritySettings retrieves the specified SecuritySettings.
+// The returned settings may be stale by up to 1 minute.
+func (c *SecuritySettingsClient) GetSecuritySettings(ctx context.Context, req *cxpb.GetSecuritySettingsRequest, opts ...gax.CallOption) (*cxpb.SecuritySettings, 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.GetSecuritySettings[0:len(c.CallOptions.GetSecuritySettings):len(c.CallOptions.GetSecuritySettings)], opts...)
+ var resp *cxpb.SecuritySettings
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.securitySettingsClient.GetSecuritySettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateSecuritySettings updates the specified SecuritySettings.
+func (c *SecuritySettingsClient) UpdateSecuritySettings(ctx context.Context, req *cxpb.UpdateSecuritySettingsRequest, opts ...gax.CallOption) (*cxpb.SecuritySettings, 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", "security_settings.name", url.QueryEscape(req.GetSecuritySettings().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateSecuritySettings[0:len(c.CallOptions.UpdateSecuritySettings):len(c.CallOptions.UpdateSecuritySettings)], opts...)
+ var resp *cxpb.SecuritySettings
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.securitySettingsClient.UpdateSecuritySettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// ListSecuritySettings returns the list of all security settings in the specified location.
+func (c *SecuritySettingsClient) ListSecuritySettings(ctx context.Context, req *cxpb.ListSecuritySettingsRequest, opts ...gax.CallOption) *SecuritySettingsIterator {
+ 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.ListSecuritySettings[0:len(c.CallOptions.ListSecuritySettings):len(c.CallOptions.ListSecuritySettings)], opts...)
+ it := &SecuritySettingsIterator{}
+ req = proto.Clone(req).(*cxpb.ListSecuritySettingsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.SecuritySettings, string, error) {
+ var resp *cxpb.ListSecuritySettingsResponse
+ 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.securitySettingsClient.ListSecuritySettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetSecuritySettings(), 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
+}
+
+// DeleteSecuritySettings deletes the specified SecuritySettings.
+func (c *SecuritySettingsClient) DeleteSecuritySettings(ctx context.Context, req *cxpb.DeleteSecuritySettingsRequest, 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.DeleteSecuritySettings[0:len(c.CallOptions.DeleteSecuritySettings):len(c.CallOptions.DeleteSecuritySettings)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.securitySettingsClient.DeleteSecuritySettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// SecuritySettingsIterator manages a stream of *cxpb.SecuritySettings.
+type SecuritySettingsIterator struct {
+ items []*cxpb.SecuritySettings
+ 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 []*cxpb.SecuritySettings, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *SecuritySettingsIterator) 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 *SecuritySettingsIterator) Next() (*cxpb.SecuritySettings, error) {
+ var item *cxpb.SecuritySettings
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *SecuritySettingsIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *SecuritySettingsIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/security_settings_client_example_test.go b/dialogflow/cx/apiv3/security_settings_client_example_test.go
new file mode 100644
index 0000000..cd299ce
--- /dev/null
+++ b/dialogflow/cx/apiv3/security_settings_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewSecuritySettingsClient() {
+ ctx := context.Background()
+ c, err := cx.NewSecuritySettingsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleSecuritySettingsClient_CreateSecuritySettings() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSecuritySettingsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateSecuritySettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateSecuritySettings(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSecuritySettingsClient_GetSecuritySettings() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSecuritySettingsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetSecuritySettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetSecuritySettings(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSecuritySettingsClient_UpdateSecuritySettings() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSecuritySettingsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateSecuritySettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateSecuritySettings(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSecuritySettingsClient_ListSecuritySettings() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewSecuritySettingsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListSecuritySettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListSecuritySettings(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleSecuritySettingsClient_DeleteSecuritySettings() {
+ ctx := context.Background()
+ c, err := cx.NewSecuritySettingsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteSecuritySettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteSecuritySettings(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/session_entity_types_client.go b/dialogflow/cx/apiv3/session_entity_types_client.go
new file mode 100644
index 0000000..3b2e90a
--- /dev/null
+++ b/dialogflow/cx/apiv3/session_entity_types_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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newSessionEntityTypesClientHook clientHook
+
+// SessionEntityTypesCallOptions contains the retry settings for each method of SessionEntityTypesClient.
+type SessionEntityTypesCallOptions struct {
+ ListSessionEntityTypes []gax.CallOption
+ GetSessionEntityType []gax.CallOption
+ CreateSessionEntityType []gax.CallOption
+ UpdateSessionEntityType []gax.CallOption
+ DeleteSessionEntityType []gax.CallOption
+}
+
+func defaultSessionEntityTypesClientOptions() []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 defaultSessionEntityTypesCallOptions() *SessionEntityTypesCallOptions {
+ return &SessionEntityTypesCallOptions{
+ ListSessionEntityTypes: []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,
+ })
+ }),
+ },
+ GetSessionEntityType: []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,
+ })
+ }),
+ },
+ CreateSessionEntityType: []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,
+ })
+ }),
+ },
+ UpdateSessionEntityType: []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,
+ })
+ }),
+ },
+ DeleteSessionEntityType: []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,
+ })
+ }),
+ },
+ }
+}
+
+// SessionEntityTypesClient 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 SessionEntityTypesClient 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.
+ sessionEntityTypesClient cxpb.SessionEntityTypesClient
+
+ // The call options for this service.
+ CallOptions *SessionEntityTypesCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewSessionEntityTypesClient creates a new session entity types client.
+//
+// Service for managing SessionEntityTypes.
+func NewSessionEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*SessionEntityTypesClient, error) {
+ clientOpts := defaultSessionEntityTypesClientOptions()
+
+ if newSessionEntityTypesClientHook != nil {
+ hookOpts, err := newSessionEntityTypesClientHook(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 := &SessionEntityTypesClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultSessionEntityTypesCallOptions(),
+
+ sessionEntityTypesClient: cxpb.NewSessionEntityTypesClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *SessionEntityTypesClient) 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 *SessionEntityTypesClient) 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 *SessionEntityTypesClient) 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...))
+}
+
+// ListSessionEntityTypes returns the list of all session entity types in the specified session.
+func (c *SessionEntityTypesClient) ListSessionEntityTypes(ctx context.Context, req *cxpb.ListSessionEntityTypesRequest, opts ...gax.CallOption) *SessionEntityTypeIterator {
+ 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.ListSessionEntityTypes[0:len(c.CallOptions.ListSessionEntityTypes):len(c.CallOptions.ListSessionEntityTypes)], opts...)
+ it := &SessionEntityTypeIterator{}
+ req = proto.Clone(req).(*cxpb.ListSessionEntityTypesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.SessionEntityType, string, error) {
+ var resp *cxpb.ListSessionEntityTypesResponse
+ 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.sessionEntityTypesClient.ListSessionEntityTypes(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetSessionEntityTypes(), 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
+}
+
+// GetSessionEntityType retrieves the specified session entity type.
+func (c *SessionEntityTypesClient) GetSessionEntityType(ctx context.Context, req *cxpb.GetSessionEntityTypeRequest, opts ...gax.CallOption) (*cxpb.SessionEntityType, 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.GetSessionEntityType[0:len(c.CallOptions.GetSessionEntityType):len(c.CallOptions.GetSessionEntityType)], opts...)
+ var resp *cxpb.SessionEntityType
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionEntityTypesClient.GetSessionEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateSessionEntityType creates a session entity type.
+func (c *SessionEntityTypesClient) CreateSessionEntityType(ctx context.Context, req *cxpb.CreateSessionEntityTypeRequest, opts ...gax.CallOption) (*cxpb.SessionEntityType, 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.CreateSessionEntityType[0:len(c.CallOptions.CreateSessionEntityType):len(c.CallOptions.CreateSessionEntityType)], opts...)
+ var resp *cxpb.SessionEntityType
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionEntityTypesClient.CreateSessionEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateSessionEntityType updates the specified session entity type.
+func (c *SessionEntityTypesClient) UpdateSessionEntityType(ctx context.Context, req *cxpb.UpdateSessionEntityTypeRequest, opts ...gax.CallOption) (*cxpb.SessionEntityType, 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", "session_entity_type.name", url.QueryEscape(req.GetSessionEntityType().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateSessionEntityType[0:len(c.CallOptions.UpdateSessionEntityType):len(c.CallOptions.UpdateSessionEntityType)], opts...)
+ var resp *cxpb.SessionEntityType
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionEntityTypesClient.UpdateSessionEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteSessionEntityType deletes the specified session entity type.
+func (c *SessionEntityTypesClient) DeleteSessionEntityType(ctx context.Context, req *cxpb.DeleteSessionEntityTypeRequest, 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.DeleteSessionEntityType[0:len(c.CallOptions.DeleteSessionEntityType):len(c.CallOptions.DeleteSessionEntityType)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.sessionEntityTypesClient.DeleteSessionEntityType(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// SessionEntityTypeIterator manages a stream of *cxpb.SessionEntityType.
+type SessionEntityTypeIterator struct {
+ items []*cxpb.SessionEntityType
+ 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 []*cxpb.SessionEntityType, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *SessionEntityTypeIterator) 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 *SessionEntityTypeIterator) Next() (*cxpb.SessionEntityType, error) {
+ var item *cxpb.SessionEntityType
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *SessionEntityTypeIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *SessionEntityTypeIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/session_entity_types_client_example_test.go b/dialogflow/cx/apiv3/session_entity_types_client_example_test.go
new file mode 100644
index 0000000..eea7879
--- /dev/null
+++ b/dialogflow/cx/apiv3/session_entity_types_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewSessionEntityTypesClient() {
+ ctx := context.Background()
+ c, err := cx.NewSessionEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleSessionEntityTypesClient_ListSessionEntityTypes() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListSessionEntityTypesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListSessionEntityTypes(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleSessionEntityTypesClient_GetSessionEntityType() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetSessionEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetSessionEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSessionEntityTypesClient_CreateSessionEntityType() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateSessionEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateSessionEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSessionEntityTypesClient_UpdateSessionEntityType() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateSessionEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateSessionEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSessionEntityTypesClient_DeleteSessionEntityType() {
+ ctx := context.Background()
+ c, err := cx.NewSessionEntityTypesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteSessionEntityTypeRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteSessionEntityType(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/sessions_client.go b/dialogflow/cx/apiv3/sessions_client.go
new file mode 100644
index 0000000..3a7b8fa
--- /dev/null
+++ b/dialogflow/cx/apiv3/sessions_client.go
@@ -0,0 +1,272 @@
+// 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 cx
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ gax "github.com/googleapis/gax-go/v2"
+ "google.golang.org/api/option"
+ "google.golang.org/api/option/internaloption"
+ gtransport "google.golang.org/api/transport/grpc"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newSessionsClientHook clientHook
+
+// SessionsCallOptions contains the retry settings for each method of SessionsClient.
+type SessionsCallOptions struct {
+ DetectIntent []gax.CallOption
+ StreamingDetectIntent []gax.CallOption
+ MatchIntent []gax.CallOption
+ FulfillIntent []gax.CallOption
+}
+
+func defaultSessionsClientOptions() []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 defaultSessionsCallOptions() *SessionsCallOptions {
+ return &SessionsCallOptions{
+ DetectIntent: []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,
+ })
+ }),
+ },
+ StreamingDetectIntent: []gax.CallOption{},
+ MatchIntent: []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,
+ })
+ }),
+ },
+ FulfillIntent: []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,
+ })
+ }),
+ },
+ }
+}
+
+// SessionsClient 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 SessionsClient 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.
+ sessionsClient cxpb.SessionsClient
+
+ // The call options for this service.
+ CallOptions *SessionsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewSessionsClient creates a new sessions client.
+//
+// A session represents an interaction with a user. You retrieve user input
+// and pass it to the DetectIntent method to determine
+// user intent and respond.
+func NewSessionsClient(ctx context.Context, opts ...option.ClientOption) (*SessionsClient, error) {
+ clientOpts := defaultSessionsClientOptions()
+
+ if newSessionsClientHook != nil {
+ hookOpts, err := newSessionsClientHook(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 := &SessionsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultSessionsCallOptions(),
+
+ sessionsClient: cxpb.NewSessionsClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *SessionsClient) 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 *SessionsClient) 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 *SessionsClient) 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...))
+}
+
+// DetectIntent processes a natural language query and returns structured, actionable data
+// as a result. This method is not idempotent, because it may cause session
+// entity types to be updated, which in turn might affect results of future
+// queries.
+//
+// Note: Always use agent versions for production traffic.
+// See Versions and
+// environments (at https://cloud.google.com/dialogflow/cx/docs/concept/version).
+func (c *SessionsClient) DetectIntent(ctx context.Context, req *cxpb.DetectIntentRequest, opts ...gax.CallOption) (*cxpb.DetectIntentResponse, 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", "session", url.QueryEscape(req.GetSession())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.DetectIntent[0:len(c.CallOptions.DetectIntent):len(c.CallOptions.DetectIntent)], opts...)
+ var resp *cxpb.DetectIntentResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionsClient.DetectIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// StreamingDetectIntent processes a natural language query in audio format in a streaming fashion
+// and returns structured, actionable data as a result. This method is only
+// available via the gRPC API (not REST).
+//
+// Note: Always use agent versions for production traffic.
+// See Versions and
+// environments (at https://cloud.google.com/dialogflow/cx/docs/concept/version).
+func (c *SessionsClient) StreamingDetectIntent(ctx context.Context, opts ...gax.CallOption) (cxpb.Sessions_StreamingDetectIntentClient, error) {
+ ctx = insertMetadata(ctx, c.xGoogMetadata)
+ opts = append(c.CallOptions.StreamingDetectIntent[0:len(c.CallOptions.StreamingDetectIntent):len(c.CallOptions.StreamingDetectIntent)], opts...)
+ var resp cxpb.Sessions_StreamingDetectIntentClient
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionsClient.StreamingDetectIntent(ctx, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// MatchIntent returns preliminary intent match results, doesn’t change the session
+// status.
+func (c *SessionsClient) MatchIntent(ctx context.Context, req *cxpb.MatchIntentRequest, opts ...gax.CallOption) (*cxpb.MatchIntentResponse, 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", "session", url.QueryEscape(req.GetSession())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.MatchIntent[0:len(c.CallOptions.MatchIntent):len(c.CallOptions.MatchIntent)], opts...)
+ var resp *cxpb.MatchIntentResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionsClient.MatchIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// FulfillIntent fulfills a matched intent returned by MatchIntent.
+// Must be called after MatchIntent, with input from
+// MatchIntentResponse. Otherwise, the behavior is undefined.
+func (c *SessionsClient) FulfillIntent(ctx context.Context, req *cxpb.FulfillIntentRequest, opts ...gax.CallOption) (*cxpb.FulfillIntentResponse, 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", "match_intent_request.session", url.QueryEscape(req.GetMatchIntentRequest().GetSession())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.FulfillIntent[0:len(c.CallOptions.FulfillIntent):len(c.CallOptions.FulfillIntent)], opts...)
+ var resp *cxpb.FulfillIntentResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.sessionsClient.FulfillIntent(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
diff --git a/dialogflow/cx/apiv3/sessions_client_example_test.go b/dialogflow/cx/apiv3/sessions_client_example_test.go
new file mode 100644
index 0000000..8c36fa9
--- /dev/null
+++ b/dialogflow/cx/apiv3/sessions_client_example_test.go
@@ -0,0 +1,131 @@
+// 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 cx_test
+
+import (
+ "context"
+ "io"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewSessionsClient() {
+ ctx := context.Background()
+ c, err := cx.NewSessionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleSessionsClient_DetectIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DetectIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.DetectIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSessionsClient_StreamingDetectIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ stream, err := c.StreamingDetectIntent(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ go func() {
+ reqs := []*cxpb.StreamingDetectIntentRequest{
+ // 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 ExampleSessionsClient_MatchIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.MatchIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.MatchIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleSessionsClient_FulfillIntent() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewSessionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.FulfillIntentRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.FulfillIntent(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/dialogflow/cx/apiv3/test_cases_client.go b/dialogflow/cx/apiv3/test_cases_client.go
new file mode 100644
index 0000000..53d7f5b
--- /dev/null
+++ b/dialogflow/cx/apiv3/test_cases_client.go
@@ -0,0 +1,978 @@
+// 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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newTestCasesClientHook clientHook
+
+// TestCasesCallOptions contains the retry settings for each method of TestCasesClient.
+type TestCasesCallOptions struct {
+ ListTestCases []gax.CallOption
+ BatchDeleteTestCases []gax.CallOption
+ GetTestCase []gax.CallOption
+ CreateTestCase []gax.CallOption
+ UpdateTestCase []gax.CallOption
+ RunTestCase []gax.CallOption
+ BatchRunTestCases []gax.CallOption
+ CalculateCoverage []gax.CallOption
+ ImportTestCases []gax.CallOption
+ ExportTestCases []gax.CallOption
+ ListTestCaseResults []gax.CallOption
+ GetTestCaseResult []gax.CallOption
+}
+
+func defaultTestCasesClientOptions() []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 defaultTestCasesCallOptions() *TestCasesCallOptions {
+ return &TestCasesCallOptions{
+ ListTestCases: []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,
+ })
+ }),
+ },
+ BatchDeleteTestCases: []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,
+ })
+ }),
+ },
+ GetTestCase: []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,
+ })
+ }),
+ },
+ CreateTestCase: []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,
+ })
+ }),
+ },
+ UpdateTestCase: []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,
+ })
+ }),
+ },
+ RunTestCase: []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,
+ })
+ }),
+ },
+ BatchRunTestCases: []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,
+ })
+ }),
+ },
+ CalculateCoverage: []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,
+ })
+ }),
+ },
+ ImportTestCases: []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,
+ })
+ }),
+ },
+ ExportTestCases: []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,
+ })
+ }),
+ },
+ ListTestCaseResults: []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,
+ })
+ }),
+ },
+ GetTestCaseResult: []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,
+ })
+ }),
+ },
+ }
+}
+
+// TestCasesClient 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 TestCasesClient 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.
+ testCasesClient cxpb.TestCasesClient
+
+ // 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 *TestCasesCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewTestCasesClient creates a new test cases client.
+//
+// Service for managing [Test Cases][google.cloud.dialogflow.cx.v3.TestCase] and
+// [Test Case Results][google.cloud.dialogflow.cx.v3.TestCaseResult].
+func NewTestCasesClient(ctx context.Context, opts ...option.ClientOption) (*TestCasesClient, error) {
+ clientOpts := defaultTestCasesClientOptions()
+
+ if newTestCasesClientHook != nil {
+ hookOpts, err := newTestCasesClientHook(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 := &TestCasesClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultTestCasesCallOptions(),
+
+ testCasesClient: cxpb.NewTestCasesClient(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 *TestCasesClient) 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 *TestCasesClient) 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 *TestCasesClient) 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...))
+}
+
+// ListTestCases fetches a list of test cases for a given agent.
+func (c *TestCasesClient) ListTestCases(ctx context.Context, req *cxpb.ListTestCasesRequest, opts ...gax.CallOption) *TestCaseIterator {
+ 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.ListTestCases[0:len(c.CallOptions.ListTestCases):len(c.CallOptions.ListTestCases)], opts...)
+ it := &TestCaseIterator{}
+ req = proto.Clone(req).(*cxpb.ListTestCasesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.TestCase, string, error) {
+ var resp *cxpb.ListTestCasesResponse
+ 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.testCasesClient.ListTestCases(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetTestCases(), 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
+}
+
+// BatchDeleteTestCases batch deletes test cases.
+func (c *TestCasesClient) BatchDeleteTestCases(ctx context.Context, req *cxpb.BatchDeleteTestCasesRequest, 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", "parent", url.QueryEscape(req.GetParent())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.BatchDeleteTestCases[0:len(c.CallOptions.BatchDeleteTestCases):len(c.CallOptions.BatchDeleteTestCases)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.testCasesClient.BatchDeleteTestCases(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// GetTestCase gets a test case.
+func (c *TestCasesClient) GetTestCase(ctx context.Context, req *cxpb.GetTestCaseRequest, opts ...gax.CallOption) (*cxpb.TestCase, 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.GetTestCase[0:len(c.CallOptions.GetTestCase):len(c.CallOptions.GetTestCase)], opts...)
+ var resp *cxpb.TestCase
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.GetTestCase(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateTestCase creates a test case for the given agent.
+func (c *TestCasesClient) CreateTestCase(ctx context.Context, req *cxpb.CreateTestCaseRequest, opts ...gax.CallOption) (*cxpb.TestCase, 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.CreateTestCase[0:len(c.CallOptions.CreateTestCase):len(c.CallOptions.CreateTestCase)], opts...)
+ var resp *cxpb.TestCase
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.CreateTestCase(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateTestCase updates the specified test case.
+func (c *TestCasesClient) UpdateTestCase(ctx context.Context, req *cxpb.UpdateTestCaseRequest, opts ...gax.CallOption) (*cxpb.TestCase, 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", "test_case.name", url.QueryEscape(req.GetTestCase().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateTestCase[0:len(c.CallOptions.UpdateTestCase):len(c.CallOptions.UpdateTestCase)], opts...)
+ var resp *cxpb.TestCase
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.UpdateTestCase(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// RunTestCase kicks off a test case run.
+func (c *TestCasesClient) RunTestCase(ctx context.Context, req *cxpb.RunTestCaseRequest, opts ...gax.CallOption) (*RunTestCaseOperation, 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.RunTestCase[0:len(c.CallOptions.RunTestCase):len(c.CallOptions.RunTestCase)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.RunTestCase(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &RunTestCaseOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// BatchRunTestCases kicks off a batch run of test cases.
+func (c *TestCasesClient) BatchRunTestCases(ctx context.Context, req *cxpb.BatchRunTestCasesRequest, opts ...gax.CallOption) (*BatchRunTestCasesOperation, 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.BatchRunTestCases[0:len(c.CallOptions.BatchRunTestCases):len(c.CallOptions.BatchRunTestCases)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.BatchRunTestCases(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &BatchRunTestCasesOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// CalculateCoverage calculates the test coverage for an agent.
+func (c *TestCasesClient) CalculateCoverage(ctx context.Context, req *cxpb.CalculateCoverageRequest, opts ...gax.CallOption) (*cxpb.CalculateCoverageResponse, 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", "agent", url.QueryEscape(req.GetAgent())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.CalculateCoverage[0:len(c.CallOptions.CalculateCoverage):len(c.CallOptions.CalculateCoverage)], opts...)
+ var resp *cxpb.CalculateCoverageResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.CalculateCoverage(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// ImportTestCases imports the test cases from a Cloud Storage bucket or a local file. It
+// always creates new test cases and won’t overwite any existing ones. The
+// provided ID in the imported test case is neglected.
+func (c *TestCasesClient) ImportTestCases(ctx context.Context, req *cxpb.ImportTestCasesRequest, opts ...gax.CallOption) (*ImportTestCasesOperation, 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.ImportTestCases[0:len(c.CallOptions.ImportTestCases):len(c.CallOptions.ImportTestCases)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.ImportTestCases(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ImportTestCasesOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// ExportTestCases exports the test cases under the agent to a Cloud Storage bucket or a local
+// file. Filter can be applied to export a subset of test cases.
+func (c *TestCasesClient) ExportTestCases(ctx context.Context, req *cxpb.ExportTestCasesRequest, opts ...gax.CallOption) (*ExportTestCasesOperation, 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.ExportTestCases[0:len(c.CallOptions.ExportTestCases):len(c.CallOptions.ExportTestCases)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.ExportTestCases(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ExportTestCasesOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// ListTestCaseResults fetches a list of results for a given test case.
+func (c *TestCasesClient) ListTestCaseResults(ctx context.Context, req *cxpb.ListTestCaseResultsRequest, opts ...gax.CallOption) *TestCaseResultIterator {
+ 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.ListTestCaseResults[0:len(c.CallOptions.ListTestCaseResults):len(c.CallOptions.ListTestCaseResults)], opts...)
+ it := &TestCaseResultIterator{}
+ req = proto.Clone(req).(*cxpb.ListTestCaseResultsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.TestCaseResult, string, error) {
+ var resp *cxpb.ListTestCaseResultsResponse
+ 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.testCasesClient.ListTestCaseResults(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetTestCaseResults(), 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
+}
+
+// GetTestCaseResult gets a test case result.
+func (c *TestCasesClient) GetTestCaseResult(ctx context.Context, req *cxpb.GetTestCaseResultRequest, opts ...gax.CallOption) (*cxpb.TestCaseResult, 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.GetTestCaseResult[0:len(c.CallOptions.GetTestCaseResult):len(c.CallOptions.GetTestCaseResult)], opts...)
+ var resp *cxpb.TestCaseResult
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.GetTestCaseResult(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// BatchRunTestCasesOperation manages a long-running operation from BatchRunTestCases.
+type BatchRunTestCasesOperation struct {
+ lro *longrunning.Operation
+}
+
+// BatchRunTestCasesOperation returns a new BatchRunTestCasesOperation from a given name.
+// The name must be that of a previously created BatchRunTestCasesOperation, possibly from a different process.
+func (c *TestCasesClient) BatchRunTestCasesOperation(name string) *BatchRunTestCasesOperation {
+ return &BatchRunTestCasesOperation{
+ 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 *BatchRunTestCasesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.BatchRunTestCasesResponse, error) {
+ var resp cxpb.BatchRunTestCasesResponse
+ 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 *BatchRunTestCasesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.BatchRunTestCasesResponse, error) {
+ var resp cxpb.BatchRunTestCasesResponse
+ 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 *BatchRunTestCasesOperation) Metadata() (*cxpb.BatchRunTestCasesMetadata, error) {
+ var meta cxpb.BatchRunTestCasesMetadata
+ 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 *BatchRunTestCasesOperation) 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 *BatchRunTestCasesOperation) Name() string {
+ return op.lro.Name()
+}
+
+// ExportTestCasesOperation manages a long-running operation from ExportTestCases.
+type ExportTestCasesOperation struct {
+ lro *longrunning.Operation
+}
+
+// ExportTestCasesOperation returns a new ExportTestCasesOperation from a given name.
+// The name must be that of a previously created ExportTestCasesOperation, possibly from a different process.
+func (c *TestCasesClient) ExportTestCasesOperation(name string) *ExportTestCasesOperation {
+ return &ExportTestCasesOperation{
+ 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 *ExportTestCasesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.ExportTestCasesResponse, error) {
+ var resp cxpb.ExportTestCasesResponse
+ 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 *ExportTestCasesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.ExportTestCasesResponse, error) {
+ var resp cxpb.ExportTestCasesResponse
+ 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 *ExportTestCasesOperation) Metadata() (*cxpb.ExportTestCasesMetadata, error) {
+ var meta cxpb.ExportTestCasesMetadata
+ 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 *ExportTestCasesOperation) 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 *ExportTestCasesOperation) Name() string {
+ return op.lro.Name()
+}
+
+// ImportTestCasesOperation manages a long-running operation from ImportTestCases.
+type ImportTestCasesOperation struct {
+ lro *longrunning.Operation
+}
+
+// ImportTestCasesOperation returns a new ImportTestCasesOperation from a given name.
+// The name must be that of a previously created ImportTestCasesOperation, possibly from a different process.
+func (c *TestCasesClient) ImportTestCasesOperation(name string) *ImportTestCasesOperation {
+ return &ImportTestCasesOperation{
+ 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 *ImportTestCasesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.ImportTestCasesResponse, error) {
+ var resp cxpb.ImportTestCasesResponse
+ 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 *ImportTestCasesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.ImportTestCasesResponse, error) {
+ var resp cxpb.ImportTestCasesResponse
+ 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 *ImportTestCasesOperation) Metadata() (*cxpb.ImportTestCasesMetadata, error) {
+ var meta cxpb.ImportTestCasesMetadata
+ 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 *ImportTestCasesOperation) 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 *ImportTestCasesOperation) Name() string {
+ return op.lro.Name()
+}
+
+// RunTestCaseOperation manages a long-running operation from RunTestCase.
+type RunTestCaseOperation struct {
+ lro *longrunning.Operation
+}
+
+// RunTestCaseOperation returns a new RunTestCaseOperation from a given name.
+// The name must be that of a previously created RunTestCaseOperation, possibly from a different process.
+func (c *TestCasesClient) RunTestCaseOperation(name string) *RunTestCaseOperation {
+ return &RunTestCaseOperation{
+ 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 *RunTestCaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.RunTestCaseResponse, error) {
+ var resp cxpb.RunTestCaseResponse
+ 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 *RunTestCaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.RunTestCaseResponse, error) {
+ var resp cxpb.RunTestCaseResponse
+ 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 *RunTestCaseOperation) Metadata() (*cxpb.RunTestCaseMetadata, error) {
+ var meta cxpb.RunTestCaseMetadata
+ 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 *RunTestCaseOperation) 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 *RunTestCaseOperation) Name() string {
+ return op.lro.Name()
+}
+
+// TestCaseIterator manages a stream of *cxpb.TestCase.
+type TestCaseIterator struct {
+ items []*cxpb.TestCase
+ 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 []*cxpb.TestCase, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *TestCaseIterator) 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 *TestCaseIterator) Next() (*cxpb.TestCase, error) {
+ var item *cxpb.TestCase
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *TestCaseIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *TestCaseIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// TestCaseResultIterator manages a stream of *cxpb.TestCaseResult.
+type TestCaseResultIterator struct {
+ items []*cxpb.TestCaseResult
+ 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 []*cxpb.TestCaseResult, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *TestCaseResultIterator) 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 *TestCaseResultIterator) Next() (*cxpb.TestCaseResult, error) {
+ var item *cxpb.TestCaseResult
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *TestCaseResultIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *TestCaseResultIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/test_cases_client_example_test.go b/dialogflow/cx/apiv3/test_cases_client_example_test.go
new file mode 100644
index 0000000..8bb04de
--- /dev/null
+++ b/dialogflow/cx/apiv3/test_cases_client_example_test.go
@@ -0,0 +1,305 @@
+// 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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewTestCasesClient() {
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleTestCasesClient_ListTestCases() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListTestCasesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListTestCases(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleTestCasesClient_BatchDeleteTestCases() {
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.BatchDeleteTestCasesRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.BatchDeleteTestCases(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleTestCasesClient_GetTestCase() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetTestCaseRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetTestCase(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_CreateTestCase() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateTestCaseRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateTestCase(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_UpdateTestCase() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateTestCaseRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateTestCase(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_RunTestCase() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.RunTestCaseRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.RunTestCase(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_BatchRunTestCases() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.BatchRunTestCasesRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.BatchRunTestCases(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_CalculateCoverage() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CalculateCoverageRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CalculateCoverage(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_ImportTestCases() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ImportTestCasesRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ImportTestCases(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_ExportTestCases() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ExportTestCasesRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ExportTestCases(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTestCasesClient_ListTestCaseResults() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListTestCaseResultsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListTestCaseResults(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleTestCasesClient_GetTestCaseResult() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetTestCaseResultRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetTestCaseResult(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/dialogflow/cx/apiv3/transition_route_groups_client.go b/dialogflow/cx/apiv3/transition_route_groups_client.go
new file mode 100644
index 0000000..f86ed37
--- /dev/null
+++ b/dialogflow/cx/apiv3/transition_route_groups_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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newTransitionRouteGroupsClientHook clientHook
+
+// TransitionRouteGroupsCallOptions contains the retry settings for each method of TransitionRouteGroupsClient.
+type TransitionRouteGroupsCallOptions struct {
+ ListTransitionRouteGroups []gax.CallOption
+ GetTransitionRouteGroup []gax.CallOption
+ CreateTransitionRouteGroup []gax.CallOption
+ UpdateTransitionRouteGroup []gax.CallOption
+ DeleteTransitionRouteGroup []gax.CallOption
+}
+
+func defaultTransitionRouteGroupsClientOptions() []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 defaultTransitionRouteGroupsCallOptions() *TransitionRouteGroupsCallOptions {
+ return &TransitionRouteGroupsCallOptions{
+ ListTransitionRouteGroups: []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,
+ })
+ }),
+ },
+ GetTransitionRouteGroup: []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,
+ })
+ }),
+ },
+ CreateTransitionRouteGroup: []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,
+ })
+ }),
+ },
+ UpdateTransitionRouteGroup: []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,
+ })
+ }),
+ },
+ DeleteTransitionRouteGroup: []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,
+ })
+ }),
+ },
+ }
+}
+
+// TransitionRouteGroupsClient 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 TransitionRouteGroupsClient 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.
+ transitionRouteGroupsClient cxpb.TransitionRouteGroupsClient
+
+ // The call options for this service.
+ CallOptions *TransitionRouteGroupsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewTransitionRouteGroupsClient creates a new transition route groups client.
+//
+// Service for managing TransitionRouteGroups.
+func NewTransitionRouteGroupsClient(ctx context.Context, opts ...option.ClientOption) (*TransitionRouteGroupsClient, error) {
+ clientOpts := defaultTransitionRouteGroupsClientOptions()
+
+ if newTransitionRouteGroupsClientHook != nil {
+ hookOpts, err := newTransitionRouteGroupsClientHook(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 := &TransitionRouteGroupsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultTransitionRouteGroupsCallOptions(),
+
+ transitionRouteGroupsClient: cxpb.NewTransitionRouteGroupsClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *TransitionRouteGroupsClient) 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 *TransitionRouteGroupsClient) 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 *TransitionRouteGroupsClient) 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...))
+}
+
+// ListTransitionRouteGroups returns the list of all transition route groups in the specified flow.
+func (c *TransitionRouteGroupsClient) ListTransitionRouteGroups(ctx context.Context, req *cxpb.ListTransitionRouteGroupsRequest, opts ...gax.CallOption) *TransitionRouteGroupIterator {
+ 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.ListTransitionRouteGroups[0:len(c.CallOptions.ListTransitionRouteGroups):len(c.CallOptions.ListTransitionRouteGroups)], opts...)
+ it := &TransitionRouteGroupIterator{}
+ req = proto.Clone(req).(*cxpb.ListTransitionRouteGroupsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.TransitionRouteGroup, string, error) {
+ var resp *cxpb.ListTransitionRouteGroupsResponse
+ 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.transitionRouteGroupsClient.ListTransitionRouteGroups(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetTransitionRouteGroups(), 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
+}
+
+// GetTransitionRouteGroup retrieves the specified TransitionRouteGroup.
+func (c *TransitionRouteGroupsClient) GetTransitionRouteGroup(ctx context.Context, req *cxpb.GetTransitionRouteGroupRequest, opts ...gax.CallOption) (*cxpb.TransitionRouteGroup, 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.GetTransitionRouteGroup[0:len(c.CallOptions.GetTransitionRouteGroup):len(c.CallOptions.GetTransitionRouteGroup)], opts...)
+ var resp *cxpb.TransitionRouteGroup
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.transitionRouteGroupsClient.GetTransitionRouteGroup(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateTransitionRouteGroup creates an TransitionRouteGroup in the specified flow.
+func (c *TransitionRouteGroupsClient) CreateTransitionRouteGroup(ctx context.Context, req *cxpb.CreateTransitionRouteGroupRequest, opts ...gax.CallOption) (*cxpb.TransitionRouteGroup, 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.CreateTransitionRouteGroup[0:len(c.CallOptions.CreateTransitionRouteGroup):len(c.CallOptions.CreateTransitionRouteGroup)], opts...)
+ var resp *cxpb.TransitionRouteGroup
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.transitionRouteGroupsClient.CreateTransitionRouteGroup(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateTransitionRouteGroup updates the specified TransitionRouteGroup.
+func (c *TransitionRouteGroupsClient) UpdateTransitionRouteGroup(ctx context.Context, req *cxpb.UpdateTransitionRouteGroupRequest, opts ...gax.CallOption) (*cxpb.TransitionRouteGroup, 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", "transition_route_group.name", url.QueryEscape(req.GetTransitionRouteGroup().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateTransitionRouteGroup[0:len(c.CallOptions.UpdateTransitionRouteGroup):len(c.CallOptions.UpdateTransitionRouteGroup)], opts...)
+ var resp *cxpb.TransitionRouteGroup
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.transitionRouteGroupsClient.UpdateTransitionRouteGroup(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteTransitionRouteGroup deletes the specified TransitionRouteGroup.
+func (c *TransitionRouteGroupsClient) DeleteTransitionRouteGroup(ctx context.Context, req *cxpb.DeleteTransitionRouteGroupRequest, 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.DeleteTransitionRouteGroup[0:len(c.CallOptions.DeleteTransitionRouteGroup):len(c.CallOptions.DeleteTransitionRouteGroup)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.transitionRouteGroupsClient.DeleteTransitionRouteGroup(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// TransitionRouteGroupIterator manages a stream of *cxpb.TransitionRouteGroup.
+type TransitionRouteGroupIterator struct {
+ items []*cxpb.TransitionRouteGroup
+ 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 []*cxpb.TransitionRouteGroup, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *TransitionRouteGroupIterator) 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 *TransitionRouteGroupIterator) Next() (*cxpb.TransitionRouteGroup, error) {
+ var item *cxpb.TransitionRouteGroup
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *TransitionRouteGroupIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *TransitionRouteGroupIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/transition_route_groups_client_example_test.go b/dialogflow/cx/apiv3/transition_route_groups_client_example_test.go
new file mode 100644
index 0000000..85f3407
--- /dev/null
+++ b/dialogflow/cx/apiv3/transition_route_groups_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewTransitionRouteGroupsClient() {
+ ctx := context.Background()
+ c, err := cx.NewTransitionRouteGroupsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleTransitionRouteGroupsClient_ListTransitionRouteGroups() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewTransitionRouteGroupsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListTransitionRouteGroupsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListTransitionRouteGroups(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleTransitionRouteGroupsClient_GetTransitionRouteGroup() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTransitionRouteGroupsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetTransitionRouteGroupRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetTransitionRouteGroup(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTransitionRouteGroupsClient_CreateTransitionRouteGroup() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTransitionRouteGroupsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateTransitionRouteGroupRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateTransitionRouteGroup(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTransitionRouteGroupsClient_UpdateTransitionRouteGroup() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewTransitionRouteGroupsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateTransitionRouteGroupRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateTransitionRouteGroup(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleTransitionRouteGroupsClient_DeleteTransitionRouteGroup() {
+ ctx := context.Background()
+ c, err := cx.NewTransitionRouteGroupsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteTransitionRouteGroupRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteTransitionRouteGroup(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/versions_client.go b/dialogflow/cx/apiv3/versions_client.go
new file mode 100644
index 0000000..54c2d00
--- /dev/null
+++ b/dialogflow/cx/apiv3/versions_client.go
@@ -0,0 +1,552 @@
+// 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 cx
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ "github.com/golang/protobuf/proto"
+ structpb "github.com/golang/protobuf/ptypes/struct"
+ 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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newVersionsClientHook clientHook
+
+// VersionsCallOptions contains the retry settings for each method of VersionsClient.
+type VersionsCallOptions struct {
+ ListVersions []gax.CallOption
+ GetVersion []gax.CallOption
+ CreateVersion []gax.CallOption
+ UpdateVersion []gax.CallOption
+ DeleteVersion []gax.CallOption
+ LoadVersion []gax.CallOption
+}
+
+func defaultVersionsClientOptions() []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 defaultVersionsCallOptions() *VersionsCallOptions {
+ return &VersionsCallOptions{
+ ListVersions: []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,
+ })
+ }),
+ },
+ GetVersion: []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,
+ })
+ }),
+ },
+ CreateVersion: []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,
+ })
+ }),
+ },
+ UpdateVersion: []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,
+ })
+ }),
+ },
+ DeleteVersion: []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,
+ })
+ }),
+ },
+ LoadVersion: []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,
+ })
+ }),
+ },
+ }
+}
+
+// VersionsClient 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 VersionsClient 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.
+ versionsClient cxpb.VersionsClient
+
+ // 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 *VersionsCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewVersionsClient creates a new versions client.
+//
+// Service for managing Versions.
+func NewVersionsClient(ctx context.Context, opts ...option.ClientOption) (*VersionsClient, error) {
+ clientOpts := defaultVersionsClientOptions()
+
+ if newVersionsClientHook != nil {
+ hookOpts, err := newVersionsClientHook(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 := &VersionsClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultVersionsCallOptions(),
+
+ versionsClient: cxpb.NewVersionsClient(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 *VersionsClient) 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 *VersionsClient) 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 *VersionsClient) 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...))
+}
+
+// ListVersions returns the list of all versions in the specified Flow.
+func (c *VersionsClient) ListVersions(ctx context.Context, req *cxpb.ListVersionsRequest, opts ...gax.CallOption) *VersionIterator {
+ 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.ListVersions[0:len(c.CallOptions.ListVersions):len(c.CallOptions.ListVersions)], opts...)
+ it := &VersionIterator{}
+ req = proto.Clone(req).(*cxpb.ListVersionsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Version, string, error) {
+ var resp *cxpb.ListVersionsResponse
+ 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.versionsClient.ListVersions(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetVersions(), 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
+}
+
+// GetVersion retrieves the specified Version.
+func (c *VersionsClient) GetVersion(ctx context.Context, req *cxpb.GetVersionRequest, opts ...gax.CallOption) (*cxpb.Version, 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.GetVersion[0:len(c.CallOptions.GetVersion):len(c.CallOptions.GetVersion)], opts...)
+ var resp *cxpb.Version
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.versionsClient.GetVersion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateVersion creates a Version in the specified Flow.
+func (c *VersionsClient) CreateVersion(ctx context.Context, req *cxpb.CreateVersionRequest, opts ...gax.CallOption) (*CreateVersionOperation, 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.CreateVersion[0:len(c.CallOptions.CreateVersion):len(c.CallOptions.CreateVersion)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.versionsClient.CreateVersion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &CreateVersionOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// UpdateVersion updates the specified Version.
+func (c *VersionsClient) UpdateVersion(ctx context.Context, req *cxpb.UpdateVersionRequest, opts ...gax.CallOption) (*cxpb.Version, 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", "version.name", url.QueryEscape(req.GetVersion().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateVersion[0:len(c.CallOptions.UpdateVersion):len(c.CallOptions.UpdateVersion)], opts...)
+ var resp *cxpb.Version
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.versionsClient.UpdateVersion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteVersion deletes the specified Version.
+func (c *VersionsClient) DeleteVersion(ctx context.Context, req *cxpb.DeleteVersionRequest, 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.DeleteVersion[0:len(c.CallOptions.DeleteVersion):len(c.CallOptions.DeleteVersion)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.versionsClient.DeleteVersion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// LoadVersion loads a specified version to draft version.
+func (c *VersionsClient) LoadVersion(ctx context.Context, req *cxpb.LoadVersionRequest, opts ...gax.CallOption) (*LoadVersionOperation, 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.LoadVersion[0:len(c.CallOptions.LoadVersion):len(c.CallOptions.LoadVersion)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.versionsClient.LoadVersion(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &LoadVersionOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// CreateVersionOperation manages a long-running operation from CreateVersion.
+type CreateVersionOperation struct {
+ lro *longrunning.Operation
+}
+
+// CreateVersionOperation returns a new CreateVersionOperation from a given name.
+// The name must be that of a previously created CreateVersionOperation, possibly from a different process.
+func (c *VersionsClient) CreateVersionOperation(name string) *CreateVersionOperation {
+ return &CreateVersionOperation{
+ 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 *CreateVersionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.Version, error) {
+ var resp cxpb.Version
+ 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 *CreateVersionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.Version, error) {
+ var resp cxpb.Version
+ 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 *CreateVersionOperation) Metadata() (*cxpb.CreateVersionOperationMetadata, error) {
+ var meta cxpb.CreateVersionOperationMetadata
+ 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 *CreateVersionOperation) 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 *CreateVersionOperation) Name() string {
+ return op.lro.Name()
+}
+
+// LoadVersionOperation manages a long-running operation from LoadVersion.
+type LoadVersionOperation struct {
+ lro *longrunning.Operation
+}
+
+// LoadVersionOperation returns a new LoadVersionOperation from a given name.
+// The name must be that of a previously created LoadVersionOperation, possibly from a different process.
+func (c *VersionsClient) LoadVersionOperation(name string) *LoadVersionOperation {
+ return &LoadVersionOperation{
+ 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 *LoadVersionOperation) 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 *LoadVersionOperation) 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 *LoadVersionOperation) Metadata() (*structpb.Struct, error) {
+ var meta structpb.Struct
+ 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 *LoadVersionOperation) 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 *LoadVersionOperation) Name() string {
+ return op.lro.Name()
+}
+
+// VersionIterator manages a stream of *cxpb.Version.
+type VersionIterator struct {
+ items []*cxpb.Version
+ 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 []*cxpb.Version, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *VersionIterator) 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 *VersionIterator) Next() (*cxpb.Version, error) {
+ var item *cxpb.Version
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *VersionIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *VersionIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/versions_client_example_test.go b/dialogflow/cx/apiv3/versions_client_example_test.go
new file mode 100644
index 0000000..fe05030
--- /dev/null
+++ b/dialogflow/cx/apiv3/versions_client_example_test.go
@@ -0,0 +1,166 @@
+// 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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewVersionsClient() {
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleVersionsClient_ListVersions() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListVersionsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListVersions(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleVersionsClient_GetVersion() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetVersionRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetVersion(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleVersionsClient_CreateVersion() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateVersionRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.CreateVersion(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleVersionsClient_UpdateVersion() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateVersionRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateVersion(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleVersionsClient_DeleteVersion() {
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteVersionRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteVersion(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleVersionsClient_LoadVersion() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewVersionsClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.LoadVersionRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.LoadVersion(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ err = op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3/webhooks_client.go b/dialogflow/cx/apiv3/webhooks_client.go
new file mode 100644
index 0000000..475468a
--- /dev/null
+++ b/dialogflow/cx/apiv3/webhooks_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 cx
+
+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"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newWebhooksClientHook clientHook
+
+// WebhooksCallOptions contains the retry settings for each method of WebhooksClient.
+type WebhooksCallOptions struct {
+ ListWebhooks []gax.CallOption
+ GetWebhook []gax.CallOption
+ CreateWebhook []gax.CallOption
+ UpdateWebhook []gax.CallOption
+ DeleteWebhook []gax.CallOption
+}
+
+func defaultWebhooksClientOptions() []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 defaultWebhooksCallOptions() *WebhooksCallOptions {
+ return &WebhooksCallOptions{
+ ListWebhooks: []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,
+ })
+ }),
+ },
+ GetWebhook: []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,
+ })
+ }),
+ },
+ CreateWebhook: []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,
+ })
+ }),
+ },
+ UpdateWebhook: []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,
+ })
+ }),
+ },
+ DeleteWebhook: []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,
+ })
+ }),
+ },
+ }
+}
+
+// WebhooksClient 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 WebhooksClient 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.
+ webhooksClient cxpb.WebhooksClient
+
+ // The call options for this service.
+ CallOptions *WebhooksCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewWebhooksClient creates a new webhooks client.
+//
+// Service for managing Webhooks.
+func NewWebhooksClient(ctx context.Context, opts ...option.ClientOption) (*WebhooksClient, error) {
+ clientOpts := defaultWebhooksClientOptions()
+
+ if newWebhooksClientHook != nil {
+ hookOpts, err := newWebhooksClientHook(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 := &WebhooksClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultWebhooksCallOptions(),
+
+ webhooksClient: cxpb.NewWebhooksClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *WebhooksClient) 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 *WebhooksClient) 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 *WebhooksClient) 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...))
+}
+
+// ListWebhooks returns the list of all webhooks in the specified agent.
+func (c *WebhooksClient) ListWebhooks(ctx context.Context, req *cxpb.ListWebhooksRequest, opts ...gax.CallOption) *WebhookIterator {
+ 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.ListWebhooks[0:len(c.CallOptions.ListWebhooks):len(c.CallOptions.ListWebhooks)], opts...)
+ it := &WebhookIterator{}
+ req = proto.Clone(req).(*cxpb.ListWebhooksRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.Webhook, string, error) {
+ var resp *cxpb.ListWebhooksResponse
+ 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.webhooksClient.ListWebhooks(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetWebhooks(), 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
+}
+
+// GetWebhook retrieves the specified webhook.
+func (c *WebhooksClient) GetWebhook(ctx context.Context, req *cxpb.GetWebhookRequest, opts ...gax.CallOption) (*cxpb.Webhook, 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.GetWebhook[0:len(c.CallOptions.GetWebhook):len(c.CallOptions.GetWebhook)], opts...)
+ var resp *cxpb.Webhook
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.webhooksClient.GetWebhook(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateWebhook creates a webhook in the specified agent.
+func (c *WebhooksClient) CreateWebhook(ctx context.Context, req *cxpb.CreateWebhookRequest, opts ...gax.CallOption) (*cxpb.Webhook, 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.CreateWebhook[0:len(c.CallOptions.CreateWebhook):len(c.CallOptions.CreateWebhook)], opts...)
+ var resp *cxpb.Webhook
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.webhooksClient.CreateWebhook(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateWebhook updates the specified webhook.
+func (c *WebhooksClient) UpdateWebhook(ctx context.Context, req *cxpb.UpdateWebhookRequest, opts ...gax.CallOption) (*cxpb.Webhook, 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", "webhook.name", url.QueryEscape(req.GetWebhook().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateWebhook[0:len(c.CallOptions.UpdateWebhook):len(c.CallOptions.UpdateWebhook)], opts...)
+ var resp *cxpb.Webhook
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.webhooksClient.UpdateWebhook(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteWebhook deletes the specified webhook.
+func (c *WebhooksClient) DeleteWebhook(ctx context.Context, req *cxpb.DeleteWebhookRequest, 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.DeleteWebhook[0:len(c.CallOptions.DeleteWebhook):len(c.CallOptions.DeleteWebhook)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.webhooksClient.DeleteWebhook(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// WebhookIterator manages a stream of *cxpb.Webhook.
+type WebhookIterator struct {
+ items []*cxpb.Webhook
+ 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 []*cxpb.Webhook, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *WebhookIterator) 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 *WebhookIterator) Next() (*cxpb.Webhook, error) {
+ var item *cxpb.Webhook
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *WebhookIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *WebhookIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/dialogflow/cx/apiv3/webhooks_client_example_test.go b/dialogflow/cx/apiv3/webhooks_client_example_test.go
new file mode 100644
index 0000000..930bc1d
--- /dev/null
+++ b/dialogflow/cx/apiv3/webhooks_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 cx_test
+
+import (
+ "context"
+
+ cx "cloud.google.com/go/dialogflow/cx/apiv3"
+ "google.golang.org/api/iterator"
+ cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+)
+
+func ExampleNewWebhooksClient() {
+ ctx := context.Background()
+ c, err := cx.NewWebhooksClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleWebhooksClient_ListWebhooks() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := cx.NewWebhooksClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.ListWebhooksRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListWebhooks(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleWebhooksClient_GetWebhook() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewWebhooksClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetWebhookRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetWebhook(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleWebhooksClient_CreateWebhook() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewWebhooksClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.CreateWebhookRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateWebhook(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleWebhooksClient_UpdateWebhook() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
+
+ ctx := context.Background()
+ c, err := cx.NewWebhooksClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.UpdateWebhookRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateWebhook(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleWebhooksClient_DeleteWebhook() {
+ ctx := context.Background()
+ c, err := cx.NewWebhooksClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.DeleteWebhookRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteWebhook(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go
index 1b74c08..f785263 100644
--- a/dialogflow/cx/apiv3beta1/doc.go
+++ b/dialogflow/cx/apiv3beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/dialogflow/cx/apiv3beta1/gapic_metadata.json b/dialogflow/cx/apiv3beta1/gapic_metadata.json
index 920828f..979439b 100644
--- a/dialogflow/cx/apiv3beta1/gapic_metadata.json
+++ b/dialogflow/cx/apiv3beta1/gapic_metadata.json
@@ -425,6 +425,11 @@
"GetTestCase"
]
},
+ "GetTestCaseResult": {
+ "methods": [
+ "GetTestCaseResult"
+ ]
+ },
"ImportTestCases": {
"methods": [
"ImportTestCases"
diff --git a/dialogflow/cx/apiv3beta1/session_entity_types_client.go b/dialogflow/cx/apiv3beta1/session_entity_types_client.go
index ab7afcf..6767ac7 100644
--- a/dialogflow/cx/apiv3beta1/session_entity_types_client.go
+++ b/dialogflow/cx/apiv3beta1/session_entity_types_client.go
@@ -259,9 +259,6 @@
}
// CreateSessionEntityType creates a session entity type.
-//
-// If the specified session entity type already exists, overrides the
-// session entity type.
func (c *SessionEntityTypesClient) CreateSessionEntityType(ctx context.Context, req *cxpb.CreateSessionEntityTypeRequest, opts ...gax.CallOption) (*cxpb.SessionEntityType, error) {
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
diff --git a/dialogflow/cx/apiv3beta1/test_cases_client.go b/dialogflow/cx/apiv3beta1/test_cases_client.go
index aee76d5..33b63db 100644
--- a/dialogflow/cx/apiv3beta1/test_cases_client.go
+++ b/dialogflow/cx/apiv3beta1/test_cases_client.go
@@ -53,6 +53,7 @@
ImportTestCases []gax.CallOption
ExportTestCases []gax.CallOption
ListTestCaseResults []gax.CallOption
+ GetTestCaseResult []gax.CallOption
}
func defaultTestCasesClientOptions() []option.ClientOption {
@@ -190,6 +191,17 @@
})
}),
},
+ GetTestCaseResult: []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,
+ })
+ }),
+ },
}
}
@@ -573,6 +585,28 @@
return it
}
+// GetTestCaseResult gets a test case result.
+func (c *TestCasesClient) GetTestCaseResult(ctx context.Context, req *cxpb.GetTestCaseResultRequest, opts ...gax.CallOption) (*cxpb.TestCaseResult, 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.GetTestCaseResult[0:len(c.CallOptions.GetTestCaseResult):len(c.CallOptions.GetTestCaseResult)], opts...)
+ var resp *cxpb.TestCaseResult
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.testCasesClient.GetTestCaseResult(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
// BatchRunTestCasesOperation manages a long-running operation from BatchRunTestCases.
type BatchRunTestCasesOperation struct {
lro *longrunning.Operation
diff --git a/dialogflow/cx/apiv3beta1/test_cases_client_example_test.go b/dialogflow/cx/apiv3beta1/test_cases_client_example_test.go
index 58b5a48..5e65f90 100644
--- a/dialogflow/cx/apiv3beta1/test_cases_client_example_test.go
+++ b/dialogflow/cx/apiv3beta1/test_cases_client_example_test.go
@@ -283,3 +283,23 @@
_ = resp
}
}
+
+func ExampleTestCasesClient_GetTestCaseResult() {
+ // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1"
+
+ ctx := context.Background()
+ c, err := cx.NewTestCasesClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &cxpb.GetTestCaseResultRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetTestCaseResult(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go
index 04999cd..b7fb16f 100644
--- a/dlp/apiv2/doc.go
+++ b/dlp/apiv2/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/documentai/apiv1/doc.go b/documentai/apiv1/doc.go
new file mode 100644
index 0000000..4a8bb98
--- /dev/null
+++ b/documentai/apiv1/doc.go
@@ -0,0 +1,118 @@
+// 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 documentai is an auto-generated package for the
+// Cloud Document AI API.
+//
+// Service to parse structured information from unstructured or
+// semi-structured documents using state-of-the-art Google AI such as natural
+// language, computer vision, translation, and AutoML.
+//
+// Use of Context
+//
+// The ctx passed to NewClient is used for authentication requests and
+// for creating the underlying connection, but is not used for subsequent calls.
+// Individual methods on the client use the ctx given to them.
+//
+// To close the open connection, use the Close() method.
+//
+// For information about setting deadlines, reusing contexts, and more
+// please visit pkg.go.dev/cloud.google.com/go.
+package documentai // import "cloud.google.com/go/documentai/apiv1"
+
+import (
+ "context"
+ "os"
+ "runtime"
+ "strconv"
+ "strings"
+ "unicode"
+
+ "google.golang.org/api/option"
+ "google.golang.org/grpc/metadata"
+)
+
+// For more information on implementing a client constructor hook, see
+// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
+type clientHookParams struct{}
+type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
+
+const versionClient = "20210325"
+
+func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
+ out, _ := metadata.FromOutgoingContext(ctx)
+ out = out.Copy()
+ for _, md := range mds {
+ for k, v := range md {
+ out[k] = append(out[k], v...)
+ }
+ }
+ return metadata.NewOutgoingContext(ctx, out)
+}
+
+func checkDisableDeadlines() (bool, error) {
+ raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE")
+ if !ok {
+ return false, nil
+ }
+
+ b, err := strconv.ParseBool(raw)
+ return b, err
+}
+
+// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
+func DefaultAuthScopes() []string {
+ return []string{
+ "https://www.googleapis.com/auth/cloud-platform",
+ }
+}
+
+// versionGo returns the Go runtime version. The returned string
+// has no whitespace, suitable for reporting in header.
+func versionGo() string {
+ const develPrefix = "devel +"
+
+ s := runtime.Version()
+ if strings.HasPrefix(s, develPrefix) {
+ s = s[len(develPrefix):]
+ if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
+ s = s[:p]
+ }
+ return s
+ }
+
+ notSemverRune := func(r rune) bool {
+ return !strings.ContainsRune("0123456789.", r)
+ }
+
+ if strings.HasPrefix(s, "go1") {
+ s = s[2:]
+ var prerelease string
+ if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
+ s, prerelease = s[:p], s[p:]
+ }
+ if strings.HasSuffix(s, ".") {
+ s += "0"
+ } else if strings.Count(s, ".") < 2 {
+ s += ".0"
+ }
+ if prerelease != "" {
+ s += "-" + prerelease
+ }
+ return s
+ }
+ return "UNKNOWN"
+}
diff --git a/documentai/apiv1/document_processor_client.go b/documentai/apiv1/document_processor_client.go
new file mode 100644
index 0000000..224b0b9
--- /dev/null
+++ b/documentai/apiv1/document_processor_client.go
@@ -0,0 +1,404 @@
+// 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 documentai
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ gax "github.com/googleapis/gax-go/v2"
+ "google.golang.org/api/option"
+ "google.golang.org/api/option/internaloption"
+ gtransport "google.golang.org/api/transport/grpc"
+ documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newDocumentProcessorClientHook clientHook
+
+// DocumentProcessorCallOptions contains the retry settings for each method of DocumentProcessorClient.
+type DocumentProcessorCallOptions struct {
+ ProcessDocument []gax.CallOption
+ BatchProcessDocuments []gax.CallOption
+ ReviewDocument []gax.CallOption
+}
+
+func defaultDocumentProcessorClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ internaloption.WithDefaultEndpoint("us-documentai.googleapis.com:443"),
+ internaloption.WithDefaultMTLSEndpoint("us-documentai.mtls.googleapis.com:443"),
+ internaloption.WithDefaultAudience("https://us-documentai.googleapis.com/"),
+ internaloption.WithDefaultScopes(DefaultAuthScopes()...),
+ option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
+ option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
+ grpc.MaxCallRecvMsgSize(math.MaxInt32))),
+ }
+}
+
+func defaultDocumentProcessorCallOptions() *DocumentProcessorCallOptions {
+ return &DocumentProcessorCallOptions{
+ ProcessDocument: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ BatchProcessDocuments: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ ReviewDocument: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ }
+}
+
+// DocumentProcessorClient is a client for interacting with Cloud Document AI API.
+//
+// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
+type DocumentProcessorClient 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.
+ documentProcessorClient documentaipb.DocumentProcessorServiceClient
+
+ // 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 *DocumentProcessorCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewDocumentProcessorClient creates a new document processor service client.
+//
+// Service to call Cloud DocumentAI to process documents according to the
+// processor’s definition. Processors are built using state-of-the-art Google
+// AI such as natural language, computer vision, and translation to extract
+// structured information from unstructured or semi-structured documents.
+func NewDocumentProcessorClient(ctx context.Context, opts ...option.ClientOption) (*DocumentProcessorClient, error) {
+ clientOpts := defaultDocumentProcessorClientOptions()
+
+ if newDocumentProcessorClientHook != nil {
+ hookOpts, err := newDocumentProcessorClientHook(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 := &DocumentProcessorClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultDocumentProcessorCallOptions(),
+
+ documentProcessorClient: documentaipb.NewDocumentProcessorServiceClient(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 *DocumentProcessorClient) 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 *DocumentProcessorClient) 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 *DocumentProcessorClient) 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...))
+}
+
+// ProcessDocument processes a single document.
+func (c *DocumentProcessorClient) ProcessDocument(ctx context.Context, req *documentaipb.ProcessRequest, opts ...gax.CallOption) (*documentaipb.ProcessResponse, error) {
+ if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
+ cctx, cancel := context.WithTimeout(ctx, 120000*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.ProcessDocument[0:len(c.CallOptions.ProcessDocument):len(c.CallOptions.ProcessDocument)], opts...)
+ var resp *documentaipb.ProcessResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.documentProcessorClient.ProcessDocument(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// BatchProcessDocuments lRO endpoint to batch process many documents. The output is written
+// to Cloud Storage as JSON in the [Document] format.
+func (c *DocumentProcessorClient) BatchProcessDocuments(ctx context.Context, req *documentaipb.BatchProcessRequest, opts ...gax.CallOption) (*BatchProcessDocumentsOperation, error) {
+ if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
+ cctx, cancel := context.WithTimeout(ctx, 120000*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.BatchProcessDocuments[0:len(c.CallOptions.BatchProcessDocuments):len(c.CallOptions.BatchProcessDocuments)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.documentProcessorClient.BatchProcessDocuments(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &BatchProcessDocumentsOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// ReviewDocument send a document for Human Review. The input document should be processed by
+// the specified processor.
+func (c *DocumentProcessorClient) ReviewDocument(ctx context.Context, req *documentaipb.ReviewDocumentRequest, opts ...gax.CallOption) (*ReviewDocumentOperation, error) {
+ if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
+ cctx, cancel := context.WithTimeout(ctx, 120000*time.Millisecond)
+ defer cancel()
+ ctx = cctx
+ }
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "human_review_config", url.QueryEscape(req.GetHumanReviewConfig())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.ReviewDocument[0:len(c.CallOptions.ReviewDocument):len(c.CallOptions.ReviewDocument)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.documentProcessorClient.ReviewDocument(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &ReviewDocumentOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// BatchProcessDocumentsOperation manages a long-running operation from BatchProcessDocuments.
+type BatchProcessDocumentsOperation struct {
+ lro *longrunning.Operation
+}
+
+// BatchProcessDocumentsOperation returns a new BatchProcessDocumentsOperation from a given name.
+// The name must be that of a previously created BatchProcessDocumentsOperation, possibly from a different process.
+func (c *DocumentProcessorClient) BatchProcessDocumentsOperation(name string) *BatchProcessDocumentsOperation {
+ return &BatchProcessDocumentsOperation{
+ 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 *BatchProcessDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*documentaipb.BatchProcessResponse, error) {
+ var resp documentaipb.BatchProcessResponse
+ 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 *BatchProcessDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*documentaipb.BatchProcessResponse, error) {
+ var resp documentaipb.BatchProcessResponse
+ 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 *BatchProcessDocumentsOperation) Metadata() (*documentaipb.BatchProcessMetadata, error) {
+ var meta documentaipb.BatchProcessMetadata
+ 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 *BatchProcessDocumentsOperation) 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 *BatchProcessDocumentsOperation) Name() string {
+ return op.lro.Name()
+}
+
+// ReviewDocumentOperation manages a long-running operation from ReviewDocument.
+type ReviewDocumentOperation struct {
+ lro *longrunning.Operation
+}
+
+// ReviewDocumentOperation returns a new ReviewDocumentOperation from a given name.
+// The name must be that of a previously created ReviewDocumentOperation, possibly from a different process.
+func (c *DocumentProcessorClient) ReviewDocumentOperation(name string) *ReviewDocumentOperation {
+ return &ReviewDocumentOperation{
+ 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 *ReviewDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*documentaipb.ReviewDocumentResponse, error) {
+ var resp documentaipb.ReviewDocumentResponse
+ 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 *ReviewDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*documentaipb.ReviewDocumentResponse, error) {
+ var resp documentaipb.ReviewDocumentResponse
+ 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 *ReviewDocumentOperation) Metadata() (*documentaipb.ReviewDocumentOperationMetadata, error) {
+ var meta documentaipb.ReviewDocumentOperationMetadata
+ 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 *ReviewDocumentOperation) 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 *ReviewDocumentOperation) Name() string {
+ return op.lro.Name()
+}
diff --git a/documentai/apiv1/document_processor_client_example_test.go b/documentai/apiv1/document_processor_client_example_test.go
new file mode 100644
index 0000000..54aa165
--- /dev/null
+++ b/documentai/apiv1/document_processor_client_example_test.go
@@ -0,0 +1,104 @@
+// 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 documentai_test
+
+import (
+ "context"
+
+ documentai "cloud.google.com/go/documentai/apiv1"
+ documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1"
+)
+
+func ExampleNewDocumentProcessorClient() {
+ ctx := context.Background()
+ c, err := documentai.NewDocumentProcessorClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleDocumentProcessorClient_ProcessDocument() {
+ // import documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1"
+
+ ctx := context.Background()
+ c, err := documentai.NewDocumentProcessorClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &documentaipb.ProcessRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.ProcessDocument(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleDocumentProcessorClient_BatchProcessDocuments() {
+ // import documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1"
+
+ ctx := context.Background()
+ c, err := documentai.NewDocumentProcessorClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &documentaipb.BatchProcessRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.BatchProcessDocuments(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleDocumentProcessorClient_ReviewDocument() {
+ // import documentaipb "google.golang.org/genproto/googleapis/cloud/documentai/v1"
+
+ ctx := context.Background()
+ c, err := documentai.NewDocumentProcessorClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &documentaipb.ReviewDocumentRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.ReviewDocument(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/documentai/apiv1/gapic_metadata.json b/documentai/apiv1/gapic_metadata.json
new file mode 100644
index 0000000..0e0f7bb
--- /dev/null
+++ b/documentai/apiv1/gapic_metadata.json
@@ -0,0 +1,33 @@
+{
+ "schema": "1.0",
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.",
+ "language": "go",
+ "protoPackage": "google.cloud.documentai.v1",
+ "libraryPackage": "cloud.google.com/go/documentai/apiv1",
+ "services": {
+ "DocumentProcessorService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "DocumentProcessorClient",
+ "rpcs": {
+ "BatchProcessDocuments": {
+ "methods": [
+ "BatchProcessDocuments"
+ ]
+ },
+ "ProcessDocument": {
+ "methods": [
+ "ProcessDocument"
+ ]
+ },
+ "ReviewDocument": {
+ "methods": [
+ "ReviewDocument"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/documentai/apiv1beta3/doc.go b/documentai/apiv1beta3/doc.go
index 7d0fe86..9241263 100644
--- a/documentai/apiv1beta3/doc.go
+++ b/documentai/apiv1beta3/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 0c3a513..b73565c 100644
--- a/domains/apiv1beta1/doc.go
+++ b/domains/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 4d8f6cf..1a442a3 100644
--- a/errorreporting/apiv1beta1/doc.go
+++ b/errorreporting/apiv1beta1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 afe2d3a..a46ad24 100644
--- a/firestore/apiv1/admin/doc.go
+++ b/firestore/apiv1/admin/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2d4ce94..41b45a5 100644
--- a/firestore/apiv1/doc.go
+++ b/firestore/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 6564e64..e65cba7 100644
--- a/firestore/go.mod
+++ b/firestore/go.mod
@@ -4,10 +4,10 @@
require (
cloud.google.com/go v0.79.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
)
diff --git a/firestore/go.sum b/firestore/go.sum
index c0f155b..ff8b42e 100644
--- a/firestore/go.sum
+++ b/firestore/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -218,8 +220,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -276,8 +279,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -362,8 +366,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -409,9 +413,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -439,8 +443,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go
index ad4093c..a39a59c 100644
--- a/functions/apiv1/doc.go
+++ b/functions/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 a86d894..0c6f219 100644
--- a/gaming/apiv1/doc.go
+++ b/gaming/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 0d93107..ab3e5eb 100644
--- a/gaming/apiv1beta/doc.go
+++ b/gaming/apiv1beta/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2937773..afce4e5 100644
--- a/gkehub/apiv1beta1/doc.go
+++ b/gkehub/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/go.mod b/go.mod
index d367ff4..804cfae 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@
require (
cloud.google.com/go/storage v1.10.0
github.com/golang/mock v1.5.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/google/martian/v3 v3.1.0
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5
@@ -13,11 +13,11 @@
github.com/jstemmer/go-junit-report v0.9.1
go.opencensus.io v0.23.0
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5
- golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
+ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
golang.org/x/text v0.3.5
golang.org/x/tools v0.1.0
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
)
diff --git a/go.sum b/go.sum
index 5648513..4501305 100644
--- a/go.sum
+++ b/go.sum
@@ -83,8 +83,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -222,8 +224,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -281,8 +284,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -367,8 +371,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -414,9 +418,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -444,8 +448,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go
index a241881..1f681b7 100644
--- a/iam/credentials/apiv1/doc.go
+++ b/iam/credentials/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 09f3ccd..ffe045e 100644
--- a/internal/.repo-metadata-full.json
+++ b/internal/.repo-metadata-full.json
@@ -29,11 +29,11 @@
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/apigateway/apiv1",
- "release_level": "beta"
+ "release_level": "ga"
},
"cloud.google.com/go/appengine/apiv1": {
"distribution_name": "cloud.google.com/go/appengine/apiv1",
- "description": "App Engine Audit Data",
+ "description": "App Engine Admin API",
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/appengine/apiv1",
@@ -359,6 +359,14 @@
"docs_url": "https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2",
"release_level": "ga"
},
+ "cloud.google.com/go/dialogflow/cx/apiv3": {
+ "distribution_name": "cloud.google.com/go/dialogflow/cx/apiv3",
+ "description": "Dialogflow API",
+ "language": "Go",
+ "client_library_type": "generated",
+ "docs_url": "https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3",
+ "release_level": "beta"
+ },
"cloud.google.com/go/dialogflow/cx/apiv3beta1": {
"distribution_name": "cloud.google.com/go/dialogflow/cx/apiv3beta1",
"description": "Dialogflow API",
@@ -375,6 +383,14 @@
"docs_url": "https://pkg.go.dev/cloud.google.com/go/dlp/apiv2",
"release_level": "ga"
},
+ "cloud.google.com/go/documentai/apiv1": {
+ "distribution_name": "cloud.google.com/go/documentai/apiv1",
+ "description": "Cloud Document AI API",
+ "language": "Go",
+ "client_library_type": "generated",
+ "docs_url": "https://pkg.go.dev/cloud.google.com/go/documentai/apiv1",
+ "release_level": "beta"
+ },
"cloud.google.com/go/documentai/apiv1beta3": {
"distribution_name": "cloud.google.com/go/documentai/apiv1beta3",
"description": "Cloud Document AI API",
@@ -557,7 +573,7 @@
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/memcache/apiv1",
- "release_level": "beta"
+ "release_level": "ga"
},
"cloud.google.com/go/memcache/apiv1beta2": {
"distribution_name": "cloud.google.com/go/memcache/apiv1beta2",
@@ -621,7 +637,7 @@
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/orgpolicy/apiv2",
- "release_level": "beta"
+ "release_level": "ga"
},
"cloud.google.com/go/osconfig/agentendpoint/apiv1": {
"distribution_name": "cloud.google.com/go/osconfig/agentendpoint/apiv1",
@@ -781,6 +797,14 @@
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/resourcemanager/apiv2",
+ "release_level": "ga"
+ },
+ "cloud.google.com/go/resourcesettings/apiv1": {
+ "distribution_name": "cloud.google.com/go/resourcesettings/apiv1",
+ "description": "Resource Settings API",
+ "language": "Go",
+ "client_library_type": "generated",
+ "docs_url": "https://pkg.go.dev/cloud.google.com/go/resourcesettings/apiv1",
"release_level": "beta"
},
"cloud.google.com/go/retail/apiv2": {
@@ -877,7 +901,7 @@
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/servicecontrol/apiv1",
- "release_level": "beta"
+ "release_level": "ga"
},
"cloud.google.com/go/servicedirectory/apiv1": {
"distribution_name": "cloud.google.com/go/servicedirectory/apiv1",
@@ -901,7 +925,7 @@
"language": "Go",
"client_library_type": "generated",
"docs_url": "https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1",
- "release_level": "beta"
+ "release_level": "ga"
},
"cloud.google.com/go/spanner": {
"distribution_name": "cloud.google.com/go/spanner",
diff --git a/internal/apidiff/apidiff.go b/internal/apidiff/apidiff.go
index 5c3dcf2..72a5585 100644
--- a/internal/apidiff/apidiff.go
+++ b/internal/apidiff/apidiff.go
@@ -47,12 +47,11 @@
log.Fatalln("Missing required flag: -repo-metadata")
}
- head, err := exec("git", "log", "-1")
+ head, err := exec("git", "log", "-2")
if err != nil {
log.Fatalln(err)
}
- if strings.Contains(head, "BREAKING_CHANGE") {
- log.Println("Not running apidiff because description contained tag BREAKING_CHANGE.")
+ if checkAllowBreakingChange(head) {
return
}
@@ -127,11 +126,6 @@
issues := map[string]error{}
for imp, entry := range m {
- // Only diff stable clients.
- if entry.ReleaseLevel != "ga" {
- continue
- }
-
// Prepare module directory paths relative to the repo root.
pkg := strings.TrimPrefix(imp, rootMod+"/")
baseModDir := baseDir
@@ -220,6 +214,23 @@
return out, err
}
+func checkAllowBreakingChange(commit string) bool {
+ if strings.Contains(commit, "BREAKING CHANGE:") {
+ log.Println("Not running apidiff because description contained tag BREAKING_CHANGE.")
+ return true
+ }
+
+ split := strings.Split(commit, "\n")
+ for _, s := range split {
+ if strings.Contains(s, "!:") || strings.Contains(s, "!(") {
+ log.Println("Not running apidiff because description contained breaking change indicator '!'.")
+ return true
+ }
+ }
+
+ return false
+}
+
func manualParent(m manifest, imp string) string {
pkg := strings.TrimPrefix(imp, rootMod)
split := strings.Split(pkg, "/")
diff --git a/internal/apidiff/apidiff_test.go b/internal/apidiff/apidiff_test.go
new file mode 100644
index 0000000..c7c2ba3
--- /dev/null
+++ b/internal/apidiff/apidiff_test.go
@@ -0,0 +1,65 @@
+// 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
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build linux darwin
+
+package main
+
+import "testing"
+
+func TestCheckAllowBreakingChange(t *testing.T) {
+ for _, tst := range []struct {
+ name, msg string
+ want bool
+ }{
+ {
+ name: "disallow - no indicator",
+ msg: "feat: add foo",
+ want: false,
+ },
+ {
+ name: "allow - bang indicator",
+ msg: "feat!: remove foo",
+ want: true,
+ },
+ {
+ name: "allow - bang indicator pre-scope",
+ msg: "feat!(scope): remove foo",
+ want: true,
+ },
+ {
+ name: "allow - tag indicator",
+ msg: "BREAKING CHANGE: remove foo",
+ want: true,
+ },
+ {
+ name: "allow - multiline bang indicator",
+ msg: `feat: add foo
+ feat!: remove bar
+ chore: update dep`,
+ want: true,
+ },
+ {
+ name: "allow - multiline tag indicator",
+ msg: `feat: add foo
+ BREAKING CHANGE: remove bar
+ chore: update dep`,
+ want: true,
+ },
+ } {
+ if got := checkAllowBreakingChange(tst.msg); got != tst.want {
+ t.Errorf("%s: got %v want %v", tst.name, got, tst.want)
+ }
+ }
+}
diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod
index d043417..58554f1 100644
--- a/internal/examples/fake/go.mod
+++ b/internal/examples/fake/go.mod
@@ -4,7 +4,7 @@
require (
cloud.google.com/go v0.79.0
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
)
diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum
index 0e8c2d9..abe33e8 100644
--- a/internal/examples/fake/go.sum
+++ b/internal/examples/fake/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -215,8 +217,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -273,8 +276,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -358,8 +362,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -405,9 +409,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -435,8 +439,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod
index f3ac2a6..ac713f3 100644
--- a/internal/examples/mock/go.mod
+++ b/internal/examples/mock/go.mod
@@ -3,13 +3,6 @@
go 1.15
require (
- github.com/golang/protobuf v1.4.3 // indirect
- github.com/google/go-cmp v0.5.5 // indirect
github.com/googleapis/gax-go/v2 v2.0.5
- golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
- golang.org/x/sys v0.0.0-20210314195730-07df6a141424 // 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-20210315173758-2651cd453018
- google.golang.org/grpc v1.36.0 // indirect
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
)
diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum
index 426ba2c..54d1fed 100644
--- a/internal/examples/mock/go.sum
+++ b/internal/examples/mock/go.sum
@@ -20,8 +20,9 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
-github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -36,26 +37,40 @@
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -66,6 +81,11 @@
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -74,8 +94,8 @@
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-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -90,9 +110,10 @@
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
-google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/internal/gapicgen/cmd/genbot/github.go b/internal/gapicgen/cmd/genbot/github.go
index 24b296d..cb96ef3 100644
--- a/internal/gapicgen/cmd/genbot/github.go
+++ b/internal/gapicgen/cmd/genbot/github.go
@@ -29,7 +29,7 @@
"time"
"cloud.google.com/go/internal/gapicgen/generator"
- "github.com/google/go-github/v33/github"
+ "github.com/google/go-github/v34/github"
"github.com/shurcooL/githubv4"
"golang.org/x/oauth2"
)
diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go
index 69c050d..d7a6078 100644
--- a/internal/gapicgen/generator/config.go
+++ b/internal/gapicgen/generator/config.go
@@ -96,8 +96,7 @@
importPath: "cloud.google.com/go/memcache/apiv1",
gRPCServiceConfigPath: "google/cloud/memcache/v1/memcache_grpc_service_config.json",
apiServiceConfigPath: "google/cloud/memcache/v1/memcache_v1.yaml",
- // GA after 2021/02/20
- releaseLevel: "beta",
+ releaseLevel: "ga",
},
{
inputDirectoryPath: "google/cloud/memcache/v1beta2",
@@ -572,6 +571,15 @@
releaseLevel: "beta",
},
{
+ inputDirectoryPath: "google/cloud/dialogflow/cx/v3",
+ pkg: "cx",
+ importPath: "cloud.google.com/go/dialogflow/cx/apiv3",
+ gRPCServiceConfigPath: "google/cloud/dialogflow/cx/v3/dialogflow_grpc_service_config.json",
+ apiServiceConfigPath: "google/cloud/dialogflow/cx/v3/dialogflow_v3.yaml",
+ // GA after 2021/04/23
+ releaseLevel: "beta",
+ },
+ {
inputDirectoryPath: "google/cloud/dialogflow/v2",
pkg: "dialogflow",
importPath: "cloud.google.com/go/dialogflow/apiv2",
@@ -899,7 +907,7 @@
inputDirectoryPath: "google/appengine/v1",
pkg: "appengine",
importPath: "cloud.google.com/go/appengine/apiv1",
- apiServiceConfigPath: "google/appengine/v1/appengine.yaml",
+ apiServiceConfigPath: "google/appengine/v1/appengine_v1.yaml",
releaseLevel: "ga",
},
{
@@ -923,8 +931,7 @@
pkg: "resourcemanager",
importPath: "cloud.google.com/go/resourcemanager/apiv2",
apiServiceConfigPath: "google/cloud/resourcemanager/v2/cloudresourcemanager_v2.yaml",
- // GA after 2021/02/19
- releaseLevel: "beta",
+ releaseLevel: "ga",
},
{
inputDirectoryPath: "google/cloud/datalabeling/v1beta1",
@@ -943,6 +950,15 @@
releaseLevel: "alpha",
},
{
+ inputDirectoryPath: "google/cloud/documentai/v1",
+ pkg: "documentai",
+ importPath: "cloud.google.com/go/documentai/apiv1",
+ gRPCServiceConfigPath: "google/cloud/documentai/v1/documentai_v1_grpc_service_config.json",
+ apiServiceConfigPath: "google/cloud/documentai/v1/documentai_v1.yaml",
+ // GA after 2021/04/23
+ releaseLevel: "beta",
+ },
+ {
inputDirectoryPath: "google/cloud/documentai/v1beta3",
pkg: "documentai",
importPath: "cloud.google.com/go/documentai/apiv1beta3",
@@ -956,8 +972,7 @@
importPath: "cloud.google.com/go/servicemanagement/apiv1",
gRPCServiceConfigPath: "google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json",
apiServiceConfigPath: "google/api/servicemanagement/v1/servicemanagement_gapic.yaml",
- // GA after 2021/02/26
- releaseLevel: "beta",
+ releaseLevel: "ga",
},
{
inputDirectoryPath: "google/cloud/domains/v1beta1",
@@ -980,8 +995,7 @@
pkg: "servicecontrol",
importPath: "cloud.google.com/go/servicecontrol/apiv1",
apiServiceConfigPath: "google/api/servicecontrol/v1/servicecontrol_gapic.yaml",
- // GA after 2021/03/01
- releaseLevel: "beta",
+ releaseLevel: "ga",
},
{
inputDirectoryPath: "google/cloud/orgpolicy/v2",
@@ -989,8 +1003,7 @@
importPath: "cloud.google.com/go/orgpolicy/apiv2",
gRPCServiceConfigPath: "google/cloud/orgpolicy/v2/orgpolicy_grpc_service_config.json",
apiServiceConfigPath: "google/cloud/orgpolicy/v2/orgpolicy_v2.yaml",
- // GA after 2021/03/02
- releaseLevel: "beta",
+ releaseLevel: "ga",
},
{
inputDirectoryPath: "google/cloud/recommendationengine/v1beta1",
@@ -1014,8 +1027,7 @@
importPath: "cloud.google.com/go/apigateway/apiv1",
gRPCServiceConfigPath: "google/cloud/apigateway/v1/apigateway_grpc_service_config.json",
apiServiceConfigPath: "google/cloud/apigateway/v1/apigateway_v1.yaml",
- // GA after 2021/03/23
- releaseLevel: "beta",
+ releaseLevel: "ga",
},
{
inputDirectoryPath: "google/cloud/metastore/v1alpha",
@@ -1033,6 +1045,15 @@
apiServiceConfigPath: "google/cloud/metastore/v1beta/metastore_v1beta.yaml",
releaseLevel: "beta",
},
+ {
+ inputDirectoryPath: "google/cloud/resourcesettings/v1",
+ pkg: "resourcesettings",
+ importPath: "cloud.google.com/go/resourcesettings/apiv1",
+ gRPCServiceConfigPath: "google/cloud/resourcesettings/v1/resourcesettings_grpc_service_config.json",
+ apiServiceConfigPath: "google/cloud/resourcesettings/v1/resourcesettings_v1.yaml",
+ // GA after 2021/04/23
+ releaseLevel: "beta",
+ },
// Non-Cloud APIs
{
diff --git a/internal/gapicgen/generator/generator.go b/internal/gapicgen/generator/generator.go
index c3831e4..f9015fc 100644
--- a/internal/gapicgen/generator/generator.go
+++ b/internal/gapicgen/generator/generator.go
@@ -73,7 +73,7 @@
if err != nil {
return nil, err
}
- commits, err := CommitsSinceHash(googleapisDir, string(lastHash), true)
+ commits, err := CommitsSinceHash(googleapisDir, string(lastHash), false)
if err != nil {
return nil, err
}
diff --git a/internal/gapicgen/go.mod b/internal/gapicgen/go.mod
index a90ebeb..ef7d5a4 100644
--- a/internal/gapicgen/go.mod
+++ b/internal/gapicgen/go.mod
@@ -3,18 +3,17 @@
go 1.13
require (
- github.com/golang/protobuf v1.4.3 // indirect
- github.com/google/go-cmp v0.5.5 // indirect
- github.com/google/go-github/v33 v33.0.0
+ github.com/golang/protobuf v1.5.1 // indirect
+ github.com/google/go-github/v34 v34.0.0
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa
github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
github.com/stretchr/testify v1.6.1 // indirect
- golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
+ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
- golang.org/x/sys v0.0.0-20210314195730-07df6a141424 // indirect
+ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
golang.org/x/text v0.3.5 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
diff --git a/internal/gapicgen/go.sum b/internal/gapicgen/go.sum
index 2b7bbae..c616fb3 100644
--- a/internal/gapicgen/go.sum
+++ b/internal/gapicgen/go.sum
@@ -88,8 +88,9 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
-github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -101,8 +102,8 @@
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-github/v33 v33.0.0 h1:qAf9yP0qc54ufQxzwv+u9H0tiVOnPJxo0lI/JXqw3ZM=
-github.com/google/go-github/v33 v33.0.0/go.mod h1:GMdDnVZY/2TsWgp/lkYnpSAh6TrzhANBBwm6k6TTEXg=
+github.com/google/go-github/v34 v34.0.0 h1:/siYFImY8KwGc5QD1gaPf+f8QX6tLwxNIco2RkYxoFA=
+github.com/google/go-github/v34 v34.0.0/go.mod h1:w/2qlrXUfty+lbyO6tatnzIw97v1CM+/jZcwXMDiPQQ=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
@@ -233,8 +234,8 @@
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -279,8 +280,9 @@
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -412,8 +414,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum
index 2b9c5fb..1c77dda 100644
--- a/internal/godocfx/go.sum
+++ b/internal/godocfx/go.sum
@@ -54,8 +54,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -159,8 +161,8 @@
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -200,8 +202,9 @@
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -256,8 +259,8 @@
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -288,9 +291,9 @@
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-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -314,8 +317,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/internal/kokoro/environment.sh b/internal/kokoro/environment.sh
new file mode 100755
index 0000000..90d5018
--- /dev/null
+++ b/internal/kokoro/environment.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+# 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A suite of tests offered by https://github.com/googleapis/env-tests-logging
+# That allows deploying and testing features in live GCP services.
+# Currently only configured to test logging & error reporting
+
+set -eo pipefail
+
+# Test prechecks
+if [[ -z "${ENVIRONMENT:-}" ]]; then
+ echo "ENVIRONMENT not set. Exiting"
+ exit 1
+fi
+
+if [[ -z "${PROJECT_ROOT:-}" ]]; then
+ PROJECT_ROOT="github/google-cloud-go"
+fi
+
+# Add the test module as a submodule to the repo.
+cd "${KOKORO_ARTIFACTS_DIR}/github/google-cloud-go/internal/"
+git submodule add https://github.com/googleapis/env-tests-logging
+cd "env-tests-logging/"
+
+# Disable buffering, so that the logs stream through.
+export PYTHONUNBUFFERED=1
+
+# Debug: show build environment
+env | grep KOKORO
+
+# Set up service account credentials
+export GOOGLE_APPLICATION_CREDENTIALS=$KOKORO_KEYSTORE_DIR/72523_go_integration_service_account
+gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
+
+set -x
+export PROJECT_ID="dulcet-port-762"
+gcloud config set project $PROJECT_ID
+gcloud config set compute/zone us-central1-b
+
+# Authenticate docker
+gcloud auth configure-docker -q
+
+# Nox tests require Python 3.7, instead of 3.8
+pyenv global 3.7.10
+python3 -m pip uninstall --yes --quiet nox-automation
+python3 -m pip install --upgrade --quiet nox
+python3 -m nox --version
+
+# create a unique id for this run
+UUID=$(python -c 'import uuid; print(uuid.uuid1())' | head -c 7)
+export ENVCTL_ID=ci-$UUID
+echo $ENVCTL_ID
+
+# Run the environment test for the specified GCP service
+set +e
+python3.7 -m nox --session "tests(language='go', platform='$ENVIRONMENT')"
+TEST_STATUS_CODE=$?
+
+# destroy resources
+echo "cleaning up..."
+./envctl/envctl go $ENVIRONMENT destroy
+
+# exit with proper status code
+exit $TEST_STATUS_CODE
diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go
index 1036126..a7bb540 100644
--- a/iot/apiv1/doc.go
+++ b/iot/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 677a6e5..f622d3a 100644
--- a/kms/apiv1/doc.go
+++ b/kms/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 8951912..7295f13 100644
--- a/language/apiv1/doc.go
+++ b/language/apiv1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 bba0fc7..f0cf7c9 100644
--- a/language/apiv1beta2/doc.go
+++ b/language/apiv1beta2/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 ce6cb65..3355fe6 100644
--- a/logging/apiv2/doc.go
+++ b/logging/apiv2/doc.go
@@ -51,7 +51,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 8ba204c..909bb13 100644
--- a/logging/go.mod
+++ b/logging/go.mod
@@ -5,12 +5,12 @@
require (
cloud.google.com/go v0.79.0
cloud.google.com/go/storage v1.10.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.23.0
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
)
diff --git a/logging/go.sum b/logging/go.sum
index f53965e..59e8786 100644
--- a/logging/go.sum
+++ b/logging/go.sum
@@ -83,8 +83,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -221,8 +223,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -280,8 +283,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -366,8 +370,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -413,9 +417,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -443,8 +447,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go
index c8fd45c..dc04010 100644
--- a/longrunning/autogen/doc.go
+++ b/longrunning/autogen/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 3951628..f1b302c 100644
--- a/managedidentities/apiv1/doc.go
+++ b/managedidentities/apiv1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 6c3a501..9a84de7 100644
--- a/mediatranslation/apiv1beta1/doc.go
+++ b/mediatranslation/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 ac7a3b6..f65ef6d 100644
--- a/memcache/apiv1/doc.go
+++ b/memcache/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 33c6049..6d1240e 100644
--- a/memcache/apiv1beta2/doc.go
+++ b/memcache/apiv1beta2/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/metastore/apiv1alpha/doc.go b/metastore/apiv1alpha/doc.go
index 3c08167..a671e7c 100644
--- a/metastore/apiv1alpha/doc.go
+++ b/metastore/apiv1alpha/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/metastore/apiv1beta/doc.go b/metastore/apiv1beta/doc.go
index fd34893..613800d 100644
--- a/metastore/apiv1beta/doc.go
+++ b/metastore/apiv1beta/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/monitoring/apiv3/v2/alert_policy_client.go b/monitoring/apiv3/v2/alert_policy_client.go
index 38437a1..f274dd3 100644
--- a/monitoring/apiv3/v2/alert_policy_client.go
+++ b/monitoring/apiv3/v2/alert_policy_client.go
@@ -186,7 +186,7 @@
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
-// ListAlertPolicies lists the existing alerting policies for the project.
+// ListAlertPolicies lists the existing alerting policies for the workspace.
func (c *AlertPolicyClient) ListAlertPolicies(ctx context.Context, req *monitoringpb.ListAlertPoliciesRequest, opts ...gax.CallOption) *AlertPolicyIterator {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go
index a737592..8bff164 100644
--- a/monitoring/apiv3/v2/doc.go
+++ b/monitoring/apiv3/v2/doc.go
@@ -22,7 +22,7 @@
// individual method pages. The table entries below are presented in
// alphabetical order, not in order of common use. For explanations of the
// concepts found in the table entries, read the [Cloud Monitoring
-// documentation](https://cloud.google.com/monitoring/docs).
+// documentation](/monitoring/docs).
//
// Use of Context
//
@@ -53,7 +53,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/monitoring/apiv3/v2/gapic_metadata.json b/monitoring/apiv3/v2/gapic_metadata.json
index 2216fea..c522dbe 100644
--- a/monitoring/apiv3/v2/gapic_metadata.json
+++ b/monitoring/apiv3/v2/gapic_metadata.json
@@ -186,6 +186,20 @@
}
}
},
+ "QueryService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "QueryClient",
+ "rpcs": {
+ "QueryTimeSeries": {
+ "methods": [
+ "QueryTimeSeries"
+ ]
+ }
+ }
+ }
+ }
+ },
"ServiceMonitoringService": {
"clients": {
"grpc": {
diff --git a/monitoring/apiv3/v2/query_client.go b/monitoring/apiv3/v2/query_client.go
new file mode 100644
index 0000000..32fef9b
--- /dev/null
+++ b/monitoring/apiv3/v2/query_client.go
@@ -0,0 +1,226 @@
+// 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 monitoring
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+
+ "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"
+ monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/metadata"
+)
+
+var newQueryClientHook clientHook
+
+// QueryCallOptions contains the retry settings for each method of QueryClient.
+type QueryCallOptions struct {
+ QueryTimeSeries []gax.CallOption
+}
+
+func defaultQueryClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ internaloption.WithDefaultEndpoint("monitoring.googleapis.com:443"),
+ internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"),
+ internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"),
+ internaloption.WithDefaultScopes(DefaultAuthScopes()...),
+ option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
+ option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
+ grpc.MaxCallRecvMsgSize(math.MaxInt32))),
+ }
+}
+
+func defaultQueryCallOptions() *QueryCallOptions {
+ return &QueryCallOptions{
+ QueryTimeSeries: []gax.CallOption{},
+ }
+}
+
+// QueryClient is a client for interacting with Cloud Monitoring API.
+//
+// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
+type QueryClient 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.
+ queryClient monitoringpb.QueryServiceClient
+
+ // The call options for this service.
+ CallOptions *QueryCallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewQueryClient creates a new query service client.
+//
+// The QueryService API is used to manage time series data in Stackdriver
+// Monitoring. Time series data is a collection of data points that describes
+// the time-varying values of a metric.
+func NewQueryClient(ctx context.Context, opts ...option.ClientOption) (*QueryClient, error) {
+ clientOpts := defaultQueryClientOptions()
+
+ if newQueryClientHook != nil {
+ hookOpts, err := newQueryClientHook(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 := &QueryClient{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultQueryCallOptions(),
+
+ queryClient: monitoringpb.NewQueryServiceClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *QueryClient) 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 *QueryClient) 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 *QueryClient) 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...))
+}
+
+// QueryTimeSeries queries time series using Monitoring Query Language. This method does not require a Workspace.
+func (c *QueryClient) QueryTimeSeries(ctx context.Context, req *monitoringpb.QueryTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesDataIterator {
+ 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.QueryTimeSeries[0:len(c.CallOptions.QueryTimeSeries):len(c.CallOptions.QueryTimeSeries)], opts...)
+ it := &TimeSeriesDataIterator{}
+ req = proto.Clone(req).(*monitoringpb.QueryTimeSeriesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.TimeSeriesData, string, error) {
+ var resp *monitoringpb.QueryTimeSeriesResponse
+ 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.queryClient.QueryTimeSeries(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetTimeSeriesData(), 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
+}
+
+// TimeSeriesDataIterator manages a stream of *monitoringpb.TimeSeriesData.
+type TimeSeriesDataIterator struct {
+ items []*monitoringpb.TimeSeriesData
+ 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 []*monitoringpb.TimeSeriesData, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *TimeSeriesDataIterator) 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 *TimeSeriesDataIterator) Next() (*monitoringpb.TimeSeriesData, error) {
+ var item *monitoringpb.TimeSeriesData
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *TimeSeriesDataIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *TimeSeriesDataIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/monitoring/apiv3/v2/query_client_example_test.go b/monitoring/apiv3/v2/query_client_example_test.go
new file mode 100644
index 0000000..11386dd
--- /dev/null
+++ b/monitoring/apiv3/v2/query_client_example_test.go
@@ -0,0 +1,62 @@
+// 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 monitoring_test
+
+import (
+ "context"
+
+ monitoring "cloud.google.com/go/monitoring/apiv3/v2"
+ "google.golang.org/api/iterator"
+ monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
+)
+
+func ExampleNewQueryClient() {
+ ctx := context.Background()
+ c, err := monitoring.NewQueryClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleQueryClient_QueryTimeSeries() {
+ // import monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := monitoring.NewQueryClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &monitoringpb.QueryTimeSeriesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.QueryTimeSeries(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/monitoring/dashboard/apiv1/dashboards_client.go b/monitoring/dashboard/apiv1/dashboards_client.go
index 7e05fd7..7e3e6f8 100644
--- a/monitoring/dashboard/apiv1/dashboards_client.go
+++ b/monitoring/dashboard/apiv1/dashboards_client.go
@@ -168,11 +168,8 @@
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
-// CreateDashboard creates a new custom dashboard.
-//
-// This method requires the monitoring.dashboards.create permission
-// on the specified project. For more information, see
-// Google Cloud IAM (at https://cloud.google.com/iam).
+// CreateDashboard creates a new custom dashboard. For examples on how you can use this API to create dashboards, see Managing dashboards by API (at https://cloud.google.com/monitoring/dashboards/api-dashboard).
+// This method requires the monitoring.dashboards.create permission on the specified project. For more information about permissions, see Cloud Identity and Access Management (at https://cloud.google.com/iam).
func (c *DashboardsClient) CreateDashboard(ctx context.Context, req *dashboardpb.CreateDashboardRequest, opts ...gax.CallOption) (*dashboardpb.Dashboard, error) {
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
cctx, cancel := context.WithTimeout(ctx, 30000*time.Millisecond)
@@ -198,7 +195,7 @@
//
// This method requires the monitoring.dashboards.list permission
// on the specified project. For more information, see
-// Google Cloud IAM (at https://cloud.google.com/iam).
+// Cloud Identity and Access Management (at https://cloud.google.com/iam).
func (c *DashboardsClient) ListDashboards(ctx context.Context, req *dashboardpb.ListDashboardsRequest, opts ...gax.CallOption) *DashboardIterator {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -243,7 +240,7 @@
//
// This method requires the monitoring.dashboards.get permission
// on the specified dashboard. For more information, see
-// Google Cloud IAM (at https://cloud.google.com/iam).
+// Cloud Identity and Access Management (at https://cloud.google.com/iam).
func (c *DashboardsClient) GetDashboard(ctx context.Context, req *dashboardpb.GetDashboardRequest, opts ...gax.CallOption) (*dashboardpb.Dashboard, error) {
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
cctx, cancel := context.WithTimeout(ctx, 30000*time.Millisecond)
@@ -269,7 +266,7 @@
//
// This method requires the monitoring.dashboards.delete permission
// on the specified dashboard. For more information, see
-// Google Cloud IAM (at https://cloud.google.com/iam).
+// Cloud Identity and Access Management (at https://cloud.google.com/iam).
func (c *DashboardsClient) DeleteDashboard(ctx context.Context, req *dashboardpb.DeleteDashboardRequest, opts ...gax.CallOption) error {
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
cctx, cancel := context.WithTimeout(ctx, 30000*time.Millisecond)
@@ -291,7 +288,7 @@
//
// This method requires the monitoring.dashboards.update permission
// on the specified dashboard. For more information, see
-// Google Cloud IAM (at https://cloud.google.com/iam).
+// Cloud Identity and Access Management (at https://cloud.google.com/iam).
func (c *DashboardsClient) UpdateDashboard(ctx context.Context, req *dashboardpb.UpdateDashboardRequest, opts ...gax.CallOption) (*dashboardpb.Dashboard, error) {
if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
cctx, cancel := context.WithTimeout(ctx, 30000*time.Millisecond)
diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go
index 347f866..2cba2ee 100644
--- a/monitoring/dashboard/apiv1/doc.go
+++ b/monitoring/dashboard/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 985c176..21ee4a0 100644
--- a/networkconnectivity/apiv1alpha1/doc.go
+++ b/networkconnectivity/apiv1alpha1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2a0d651..02cc0a1 100644
--- a/notebooks/apiv1beta1/doc.go
+++ b/notebooks/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 a363f51..c960ff0 100644
--- a/orgpolicy/apiv2/doc.go
+++ b/orgpolicy/apiv2/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 48cafc7..52da96e 100644
--- a/osconfig/agentendpoint/apiv1/doc.go
+++ b/osconfig/agentendpoint/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 d9b54ee..81438c7 100644
--- a/osconfig/agentendpoint/apiv1beta/doc.go
+++ b/osconfig/agentendpoint/apiv1beta/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 3487739..121b495 100644
--- a/osconfig/apiv1/doc.go
+++ b/osconfig/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 c6b77fa..128d143 100644
--- a/osconfig/apiv1beta/doc.go
+++ b/osconfig/apiv1beta/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 5f7c81a..a973f34 100644
--- a/oslogin/apiv1/doc.go
+++ b/oslogin/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 60af2f8..6ce89d7 100644
--- a/oslogin/apiv1beta/doc.go
+++ b/oslogin/apiv1beta/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 236e1e4..3758b22 100644
--- a/phishingprotection/apiv1beta1/doc.go
+++ b/phishingprotection/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 5b378f7..7af0428 100644
--- a/policytroubleshooter/apiv1/doc.go
+++ b/policytroubleshooter/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2443ffd..82df345 100644
--- a/pubsub/apiv1/doc.go
+++ b/pubsub/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/pubsub/go.mod b/pubsub/go.mod
index cdff63e..dddda07 100644
--- a/pubsub/go.mod
+++ b/pubsub/go.mod
@@ -4,15 +4,15 @@
require (
cloud.google.com/go v0.79.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.23.0
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
- google.golang.org/protobuf v1.25.0
+ google.golang.org/protobuf v1.26.0
)
diff --git a/pubsub/go.sum b/pubsub/go.sum
index ade258e..06126a2 100644
--- a/pubsub/go.sum
+++ b/pubsub/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -122,7 +124,6 @@
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
-github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -174,7 +175,6 @@
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
-golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
@@ -185,7 +185,6 @@
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -218,8 +217,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -277,8 +277,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -338,12 +339,10 @@
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
-golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -365,15 +364,14 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
-google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
@@ -412,9 +410,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -442,8 +440,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/pubsub/integration_test.go b/pubsub/integration_test.go
index 3427655..c1f9b18 100644
--- a/pubsub/integration_test.go
+++ b/pubsub/integration_test.go
@@ -19,6 +19,7 @@
"bytes"
"context"
"fmt"
+ "io/ioutil"
"os"
"strings"
"sync"
@@ -47,8 +48,9 @@
)
var (
- topicIDs = uid.NewSpace("topic", nil)
- subIDs = uid.NewSpace("sub", nil)
+ topicIDs = uid.NewSpace("topic", nil)
+ subIDs = uid.NewSpace("sub", nil)
+ schemaIDs = uid.NewSpace("schema", nil)
)
// messageData is used to hold the contents of a message so that it can be compared against the contents
@@ -97,6 +99,26 @@
return client
}
+func integrationTestSchemaClient(ctx context.Context, t *testing.T, opts ...option.ClientOption) *SchemaClient {
+ if testing.Short() {
+ t.Skip("Integration tests skipped in short mode")
+ }
+ projID := testutil.ProjID()
+ if projID == "" {
+ t.Skip("Integration tests skipped. See CONTRIBUTING.md for details")
+ }
+ ts := testutil.TokenSource(ctx, ScopePubSub, ScopeCloudPlatform)
+ if ts == nil {
+ t.Skip("Integration tests skipped. See CONTRIBUTING.md for details")
+ }
+ opts = append(withGRPCHeadersAssertion(t, option.WithTokenSource(ts)), opts...)
+ sc, err := NewSchemaClient(ctx, projID, opts...)
+ if err != nil {
+ t.Fatalf("Creating client error: %v", err)
+ }
+ return sc
+}
+
func TestIntegration_All(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -1100,7 +1122,7 @@
t.Fatal(err)
}
want := tc
- if diff := testutil.Diff(got, want); diff != "" {
+ if diff := testutil.Diff(got.MessageStoragePolicy, want.MessageStoragePolicy); diff != "" {
t.Fatalf("\ngot: - want: +\n%s", diff)
}
}
@@ -1726,3 +1748,186 @@
t.Fatalf("SubscriptionConfig for detached sub; got: - want: +\n%s", diff)
}
}
+
+func TestIntegration_SchemaAdmin(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ c := integrationTestSchemaClient(ctx, t)
+ defer c.Close()
+
+ for _, tc := range []struct {
+ desc string
+ schemaType SchemaType
+ path string
+ }{
+ {
+ desc: "avro schema",
+ schemaType: SchemaAvro,
+ path: "testdata/us-states.avsc",
+ },
+ {
+ desc: "protocol buffer schema",
+ schemaType: SchemaProtocolBuffer,
+ path: "testdata/us-states.proto",
+ },
+ } {
+ t.Run(tc.desc, func(t *testing.T) {
+ content, err := ioutil.ReadFile(tc.path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ schema := string(content)
+ schemaID := schemaIDs.New()
+ schemaPath := fmt.Sprintf("projects/%s/schemas/%s", testutil.ProjID(), schemaID)
+ sc := SchemaConfig{
+ Type: tc.schemaType,
+ Definition: schema,
+ }
+ got, err := c.CreateSchema(ctx, schemaID, sc)
+ if err != nil {
+ t.Fatalf("SchemaClient.CreateSchema error: %v", err)
+ }
+
+ want := &SchemaConfig{
+ Name: schemaPath,
+ Type: tc.schemaType,
+ Definition: schema,
+ }
+ if diff := testutil.Diff(got, want); diff != "" {
+ t.Fatalf("\ngot: - want: +\n%s", diff)
+ }
+
+ got, err = c.Schema(ctx, schemaPath, SchemaViewFull)
+ if err != nil {
+ t.Fatalf("SchemaClient.Schema error: %v", err)
+ }
+ if diff := testutil.Diff(got, want); diff != "" {
+ t.Fatalf("\ngot: - want: +\n%s", diff)
+ }
+
+ err = c.DeleteSchema(ctx, schemaPath)
+ if err != nil {
+ t.Fatalf("SchemaClient.DeleteSchema error: %v", err)
+ }
+ })
+ }
+}
+
+func TestIntegration_ValidateSchema(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ c := integrationTestSchemaClient(ctx, t)
+ defer c.Close()
+
+ for _, tc := range []struct {
+ desc string
+ schemaType SchemaType
+ path string
+ wantErr error
+ }{
+ {
+ desc: "avro schema",
+ schemaType: SchemaAvro,
+ path: "testdata/schema/us-states.avsc",
+ wantErr: nil,
+ },
+ {
+ desc: "protocol buffer schema",
+ schemaType: SchemaProtocolBuffer,
+ path: "testdata/schema/us-states.proto",
+ wantErr: nil,
+ },
+ {
+ desc: "protocol buffer schema",
+ schemaType: SchemaProtocolBuffer,
+ path: "testdata/schema/invalid.avsc",
+ wantErr: status.Errorf(codes.InvalidArgument, "Request contains an invalid argument."),
+ },
+ } {
+ t.Run(tc.desc, func(t *testing.T) {
+ content, err := ioutil.ReadFile(tc.path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ def := string(content)
+ cfg := SchemaConfig{
+ Type: tc.schemaType,
+ Definition: def,
+ }
+ _, gotErr := c.ValidateSchema(ctx, cfg)
+ if status.Code(gotErr) != status.Code(tc.wantErr) {
+ t.Fatalf("got err: %v\nwant err: %v", gotErr, tc.wantErr)
+ }
+ })
+ }
+}
+
+func TestIntegration_ValidateMessage(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ c := integrationTestSchemaClient(ctx, t)
+ defer c.Close()
+
+ for _, tc := range []struct {
+ desc string
+ schemaType SchemaType
+ schemaPath string
+ encoding SchemaEncoding
+ messagePath string
+ wantErr error
+ }{
+ {
+ desc: "avro json encoding",
+ schemaType: SchemaAvro,
+ schemaPath: "testdata/schema/us-states.avsc",
+ encoding: EncodingJSON,
+ messagePath: "testdata/schema/alaska.json",
+ wantErr: nil,
+ },
+ {
+ desc: "avro binary encoding",
+ schemaType: SchemaAvro,
+ schemaPath: "testdata/schema/us-states.avsc",
+ encoding: EncodingBinary,
+ messagePath: "testdata/schema/alaska.avro",
+ wantErr: nil,
+ },
+ {
+ desc: "proto json encoding",
+ schemaType: SchemaProtocolBuffer,
+ schemaPath: "testdata/schema/us-states.proto",
+ encoding: EncodingJSON,
+ messagePath: "testdata/schema/alaska.json",
+ wantErr: nil,
+ },
+ {
+ desc: "protocol buffer schema",
+ schemaType: SchemaProtocolBuffer,
+ schemaPath: "testdata/schema/invalid.avsc",
+ encoding: EncodingBinary,
+ messagePath: "testdata/schema/invalid.avsc",
+ wantErr: status.Errorf(codes.InvalidArgument, "Request contains an invalid argument."),
+ },
+ } {
+ t.Run(tc.desc, func(t *testing.T) {
+ content, err := ioutil.ReadFile(tc.schemaPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ def := string(content)
+ cfg := SchemaConfig{
+ Type: tc.schemaType,
+ Definition: def,
+ }
+
+ msg, err := ioutil.ReadFile(tc.messagePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, gotErr := c.ValidateMessageWithConfig(ctx, msg, tc.encoding, cfg)
+ if status.Code(gotErr) != status.Code(tc.wantErr) {
+ t.Fatalf("got err: %v\nwant err: %v", gotErr, tc.wantErr)
+ }
+ })
+ }
+}
diff --git a/pubsub/pstest/fake.go b/pubsub/pstest/fake.go
index 2f50f97..edd82f1 100644
--- a/pubsub/pstest/fake.go
+++ b/pubsub/pstest/fake.go
@@ -98,6 +98,7 @@
streamTimeout time.Duration
timeNowFunc func() time.Time
reactorOptions ReactorOptions
+ schemas map[string]*pb.Schema
}
// NewServer creates a new fake server running in the current process.
@@ -119,10 +120,12 @@
msgsByID: map[string]*Message{},
timeNowFunc: timeNow,
reactorOptions: reactorOptions,
+ schemas: map[string]*pb.Schema{},
},
}
pb.RegisterPublisherServer(srv.Gsrv, &s.GServer)
pb.RegisterSubscriberServer(srv.Gsrv, &s.GServer)
+ pb.RegisterSchemaServiceServer(srv.Gsrv, &s.GServer)
srv.Start()
return s
}
@@ -1180,3 +1183,115 @@
Reactor: &errorInjectionReactor{code: code, msg: msg},
}
}
+
+func (s *GServer) CreateSchema(_ context.Context, req *pb.CreateSchemaRequest) (*pb.Schema, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if handled, ret, err := s.runReactor(req, "CreateSchema", &pb.Schema{}); handled || err != nil {
+ return ret.(*pb.Schema), err
+ }
+
+ name := fmt.Sprintf("%s/schemas/%s", req.Parent, req.SchemaId)
+ sc := &pb.Schema{
+ Name: name,
+ Type: req.Schema.Type,
+ Definition: req.Schema.Definition,
+ }
+ s.schemas[name] = sc
+
+ return sc, nil
+}
+
+func (s *GServer) GetSchema(_ context.Context, req *pb.GetSchemaRequest) (*pb.Schema, error) {
+
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if handled, ret, err := s.runReactor(req, "GetSchema", &pb.Schema{}); handled || err != nil {
+ return ret.(*pb.Schema), err
+ }
+
+ sc, ok := s.schemas[req.Name]
+ if !ok {
+ return nil, status.Errorf(codes.NotFound, "schema(%q) not found", req.Name)
+ }
+ return sc, nil
+}
+
+func (s *GServer) ListSchemas(_ context.Context, req *pb.ListSchemasRequest) (*pb.ListSchemasResponse, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if handled, ret, err := s.runReactor(req, "ListSchemas", &pb.ListSchemasResponse{}); handled || err != nil {
+ return ret.(*pb.ListSchemasResponse), err
+ }
+ ss := make([]*pb.Schema, 0)
+ for _, sc := range s.schemas {
+ ss = append(ss, sc)
+ }
+ return &pb.ListSchemasResponse{
+ Schemas: ss,
+ }, nil
+}
+
+func (s *GServer) DeleteSchema(_ context.Context, req *pb.DeleteSchemaRequest) (*emptypb.Empty, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if handled, ret, err := s.runReactor(req, "DeleteSchema", &emptypb.Empty{}); handled || err != nil {
+ return ret.(*emptypb.Empty), err
+ }
+
+ schema := s.schemas[req.Name]
+ if schema == nil {
+ return nil, status.Errorf(codes.NotFound, "schema %q", req.Name)
+ }
+
+ delete(s.schemas, req.Name)
+ return &emptypb.Empty{}, nil
+}
+
+// ValidateSchema mocks the ValidateSchema call but only checks that the schema definition is not empty.
+func (s *GServer) ValidateSchema(_ context.Context, req *pb.ValidateSchemaRequest) (*pb.ValidateSchemaResponse, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if handled, ret, err := s.runReactor(req, "ValidateSchema", &pb.ValidateSchemaResponse{}); handled || err != nil {
+ return ret.(*pb.ValidateSchemaResponse), err
+ }
+
+ if req.Schema.Definition == "" {
+ return nil, status.Error(codes.InvalidArgument, "schema definition cannot be empty")
+ }
+ return &pb.ValidateSchemaResponse{}, nil
+}
+
+// ValidateMessage mocks the ValidateMessage call but only checks that the schema definition to validate the
+// message against is not empty.
+func (s *GServer) ValidateMessage(_ context.Context, req *pb.ValidateMessageRequest) (*pb.ValidateMessageResponse, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if handled, ret, err := s.runReactor(req, "ValidateMessage", &pb.ValidateMessageResponse{}); handled || err != nil {
+ return ret.(*pb.ValidateMessageResponse), err
+ }
+
+ spec := req.GetSchemaSpec()
+ if valReq, ok := spec.(*pb.ValidateMessageRequest_Name); ok {
+ sc, ok := s.schemas[valReq.Name]
+ if !ok {
+ return nil, status.Errorf(codes.NotFound, "schema(%q) not found", valReq.Name)
+ }
+ if sc.Definition == "" {
+ return nil, status.Error(codes.InvalidArgument, "schema definition cannot be empty")
+ }
+ }
+ if valReq, ok := spec.(*pb.ValidateMessageRequest_Schema); ok {
+ if valReq.Schema.Definition == "" {
+ return nil, status.Error(codes.InvalidArgument, "schema definition cannot be empty")
+ }
+ }
+
+ return &pb.ValidateMessageResponse{}, nil
+}
diff --git a/pubsub/pstest/fake_test.go b/pubsub/pstest/fake_test.go
index 6b75c2f..3b2adc3 100644
--- a/pubsub/pstest/fake_test.go
+++ b/pubsub/pstest/fake_test.go
@@ -850,6 +850,69 @@
}
}
+// Test Create, Get, List, and Delete methods for schema client.
+// Updating a schema is not available at this moment.
+func TestSchemaAdminClient(t *testing.T) {
+ ctx := context.Background()
+ _, _, srv, cleanup := newFake(ctx, t)
+ defer cleanup()
+
+ conn, err := grpc.DialContext(ctx, srv.Addr, grpc.WithInsecure())
+ if err != nil {
+ t.Fatal(err)
+ }
+ project := "projects/some-project"
+ schemaID := "some-schema"
+ sclient := pb.NewSchemaServiceClient(conn)
+ pbs, err := sclient.CreateSchema(ctx, &pb.CreateSchemaRequest{
+ Parent: project,
+ Schema: &pb.Schema{
+ Type: pb.Schema_AVRO,
+ Definition: "avro-definition",
+ },
+ SchemaId: schemaID,
+ })
+ if err != nil {
+ t.Errorf("cannot create schema: %v", err)
+ }
+ pbs2, err := sclient.GetSchema(ctx, &pb.GetSchemaRequest{
+ Name: fmt.Sprintf("%s/schemas/%s", project, schemaID),
+ View: pb.SchemaView_FULL,
+ })
+ if err != nil {
+ t.Errorf("cannot get schema: %v", err)
+ }
+ if diff := testutil.Diff(pbs, pbs2); diff != "" {
+ t.Errorf("returned schema different, -want, +got, %s", diff)
+ }
+
+ resp, err := sclient.ListSchemas(ctx, &pb.ListSchemasRequest{
+ Parent: project,
+ View: pb.SchemaView_FULL,
+ })
+ if err != nil {
+ t.Errorf("cannot list schema: %v", err)
+ }
+ schemas := resp.Schemas
+ if len(schemas) != 1 {
+ for _, schema := range schemas {
+ fmt.Printf("schema: %v\n", schema)
+ }
+ t.Errorf("got wrong number of schemas in list: %d", len(schemas))
+ }
+
+ _, err = sclient.DeleteSchema(ctx, &pb.DeleteSchemaRequest{
+ Name: fmt.Sprintf("%s/schemas/%s", project, schemaID),
+ })
+ if err != nil {
+ t.Errorf("cannot delete schema: %v", err)
+ }
+ if got, want := len(srv.GServer.schemas), 0; got != want {
+ t.Fatalf("got %d topics, want %d", got, want)
+ }
+
+}
+
func mustStartStreamingPull(ctx context.Context, t *testing.T, sc pb.SubscriberClient, sub *pb.Subscription) pb.Subscriber_StreamingPullClient {
spc, err := sc.StreamingPull(ctx)
if err != nil {
diff --git a/pubsub/schema.go b/pubsub/schema.go
new file mode 100644
index 0000000..c1d39aa
--- /dev/null
+++ b/pubsub/schema.go
@@ -0,0 +1,263 @@
+// 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
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pubsub
+
+import (
+ "context"
+ "fmt"
+
+ "google.golang.org/api/option"
+
+ vkit "cloud.google.com/go/pubsub/apiv1"
+ pb "google.golang.org/genproto/googleapis/pubsub/v1"
+)
+
+// SchemaClient is a Pub/Sub schema client scoped to a single project.
+type SchemaClient struct {
+ sc *vkit.SchemaClient
+ projectID string
+}
+
+// Close closes the schema client and frees up resources.
+func (s *SchemaClient) Close() error {
+ return s.sc.Close()
+}
+
+// NewSchemaClient creates a new Pub/Sub Schema client.
+func NewSchemaClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*SchemaClient, error) {
+ sc, err := vkit.NewSchemaClient(ctx, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &SchemaClient{sc: sc, projectID: projectID}, nil
+}
+
+// SchemaConfig is a reference to a PubSub schema.
+type SchemaConfig struct {
+ // The name of the schema populated by the server. This field is read-only.
+ Name string
+
+ // The type of the schema definition.
+ Type SchemaType
+
+ // The definition of the schema. This should contain a string representing
+ // the full definition of the schema that is a valid schema definition of
+ // the type specified in `type`.
+ Definition string
+}
+
+// SchemaType is the possible shcema definition types.
+type SchemaType pb.Schema_Type
+
+const (
+ // SchemaTypeUnspecified is the unused default value.
+ SchemaTypeUnspecified SchemaType = 0
+ // SchemaProtocolBuffer is a protobuf schema definition.
+ SchemaProtocolBuffer SchemaType = 1
+ // SchemaAvro is an Avro schema definition.
+ SchemaAvro SchemaType = 2
+)
+
+// SchemaView is a view of Schema object fields to be returned
+// by GetSchema and ListSchemas.
+type SchemaView pb.SchemaView
+
+const (
+ // SchemaViewUnspecified is the default/unset value.
+ SchemaViewUnspecified SchemaView = 0
+ // SchemaViewBasic includes the name and type of the schema, but not the definition.
+ SchemaViewBasic SchemaView = 1
+ // SchemaViewFull includes all Schema object fields.
+ SchemaViewFull SchemaView = 2
+)
+
+// SchemaSettings are settings for validating messages
+// published against a schema.
+type SchemaSettings struct {
+ Schema string
+ Encoding SchemaEncoding
+}
+
+func schemaSettingsToProto(schema *SchemaSettings) *pb.SchemaSettings {
+ if schema == nil {
+ return nil
+ }
+ return &pb.SchemaSettings{
+ Schema: schema.Schema,
+ Encoding: pb.Encoding(schema.Encoding),
+ }
+}
+
+func protoToSchemaSettings(pbs *pb.SchemaSettings) *SchemaSettings {
+ if pbs == nil {
+ return nil
+ }
+ return &SchemaSettings{
+ Schema: pbs.Schema,
+ Encoding: SchemaEncoding(pbs.Encoding),
+ }
+}
+
+// SchemaEncoding is the encoding expected for messages.
+type SchemaEncoding pb.Encoding
+
+const (
+ // EncodingUnspecified is the default unused value.
+ EncodingUnspecified SchemaEncoding = 0
+ // EncodingJSON is the JSON encoding type for a message.
+ EncodingJSON SchemaEncoding = 1
+ // EncodingBinary is the binary encoding type for a message.
+ // For some schema types, binary encoding may not be available.
+ EncodingBinary SchemaEncoding = 2
+)
+
+func (s *SchemaConfig) toProto() *pb.Schema {
+ pbs := &pb.Schema{
+ Name: s.Name,
+ Type: pb.Schema_Type(s.Type),
+ Definition: s.Definition,
+ }
+ return pbs
+}
+
+func protoToSchemaConfig(pbs *pb.Schema) *SchemaConfig {
+ return &SchemaConfig{
+ Name: pbs.Name,
+ Type: SchemaType(pbs.Type),
+ Definition: pbs.Definition,
+ }
+}
+
+// CreateSchema creates a new schema with the given schemaID
+// and config. Schemas cannot be updated after creation.
+func (c *SchemaClient) CreateSchema(ctx context.Context, schemaID string, s SchemaConfig) (*SchemaConfig, error) {
+ req := &pb.CreateSchemaRequest{
+ Parent: fmt.Sprintf("projects/%s", c.projectID),
+ Schema: s.toProto(),
+ SchemaId: schemaID,
+ }
+ pbs, err := c.sc.CreateSchema(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+ return protoToSchemaConfig(pbs), nil
+}
+
+// Schema retrieves the configuration of a schema.
+func (c *SchemaClient) Schema(ctx context.Context, schemaID string, view SchemaView) (*SchemaConfig, error) {
+ schemaPath := fmt.Sprintf("projects/%s/schemas/%s", c.projectID, schemaID)
+ req := &pb.GetSchemaRequest{
+ Name: schemaPath,
+ View: pb.SchemaView(view),
+ }
+ s, err := c.sc.GetSchema(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+ return protoToSchemaConfig(s), nil
+}
+
+// Schemas returns an iterator which returns all of the schemas for the client's project.
+func (c *SchemaClient) Schemas(ctx context.Context, view SchemaView) *SchemaIterator {
+ return &SchemaIterator{
+ it: c.sc.ListSchemas(ctx, &pb.ListSchemasRequest{
+ Parent: fmt.Sprintf("projects/%s", c.projectID),
+ View: pb.SchemaView(view),
+ }),
+ }
+}
+
+// SchemaIterator is a struct used to iterate over schemas.
+type SchemaIterator struct {
+ it *vkit.SchemaIterator
+ err error
+}
+
+// Next returns the next schema. If there are no more schemas, iterator.Done will be returned.
+func (s *SchemaIterator) Next() (*SchemaConfig, error) {
+ if s.err != nil {
+ return nil, s.err
+ }
+ pbs, err := s.it.Next()
+ if err != nil {
+ return nil, err
+ }
+ return protoToSchemaConfig(pbs), nil
+}
+
+// DeleteSchema deletes an existing schema.
+func (s *SchemaClient) DeleteSchema(ctx context.Context, schemaID string) error {
+ schemaPath := fmt.Sprintf("projects/%s/schemas/%s", s.projectID, schemaID)
+ return s.sc.DeleteSchema(ctx, &pb.DeleteSchemaRequest{
+ Name: schemaPath,
+ })
+}
+
+// ValidateSchemaResult is the response for the ValidateSchema method.
+// Reserved for future use.
+type ValidateSchemaResult struct{}
+
+// ValidateSchema validates a schema config and returns an error if invalid.
+func (s *SchemaClient) ValidateSchema(ctx context.Context, schema SchemaConfig) (*ValidateSchemaResult, error) {
+ req := &pb.ValidateSchemaRequest{
+ Parent: fmt.Sprintf("projects/%s", s.projectID),
+ Schema: schema.toProto(),
+ }
+ _, err := s.sc.ValidateSchema(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+ return &ValidateSchemaResult{}, nil
+}
+
+// ValidateMessageResult is the response for the ValidateMessage method.
+// Reserved for future use.
+type ValidateMessageResult struct{}
+
+// ValidateMessageWithConfig validates a message against an schema specified
+// by a schema config.
+func (s *SchemaClient) ValidateMessageWithConfig(ctx context.Context, msg []byte, encoding SchemaEncoding, config SchemaConfig) (*ValidateMessageResult, error) {
+ req := &pb.ValidateMessageRequest{
+ Parent: fmt.Sprintf("projects/%s", s.projectID),
+ SchemaSpec: &pb.ValidateMessageRequest_Schema{
+ Schema: config.toProto(),
+ },
+ Message: msg,
+ Encoding: pb.Encoding(encoding),
+ }
+ _, err := s.sc.ValidateMessage(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+ return &ValidateMessageResult{}, nil
+}
+
+// ValidateMessageWithID validates a message against an schema specified
+// by the schema ID of an existing schema.
+func (s *SchemaClient) ValidateMessageWithID(ctx context.Context, msg []byte, encoding SchemaEncoding, schemaID string) (*ValidateMessageResult, error) {
+ req := &pb.ValidateMessageRequest{
+ Parent: fmt.Sprintf("projects/%s", s.projectID),
+ SchemaSpec: &pb.ValidateMessageRequest_Name{
+ Name: fmt.Sprintf("projects/%s/schemas/%s", s.projectID, schemaID),
+ },
+ Message: msg,
+ Encoding: pb.Encoding(encoding),
+ }
+ _, err := s.sc.ValidateMessage(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+ return &ValidateMessageResult{}, nil
+}
diff --git a/pubsub/schema_test.go b/pubsub/schema_test.go
new file mode 100644
index 0000000..bc0b7ef
--- /dev/null
+++ b/pubsub/schema_test.go
@@ -0,0 +1,175 @@
+// 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
+
+package pubsub
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "cloud.google.com/go/internal/testutil"
+ "github.com/google/go-cmp/cmp"
+ "google.golang.org/api/iterator"
+ "google.golang.org/api/option"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+
+ "cloud.google.com/go/pubsub/pstest"
+)
+
+func newSchemaFake(t *testing.T) (*SchemaClient, *pstest.Server) {
+ ctx := context.Background()
+ srv := pstest.NewServer()
+
+ schema, err := NewSchemaClient(ctx, "my-proj", option.WithEndpoint(srv.Addr), option.WithoutAuthentication(), option.WithGRPCDialOption(grpc.WithInsecure()))
+ if err != nil {
+ t.Fatal(err)
+ }
+ return schema, srv
+}
+
+func TestSchemaBasicCreateGetDelete(t *testing.T) {
+ ctx := context.Background()
+
+ // Inputs
+ schemaID := "my-schema"
+ schemaPath := fmt.Sprintf("projects/my-proj/schemas/%s", schemaID)
+ schemaConfig := SchemaConfig{
+ Name: schemaPath,
+ Type: SchemaAvro,
+ Definition: "some-definition",
+ }
+
+ admin, _ := newSchemaFake(t)
+ defer admin.Close()
+
+ if gotConfig, err := admin.CreateSchema(ctx, schemaID, schemaConfig); err != nil {
+ t.Errorf("CreateSchema() got err: %v", err)
+ } else if diff := cmp.Diff(*gotConfig, schemaConfig); diff != "" {
+ t.Errorf("CreateSchema() -want, +got: %v", diff)
+ }
+
+ gotConfig, err := admin.Schema(ctx, schemaID, SchemaViewFull)
+ if err != nil {
+ t.Errorf("Schema() got err: %v", err)
+ }
+ if diff := testutil.Diff(*gotConfig, schemaConfig); diff != "" {
+ t.Errorf("Schema() -got, +want:\n%v", diff)
+ }
+
+ if err := admin.DeleteSchema(ctx, schemaID); err != nil {
+ t.Errorf("DeleteSchema() got err: %v", err)
+ }
+
+ if err := admin.DeleteSchema(ctx, "fake-schema"); err == nil {
+ t.Error("DeleteSchema() got nil, expected NotFound err")
+ }
+}
+
+func TestSchemaListSchemas(t *testing.T) {
+ ctx := context.Background()
+ admin, _ := newSchemaFake(t)
+ defer admin.Close()
+
+ // Inputs
+ schemaConfig1 := SchemaConfig{
+ Name: "projects/my-proj/schemas/schema-1",
+ Type: SchemaAvro,
+ Definition: "some schema definition",
+ }
+ schemaConfig2 := SchemaConfig{
+ Name: "projects/my-proj/schemas/schema-2",
+ Type: SchemaProtocolBuffer,
+ Definition: "some other schema definition",
+ }
+
+ mustCreateSchema(t, admin, "schema-1", schemaConfig1)
+ mustCreateSchema(t, admin, "schema-2", schemaConfig2)
+
+ var gotSchemaConfigs []SchemaConfig
+ it := admin.Schemas(ctx, SchemaViewFull)
+ for {
+ schema, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ t.Errorf("SchemaIterator.Next() got err: %v", err)
+ } else {
+ gotSchemaConfigs = append(gotSchemaConfigs, *schema)
+ }
+ }
+
+ got := len(gotSchemaConfigs)
+ want := 2
+ if got != want {
+ t.Errorf("Schemas() want: %d schemas, got: %d", want, got)
+ }
+}
+
+func TestSchemaValidateSchema(t *testing.T) {
+ ctx := context.Background()
+ admin, _ := newSchemaFake(t)
+ defer admin.Close()
+
+ for _, tc := range []struct {
+ desc string
+ schema SchemaConfig
+ wantErr error
+ }{
+ {
+ desc: "valid avro schema",
+ schema: SchemaConfig{
+ Name: "schema-1",
+ Type: SchemaAvro,
+ Definition: "{name:some-avro-schema}",
+ },
+ wantErr: nil,
+ },
+ {
+ desc: "valid proto schema",
+ schema: SchemaConfig{
+ Name: "schema-1",
+ Type: SchemaProtocolBuffer,
+ Definition: "some proto buf schema definition",
+ },
+ wantErr: nil,
+ },
+ {
+ desc: "empty invalid schema",
+ schema: SchemaConfig{
+ Name: "schema-3",
+ Type: SchemaProtocolBuffer,
+ Definition: "",
+ },
+ wantErr: status.Error(codes.InvalidArgument, "schema definition cannot be empty"),
+ },
+ } {
+ t.Run(tc.desc, func(t *testing.T) {
+ _, gotErr := admin.ValidateSchema(ctx, tc.schema)
+ if status.Code(gotErr) != status.Code(tc.wantErr) {
+ t.Fatalf("got err: %v\nwant err: %v", gotErr, tc.wantErr)
+ }
+ })
+ }
+}
+
+func mustCreateSchema(t *testing.T, c *SchemaClient, id string, sc SchemaConfig) *SchemaConfig {
+ schema, err := c.CreateSchema(context.Background(), id, sc)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return schema
+}
diff --git a/pubsub/testdata/README.md b/pubsub/testdata/README.md
index 9b28a9c..76dba1c 100644
--- a/pubsub/testdata/README.md
+++ b/pubsub/testdata/README.md
@@ -1,3 +1,9 @@
# Generation
publish.csv was generated with `kimkyung@`'s ordering_key_verifier.
+
+`schema` contains test data related to the schema feature.
+
+`schema/us-states.proto` and `schema/us-states.avsc` are used to validate protobuf and avro schemas respectively. `schema/invalid.avsc` contains an invalid avro schema definition.
+
+`schema/alaska.avro` and `schema/alaska.json` are messages for testing binary and json encoding of messages.
diff --git a/pubsub/testdata/schema/alaska.avro b/pubsub/testdata/schema/alaska.avro
new file mode 100644
index 0000000..bdfae64
--- /dev/null
+++ b/pubsub/testdata/schema/alaska.avro
@@ -0,0 +1 @@
+AlaskaAK
\ No newline at end of file
diff --git a/pubsub/testdata/schema/alaska.json b/pubsub/testdata/schema/alaska.json
new file mode 100644
index 0000000..116d5f7
--- /dev/null
+++ b/pubsub/testdata/schema/alaska.json
@@ -0,0 +1 @@
+{"name":"Alaska","post_abbr":"AK"}
diff --git a/pubsub/testdata/schema/invalid.avsc b/pubsub/testdata/schema/invalid.avsc
new file mode 100644
index 0000000..bf0f7f7
--- /dev/null
+++ b/pubsub/testdata/schema/invalid.avsc
@@ -0,0 +1,6 @@
+{
+ "type":"record",
+ "name":"invalid",
+ "namespace":"utilities",
+ "doc":"A invalid avro schema definition",
+}
diff --git a/pubsub/testdata/schema/us-states.avsc b/pubsub/testdata/schema/us-states.avsc
new file mode 100644
index 0000000..79905d5
--- /dev/null
+++ b/pubsub/testdata/schema/us-states.avsc
@@ -0,0 +1,18 @@
+{
+ "type":"record",
+ "name":"State",
+ "namespace":"utilities",
+ "doc":"A list of states in the United States of America.",
+ "fields":[
+ {
+ "name":"name",
+ "type":"string",
+ "doc":"The common name of the state."
+ },
+ {
+ "name":"post_abbr",
+ "type":"string",
+ "doc":"The postal code abbreviation of the state."
+ }
+ ]
+}
diff --git a/pubsub/testdata/schema/us-states.proto b/pubsub/testdata/schema/us-states.proto
new file mode 100644
index 0000000..3482fe1
--- /dev/null
+++ b/pubsub/testdata/schema/us-states.proto
@@ -0,0 +1,23 @@
+// 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
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+package utilities;
+option java_outer_classname = "StateProto";
+
+message State {
+ string name = 1;
+ string post_abbr = 2;
+}
\ No newline at end of file
diff --git a/pubsub/topic.go b/pubsub/topic.go
index 806a235..72570d3 100644
--- a/pubsub/topic.go
+++ b/pubsub/topic.go
@@ -148,6 +148,7 @@
Labels: tc.Labels,
MessageStoragePolicy: messageStoragePolicyToProto(&tc.MessageStoragePolicy),
KmsKeyName: tc.KMSKeyName,
+ SchemaSettings: schemaSettingsToProto(tc.SchemaSettings),
})
if err != nil {
return nil, err
@@ -195,6 +196,10 @@
// published to this topic, in the format
// "projects/P/locations/L/keyRings/R/cryptoKeys/K".
KMSKeyName string
+
+ // Schema defines the schema settings upon topic creation. This cannot
+ // be modified after a topic has been created.
+ SchemaSettings *SchemaSettings
}
// TopicConfigToUpdate describes how to update a topic.
@@ -221,6 +226,7 @@
Labels: pbt.Labels,
MessageStoragePolicy: protoToMessageStoragePolicy(pbt.MessageStoragePolicy),
KMSKeyName: pbt.KmsKeyName,
+ SchemaSettings: protoToSchemaSettings(pbt.SchemaSettings),
}
}
diff --git a/pubsub/topic_test.go b/pubsub/topic_test.go
index 2736fb2..d30a77a 100644
--- a/pubsub/topic_test.go
+++ b/pubsub/topic_test.go
@@ -84,6 +84,10 @@
AllowedPersistenceRegions: []string{"us-east1"},
},
KMSKeyName: "projects/P/locations/L/keyRings/R/cryptoKeys/K",
+ SchemaSettings: &SchemaSettings{
+ Schema: "projects/P/schemas/S",
+ Encoding: EncodingJSON,
+ },
}
topic := mustCreateTopicWithConfig(t, c, id, &want)
diff --git a/pubsublite/CHANGES.md b/pubsublite/CHANGES.md
index 98139a3..bcce2f7 100644
--- a/pubsublite/CHANGES.md
+++ b/pubsublite/CHANGES.md
@@ -1,5 +1,22 @@
# Changes
+## [0.8.0](https://www.github.com/googleapis/google-cloud-go/compare/pubsublite/v0.7.0...pubsublite/v0.8.0) (2021-03-25)
+
+
+### Features
+
+* **pubsublite:** add skip_backlog field to allow subscriptions to be created at HEAD ([18c88c4](https://www.github.com/googleapis/google-cloud-go/commit/18c88c437bd1741eaf5bf5911b9da6f6ea7cd75d))
+* **pubsublite:** adding ability to create subscriptions at head ([#3790](https://www.github.com/googleapis/google-cloud-go/issues/3790)) ([bc083b6](https://www.github.com/googleapis/google-cloud-go/commit/bc083b66972b1c4329c18da9529c76b79ef56c50))
+
+
+### Bug Fixes
+
+* **pubsublite:** ackTracker should discard new acks after committer terminates ([#3827](https://www.github.com/googleapis/google-cloud-go/issues/3827)) ([bc49753](https://www.github.com/googleapis/google-cloud-go/commit/bc497531a9918f2e3bc9f1895ddd49011427e388))
+* **pubsublite:** fix committer races ([#3810](https://www.github.com/googleapis/google-cloud-go/issues/3810)) ([d8689f1](https://www.github.com/googleapis/google-cloud-go/commit/d8689f1d32be83f9bbbacb9dd24ce085d81d79e8))
+* **pubsublite:** improve handling of backend unavailability ([#3846](https://www.github.com/googleapis/google-cloud-go/issues/3846)) ([db31457](https://www.github.com/googleapis/google-cloud-go/commit/db31457cebdcd1c6370953e0360acd227567496d))
+* **pubsublite:** increase default timeouts for publish and subscribe stream connections ([#3821](https://www.github.com/googleapis/google-cloud-go/issues/3821)) ([df28999](https://www.github.com/googleapis/google-cloud-go/commit/df28999076fa91939038c06a706fc63811b20932))
+* **pubsublite:** remove publish error translation ([#3843](https://www.github.com/googleapis/google-cloud-go/issues/3843)) ([d8d8f68](https://www.github.com/googleapis/google-cloud-go/commit/d8d8f68e8a70e2353048578f5d22fa1cd2ca6482))
+
## [0.7.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.6.0...v0.7.0) (2021-02-18)
The status of this library is now **BETA**.
diff --git a/pubsublite/README.md b/pubsublite/README.md
index bf041fd..9d3ee9d 100644
--- a/pubsublite/README.md
+++ b/pubsublite/README.md
@@ -4,6 +4,7 @@
- [Client library documentation](https://cloud.google.com/pubsub/lite/docs/reference/libraries)
- [API documentation](https://cloud.google.com/pubsub/lite/docs/apis)
- [Go client documentation](https://pkg.go.dev/cloud.google.com/go/pubsublite)
+- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/pubsublite)
*This library is in BETA. Backwards-incompatible changes may be made before
stable v1.0.0 is released.*
diff --git a/pubsublite/admin.go b/pubsublite/admin.go
index 8c548d3..5cd0080 100644
--- a/pubsublite/admin.go
+++ b/pubsublite/admin.go
@@ -29,6 +29,18 @@
errNoSubscriptionFieldsUpdated = errors.New("pubsublite: no fields updated for subscription")
)
+// BacklogLocation refers to a location with respect to the message backlog.
+type BacklogLocation int
+
+const (
+ // End refers to the location past all currently published messages. End
+ // skips the entire message backlog.
+ End BacklogLocation = iota + 1
+
+ // Beginning refers to the location of the oldest retained message.
+ Beginning
+)
+
// AdminClient provides admin operations for Pub/Sub Lite resources within a
// Google Cloud region. The zone component of resource paths must be within this
// region. See https://cloud.google.com/pubsub/lite/docs/locations for the list
@@ -147,9 +159,40 @@
}
}
+type createSubscriptionSettings struct {
+ backlogLocation BacklogLocation
+}
+
+// CreateSubscriptionOption is an option for AdminClient.CreateSubscription.
+type CreateSubscriptionOption interface {
+ Apply(*createSubscriptionSettings)
+}
+
+type startingOffset struct {
+ backlogLocation BacklogLocation
+}
+
+func (so startingOffset) Apply(settings *createSubscriptionSettings) {
+ settings.backlogLocation = so.backlogLocation
+}
+
+// StartingOffset specifies the offset at which a newly created subscription
+// will start receiving messages.
+func StartingOffset(location BacklogLocation) CreateSubscriptionOption {
+ return startingOffset{location}
+}
+
// CreateSubscription creates a new subscription from the given config. If the
// subscription already exists an error will be returned.
-func (ac *AdminClient) CreateSubscription(ctx context.Context, config SubscriptionConfig) (*SubscriptionConfig, error) {
+//
+// By default, a new subscription will only receive messages published after
+// the subscription was created. Use StartingOffset to override.
+func (ac *AdminClient) CreateSubscription(ctx context.Context, config SubscriptionConfig, opts ...CreateSubscriptionOption) (*SubscriptionConfig, error) {
+ var settings createSubscriptionSettings
+ for _, opt := range opts {
+ opt.Apply(&settings)
+ }
+
subsPath, err := wire.ParseSubscriptionPath(config.Name)
if err != nil {
return nil, err
@@ -161,6 +204,7 @@
Parent: subsPath.Location().String(),
Subscription: config.toProto(),
SubscriptionId: subsPath.SubscriptionID,
+ SkipBacklog: settings.backlogLocation != Beginning,
}
subspb, err := ac.admin.CreateSubscription(ctx, req)
if err != nil {
diff --git a/pubsublite/admin_test.go b/pubsublite/admin_test.go
index 522b809..d0a9b0e 100644
--- a/pubsublite/admin_test.go
+++ b/pubsublite/admin_test.go
@@ -275,6 +275,13 @@
Parent: "projects/my-proj/locations/us-central1-a",
SubscriptionId: "my-subscription",
Subscription: subscriptionConfig.toProto(),
+ SkipBacklog: true,
+ }
+ wantCreateAtBacklogReq := &pb.CreateSubscriptionRequest{
+ Parent: "projects/my-proj/locations/us-central1-a",
+ SubscriptionId: "my-subscription",
+ Subscription: subscriptionConfig.toProto(),
+ SkipBacklog: false,
}
wantUpdateReq := updateConfig.toUpdateRequest()
wantGetReq := &pb.GetSubscriptionRequest{
@@ -286,6 +293,8 @@
verifiers := test.NewVerifiers(t)
verifiers.GlobalVerifier.Push(wantCreateReq, subscriptionConfig.toProto(), nil)
+ verifiers.GlobalVerifier.Push(wantCreateReq, subscriptionConfig.toProto(), nil)
+ verifiers.GlobalVerifier.Push(wantCreateAtBacklogReq, subscriptionConfig.toProto(), nil)
verifiers.GlobalVerifier.Push(wantUpdateReq, subscriptionConfig.toProto(), nil)
verifiers.GlobalVerifier.Push(wantGetReq, subscriptionConfig.toProto(), nil)
verifiers.GlobalVerifier.Push(wantDeleteReq, &emptypb.Empty{}, nil)
@@ -301,6 +310,18 @@
t.Errorf("CreateSubscription() got: %v\nwant: %v", gotConfig, subscriptionConfig)
}
+ if gotConfig, err := admin.CreateSubscription(ctx, subscriptionConfig, StartingOffset(End)); err != nil {
+ t.Errorf("CreateSubscription() got err: %v", err)
+ } else if !testutil.Equal(gotConfig, &subscriptionConfig) {
+ t.Errorf("CreateSubscription() got: %v\nwant: %v", gotConfig, subscriptionConfig)
+ }
+
+ if gotConfig, err := admin.CreateSubscription(ctx, subscriptionConfig, StartingOffset(Beginning)); err != nil {
+ t.Errorf("CreateSubscription() got err: %v", err)
+ } else if !testutil.Equal(gotConfig, &subscriptionConfig) {
+ t.Errorf("CreateSubscription() got: %v\nwant: %v", gotConfig, subscriptionConfig)
+ }
+
if gotConfig, err := admin.UpdateSubscription(ctx, updateConfig); err != nil {
t.Errorf("UpdateSubscription() got err: %v", err)
} else if !testutil.Equal(gotConfig, &subscriptionConfig) {
diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go
index 9573f9d..ae33270 100644
--- a/pubsublite/apiv1/doc.go
+++ b/pubsublite/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/pubsublite/go.mod b/pubsublite/go.mod
index 2659333..3795cb7 100644
--- a/pubsublite/go.mod
+++ b/pubsublite/go.mod
@@ -5,14 +5,14 @@
require (
cloud.google.com/go v0.79.0
cloud.google.com/go/pubsub v1.9.1
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/google/uuid v1.2.0
github.com/googleapis/gax-go/v2 v2.0.5
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
- google.golang.org/protobuf v1.25.0
+ google.golang.org/protobuf v1.26.0
)
diff --git a/pubsublite/go.sum b/pubsublite/go.sum
index 32163ba..f9d7c4a 100644
--- a/pubsublite/go.sum
+++ b/pubsublite/go.sum
@@ -85,8 +85,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -224,8 +226,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -283,8 +286,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -371,8 +375,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -420,9 +424,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -450,8 +454,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/pubsublite/internal/wire/acks.go b/pubsublite/internal/wire/acks.go
index 2e55fd7..9964724 100644
--- a/pubsublite/internal/wire/acks.go
+++ b/pubsublite/internal/wire/acks.go
@@ -91,12 +91,15 @@
ackedPrefixOffset int64
// Outstanding message acks, strictly ordered by increasing message offsets.
outstandingAcks *list.List // Value = *ackConsumer
+ // Whether new acks can be pushed.
+ enablePush bool
}
func newAckTracker() *ackTracker {
return &ackTracker{
ackedPrefixOffset: nilCursorOffset,
outstandingAcks: list.New(),
+ enablePush: true,
}
}
@@ -105,6 +108,11 @@
at.mu.Lock()
defer at.mu.Unlock()
+ if !at.enablePush {
+ ack.Clear()
+ return nil
+ }
+
// These errors should not occur unless there is a bug in the client library
// as message ordering should have been validated by subscriberOffsetTracker.
if ack.Offset <= at.ackedPrefixOffset {
@@ -136,12 +144,13 @@
return at.ackedPrefixOffset + 1
}
-// Release clears and invalidates any outstanding acks. This should be called
-// when the subscriber terminates.
+// Release clears and invalidates any outstanding acks. Push will clear and
+// discard new acks. This should be called when the committer terminates.
func (at *ackTracker) Release() {
at.mu.Lock()
defer at.mu.Unlock()
+ at.enablePush = false
at.unsafeProcessAcks()
for elem := at.outstandingAcks.Front(); elem != nil; elem = elem.Next() {
diff --git a/pubsublite/internal/wire/acks_test.go b/pubsublite/internal/wire/acks_test.go
index ea9f56b..4e94a5b 100644
--- a/pubsublite/internal/wire/acks_test.go
+++ b/pubsublite/internal/wire/acks_test.go
@@ -117,6 +117,7 @@
ack1 := newAckConsumer(1, 0, emptyAckConsumer)
ack2 := newAckConsumer(2, 0, onAckAfterRelease)
ack3 := newAckConsumer(3, 0, onAckAfterRelease)
+ ack4 := newAckConsumer(4, 0, onAckAfterRelease)
if err := ackTracker.Push(ack1); err != nil {
t.Errorf("ackTracker.Push() got err %v", err)
@@ -136,6 +137,15 @@
ack2.Ack()
ack3.Ack()
+ // New acks should be cleared and discarded.
+ if err := ackTracker.Push(ack4); err != nil {
+ t.Errorf("ackTracker.Push() got err %v", err)
+ }
+ if got, want := ackTracker.Empty(), true; got != want {
+ t.Errorf("ackTracker.Empty() got %v, want %v", got, want)
+ }
+ ack4.Ack()
+
if got, want := ackTracker.CommitOffset(), int64(2); got != want {
t.Errorf("ackTracker.CommitOffset() got %v, want %v", got, want)
}
diff --git a/pubsublite/internal/wire/errors.go b/pubsublite/internal/wire/errors.go
index ac4bfe7..dfb2ca1 100644
--- a/pubsublite/internal/wire/errors.go
+++ b/pubsublite/internal/wire/errors.go
@@ -42,6 +42,11 @@
// cannot perform an operation because it has stopped or is in the process of
// stopping.
ErrServiceStopped = errors.New("pubsublite: service has stopped or is stopping")
+
+ // ErrBackendUnavailable indicates that the backend service has been
+ // unavailable for a period of time. The timeout can be configured using
+ // PublishSettings.Timeout or ReceiveSettings.Timeout.
+ ErrBackendUnavailable = errors.New("pubsublite: backend service is unavailable")
)
func wrapError(context, resource string, err error) error {
diff --git a/pubsublite/internal/wire/publish_batcher_test.go b/pubsublite/internal/wire/publish_batcher_test.go
index 014bd0d..9ace683 100644
--- a/pubsublite/internal/wire/publish_batcher_test.go
+++ b/pubsublite/internal/wire/publish_batcher_test.go
@@ -21,6 +21,7 @@
"cloud.google.com/go/internal/testutil"
"cloud.google.com/go/pubsublite/internal/test"
"github.com/google/go-cmp/cmp"
+ "golang.org/x/xerrors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
@@ -187,8 +188,8 @@
t.Run("oversized message", func(t *testing.T) {
msg := &pb.PubSubMessage{Data: bytes.Repeat([]byte{'0'}, MaxPublishRequestBytes)}
- if gotErr, wantMsg := batcher.AddMessage(msg, nil), "MaxPublishRequestBytes"; !test.ErrorHasMsg(gotErr, wantMsg) {
- t.Errorf("AddMessage(%v) got err: %v, want err msg: %q", msg, gotErr, wantMsg)
+ if gotErr := batcher.AddMessage(msg, nil); !xerrors.Is(gotErr, ErrOversizedMessage) {
+ t.Errorf("AddMessage(%v) got err: %v, want err: %q", msg, gotErr, ErrOversizedMessage)
}
})
diff --git a/pubsublite/internal/wire/rpc.go b/pubsublite/internal/wire/rpc.go
index fdca3e8..e5c6dfb 100644
--- a/pubsublite/internal/wire/rpc.go
+++ b/pubsublite/internal/wire/rpc.go
@@ -22,7 +22,9 @@
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
+ "google.golang.org/grpc"
"google.golang.org/grpc/codes"
+ "google.golang.org/grpc/keepalive"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
@@ -50,26 +52,24 @@
}
}
-func (r *streamRetryer) RetrySend(err error) (time.Duration, bool) {
- if time.Now().After(r.deadline) {
- return 0, false
- }
+func (r *streamRetryer) RetrySend(err error) (backoff time.Duration, shouldRetry bool) {
if isRetryableSendError(err) {
return r.bo.Pause(), true
}
return 0, false
}
-func (r *streamRetryer) RetryRecv(err error) (time.Duration, bool) {
- if time.Now().After(r.deadline) {
- return 0, false
- }
+func (r *streamRetryer) RetryRecv(err error) (backoff time.Duration, shouldRetry bool) {
if isRetryableRecvError(err) {
return r.bo.Pause(), true
}
return 0, false
}
+func (r *streamRetryer) ExceededDeadline() bool {
+ return time.Now().After(r.deadline)
+}
+
func isRetryableSendCode(code codes.Code) bool {
switch code {
// Client-side errors that occur during grpc.ClientStream.SendMsg() have a
@@ -135,6 +135,10 @@
func defaultClientOptions(region string) []option.ClientOption {
return []option.ClientOption{
internaloption.WithDefaultEndpoint(region + pubsubLiteDefaultEndpoint),
+ // Keep inactive connections alive.
+ option.WithGRPCDialOption(grpc.WithKeepaliveParams(keepalive.ClientParameters{
+ Time: 5 * time.Minute,
+ })),
}
}
diff --git a/pubsublite/internal/wire/settings.go b/pubsublite/internal/wire/settings.go
index 6bfe7dc..3fa130a 100644
--- a/pubsublite/internal/wire/settings.go
+++ b/pubsublite/internal/wire/settings.go
@@ -82,7 +82,7 @@
DelayThreshold: 10 * time.Millisecond,
CountThreshold: 100,
ByteThreshold: 1e6,
- Timeout: 60 * time.Minute,
+ Timeout: 7 * 24 * time.Hour, // 1 week
// By default set to a high limit that is not likely to occur, but prevents
// OOM errors in clients.
BufferedByteLimit: 1 << 30, // 1 GiB
@@ -146,7 +146,7 @@
var DefaultReceiveSettings = ReceiveSettings{
MaxOutstandingMessages: 1000,
MaxOutstandingBytes: 1e9,
- Timeout: 60 * time.Minute,
+ Timeout: 7 * 24 * time.Hour, // 1 week
}
func validateReceiveSettings(settings ReceiveSettings) error {
diff --git a/pubsublite/internal/wire/streams.go b/pubsublite/internal/wire/streams.go
index e97d3dc..752acb9 100644
--- a/pubsublite/internal/wire/streams.go
+++ b/pubsublite/internal/wire/streams.go
@@ -20,6 +20,7 @@
"sync"
"time"
+ "golang.org/x/xerrors"
"google.golang.org/grpc"
gax "github.com/googleapis/gax-go/v2"
@@ -32,10 +33,10 @@
type streamStatus int
const (
- streamUninitialized streamStatus = 0
- streamReconnecting streamStatus = 1
- streamConnected streamStatus = 2
- streamTerminated streamStatus = 3
+ streamUninitialized streamStatus = iota
+ streamReconnecting
+ streamConnected
+ streamTerminated
)
type initialResponseRequired bool
@@ -257,14 +258,6 @@
r := newStreamRetryer(rs.timeout)
for {
backoff, shouldRetry := func() (time.Duration, bool) {
- defer func() {
- if err != nil && cancelFunc != nil {
- cancelFunc()
- cancelFunc = nil
- newStream = nil
- }
- }()
-
var cctx context.Context
cctx, cancelFunc = context.WithCancel(rs.ctx)
// Store the cancel func to quickly cancel reconnecting if the stream is
@@ -286,6 +279,7 @@
}
if err = rs.handler.validateInitialResponse(response); err != nil {
// An unexpected initial response from the server is a permanent error.
+ cancelFunc()
return 0, false
}
}
@@ -294,10 +288,17 @@
return 0, false
}()
- if !shouldRetry {
+ if (shouldRetry || err != nil) && cancelFunc != nil {
+ // Ensure that streams aren't leaked.
+ cancelFunc()
+ cancelFunc = nil
+ newStream = nil
+ }
+ if !shouldRetry || rs.Status() == streamTerminated {
break
}
- if rs.Status() == streamTerminated {
+ if r.ExceededDeadline() {
+ err = xerrors.Errorf("%v: %w", err, ErrBackendUnavailable)
break
}
if err = gax.Sleep(rs.ctx, backoff); err != nil {
diff --git a/pubsublite/internal/wire/streams_test.go b/pubsublite/internal/wire/streams_test.go
index 968fd48..2079f8a 100644
--- a/pubsublite/internal/wire/streams_test.go
+++ b/pubsublite/internal/wire/streams_test.go
@@ -22,6 +22,7 @@
"cloud.google.com/go/internal/testutil"
"cloud.google.com/go/pubsublite/internal/test"
+ "golang.org/x/xerrors"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -308,8 +309,8 @@
if pub.Stream.currentStream() != nil {
t.Error("Client stream should be nil")
}
- if gotErr := pub.Stream.Error(); !test.ErrorEqual(gotErr, wantErr) {
- t.Errorf("Stream final err: got (%v), want (%v)", gotErr, wantErr)
+ if gotErr := pub.Stream.Error(); !xerrors.Is(gotErr, ErrBackendUnavailable) {
+ t.Errorf("Stream final err: got (%v), want (%v)", gotErr, ErrBackendUnavailable)
}
}
diff --git a/pubsublite/pscompat/example_test.go b/pubsublite/pscompat/example_test.go
index d81b6b1..7ca12e6 100644
--- a/pubsublite/pscompat/example_test.go
+++ b/pubsublite/pscompat/example_test.go
@@ -16,10 +16,13 @@
import (
"context"
"fmt"
+ "sync"
"time"
"cloud.google.com/go/pubsub"
"cloud.google.com/go/pubsublite/pscompat"
+ "golang.org/x/sync/errgroup"
+ "golang.org/x/xerrors"
)
func ExamplePublisherClient_Publish() {
@@ -37,15 +40,25 @@
})
results = append(results, r)
// Publish more messages ...
+
+ var publishFailed bool
for _, r := range results {
id, err := r.Get(ctx)
if err != nil {
// TODO: Handle error.
- // NOTE: The publisher will terminate upon first error. Create a new
- // publisher to republish failed messages.
+ publishFailed = true
+ continue
}
fmt.Printf("Published a message with a message ID: %s\n", id)
}
+
+ // NOTE: A failed PublishResult indicates that the publisher client
+ // encountered a fatal error and has permanently terminated. After the fatal
+ // error has been resolved, a new publisher client instance must be created to
+ // republish failed messages.
+ if publishFailed {
+ fmt.Printf("Publisher client terminated due to error: %v\n", publisher.Error())
+ }
}
// This example illustrates how to set batching settings for publishing. Note
@@ -55,10 +68,11 @@
func ExamplePublisherClient_Publish_batchingSettings() {
ctx := context.Background()
const topic = "projects/my-project/locations/zone/topics/my-topic"
- settings := pscompat.DefaultPublishSettings
- settings.DelayThreshold = 50 * time.Millisecond
- settings.CountThreshold = 200
- settings.BufferedByteLimit = 5e8
+ settings := pscompat.PublishSettings{
+ DelayThreshold: 50 * time.Millisecond,
+ CountThreshold: 200,
+ BufferedByteLimit: 5e8,
+ }
publisher, err := pscompat.NewPublisherClientWithSettings(ctx, topic, settings)
if err != nil {
// TODO: Handle error.
@@ -71,43 +85,89 @@
})
results = append(results, r)
// Publish more messages ...
+
+ var publishFailed bool
for _, r := range results {
id, err := r.Get(ctx)
if err != nil {
// TODO: Handle error.
- // NOTE: The publisher will terminate upon first error. Create a new
- // publisher to republish failed messages.
+ publishFailed = true
+ continue
}
fmt.Printf("Published a message with a message ID: %s\n", id)
}
+
+ // NOTE: A failed PublishResult indicates that the publisher client
+ // encountered a fatal error and has permanently terminated. After the fatal
+ // error has been resolved, a new publisher client instance must be created to
+ // republish failed messages.
+ if publishFailed {
+ fmt.Printf("Publisher client terminated due to error: %v\n", publisher.Error())
+ }
}
-func ExamplePublisherClient_Error() {
+// This example illustrates how to handle various publishing errors. Some errors
+// can be automatically handled (e.g. backend unavailable and buffer overflow),
+// while others are fatal errors that should be inspected.
+// If the application has a low tolerance to backend unavailability, set a lower
+// PublishSettings.Timeout value to detect and alert.
+func ExamplePublisherClient_Publish_errorHandling() {
ctx := context.Background()
const topic = "projects/my-project/locations/zone/topics/my-topic"
- publisher, err := pscompat.NewPublisherClient(ctx, topic)
+ settings := pscompat.PublishSettings{
+ // The PublisherClient will terminate when it cannot connect to backends for
+ // more than 10 minutes.
+ Timeout: 10 * time.Minute,
+ // Sets a conservative publish buffer byte limit, per partition.
+ BufferedByteLimit: 1e8,
+ }
+ publisher, err := pscompat.NewPublisherClientWithSettings(ctx, topic, settings)
if err != nil {
// TODO: Handle error.
}
defer publisher.Stop()
- var results []*pubsub.PublishResult
- r := publisher.Publish(ctx, &pubsub.Message{
- Data: []byte("hello world"),
- })
- results = append(results, r)
- // Publish more messages ...
- for _, r := range results {
- id, err := r.Get(ctx)
- if err != nil {
- // Prints the fatal error that caused the publisher to terminate.
- fmt.Printf("Publisher client stopped due to error: %v\n", publisher.Error())
+ var toRepublish []*pubsub.Message
+ var mu sync.Mutex
+ g := new(errgroup.Group)
- // TODO: Handle error.
- // NOTE: The publisher will terminate upon first error. Create a new
- // publisher to republish failed messages.
+ for i := 0; i < 10; i++ {
+ msg := &pubsub.Message{
+ Data: []byte(fmt.Sprintf("message-%d", i)),
}
- fmt.Printf("Published a message with a message ID: %s\n", id)
+ result := publisher.Publish(ctx, msg)
+
+ g.Go(func() error {
+ id, err := result.Get(ctx)
+ if err != nil {
+ // NOTE: A failed PublishResult indicates that the publisher client has
+ // permanently terminated. A new publisher client instance must be
+ // created to republish failed messages.
+ fmt.Printf("Publish error: %v\n", err)
+ // Oversized messages cannot be published.
+ if !xerrors.Is(err, pscompat.ErrOversizedMessage) {
+ mu.Lock()
+ toRepublish = append(toRepublish, msg)
+ mu.Unlock()
+ }
+ return err
+ }
+ fmt.Printf("Published a message with a message ID: %s\n", id)
+ return nil
+ })
+ }
+ if err := g.Wait(); err != nil {
+ fmt.Printf("Publisher client terminated due to error: %v\n", publisher.Error())
+ switch {
+ case xerrors.Is(publisher.Error(), pscompat.ErrBackendUnavailable):
+ // TODO: Create a new publisher client to republish failed messages.
+ case xerrors.Is(publisher.Error(), pscompat.ErrOverflow):
+ // TODO: Create a new publisher client to republish failed messages.
+ // Throttle publishing. Note that backend unavailability can also cause
+ // buffer overflow before the ErrBackendUnavailable error.
+ default:
+ // TODO: Inspect and handle fatal error.
+ }
}
}
@@ -128,10 +188,49 @@
// TODO: Handle error.
}
- // Call cancel from callback, or another goroutine.
+ // Call cancel from the receiver callback or another goroutine to stop
+ // receiving.
cancel()
}
+// If the application has a low tolerance to backend unavailability, set a lower
+// ReceiveSettings.Timeout value to detect and alert.
+func ExampleSubscriberClient_Receive_errorHandling() {
+ ctx := context.Background()
+ const subscription = "projects/my-project/locations/zone/subscriptions/my-subscription"
+ settings := pscompat.ReceiveSettings{
+ // The SubscriberClient will terminate when it cannot connect to backends
+ // for more than 5 minutes.
+ Timeout: 5 * time.Minute,
+ }
+ subscriber, err := pscompat.NewSubscriberClientWithSettings(ctx, subscription, settings)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ for {
+ cctx, cancel := context.WithCancel(ctx)
+ err = subscriber.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {
+ // TODO: Handle message.
+ // NOTE: May be called concurrently; synchronize access to shared memory.
+ m.Ack()
+ })
+ if err != nil {
+ fmt.Printf("Subscriber client stopped receiving due to error: %v\n", err)
+ if xerrors.Is(err, pscompat.ErrBackendUnavailable) {
+ // TODO: Alert if necessary. Receive can be retried.
+ } else {
+ // TODO: Handle fatal error.
+ break
+ }
+ }
+
+ // Call cancel from the receiver callback or another goroutine to stop
+ // receiving.
+ cancel()
+ }
+}
+
// This example shows how to throttle SubscriberClient.Receive, which aims for
// high throughput by default. By limiting the number of messages and/or bytes
// being processed at once, you can bound your program's resource consumption.
@@ -140,9 +239,10 @@
func ExampleSubscriberClient_Receive_maxOutstanding() {
ctx := context.Background()
const subscription = "projects/my-project/locations/zone/subscriptions/my-subscription"
- settings := pscompat.DefaultReceiveSettings
- settings.MaxOutstandingMessages = 5
- settings.MaxOutstandingBytes = 10e6
+ settings := pscompat.ReceiveSettings{
+ MaxOutstandingMessages: 5,
+ MaxOutstandingBytes: 10e6,
+ }
subscriber, err := pscompat.NewSubscriberClientWithSettings(ctx, subscription, settings)
if err != nil {
// TODO: Handle error.
@@ -169,9 +269,10 @@
func ExampleSubscriberClient_Receive_manualPartitionAssignment() {
ctx := context.Background()
const subscription = "projects/my-project/locations/zone/subscriptions/my-subscription"
- settings := pscompat.DefaultReceiveSettings
- // NOTE: The corresponding topic must have 2 or more partitions.
- settings.Partitions = []int{0, 1}
+ settings := pscompat.ReceiveSettings{
+ // NOTE: The corresponding topic must have 2 or more partitions.
+ Partitions: []int{0, 1},
+ }
subscriber, err := pscompat.NewSubscriberClientWithSettings(ctx, subscription, settings)
if err != nil {
// TODO: Handle error.
diff --git a/pubsublite/pscompat/publisher.go b/pubsublite/pscompat/publisher.go
index be36e7f..6f4e941 100644
--- a/pubsublite/pscompat/publisher.go
+++ b/pubsublite/pscompat/publisher.go
@@ -19,9 +19,7 @@
"cloud.google.com/go/pubsub"
"cloud.google.com/go/pubsublite/internal/wire"
- "golang.org/x/xerrors"
"google.golang.org/api/option"
- "google.golang.org/api/support/bundler"
ipubsub "cloud.google.com/go/internal/pubsub"
pb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1"
@@ -29,30 +27,25 @@
var (
// ErrOverflow is set for a PublishResult when publish buffers overflow.
- ErrOverflow = bundler.ErrOverflow
+ // Use errors.Is for comparing errors.
+ ErrOverflow = wire.ErrOverflow
// ErrOversizedMessage is set for a PublishResult when a published message
- // exceeds MaxPublishRequestBytes.
- ErrOversizedMessage = bundler.ErrOversizedItem
+ // exceeds MaxPublishRequestBytes. Use errors.Is for comparing errors.
+ ErrOversizedMessage = wire.ErrOversizedMessage
// ErrPublisherStopped is set for a PublishResult when a message cannot be
// published because the publisher client has stopped or is in the process of
// stopping. PublisherClient.Error() returns the error that caused the
- // publisher client to terminate (if any).
+ // publisher client to terminate (if any). Use errors.Is for comparing errors.
ErrPublisherStopped = wire.ErrServiceStopped
-)
-// translateError transforms a subset of errors to what would be returned by the
-// pubsub package.
-func translateError(err error) error {
- if xerrors.Is(err, wire.ErrOversizedMessage) {
- return ErrOversizedMessage
- }
- if xerrors.Is(err, wire.ErrOverflow) {
- return ErrOverflow
- }
- return err
-}
+ // ErrBackendUnavailable indicates that the backend service has been
+ // unavailable for a period of time. The timeout can be configured using
+ // PublishSettings.Timeout or ReceiveSettings.Timeout. Use errors.Is for
+ // comparing errors.
+ ErrBackendUnavailable = wire.ErrBackendUnavailable
+)
// PublisherClient is a Pub/Sub Lite client to publish messages to a given
// topic. A PublisherClient is safe to use from multiple goroutines.
@@ -68,16 +61,17 @@
err error
}
-// NewPublisherClient creates a new Pub/Sub Lite client to publish messages to
-// a given topic, using DefaultPublishSettings. A valid topic path has the
-// format: "projects/PROJECT_ID/locations/ZONE/topics/TOPIC_ID".
+// NewPublisherClient creates a new Pub/Sub Lite publisher client to publish
+// messages to a given topic, using DefaultPublishSettings. A valid topic path
+// has the format: "projects/PROJECT_ID/locations/ZONE/topics/TOPIC_ID".
func NewPublisherClient(ctx context.Context, topic string, opts ...option.ClientOption) (*PublisherClient, error) {
return NewPublisherClientWithSettings(ctx, topic, DefaultPublishSettings, opts...)
}
-// NewPublisherClientWithSettings creates a new Pub/Sub Lite client to publish
-// messages to a given topic, using the specified PublishSettings. A valid topic
-// path has the format: "projects/PROJECT_ID/locations/ZONE/topics/TOPIC_ID".
+// NewPublisherClientWithSettings creates a new Pub/Sub Lite publisher client to
+// publish messages to a given topic, using the specified PublishSettings. A
+// valid topic path has the format:
+// "projects/PROJECT_ID/locations/ZONE/topics/TOPIC_ID".
func NewPublisherClientWithSettings(ctx context.Context, topic string, settings PublishSettings, opts ...option.ClientOption) (*PublisherClient, error) {
topicPath, err := wire.ParseTopicPath(topic)
if err != nil {
@@ -106,15 +100,18 @@
// sent according to the client's PublishSettings. Publish never blocks.
//
// Publish returns a non-nil PublishResult which will be ready when the
-// message has been sent (or has failed to be sent) to the server. Once the
-// first publish error occurs, the publisher will terminate and subsequent
-// PublishResults will also have an error. A new publisher must be created to
-// republish failed messages.
+// message has been sent (or has failed to be sent) to the server. Retryable
+// errors are automatically handled. If a PublishResult returns an error, this
+// indicates that the publisher client encountered a fatal error and has
+// permanently terminated. After the fatal error has been resolved, a new
+// publisher client instance must be created to republish failed messages.
//
-// Once Stop() has been called or the publisher has failed permanently due to an
-// error, future calls to Publish will immediately return a PublishResult with
-// error ErrPublisherStopped. Error() returns the error that caused the
-// publisher to terminate.
+// Once Stop() has been called or the publisher client has failed permanently
+// due to an error, future calls to Publish will immediately return a
+// PublishResult with error ErrPublisherStopped.
+//
+// Error() returns the error that caused the publisher client to terminate and
+// may contain more context than the error returned by PublishResult.
func (p *PublisherClient) Publish(ctx context.Context, msg *pubsub.Message) *pubsub.PublishResult {
result := ipubsub.NewPublishResult()
msgpb := new(pb.PubSubMessage)
@@ -126,7 +123,6 @@
}
p.wirePub.Publish(msgpb, func(metadata *wire.MessageMetadata, err error) {
- err = translateError(err)
if metadata != nil {
ipubsub.SetPublishResult(result, metadata.String(), err)
} else {
@@ -144,8 +140,9 @@
p.wirePub.WaitStopped()
}
-// Error returns the error that caused the publisher client to terminate. It
-// may be nil if Stop() was called.
+// Error returns the error that caused the publisher client to terminate. The
+// error returned here may contain more context than PublishResult errors. The
+// return value may be nil if Stop() was called.
func (p *PublisherClient) Error() error {
p.mu.Lock()
defer p.mu.Unlock()
diff --git a/pubsublite/pscompat/publisher_test.go b/pubsublite/pscompat/publisher_test.go
index d794b46..4dfe7df 100644
--- a/pubsublite/pscompat/publisher_test.go
+++ b/pubsublite/pscompat/publisher_test.go
@@ -21,8 +21,6 @@
"cloud.google.com/go/pubsub"
"cloud.google.com/go/pubsublite/internal/test"
"cloud.google.com/go/pubsublite/internal/wire"
- "golang.org/x/xerrors"
- "google.golang.org/api/support/bundler"
pb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1"
)
@@ -176,62 +174,3 @@
t.Errorf("Publisher.Stopped: got %v, want %v", got, want)
}
}
-
-func TestPublisherClientTranslatePublishResultErrors(t *testing.T) {
- ctx := context.Background()
- input := &pubsub.Message{
- Data: []byte("data"),
- OrderingKey: "ordering_key",
- }
- wantMsg := &pb.PubSubMessage{
- Data: []byte("data"),
- Key: []byte("ordering_key"),
- }
-
- for _, tc := range []struct {
- desc string
- wireErr error
- wantErr error
- }{
- {
- desc: "oversized message",
- wireErr: wire.ErrOversizedMessage,
- wantErr: bundler.ErrOversizedItem,
- },
- {
- desc: "oversized message wrapped",
- wireErr: xerrors.Errorf("placeholder error message: %w", wire.ErrOversizedMessage),
- wantErr: bundler.ErrOversizedItem,
- },
- {
- desc: "buffer overflow",
- wireErr: wire.ErrOverflow,
- wantErr: bundler.ErrOverflow,
- },
- {
- desc: "service stopped",
- wireErr: wire.ErrServiceStopped,
- wantErr: wire.ErrServiceStopped,
- },
- } {
- t.Run(tc.desc, func(t *testing.T) {
- verifier := test.NewRPCVerifier(t)
- verifier.Push(wantMsg, nil, tc.wireErr)
- defer verifier.Flush()
-
- pubClient := newTestPublisherClient(verifier, DefaultPublishSettings)
- result := pubClient.Publish(ctx, input)
-
- _, gotErr := result.Get(ctx)
- if !test.ErrorEqual(gotErr, tc.wantErr) {
- t.Errorf("Publish() got err: (%v), want err: (%v)", gotErr, tc.wantErr)
- }
- if !test.ErrorEqual(pubClient.Error(), tc.wireErr) {
- t.Errorf("PublisherClient.Error() got: (%v), want: (%v)", pubClient.Error(), tc.wireErr)
- }
- if got, want := pubClient.wirePub.(*mockWirePublisher).Stopped, false; got != want {
- t.Errorf("Publisher.Stopped: got %v, want %v", got, want)
- }
- })
- }
-}
diff --git a/pubsublite/pscompat/settings.go b/pubsublite/pscompat/settings.go
index cb05b0a..1e5b98e 100644
--- a/pubsublite/pscompat/settings.go
+++ b/pubsublite/pscompat/settings.go
@@ -67,9 +67,12 @@
// to the server. If Timeout is 0, it will be treated as
// DefaultPublishSettings.Timeout. Otherwise must be > 0.
//
- // The timeout is exceeded, the publisher will terminate with the last error
- // that occurred while trying to reconnect. Note that if the timeout duration
- // is long, ErrOverflow may occur first.
+ // If your application has a low tolerance to backend unavailability, set
+ // Timeout to a lower duration to detect and handle. When the timeout is
+ // exceeded, the PublisherClient will terminate with ErrBackendUnavailable and
+ // details of the last error that occurred while trying to reconnect to
+ // backends. Note that if the timeout duration is long, ErrOverflow may occur
+ // first.
Timeout time.Duration
// The maximum number of bytes that the publisher will keep in memory before
@@ -106,8 +109,8 @@
DelayThreshold: 10 * time.Millisecond,
CountThreshold: 100,
ByteThreshold: 1e6,
- Timeout: 60 * time.Minute,
- BufferedByteLimit: 1e8,
+ Timeout: 7 * 24 * time.Hour,
+ BufferedByteLimit: 1e10,
}
func (s *PublishSettings) toWireSettings() wire.PublishSettings {
@@ -183,8 +186,11 @@
// to the server. If Timeout is 0, it will be treated as
// DefaultReceiveSettings.Timeout. Otherwise must be > 0.
//
- // The timeout is exceeded, the SubscriberClient will terminate with the last
- // error that occurred while trying to reconnect.
+ // If your application has a low tolerance to backend unavailability, set
+ // Timeout to a lower duration to detect and handle. When the timeout is
+ // exceeded, the SubscriberClient will terminate with ErrBackendUnavailable
+ // and details of the last error that occurred while trying to reconnect to
+ // backends.
Timeout time.Duration
// The topic partition numbers (zero-indexed) to receive messages from.
@@ -206,7 +212,7 @@
var DefaultReceiveSettings = ReceiveSettings{
MaxOutstandingMessages: 1000,
MaxOutstandingBytes: 1e9,
- Timeout: 60 * time.Minute,
+ Timeout: 7 * 24 * time.Hour,
}
func (s *ReceiveSettings) toWireSettings() wire.ReceiveSettings {
diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go
index 8675d80..79eec07 100644
--- a/recaptchaenterprise/apiv1/doc.go
+++ b/recaptchaenterprise/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 d567a51..02acb3b 100644
--- a/recaptchaenterprise/apiv1beta1/doc.go
+++ b/recaptchaenterprise/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 fe3e281..e0c0557 100644
--- a/recommendationengine/apiv1beta1/doc.go
+++ b/recommendationengine/apiv1beta1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 9173f09..04315e2 100644
--- a/recommender/apiv1/doc.go
+++ b/recommender/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 4a98741..3739234 100644
--- a/recommender/apiv1beta1/doc.go
+++ b/recommender/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 63f34f2..c67e2e2 100644
--- a/redis/apiv1/doc.go
+++ b/redis/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 d7cef89..e966bce 100644
--- a/redis/apiv1beta1/doc.go
+++ b/redis/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2297cc5..eeb4db7 100644
--- a/resourcemanager/apiv2/doc.go
+++ b/resourcemanager/apiv2/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/resourcesettings/apiv1/doc.go b/resourcesettings/apiv1/doc.go
new file mode 100644
index 0000000..8b3309e
--- /dev/null
+++ b/resourcesettings/apiv1/doc.go
@@ -0,0 +1,118 @@
+// 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 resourcesettings is an auto-generated package for the
+// Resource Settings API.
+//
+// The Resource Settings API allows users to control and modify the behavior
+// of their GCP resources (e.g., VM, firewall, Project, etc.) across the
+// Cloud Resource Hierarchy.
+//
+// Use of Context
+//
+// The ctx passed to NewClient is used for authentication requests and
+// for creating the underlying connection, but is not used for subsequent calls.
+// Individual methods on the client use the ctx given to them.
+//
+// To close the open connection, use the Close() method.
+//
+// For information about setting deadlines, reusing contexts, and more
+// please visit pkg.go.dev/cloud.google.com/go.
+package resourcesettings // import "cloud.google.com/go/resourcesettings/apiv1"
+
+import (
+ "context"
+ "os"
+ "runtime"
+ "strconv"
+ "strings"
+ "unicode"
+
+ "google.golang.org/api/option"
+ "google.golang.org/grpc/metadata"
+)
+
+// For more information on implementing a client constructor hook, see
+// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
+type clientHookParams struct{}
+type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
+
+const versionClient = "20210325"
+
+func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
+ out, _ := metadata.FromOutgoingContext(ctx)
+ out = out.Copy()
+ for _, md := range mds {
+ for k, v := range md {
+ out[k] = append(out[k], v...)
+ }
+ }
+ return metadata.NewOutgoingContext(ctx, out)
+}
+
+func checkDisableDeadlines() (bool, error) {
+ raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE")
+ if !ok {
+ return false, nil
+ }
+
+ b, err := strconv.ParseBool(raw)
+ return b, err
+}
+
+// DefaultAuthScopes reports the default set of authentication scopes to use with this package.
+func DefaultAuthScopes() []string {
+ return []string{
+ "https://www.googleapis.com/auth/cloud-platform",
+ }
+}
+
+// versionGo returns the Go runtime version. The returned string
+// has no whitespace, suitable for reporting in header.
+func versionGo() string {
+ const develPrefix = "devel +"
+
+ s := runtime.Version()
+ if strings.HasPrefix(s, develPrefix) {
+ s = s[len(develPrefix):]
+ if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 {
+ s = s[:p]
+ }
+ return s
+ }
+
+ notSemverRune := func(r rune) bool {
+ return !strings.ContainsRune("0123456789.", r)
+ }
+
+ if strings.HasPrefix(s, "go1") {
+ s = s[2:]
+ var prerelease string
+ if p := strings.IndexFunc(s, notSemverRune); p >= 0 {
+ s, prerelease = s[:p], s[p:]
+ }
+ if strings.HasSuffix(s, ".") {
+ s += "0"
+ } else if strings.Count(s, ".") < 2 {
+ s += ".0"
+ }
+ if prerelease != "" {
+ s += "-" + prerelease
+ }
+ return s
+ }
+ return "UNKNOWN"
+}
diff --git a/resourcesettings/apiv1/gapic_metadata.json b/resourcesettings/apiv1/gapic_metadata.json
new file mode 100644
index 0000000..b7952d4
--- /dev/null
+++ b/resourcesettings/apiv1/gapic_metadata.json
@@ -0,0 +1,53 @@
+{
+ "schema": "1.0",
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.",
+ "language": "go",
+ "protoPackage": "google.cloud.resourcesettings.v1",
+ "libraryPackage": "cloud.google.com/go/resourcesettings/apiv1",
+ "services": {
+ "ResourceSettingsService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "Client",
+ "rpcs": {
+ "CreateSettingValue": {
+ "methods": [
+ "CreateSettingValue"
+ ]
+ },
+ "DeleteSettingValue": {
+ "methods": [
+ "DeleteSettingValue"
+ ]
+ },
+ "GetSettingValue": {
+ "methods": [
+ "GetSettingValue"
+ ]
+ },
+ "ListSettings": {
+ "methods": [
+ "ListSettings"
+ ]
+ },
+ "LookupEffectiveSettingValue": {
+ "methods": [
+ "LookupEffectiveSettingValue"
+ ]
+ },
+ "SearchSettingValues": {
+ "methods": [
+ "SearchSettingValues"
+ ]
+ },
+ "UpdateSettingValue": {
+ "methods": [
+ "UpdateSettingValue"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/resourcesettings/apiv1/resource_settings_client.go b/resourcesettings/apiv1/resource_settings_client.go
new file mode 100644
index 0000000..26dca5f
--- /dev/null
+++ b/resourcesettings/apiv1/resource_settings_client.go
@@ -0,0 +1,565 @@
+// 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 resourcesettings
+
+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"
+ resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+var newClientHook clientHook
+
+// CallOptions contains the retry settings for each method of Client.
+type CallOptions struct {
+ ListSettings []gax.CallOption
+ SearchSettingValues []gax.CallOption
+ GetSettingValue []gax.CallOption
+ LookupEffectiveSettingValue []gax.CallOption
+ CreateSettingValue []gax.CallOption
+ UpdateSettingValue []gax.CallOption
+ DeleteSettingValue []gax.CallOption
+}
+
+func defaultClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ internaloption.WithDefaultEndpoint("resourcesettings.googleapis.com:443"),
+ internaloption.WithDefaultMTLSEndpoint("resourcesettings.mtls.googleapis.com:443"),
+ internaloption.WithDefaultAudience("https://resourcesettings.googleapis.com/"),
+ internaloption.WithDefaultScopes(DefaultAuthScopes()...),
+ option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
+ option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
+ grpc.MaxCallRecvMsgSize(math.MaxInt32))),
+ }
+}
+
+func defaultCallOptions() *CallOptions {
+ return &CallOptions{
+ ListSettings: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ SearchSettingValues: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ GetSettingValue: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ LookupEffectiveSettingValue: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ CreateSettingValue: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ UpdateSettingValue: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ DeleteSettingValue: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.Unavailable,
+ codes.DeadlineExceeded,
+ }, gax.Backoff{
+ Initial: 1000 * time.Millisecond,
+ Max: 10000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ }
+}
+
+// Client is a client for interacting with Resource Settings API.
+//
+// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
+type Client 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.
+ client resourcesettingspb.ResourceSettingsServiceClient
+
+ // The call options for this service.
+ CallOptions *CallOptions
+
+ // The x-goog-* metadata to be sent with each request.
+ xGoogMetadata metadata.MD
+}
+
+// NewClient creates a new resource settings service client.
+//
+// An interface to interact with resource settings and setting values throughout
+// the resource hierarchy.
+//
+// Services may surface a number of settings for users to control how their
+// resources behave. Setting values applied on a given Cloud resource are
+// evaluated hierarchically and inherited by all descendants of that resource.
+//
+// For all requests, returns a google.rpc.Status with
+// google.rpc.Code.PERMISSION_DENIED if the IAM check fails or the parent
+// resource is not in a Cloud Organization.
+// For all requests, returns a google.rpc.Status with
+// google.rpc.Code.INVALID_ARGUMENT if the request is malformed.
+func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
+ clientOpts := defaultClientOptions()
+
+ if newClientHook != nil {
+ hookOpts, err := newClientHook(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 := &Client{
+ connPool: connPool,
+ disableDeadlines: disableDeadlines,
+ CallOptions: defaultCallOptions(),
+
+ client: resourcesettingspb.NewResourceSettingsServiceClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ return c, nil
+}
+
+// Connection returns a connection to the API service.
+//
+// Deprecated.
+func (c *Client) 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 *Client) 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 *Client) setGoogleClientInfo(keyval ...string) {
+ kv := append([]string{"gl-go", versionGo()}, keyval...)
+ kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
+ c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
+}
+
+// ListSettings lists all the settings that are available on the Cloud resource parent.
+func (c *Client) ListSettings(ctx context.Context, req *resourcesettingspb.ListSettingsRequest, opts ...gax.CallOption) *SettingIterator {
+ 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.ListSettings[0:len(c.CallOptions.ListSettings):len(c.CallOptions.ListSettings)], opts...)
+ it := &SettingIterator{}
+ req = proto.Clone(req).(*resourcesettingspb.ListSettingsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*resourcesettingspb.Setting, string, error) {
+ var resp *resourcesettingspb.ListSettingsResponse
+ 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.client.ListSettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetSettings(), 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
+}
+
+// SearchSettingValues searches for all setting values that exist on the resource parent. The
+// setting values are not limited to those of a particular setting.
+func (c *Client) SearchSettingValues(ctx context.Context, req *resourcesettingspb.SearchSettingValuesRequest, opts ...gax.CallOption) *SettingValueIterator {
+ 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.SearchSettingValues[0:len(c.CallOptions.SearchSettingValues):len(c.CallOptions.SearchSettingValues)], opts...)
+ it := &SettingValueIterator{}
+ req = proto.Clone(req).(*resourcesettingspb.SearchSettingValuesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*resourcesettingspb.SettingValue, string, error) {
+ var resp *resourcesettingspb.SearchSettingValuesResponse
+ 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.client.SearchSettingValues(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GetSettingValues(), 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
+}
+
+// GetSettingValue gets a setting value.
+//
+// Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the
+// setting value does not exist.
+func (c *Client) GetSettingValue(ctx context.Context, req *resourcesettingspb.GetSettingValueRequest, opts ...gax.CallOption) (*resourcesettingspb.SettingValue, 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.GetSettingValue[0:len(c.CallOptions.GetSettingValue):len(c.CallOptions.GetSettingValue)], opts...)
+ var resp *resourcesettingspb.SettingValue
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.GetSettingValue(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// LookupEffectiveSettingValue computes the effective setting value of a setting at the Cloud resource
+// parent. The effective setting value is the calculated setting value at a
+// Cloud resource and evaluates to one of the following options in the given
+// order (the next option is used if the previous one does not exist):
+//
+// the setting value on the given resource
+//
+// the setting value on the given resource’s nearest ancestor
+//
+// the setting’s default value
+//
+// an empty setting value, defined as a SettingValue with all fields
+// unset
+//
+// Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the
+// setting does not exist.
+func (c *Client) LookupEffectiveSettingValue(ctx context.Context, req *resourcesettingspb.LookupEffectiveSettingValueRequest, opts ...gax.CallOption) (*resourcesettingspb.SettingValue, 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.LookupEffectiveSettingValue[0:len(c.CallOptions.LookupEffectiveSettingValue):len(c.CallOptions.LookupEffectiveSettingValue)], opts...)
+ var resp *resourcesettingspb.SettingValue
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.LookupEffectiveSettingValue(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateSettingValue creates a setting value.
+//
+// Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the
+// setting does not exist.
+// Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the
+// setting value already exists on the given Cloud resource.
+// Returns a google.rpc.Status with google.rpc.Code.FAILED_PRECONDITION if
+// the setting is flagged as read only.
+func (c *Client) CreateSettingValue(ctx context.Context, req *resourcesettingspb.CreateSettingValueRequest, opts ...gax.CallOption) (*resourcesettingspb.SettingValue, 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.CreateSettingValue[0:len(c.CallOptions.CreateSettingValue):len(c.CallOptions.CreateSettingValue)], opts...)
+ var resp *resourcesettingspb.SettingValue
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.CreateSettingValue(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateSettingValue updates a setting value.
+//
+// Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the
+// setting or the setting value does not exist.
+// Returns a google.rpc.Status with google.rpc.Code.FAILED_PRECONDITION if
+// the setting is flagged as read only.
+// Returns a google.rpc.Status with google.rpc.Code.ABORTED if the etag
+// supplied in the request does not match the persisted etag of the setting
+// value.
+//
+// Note: the supplied setting value will perform a full overwrite of all
+// fields.
+func (c *Client) UpdateSettingValue(ctx context.Context, req *resourcesettingspb.UpdateSettingValueRequest, opts ...gax.CallOption) (*resourcesettingspb.SettingValue, 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", "setting_value.name", url.QueryEscape(req.GetSettingValue().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateSettingValue[0:len(c.CallOptions.UpdateSettingValue):len(c.CallOptions.UpdateSettingValue)], opts...)
+ var resp *resourcesettingspb.SettingValue
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateSettingValue(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteSettingValue deletes a setting value. If the setting value does not exist, the operation
+// is a no-op.
+//
+// Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the
+// setting or the setting value does not exist. The setting value will not
+// exist if a prior call to DeleteSettingValue for the setting value already
+// returned a success code.
+// Returns a google.rpc.Status with google.rpc.Code.FAILED_PRECONDITION if
+// the setting is flagged as read only.
+func (c *Client) DeleteSettingValue(ctx context.Context, req *resourcesettingspb.DeleteSettingValueRequest, 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.DeleteSettingValue[0:len(c.CallOptions.DeleteSettingValue):len(c.CallOptions.DeleteSettingValue)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.client.DeleteSettingValue(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// SettingIterator manages a stream of *resourcesettingspb.Setting.
+type SettingIterator struct {
+ items []*resourcesettingspb.Setting
+ 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 []*resourcesettingspb.Setting, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *SettingIterator) 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 *SettingIterator) Next() (*resourcesettingspb.Setting, error) {
+ var item *resourcesettingspb.Setting
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *SettingIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *SettingIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// SettingValueIterator manages a stream of *resourcesettingspb.SettingValue.
+type SettingValueIterator struct {
+ items []*resourcesettingspb.SettingValue
+ 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 []*resourcesettingspb.SettingValue, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *SettingValueIterator) 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 *SettingValueIterator) Next() (*resourcesettingspb.SettingValue, error) {
+ var item *resourcesettingspb.SettingValue
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *SettingValueIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *SettingValueIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/resourcesettings/apiv1/resource_settings_client_example_test.go b/resourcesettings/apiv1/resource_settings_client_example_test.go
new file mode 100644
index 0000000..80370af
--- /dev/null
+++ b/resourcesettings/apiv1/resource_settings_client_example_test.go
@@ -0,0 +1,185 @@
+// 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 resourcesettings_test
+
+import (
+ "context"
+
+ resourcesettings "cloud.google.com/go/resourcesettings/apiv1"
+ "google.golang.org/api/iterator"
+ resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+)
+
+func ExampleNewClient() {
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleClient_ListSettings() {
+ // import resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.ListSettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListSettings(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_SearchSettingValues() {
+ // import resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.SearchSettingValuesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.SearchSettingValues(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_GetSettingValue() {
+ // import resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.GetSettingValueRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetSettingValue(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_LookupEffectiveSettingValue() {
+ // import resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.LookupEffectiveSettingValueRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.LookupEffectiveSettingValue(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_CreateSettingValue() {
+ // import resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.CreateSettingValueRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateSettingValue(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_UpdateSettingValue() {
+ // import resourcesettingspb "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1"
+
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.UpdateSettingValueRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateSettingValue(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_DeleteSettingValue() {
+ ctx := context.Background()
+ c, err := resourcesettings.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &resourcesettingspb.DeleteSettingValueRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteSettingValue(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
diff --git a/retail/apiv2/doc.go b/retail/apiv2/doc.go
index c19db82..94548d6 100644
--- a/retail/apiv2/doc.go
+++ b/retail/apiv2/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 b6dbd72..356a360 100644
--- a/scheduler/apiv1/doc.go
+++ b/scheduler/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 cc29866..f6b6647 100644
--- a/scheduler/apiv1beta1/doc.go
+++ b/scheduler/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 e506aef..6bc1f5d 100644
--- a/secretmanager/apiv1/doc.go
+++ b/secretmanager/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 28d3ff5..fafe287 100644
--- a/secretmanager/apiv1beta1/doc.go
+++ b/secretmanager/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 15b5317..8f9cc7c 100644
--- a/security/privateca/apiv1beta1/doc.go
+++ b/security/privateca/apiv1beta1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 f3267ff..a09fe1f 100644
--- a/securitycenter/apiv1/doc.go
+++ b/securitycenter/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 8b16d2c..2d7adf9 100644
--- a/securitycenter/apiv1beta1/doc.go
+++ b/securitycenter/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 001010e..a88104d 100644
--- a/securitycenter/apiv1p1beta1/doc.go
+++ b/securitycenter/apiv1p1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 751b1f2..224bb94 100644
--- a/securitycenter/settings/apiv1beta1/doc.go
+++ b/securitycenter/settings/apiv1beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 c9bef6a..efb8a7d 100644
--- a/servicecontrol/apiv1/doc.go
+++ b/servicecontrol/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/servicecontrol/apiv1/quota_controller_client.go b/servicecontrol/apiv1/quota_controller_client.go
index 3b9b437..2082a21 100644
--- a/servicecontrol/apiv1/quota_controller_client.go
+++ b/servicecontrol/apiv1/quota_controller_client.go
@@ -78,7 +78,7 @@
// NewQuotaControllerClient creates a new quota controller client.
//
-// Google Quota Control API (at /service-control/overview)
+// Google Quota Control API (at https://cloud.google.com/service-control/overview)
//
// Allows clients to allocate and release quota against a managed
// service (at https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
diff --git a/servicecontrol/apiv1/service_controller_client.go b/servicecontrol/apiv1/service_controller_client.go
index 63fc657..1204c93 100644
--- a/servicecontrol/apiv1/service_controller_client.go
+++ b/servicecontrol/apiv1/service_controller_client.go
@@ -80,7 +80,7 @@
// NewServiceControllerClient creates a new service controller client.
//
-// Google Service Control API (at /service-control/overview)
+// Google Service Control API (at https://cloud.google.com/service-control/overview)
//
// Lets clients check and report operations against a managed
// service (at https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
diff --git a/servicedirectory/apiv1/doc.go b/servicedirectory/apiv1/doc.go
index 5ad92a6..39102c7 100644
--- a/servicedirectory/apiv1/doc.go
+++ b/servicedirectory/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 e6ea162..3fe5c12 100644
--- a/servicedirectory/apiv1beta1/doc.go
+++ b/servicedirectory/apiv1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 c0c32d8..b438049 100644
--- a/servicemanagement/apiv1/doc.go
+++ b/servicemanagement/apiv1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/spanner/CHANGES.md b/spanner/CHANGES.md
index 0886540..941b3ef 100644
--- a/spanner/CHANGES.md
+++ b/spanner/CHANGES.md
@@ -1,5 +1,18 @@
# Changes
+## [1.16.0](https://www.github.com/googleapis/google-cloud-go/compare/v1.15.0...v1.16.0) (2021-03-17)
+
+
+### Features
+
+* **spanner:** add `optimizer_statistics_package` field in `QueryOptions` ([18c88c4](https://www.github.com/googleapis/google-cloud-go/commit/18c88c437bd1741eaf5bf5911b9da6f6ea7cd75d))
+* **spanner/admin/database:** add CMEK fields to backup and database ([16597fa](https://github.com/googleapis/google-cloud-go/commit/16597fa1ce549053c7183e8456e23f554a5501de))
+
+
+### Bug Fixes
+
+* **spanner/spansql:** fix parsing of NOT IN operator ([#3724](https://www.github.com/googleapis/google-cloud-go/issues/3724)) ([7636478](https://www.github.com/googleapis/google-cloud-go/commit/76364784d82073b80929ae60fd42da34c8050820))
+
## [1.15.0](https://www.github.com/googleapis/google-cloud-go/compare/v1.14.1...v1.15.0) (2021-02-24)
diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go
index 6568511..e978eb7 100644
--- a/spanner/admin/database/apiv1/doc.go
+++ b/spanner/admin/database/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 88ecf90..4b59cb1 100644
--- a/spanner/admin/instance/apiv1/doc.go
+++ b/spanner/admin/instance/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 a6b3dc2..6444fd0 100644
--- a/spanner/apiv1/doc.go
+++ b/spanner/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 36ff3be..cd9d31b 100644
--- a/spanner/go.mod
+++ b/spanner/go.mod
@@ -4,13 +4,13 @@
require (
cloud.google.com/go v0.79.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.23.0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
- google.golang.org/protobuf v1.25.0
+ google.golang.org/protobuf v1.26.0
)
diff --git a/spanner/go.sum b/spanner/go.sum
index c0f155b..ff8b42e 100644
--- a/spanner/go.sum
+++ b/spanner/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -218,8 +220,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -276,8 +279,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -362,8 +366,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -409,9 +413,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -439,8 +443,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go
index 95ccd14..0854e89 100644
--- a/speech/apiv1/doc.go
+++ b/speech/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 edae6df..8936f67 100644
--- a/speech/apiv1p1beta1/doc.go
+++ b/speech/apiv1p1beta1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 83142a3..0862df8 100644
--- a/storage/go.mod
+++ b/storage/go.mod
@@ -4,11 +4,11 @@
require (
cloud.google.com/go v0.79.0
- github.com/golang/protobuf v1.4.3
+ github.com/golang/protobuf v1.5.1
github.com/google/go-cmp v0.5.5
github.com/googleapis/gax-go/v2 v2.0.5
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
- google.golang.org/api v0.42.0
- google.golang.org/genproto v0.0.0-20210315173758-2651cd453018
+ google.golang.org/api v0.43.0
+ google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14
google.golang.org/grpc v1.36.0
)
diff --git a/storage/go.sum b/storage/go.sum
index a93e720..f973130 100644
--- a/storage/go.sum
+++ b/storage/go.sum
@@ -82,8 +82,10 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -220,8 +222,9 @@
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -278,8 +281,9 @@
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424 h1:+39ahH47SWi1PhMRAHfIrm8f69HRZ5K2koXH6dmO8TQ=
-golang.org/x/sys v0.0.0-20210314195730-07df6a141424/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -364,8 +368,8 @@
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
-google.golang.org/api v0.42.0 h1:uqATLkpxiBrhrvFoebXUjvyzE9nQf+pVyy0Z0IHE+fc=
-google.golang.org/api v0.42.0/go.mod h1:+Oj4s6ch2SEGtPjGqfUfZonBH0GjQH89gTeKKAEGZKI=
+google.golang.org/api v0.43.0 h1:4sAyIHT6ZohtAQDoxws+ez7bROYmUlOVvsUscYCDTqA=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -411,9 +415,9 @@
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210312152112-fc591d9ea70f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018 h1:ZH67MZWSz0sEGHWoYAO1ysjL0yWEXTQ7gOxytol4KAk=
-google.golang.org/genproto v0.0.0-20210315173758-2651cd453018/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14 h1:0VNRpy5TroA/6mYt3pPEq+E3oomxLJ+FUit3+oIsUy4=
+google.golang.org/genproto v0.0.0-20210325141258-5636347f2b14/go.mod h1:f2Bd7+2PlaVKmvKQ52aspJZXIDaRQBVdOOBfJ5i8OEs=
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=
@@ -441,8 +445,10 @@
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go
index d04f1e5..3c5bada 100644
--- a/talent/apiv4/doc.go
+++ b/talent/apiv4/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 5774996..9378714 100644
--- a/talent/apiv4beta1/doc.go
+++ b/talent/apiv4beta1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 91367df..786604b 100644
--- a/texttospeech/apiv1/doc.go
+++ b/texttospeech/apiv1/doc.go
@@ -49,7 +49,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 702be45..8198459 100644
--- a/trace/apiv1/doc.go
+++ b/trace/apiv1/doc.go
@@ -52,7 +52,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 197110f..cdbaaa0 100644
--- a/trace/apiv2/doc.go
+++ b/trace/apiv2/doc.go
@@ -52,7 +52,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 b06ddac..faeb974 100644
--- a/translate/apiv3/doc.go
+++ b/translate/apiv3/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 732df72..e1819f3 100644
--- a/video/transcoder/apiv1beta1/doc.go
+++ b/video/transcoder/apiv1beta1/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 32b2878..036d480 100644
--- a/videointelligence/apiv1/doc.go
+++ b/videointelligence/apiv1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2f71c1f..68f828d 100644
--- a/videointelligence/apiv1beta2/doc.go
+++ b/videointelligence/apiv1beta2/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 cf3b418..813aa45 100644
--- a/vision/apiv1/doc.go
+++ b/vision/apiv1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 0f985b0..3ad1b38 100644
--- a/vision/apiv1p1beta1/doc.go
+++ b/vision/apiv1p1beta1/doc.go
@@ -50,7 +50,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2522290..bf9902b 100644
--- a/webrisk/apiv1/doc.go
+++ b/webrisk/apiv1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 fc12aa1..6383e4f 100644
--- a/webrisk/apiv1beta1/doc.go
+++ b/webrisk/apiv1beta1/doc.go
@@ -46,7 +46,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 adbb4ea..81f8a65 100644
--- a/websecurityscanner/apiv1/doc.go
+++ b/websecurityscanner/apiv1/doc.go
@@ -48,7 +48,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2e6c3be..a349c86 100644
--- a/workflows/apiv1beta/doc.go
+++ b/workflows/apiv1beta/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
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 2d292b7..23355cd 100644
--- a/workflows/executions/apiv1beta/doc.go
+++ b/workflows/executions/apiv1beta/doc.go
@@ -44,7 +44,7 @@
type clientHookParams struct{}
type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
-const versionClient = "20210315"
+const versionClient = "20210325"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)