diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1398722c3ee..6ca285bee22f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -129,10 +129,13 @@ project's service account. (e.g. doorway-cliff-677) for the Firestore project. - `GCLOUD_TESTS_GOLANG_FIRESTORE_KEY`: The path to the JSON key file of the Firestore project's service account. +- `GCLOUD_TESTS_API_KEY`: API key for using the Translate API created above. + +As part of the setup that follows, the following variables will be configured: + - `GCLOUD_TESTS_GOLANG_KEYRING`: The full name of the keyring for the tests, in the form "projects/P/locations/L/keyRings/R". The creation of this is described below. -- `GCLOUD_TESTS_API_KEY`: API key for using the Translate API. - `GCLOUD_TESTS_GOLANG_ZONE`: Compute Engine zone. Install the [gcloud command-line tool][gcloudcli] to your machine and use it to @@ -159,7 +162,7 @@ $ gsutil acl ch -g cloud-logs@google.com:O gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID # Creates a PubSub topic for integration tests of storage notifications. $ gcloud beta pubsub topics create go-storage-notification-test # Next, go to the Pub/Sub dashboard in GCP console. Authorize the user -# "service-@gs-project-accounts.iam.gserviceaccount.com" +# "service-@gs-project-accounts.iam.gserviceaccount.com" # as a publisher to that topic. # Creates a Spanner instance for the spanner integration tests. @@ -178,7 +181,38 @@ $ gcloud kms keys create key2 --keyring $MY_KEYRING --location $MY_LOCATION --pu # Sets the GCLOUD_TESTS_GOLANG_KEYRING environment variable. $ export GCLOUD_TESTS_GOLANG_KEYRING=projects/$GCLOUD_TESTS_GOLANG_PROJECT_ID/locations/$MY_LOCATION/keyRings/$MY_KEYRING # Authorizes Google Cloud Storage to encrypt and decrypt using key1. -gsutil kms authorize -p $GCLOUD_TESTS_GOLANG_PROJECT_ID -k $GCLOUD_TESTS_GOLANG_KEYRING/cryptoKeys/key1 +$ gsutil kms authorize -p $GCLOUD_TESTS_GOLANG_PROJECT_ID -k $GCLOUD_TESTS_GOLANG_KEYRING/cryptoKeys/key1 +``` + +It may be useful to add exports to your shell initialization for future use. +For instance, in `.zshrc`: + +```sh +#### START GO SDK Test Variables +# Developers Console project's ID (e.g. bamboo-shift-455) for the general project. +export GCLOUD_TESTS_GOLANG_PROJECT_ID=your-project + +# The path to the JSON key file of the general project's service account. +export GCLOUD_TESTS_GOLANG_KEY=~/directory/your-project-abcd1234.json + +# Developers Console project's ID (e.g. doorway-cliff-677) for the Firestore project. +export GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID=your-firestore-project + +# The path to the JSON key file of the Firestore project's service account. +export GCLOUD_TESTS_GOLANG_FIRESTORE_KEY=~/directory/your-firestore-project-abcd1234.json + +# The full name of the keyring for the tests, in the form "projects/P/locations/L/keyRings/R". +# The creation of this is described below. +export MY_KEYRING=my-golang-sdk-test +export MY_LOCATION=global +export GCLOUD_TESTS_GOLANG_KEYRING=projects/$GCLOUD_TESTS_GOLANG_PROJECT_ID/locations/$MY_LOCATION/keyRings/$MY_KEYRING + +# API key for using the Translate API. +export GCLOUD_TESTS_API_KEY=abcdefghijk123456789 + +# Compute Engine zone. (https://cloud.google.com/compute/docs/regions-zones) +export GCLOUD_TESTS_GOLANG_ZONE=your-chosen-region +#### END GO SDK Test Variables ``` #### Running @@ -187,7 +221,15 @@ Once you've done the necessary setup, you can run the integration tests by running: ``` sh -$ go test -v cloud.google.com/go/... +$ go test -v ./... +``` + +Note that the above command will not run the tests in other modules. To run +tests on other modules, first navigate to the appropriate +subdirectory. For instance, to run only the tests for datastore: +``` sh +$ cd datastore +$ go test -v ./... ``` #### Replay diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index c48a786e1680..c55b078a4778 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 b1b1b68b236e..3ab19023d6dd 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 f0ed3a15b5f5..ab59980e69ef 100644 --- a/analytics/data/apiv1alpha/doc.go +++ b/analytics/data/apiv1alpha/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go index 983f2b5158c7..38c92b037e4d 100644 --- a/area120/tables/apiv1alpha1/doc.go +++ b/area120/tables/apiv1alpha1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 b42761811392..9ae8235afa66 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1beta1/doc.go b/asset/apiv1beta1/doc.go index 2164f0c47349..4ba076e6be72 100644 --- a/asset/apiv1beta1/doc.go +++ b/asset/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 8d125657d69c..be7cb94be837 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 810143a7a868..a9516ec278cc 100644 --- a/asset/apiv1p5beta1/doc.go +++ b/asset/apiv1p5beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 8d10a752f78e..b9a3f619c4cb 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 5c3d9d67ff80..da4ec7c788ab 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 47b1b7709d42..07ce9db85ccb 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 f1041d39c9c9..a95a392824b2 100644 --- a/bigquery/connection/apiv1/doc.go +++ b/bigquery/connection/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 5914d32f92f6..85aa827dd59f 100644 --- a/bigquery/connection/apiv1beta1/doc.go +++ b/bigquery/connection/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 966cbbd3e11c..45110fd5ecc4 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/external.go b/bigquery/external.go index e8d1fdee5503..3f8647e568a3 100644 --- a/bigquery/external.go +++ b/bigquery/external.go @@ -92,6 +92,10 @@ type ExternalDataConfig struct { // Additional options for CSV, GoogleSheets and Bigtable formats. Options ExternalDataConfigOptions + + // HivePartitioningOptions allows use of Hive partitioning based on the + // layout of objects in Google Cloud Storage. + HivePartitioningOptions *HivePartitioningOptions } func (e *ExternalDataConfig) toBQ() bq.ExternalDataConfiguration { @@ -106,6 +110,9 @@ func (e *ExternalDataConfig) toBQ() bq.ExternalDataConfiguration { if e.Schema != nil { q.Schema = e.Schema.toBQ() } + if e.HivePartitioningOptions != nil { + q.HivePartitioningOptions = e.HivePartitioningOptions.toBQ() + } if e.Options != nil { e.Options.populateExternalDataConfig(&q) } @@ -134,6 +141,9 @@ func bqToExternalDataConfig(q *bq.ExternalDataConfiguration) (*ExternalDataConfi return nil, err } } + if q.HivePartitioningOptions != nil { + e.HivePartitioningOptions = bqToHivePartitioningOptions(q.HivePartitioningOptions) + } return e, nil } @@ -409,3 +419,65 @@ func bqToBigtableColumn(q *bq.BigtableColumn) (*BigtableColumn, error) { } return b, nil } + +// HivePartitioningMode is used in conjunction with HivePartitioningOptions. +type HivePartitioningMode string + +const ( + // AutoHivePartitioningMode automatically infers partitioning key and types. + AutoHivePartitioningMode HivePartitioningMode = "AUTO" + // StringHivePartitioningMode automatically infers partitioning keys and treats values as string. + StringHivePartitioningMode HivePartitioningMode = "STRINGS" + // CustomHivePartitioningMode allows custom definition of the external partitioning. + CustomHivePartitioningMode HivePartitioningMode = "CUSTOM" +) + +// HivePartitioningOptions defines the behavior of Hive partitioning +// when working with external data. +type HivePartitioningOptions struct { + + // Mode defines which hive partitioning mode to use when reading data. + Mode HivePartitioningMode + + // When hive partition detection is requested, a common prefix for + // all source uris should be supplied. The prefix must end immediately + // before the partition key encoding begins. + // + // For example, consider files following this data layout. + // gs://bucket/path_to_table/dt=2019-01-01/country=BR/id=7/file.avro + // gs://bucket/path_to_table/dt=2018-12-31/country=CA/id=3/file.avro + // + // When hive partitioning is requested with either AUTO or STRINGS + // detection, the common prefix can be either of + // gs://bucket/path_to_table or gs://bucket/path_to_table/ (trailing + // slash does not matter). + SourceURIPrefix string + + // If set to true, queries against this external table require + // a partition filter to be present that can perform partition + // elimination. Hive-partitioned load jobs with this field + // set to true will fail. + RequirePartitionFilter bool +} + +func (o *HivePartitioningOptions) toBQ() *bq.HivePartitioningOptions { + if o == nil { + return nil + } + return &bq.HivePartitioningOptions{ + Mode: string(o.Mode), + SourceUriPrefix: o.SourceURIPrefix, + RequirePartitionFilter: o.RequirePartitionFilter, + } +} + +func bqToHivePartitioningOptions(q *bq.HivePartitioningOptions) *HivePartitioningOptions { + if q == nil { + return nil + } + return &HivePartitioningOptions{ + Mode: HivePartitioningMode(q.Mode), + SourceURIPrefix: q.SourceUriPrefix, + RequirePartitionFilter: q.RequirePartitionFilter, + } +} diff --git a/bigquery/external_test.go b/bigquery/external_test.go index f64297fd1a09..222cf2749998 100644 --- a/bigquery/external_test.go +++ b/bigquery/external_test.go @@ -48,6 +48,14 @@ func TestExternalDataConfig(t *testing.T) { Range: "sheet1!A1:Z10", }, }, + { + SourceFormat: Avro, + HivePartitioningOptions: &HivePartitioningOptions{ + Mode: AutoHivePartitioningMode, + SourceURIPrefix: "gs://somebucket/a/b/c", + RequirePartitionFilter: true, + }, + }, { SourceFormat: Bigtable, Options: &BigtableOptions{ diff --git a/bigquery/go.mod b/bigquery/go.mod index 92bed66df5c8..9a84fc5eeaf3 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -8,8 +8,8 @@ require ( github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 4d90c55b7279..ed3e17490230 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -401,8 +401,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -491,8 +491,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= diff --git a/bigquery/integration_test.go b/bigquery/integration_test.go index 14573e2bb3aa..e450e207ec5d 100644 --- a/bigquery/integration_test.go +++ b/bigquery/integration_test.go @@ -1434,6 +1434,7 @@ func TestIntegration_InsertAndReadNullable(t *testing.T) { ctm := civil.Time{Hour: 15, Minute: 4, Second: 5, Nanosecond: 6000} cdt := civil.DateTime{Date: testDate, Time: ctm} rat := big.NewRat(33, 100) + rat2 := big.NewRat(66, 100) geo := "POINT(-122.198939 47.669865)" // Nil fields in the struct. @@ -1455,20 +1456,21 @@ func TestIntegration_InsertAndReadNullable(t *testing.T) { // Populate the struct with values. testInsertAndReadNullable(t, testStructNullable{ - String: NullString{"x", true}, - Bytes: []byte{1, 2, 3}, - Integer: NullInt64{1, true}, - Float: NullFloat64{2.3, true}, - Boolean: NullBool{true, true}, - Timestamp: NullTimestamp{testTimestamp, true}, - Date: NullDate{testDate, true}, - Time: NullTime{ctm, true}, - DateTime: NullDateTime{cdt, true}, - Numeric: rat, - Geography: NullGeography{geo, true}, - Record: &subNullable{X: NullInt64{4, true}}, + String: NullString{"x", true}, + Bytes: []byte{1, 2, 3}, + Integer: NullInt64{1, true}, + Float: NullFloat64{2.3, true}, + Boolean: NullBool{true, true}, + Timestamp: NullTimestamp{testTimestamp, true}, + Date: NullDate{testDate, true}, + Time: NullTime{ctm, true}, + DateTime: NullDateTime{cdt, true}, + Numeric: rat, + BigNumeric: rat2, + Geography: NullGeography{geo, true}, + Record: &subNullable{X: NullInt64{4, true}}, }, - []Value{"x", []byte{1, 2, 3}, int64(1), 2.3, true, testTimestamp, testDate, ctm, cdt, rat, geo, []Value{int64(4)}}) + []Value{"x", []byte{1, 2, 3}, int64(1), 2.3, true, testTimestamp, testDate, ctm, cdt, rat, rat2, geo, []Value{int64(4)}}) } func testInsertAndReadNullable(t *testing.T, ts testStructNullable, wantRow []Value) { @@ -1857,6 +1859,59 @@ func TestIntegration_LegacyQuery(t *testing.T) { } } +func TestIntegration_QueryExternalHivePartitioning(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + + autoTable := dataset.Table(tableIDs.New()) + customTable := dataset.Table(tableIDs.New()) + + err := autoTable.Create(ctx, &TableMetadata{ + ExternalDataConfig: &ExternalDataConfig{ + SourceFormat: Parquet, + SourceURIs: []string{"gs://cloud-samples-data/bigquery/hive-partitioning-samples/autolayout/*"}, + AutoDetect: true, + HivePartitioningOptions: &HivePartitioningOptions{ + Mode: AutoHivePartitioningMode, + SourceURIPrefix: "gs://cloud-samples-data/bigquery/hive-partitioning-samples/autolayout/", + RequirePartitionFilter: true, + }, + }, + }) + if err != nil { + t.Fatalf("table.Create(auto): %v", err) + } + defer autoTable.Delete(ctx) + + err = customTable.Create(ctx, &TableMetadata{ + ExternalDataConfig: &ExternalDataConfig{ + SourceFormat: Parquet, + SourceURIs: []string{"gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/*"}, + AutoDetect: true, + HivePartitioningOptions: &HivePartitioningOptions{ + Mode: CustomHivePartitioningMode, + SourceURIPrefix: "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/{pkey:STRING}/", + RequirePartitionFilter: true, + }, + }, + }) + if err != nil { + t.Fatalf("table.Create(custom): %v", err) + } + defer customTable.Delete(ctx) + + // Issue a test query that prunes based on the custom hive partitioning key, and verify the result is as expected. + sql := fmt.Sprintf("SELECT COUNT(*) as ct FROM `%s`.%s.%s WHERE pkey=\"foo\"", customTable.ProjectID, customTable.DatasetID, customTable.TableID) + q := client.Query(sql) + it, err := q.Read(ctx) + if err != nil { + t.Fatalf("Error querying: %v", err) + } + checkReadAndTotalRows(t, "HiveQuery", it, [][]Value{{int64(50)}}) +} + func TestIntegration_QueryParameters(t *testing.T) { if client == nil { t.Skip("Integration tests skipped") diff --git a/bigquery/params.go b/bigquery/params.go index 595702261898..68bb3fa01ac4 100644 --- a/bigquery/params.go +++ b/bigquery/params.go @@ -65,16 +65,17 @@ func (e invalidFieldNameError) Error() string { var fieldCache = fields.NewCache(bqTagParser, nil, nil) var ( - int64ParamType = &bq.QueryParameterType{Type: "INT64"} - float64ParamType = &bq.QueryParameterType{Type: "FLOAT64"} - boolParamType = &bq.QueryParameterType{Type: "BOOL"} - stringParamType = &bq.QueryParameterType{Type: "STRING"} - bytesParamType = &bq.QueryParameterType{Type: "BYTES"} - dateParamType = &bq.QueryParameterType{Type: "DATE"} - timeParamType = &bq.QueryParameterType{Type: "TIME"} - dateTimeParamType = &bq.QueryParameterType{Type: "DATETIME"} - timestampParamType = &bq.QueryParameterType{Type: "TIMESTAMP"} - numericParamType = &bq.QueryParameterType{Type: "NUMERIC"} + int64ParamType = &bq.QueryParameterType{Type: "INT64"} + float64ParamType = &bq.QueryParameterType{Type: "FLOAT64"} + boolParamType = &bq.QueryParameterType{Type: "BOOL"} + stringParamType = &bq.QueryParameterType{Type: "STRING"} + bytesParamType = &bq.QueryParameterType{Type: "BYTES"} + dateParamType = &bq.QueryParameterType{Type: "DATE"} + timeParamType = &bq.QueryParameterType{Type: "TIME"} + dateTimeParamType = &bq.QueryParameterType{Type: "DATETIME"} + timestampParamType = &bq.QueryParameterType{Type: "TIMESTAMP"} + numericParamType = &bq.QueryParameterType{Type: "NUMERIC"} + bigNumericParamType = &bq.QueryParameterType{Type: "BIGNUMERIC"} ) var ( @@ -233,6 +234,9 @@ func paramValue(v reflect.Value) (bq.QueryParameterValue, error) { return res, nil case typeOfRat: + // big.Rat types don't communicate scale or precision, so we cannot + // disambiguate between NUMERIC and BIGNUMERIC. For now, we'll continue + // to honor previous behavior and send as Numeric type. res.Value = NumericString(v.Interface().(*big.Rat)) return res, nil } @@ -304,14 +308,15 @@ func bqToQueryParameter(q *bq.QueryParameter) (QueryParameter, error) { } var paramTypeToFieldType = map[string]FieldType{ - int64ParamType.Type: IntegerFieldType, - float64ParamType.Type: FloatFieldType, - boolParamType.Type: BooleanFieldType, - stringParamType.Type: StringFieldType, - bytesParamType.Type: BytesFieldType, - dateParamType.Type: DateFieldType, - timeParamType.Type: TimeFieldType, - numericParamType.Type: NumericFieldType, + int64ParamType.Type: IntegerFieldType, + float64ParamType.Type: FloatFieldType, + boolParamType.Type: BooleanFieldType, + stringParamType.Type: StringFieldType, + bytesParamType.Type: BytesFieldType, + dateParamType.Type: DateFieldType, + timeParamType.Type: TimeFieldType, + numericParamType.Type: NumericFieldType, + bigNumericParamType.Type: BigNumericFieldType, } // Convert a parameter value from the service to a Go value. This is similar to, but diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index 5d94f650ad8f..d140b84ce3f9 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 efc2ceaea250..1e85e6b7d64b 100644 --- a/bigquery/reservation/apiv1beta1/doc.go +++ b/bigquery/reservation/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/schema.go b/bigquery/schema.go index a9a50ef0006c..dcb5c6f9b771 100644 --- a/bigquery/schema.go +++ b/bigquery/schema.go @@ -182,23 +182,27 @@ const ( // GeographyFieldType is a string field type. Geography types represent a set of points // on the Earth's surface, represented in Well Known Text (WKT) format. GeographyFieldType FieldType = "GEOGRAPHY" + // BigNumericFieldType is a numeric field type that supports values of larger precision + // and scale than the NumericFieldType. + BigNumericFieldType FieldType = "BIGNUMERIC" ) var ( errEmptyJSONSchema = errors.New("bigquery: empty JSON schema") fieldTypes = map[FieldType]bool{ - StringFieldType: true, - BytesFieldType: true, - IntegerFieldType: true, - FloatFieldType: true, - BooleanFieldType: true, - TimestampFieldType: true, - RecordFieldType: true, - DateFieldType: true, - TimeFieldType: true, - DateTimeFieldType: true, - NumericFieldType: true, - GeographyFieldType: true, + StringFieldType: true, + BytesFieldType: true, + IntegerFieldType: true, + FloatFieldType: true, + BooleanFieldType: true, + TimestampFieldType: true, + RecordFieldType: true, + DateFieldType: true, + TimeFieldType: true, + DateTimeFieldType: true, + NumericFieldType: true, + GeographyFieldType: true, + BigNumericFieldType: true, } // The API will accept alias names for the types based on the Standard SQL type names. fieldAliases = map[FieldType]FieldType{ @@ -346,6 +350,10 @@ func inferFieldSchema(fieldName string, rt reflect.Type, nullable bool) (*FieldS case typeOfDateTime: return &FieldSchema{Required: true, Type: DateTimeFieldType}, nil case typeOfRat: + // We automatically infer big.Rat values as NUMERIC as we cannot + // determine precision/scale from the type. Users who want the + // larger precision of BIGNUMERIC need to manipulate the inferred + // schema. return &FieldSchema{Required: !nullable, Type: NumericFieldType}, nil } if ft := nullableFieldType(rt); ft != "" { diff --git a/bigquery/schema_test.go b/bigquery/schema_test.go index 5bd10849ac36..ae936980c783 100644 --- a/bigquery/schema_test.go +++ b/bigquery/schema_test.go @@ -1041,7 +1041,8 @@ func TestSchemaFromJSON(t *testing.T) { {"name":"flat_date","type":"DATE","mode":"NULLABLE","description":"Flat required DATE"}, {"name":"flat_time","type":"TIME","mode":"REQUIRED","description":"Flat nullable TIME"}, {"name":"flat_datetime","type":"DATETIME","mode":"NULLABLE","description":"Flat required DATETIME"}, - {"name":"flat_numeric","type":"NUMERIC","mode":"REQUIRED","description":"Flat nullable NUMERIC"}, + {"name":"flat_numeric","type":"NUMERIC","mode":"REQUIRED","description":"Flat required NUMERIC"}, + {"name":"flat_bignumeric","type":"BIGNUMERIC","mode":"NULLABLE","description":"Flat nullable BIGNUMERIC"}, {"name":"flat_geography","type":"GEOGRAPHY","mode":"REQUIRED","description":"Flat required GEOGRAPHY"}, {"name":"aliased_integer","type":"INT64","mode":"REQUIRED","description":"Aliased required integer"}, {"name":"aliased_boolean","type":"BOOL","mode":"NULLABLE","description":"Aliased nullable boolean"}, @@ -1058,7 +1059,8 @@ func TestSchemaFromJSON(t *testing.T) { fieldSchema("Flat required DATE", "flat_date", "DATE", false, false, nil), fieldSchema("Flat nullable TIME", "flat_time", "TIME", false, true, nil), fieldSchema("Flat required DATETIME", "flat_datetime", "DATETIME", false, false, nil), - fieldSchema("Flat nullable NUMERIC", "flat_numeric", "NUMERIC", false, true, nil), + fieldSchema("Flat required NUMERIC", "flat_numeric", "NUMERIC", false, true, nil), + fieldSchema("Flat nullable BIGNUMERIC", "flat_bignumeric", "BIGNUMERIC", false, false, nil), fieldSchema("Flat required GEOGRAPHY", "flat_geography", "GEOGRAPHY", false, true, nil), fieldSchema("Aliased required integer", "aliased_integer", "INTEGER", false, true, nil), fieldSchema("Aliased nullable boolean", "aliased_boolean", "BOOLEAN", false, false, nil), diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index 841d44f04fac..1798961dbdd7 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 c352217e9538..b9016f8eb4d3 100644 --- a/bigquery/storage/apiv1alpha2/doc.go +++ b/bigquery/storage/apiv1alpha2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 9146738e38fe..d199f5fe0927 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 6c3a7d267b2c..7bcbee94b5b7 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/value.go b/bigquery/value.go index 361341c2bb82..cae28be0464f 100644 --- a/bigquery/value.go +++ b/bigquery/value.go @@ -407,6 +407,13 @@ func determineSetFunc(ftype reflect.Type, stype FieldType) setFunc { return setNull(v, x, func() interface{} { return x.(*big.Rat) }) } } + + case BigNumericFieldType: + if ftype == typeOfRat { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { return x.(*big.Rat) }) + } + } } return nil } @@ -692,7 +699,7 @@ func structFieldToUploadValue(vfield reflect.Value, schemaField *FieldSchema) (i } func toUploadValue(val interface{}, fs *FieldSchema) interface{} { - if fs.Type == TimeFieldType || fs.Type == DateTimeFieldType || fs.Type == NumericFieldType { + if fs.Type == TimeFieldType || fs.Type == DateTimeFieldType || fs.Type == NumericFieldType || fs.Type == BigNumericFieldType { return toUploadValueReflect(reflect.ValueOf(val), fs) } return val @@ -721,6 +728,13 @@ func toUploadValueReflect(v reflect.Value, fs *FieldSchema) interface{} { return formatUploadValue(v, fs, func(v reflect.Value) string { return NumericString(v.Interface().(*big.Rat)) }) + case BigNumericFieldType: + if r, ok := v.Interface().(*big.Rat); ok && r == nil { + return nil + } + return formatUploadValue(v, fs, func(v reflect.Value) string { + return BigNumericString(v.Interface().(*big.Rat)) + }) default: if !fs.Repeated || v.Len() > 0 { return v.Interface() @@ -786,6 +800,12 @@ const ( // NumericScaleDigits is the maximum number of digits after the decimal point in a NUMERIC value. NumericScaleDigits = 9 + + // BigNumericPrecisionDigits is the maximum number of full digits in a BIGNUMERIC value. + BigNumericPrecisionDigits = 76 + + // BigNumericScaleDigits is the maximum number of full digits in a BIGNUMERIC value. + BigNumericScaleDigits = 38 ) // NumericString returns a string representing a *big.Rat in a format compatible @@ -795,6 +815,12 @@ func NumericString(r *big.Rat) string { return r.FloatString(NumericScaleDigits) } +// BigNumericString returns a string representing a *big.Rat in a format compatible with BigQuery +// SQL. It returns a floating point literal with 38 digits after the decimal point. +func BigNumericString(r *big.Rat) string { + return r.FloatString(BigNumericScaleDigits) +} + // convertRows converts a series of TableRows into a series of Value slices. // schema is used to interpret the data from rows; its length must match the // length of each row. @@ -913,6 +939,12 @@ func convertBasicType(val string, typ FieldType) (Value, error) { return nil, fmt.Errorf("bigquery: invalid NUMERIC value %q", val) } return Value(r), nil + case BigNumericFieldType: + r, ok := (&big.Rat{}).SetString(val) + if !ok { + return nil, fmt.Errorf("bigquery: invalid BIGNUMERIC value %q", val) + } + return Value(r), nil case GeographyFieldType: return val, nil default: diff --git a/bigquery/value_test.go b/bigquery/value_test.go index 1e5bb2d37fcd..4d08336ed020 100644 --- a/bigquery/value_test.go +++ b/bigquery/value_test.go @@ -36,6 +36,7 @@ func TestConvertBasicValues(t *testing.T) { {Type: BooleanFieldType}, {Type: BytesFieldType}, {Type: NumericFieldType}, + {Type: BigNumericFieldType}, {Type: GeographyFieldType}, } row := &bq.TableRow{ @@ -46,6 +47,7 @@ func TestConvertBasicValues(t *testing.T) { {V: "true"}, {V: base64.StdEncoding.EncodeToString([]byte("foo"))}, {V: "123.123456789"}, + {V: "99999999999999999999999999999999999999.99999999999999999999999999999999999999"}, {V: testGeography}, }, } @@ -54,7 +56,9 @@ func TestConvertBasicValues(t *testing.T) { t.Fatalf("error converting: %v", err) } - want := []Value{"a", int64(1), 1.2, true, []byte("foo"), big.NewRat(123123456789, 1e9), testGeography} + bigRatVal := new(big.Rat) + bigRatVal.SetString("99999999999999999999999999999999999999.99999999999999999999999999999999999999") + want := []Value{"a", int64(1), 1.2, true, []byte("foo"), big.NewRat(123123456789, 1e9), bigRatVal, testGeography} if !testutil.Equal(got, want) { t.Errorf("converting basic values: got:\n%v\nwant:\n%v", got, want) } @@ -444,6 +448,7 @@ func TestValuesSaverConvertsToMap(t *testing.T) { {Name: "strField", Type: StringFieldType}, {Name: "dtField", Type: DateTimeFieldType}, {Name: "nField", Type: NumericFieldType}, + {Name: "bigNumField", Type: BigNumericFieldType}, {Name: "geoField", Type: GeographyFieldType}, }, InsertID: "iid", @@ -452,16 +457,18 @@ func TestValuesSaverConvertsToMap(t *testing.T) { Date: civil.Date{Year: 1, Month: 2, Day: 3}, Time: civil.Time{Hour: 4, Minute: 5, Second: 6, Nanosecond: 7000}}, big.NewRat(123456789000, 1e9), + big.NewRat(1, 3), testGeography, }, }, wantInsertID: "iid", wantRow: map[string]Value{ - "intField": 1, - "strField": "a", - "dtField": "0001-02-03 04:05:06.000007", - "nField": "123.456789000", - "geoField": testGeography, + "intField": 1, + "strField": "a", + "dtField": "0001-02-03 04:05:06.000007", + "nField": "123.456789000", + "bigNumField": "0.33333333333333333333333333333333333333", + "geoField": testGeography, }, }, { @@ -603,6 +610,8 @@ func TestStructSaver(t *testing.T) { {Name: "p", Type: IntegerFieldType, Required: false}, {Name: "n", Type: NumericFieldType, Required: false}, {Name: "nr", Type: NumericFieldType, Repeated: true}, + {Name: "bn", Type: BigNumericFieldType, Required: false}, + {Name: "bnr", Type: BigNumericFieldType, Repeated: true}, {Name: "g", Type: GeographyFieldType, Required: false}, {Name: "gr", Type: GeographyFieldType, Repeated: true}, } @@ -619,6 +628,8 @@ func TestStructSaver(t *testing.T) { P NullInt64 N *big.Rat NR []*big.Rat + BN *big.Rat + BNR []*big.Rat G NullGeography GR []string // Repeated Geography } @@ -654,6 +665,8 @@ func TestStructSaver(t *testing.T) { P: NullInt64{Valid: true, Int64: 17}, N: big.NewRat(123456, 1000), NR: []*big.Rat{big.NewRat(3, 1), big.NewRat(56789, 1e5)}, + BN: big.NewRat(1, 3), + BNR: []*big.Rat{big.NewRat(1, 3), big.NewRat(1, 2)}, G: NullGeography{Valid: true, GeographyVal: "POINT(-122.350220 47.649154)"}, GR: []string{"POINT(-122.350220 47.649154)", "POINT(-122.198939 47.669865)"}, } @@ -667,6 +680,8 @@ func TestStructSaver(t *testing.T) { "p": NullInt64{Valid: true, Int64: 17}, "n": "123.456000000", "nr": []string{"3.000000000", "0.567890000"}, + "bn": "0.33333333333333333333333333333333333333", + "bnr": []string{"0.33333333333333333333333333333333333333", "0.50000000000000000000000000000000000000"}, "g": NullGeography{Valid: true, GeographyVal: "POINT(-122.350220 47.649154)"}, "gr": []string{"POINT(-122.350220 47.649154)", "POINT(-122.198939 47.669865)"}, } @@ -729,20 +744,24 @@ func TestStructSaverErrors(t *testing.T) { } } -func TestNumericString(t *testing.T) { +func TestNumericStrings(t *testing.T) { for _, test := range []struct { - in *big.Rat - want string + description string + in *big.Rat + wantNumeric string + wantBigNumeric string }{ - {big.NewRat(2, 3), "0.666666667"}, // round to 9 places - {big.NewRat(1, 2), "0.500000000"}, - {big.NewRat(1, 2*1e8), "0.000000005"}, - {big.NewRat(5, 1e10), "0.000000001"}, // round up the 5 in the 10th decimal place - {big.NewRat(-5, 1e10), "-0.000000001"}, // round half away from zero + {"repeating with rounding", big.NewRat(2, 3), "0.666666667", "0.66666666666666666666666666666666666667"}, + {"all zero padding", big.NewRat(1, 2), "0.500000000", "0.50000000000000000000000000000000000000"}, + {"zero pad with digit", big.NewRat(1, 2*1e8), "0.000000005", "0.00000000500000000000000000000000000000"}, + {"smaller rounding case 1", big.NewRat(5, 1e10), "0.000000001", "0.00000000050000000000000000000000000000"}, + {"smaller rounding case 2", big.NewRat(-5, 1e10), "-0.000000001", "-0.00000000050000000000000000000000000000"}, } { - got := NumericString(test.in) - if got != test.want { - t.Errorf("%v: got %q, want %q", test.in, got, test.want) + if got := NumericString(test.in); got != test.wantNumeric { + t.Errorf("case %q, val %v as numeric: got %q, want %q", test.description, test.in, got, test.wantNumeric) + } + if got := BigNumericString(test.in); got != test.wantBigNumeric { + t.Errorf("case %q, val %v as bignumeric: got %q, want %q", test.description, test.in, got, test.wantBigNumeric) } } } @@ -887,6 +906,7 @@ var ( {Name: "T", Type: TimeFieldType}, {Name: "DT", Type: DateTimeFieldType}, {Name: "N", Type: NumericFieldType}, + {Name: "BN", Type: BigNumericFieldType}, {Name: "G", Type: GeographyFieldType}, {Name: "nested", Type: RecordFieldType, Schema: Schema{ {Name: "nestS", Type: StringFieldType}, @@ -895,16 +915,17 @@ var ( {Name: "t", Type: StringFieldType}, } - testTimestamp = time.Date(2016, 11, 5, 7, 50, 22, 8, time.UTC) - testDate = civil.Date{Year: 2016, Month: 11, Day: 5} - testTime = civil.Time{Hour: 7, Minute: 50, Second: 22, Nanosecond: 8} - testDateTime = civil.DateTime{Date: testDate, Time: testTime} - testNumeric = big.NewRat(123, 456) + testTimestamp = time.Date(2016, 11, 5, 7, 50, 22, 8, time.UTC) + testDate = civil.Date{Year: 2016, Month: 11, Day: 5} + testTime = civil.Time{Hour: 7, Minute: 50, Second: 22, Nanosecond: 8} + testDateTime = civil.DateTime{Date: testDate, Time: testTime} + testNumeric = big.NewRat(123, 456) + testBigNumeric = big.NewRat(456, 789) // testGeography is a WKT string representing a single point. testGeography = "POINT(-122.350220 47.649154)" testValues = []Value{"x", "y", []byte{1, 2, 3}, int64(7), int64(8), 3.14, true, - testTimestamp, testDate, testTime, testDateTime, testNumeric, testGeography, + testTimestamp, testDate, testTime, testDateTime, testNumeric, testBigNumeric, testGeography, []Value{"nested", int64(17)}, "z"} ) @@ -918,6 +939,7 @@ type testStruct1 struct { By []byte F float64 N *big.Rat + BN *big.Rat G string Nested nested Tagged string `bigquery:"t"` @@ -952,6 +974,7 @@ func TestStructLoader(t *testing.T) { S2: "y", By: []byte{1, 2, 3}, N: big.NewRat(123, 456), + BN: big.NewRat(456, 789), G: testGeography, Nested: nested{NestS: "nested", NestI: 17}, Tagged: "z", @@ -1043,18 +1066,19 @@ func TestStructLoaderRepeated(t *testing.T) { } type testStructNullable struct { - String NullString - Bytes []byte - Integer NullInt64 - Float NullFloat64 - Boolean NullBool - Timestamp NullTimestamp - Date NullDate - Time NullTime - DateTime NullDateTime - Numeric *big.Rat - Geography NullGeography - Record *subNullable + String NullString + Bytes []byte + Integer NullInt64 + Float NullFloat64 + Boolean NullBool + Timestamp NullTimestamp + Date NullDate + Time NullTime + DateTime NullDateTime + Numeric *big.Rat + BigNumeric *big.Rat + Geography NullGeography + Record *subNullable } type subNullable struct { @@ -1072,6 +1096,7 @@ var testStructNullableSchema = Schema{ {Name: "Time", Type: TimeFieldType, Required: false}, {Name: "DateTime", Type: DateTimeFieldType, Required: false}, {Name: "Numeric", Type: NumericFieldType, Required: false}, + {Name: "BigNumeric", Type: BigNumericFieldType, Required: false}, {Name: "Geography", Type: GeographyFieldType, Required: false}, {Name: "Record", Type: RecordFieldType, Required: false, Schema: Schema{ {Name: "X", Type: IntegerFieldType, Required: false}, @@ -1088,24 +1113,25 @@ func TestStructLoaderNullable(t *testing.T) { } nonnilVals := []Value{"x", []byte{1, 2, 3}, int64(1), 2.3, true, testTimestamp, testDate, testTime, - testDateTime, big.NewRat(1, 2), testGeography, []Value{int64(4)}} + testDateTime, big.NewRat(1, 2), big.NewRat(3, 4), testGeography, []Value{int64(4)}} // All ts fields are nil. Loading non-nil values will cause them all to // be allocated. mustLoad(t, &ts, testStructNullableSchema, nonnilVals) want = testStructNullable{ - String: NullString{StringVal: "x", Valid: true}, - Bytes: []byte{1, 2, 3}, - Integer: NullInt64{Int64: 1, Valid: true}, - Float: NullFloat64{Float64: 2.3, Valid: true}, - Boolean: NullBool{Bool: true, Valid: true}, - Timestamp: NullTimestamp{Timestamp: testTimestamp, Valid: true}, - Date: NullDate{Date: testDate, Valid: true}, - Time: NullTime{Time: testTime, Valid: true}, - DateTime: NullDateTime{DateTime: testDateTime, Valid: true}, - Numeric: big.NewRat(1, 2), - Geography: NullGeography{GeographyVal: testGeography, Valid: true}, - Record: &subNullable{X: NullInt64{Int64: 4, Valid: true}}, + String: NullString{StringVal: "x", Valid: true}, + Bytes: []byte{1, 2, 3}, + Integer: NullInt64{Int64: 1, Valid: true}, + Float: NullFloat64{Float64: 2.3, Valid: true}, + Boolean: NullBool{Bool: true, Valid: true}, + Timestamp: NullTimestamp{Timestamp: testTimestamp, Valid: true}, + Date: NullDate{Date: testDate, Valid: true}, + Time: NullTime{Time: testTime, Valid: true}, + DateTime: NullDateTime{DateTime: testDateTime, Valid: true}, + Numeric: big.NewRat(1, 2), + BigNumeric: big.NewRat(3, 4), + Geography: NullGeography{GeographyVal: testGeography, Valid: true}, + Record: &subNullable{X: NullInt64{Int64: 4, Valid: true}}, } if diff := testutil.Diff(ts, want); diff != "" { t.Error(diff) @@ -1114,7 +1140,7 @@ func TestStructLoaderNullable(t *testing.T) { // Struct pointers are reused, byte slices are not. want = ts want.Bytes = []byte{17} - vals2 := []Value{nil, []byte{17}, nil, nil, nil, nil, nil, nil, nil, nil, nil, []Value{int64(7)}} + vals2 := []Value{nil, []byte{17}, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, []Value{int64(7)}} mustLoad(t, &ts, testStructNullableSchema, vals2) if ts.Record != want.Record { t.Error("record pointers not identical") diff --git a/bigtable/go.mod b/bigtable/go.mod index c9dd5697393e..9b45af829181 100644 --- a/bigtable/go.mod +++ b/bigtable/go.mod @@ -9,9 +9,9 @@ require ( github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 rsc.io/binaryregexp v0.2.0 ) diff --git a/bigtable/go.sum b/bigtable/go.sum index 6af98194bdd9..8a0c8c5bf2c1 100644 --- a/bigtable/go.sum +++ b/bigtable/go.sum @@ -411,8 +411,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -505,8 +505,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go index b1d0fb357298..cef2010d7905 100644 --- a/billing/apiv1/doc.go +++ b/billing/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 a9494438e2f7..21319c9b8a65 100644 --- a/billing/budgets/apiv1/doc.go +++ b/billing/budgets/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 6d6a4a402a7d..a5d8344f4a7b 100644 --- a/billing/budgets/apiv1beta1/doc.go +++ b/billing/budgets/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 5544d3bdf294..3d8bb7331816 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index 73596fe8a0b1..ccdcf6596329 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ca91a3ba9535..a1a777a48a74 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 79ed38aa6c92..f9fa7fdbd507 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 fddbf232a678..18f094a208ef 100644 --- a/container/apiv1/doc.go +++ b/container/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 fad61b218d25..0935f46cb3f6 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 8b9de2d08bd9..fae3cd44539f 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 e5631ed2e30f..701cb5b00a65 100644 --- a/datacatalog/apiv1beta1/doc.go +++ b/datacatalog/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 9247ce66ab54..b85109a3705c 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 5fb700f25f44..a22989e6b8b2 100644 --- a/dataproc/apiv1beta2/doc.go +++ b/dataproc/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 360f7a21d4b9..4a80e590d022 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 0806fec18758..0b249a985946 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -7,8 +7,8 @@ require ( github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/datastore/go.sum b/datastore/go.sum index 07eac46bbdbe..e1cc2a5f6930 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -404,8 +404,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -497,8 +497,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index 6947235b468a..4caa032af033 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index 4d2c0f6de22a..9908061838d9 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index fd0d3cf75451..c175b1fca0a3 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index 0a6c951c70ef..5c97e61c00db 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 e27a7cd90d76..5cbd2988bdfa 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ea42b0ce27c9..eaa25aeb5aa3 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 835350685d4d..b8209031a9d5 100644 --- a/firestore/apiv1/doc.go +++ b/firestore/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 789ebc17f6d6..179c587d3961 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -7,8 +7,8 @@ require ( github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/firestore/go.sum b/firestore/go.sum index 07aaeacef9c2..fbcb141a65ac 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -406,8 +406,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -469,8 +469,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/firestore/integration_test.go b/firestore/integration_test.go index e0c073f8cbbd..57d5479dc55c 100644 --- a/firestore/integration_test.go +++ b/firestore/integration_test.go @@ -644,28 +644,32 @@ func TestIntegration_QueryDocuments(t *testing.T) { h.mustCreate(doc, map[string]interface{}{"q": i, "x": 1}) wants = append(wants, map[string]interface{}{"q": int64(i)}) } - q := coll.Select("q").OrderBy("q", Asc) + q := coll.Select("q") for i, test := range []struct { - q Query - want []map[string]interface{} + q Query + want []map[string]interface{} + orderBy bool // Some query types do not allow ordering. }{ - {q, wants}, - {q.Where("q", ">", 1), wants[2:]}, - {q.Where("q", "<", 1), wants[:1]}, - {q.Where("q", "==", 1), wants[1:2]}, - {q.Where("q", "!=", 0), wants[1:]}, - {q.Where("q", ">=", 1), wants[1:]}, - {q.Where("q", "<=", 1), wants[:2]}, - {q.Where("q", "in", []int{0, 1}), wants[:2]}, - {q.Where("q", "not-in", []int{0, 1}), wants[2:]}, - {q.WherePath([]string{"q"}, ">", 1), wants[2:]}, - {q.Offset(1).Limit(1), wants[1:2]}, - {q.StartAt(1), wants[1:]}, - {q.StartAfter(1), wants[2:]}, - {q.EndAt(1), wants[:2]}, - {q.EndBefore(1), wants[:1]}, - {q.LimitToLast(2), wants[1:]}, + {q, wants, true}, + {q.Where("q", ">", 1), wants[2:], true}, + {q.Where("q", "<", 1), wants[:1], true}, + {q.Where("q", "==", 1), wants[1:2], false}, + {q.Where("q", "!=", 0), wants[1:], true}, + {q.Where("q", ">=", 1), wants[1:], true}, + {q.Where("q", "<=", 1), wants[:2], true}, + {q.Where("q", "in", []int{0}), wants[:1], false}, + {q.Where("q", "not-in", []int{0, 1}), wants[2:], true}, + {q.WherePath([]string{"q"}, ">", 1), wants[2:], true}, + {q.Offset(1).Limit(1), wants[1:2], true}, + {q.StartAt(1), wants[1:], true}, + {q.StartAfter(1), wants[2:], true}, + {q.EndAt(1), wants[:2], true}, + {q.EndBefore(1), wants[:1], true}, + {q.LimitToLast(2), wants[1:], true}, } { + if test.orderBy { + test.q = test.q.OrderBy("q", Asc) + } gotDocs, err := test.q.Documents(ctx).GetAll() if err != nil { t.Errorf("#%d: %+v: %v", i, test.q, err) diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go index f4aceb6d71b3..3cec40097e89 100644 --- a/functions/apiv1/doc.go +++ b/functions/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 939af3c2eaf5..336e4909c789 100644 --- a/gaming/apiv1/doc.go +++ b/gaming/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ec8ae4c309c9..e5e9a268ebae 100644 --- a/gaming/apiv1beta/doc.go +++ b/gaming/apiv1beta/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/go.mod b/go.mod index 115ea089eb46..b09aedfce201 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( golang.org/x/net v0.0.0-20201110031124-69a78807bb2b golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 golang.org/x/text v0.3.4 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/go.sum b/go.sum index 836f62118720..b75391c1aae5 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,7 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0 h1:a/O/bK/vWrYGOTFtH8di4rBxMZnmkjy+Y5LxpDwo+dA= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= @@ -348,6 +349,7 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuA golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -397,8 +399,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d h1:szSOL78iTCl0LF1AMjhSWJj golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -480,8 +482,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c h1:Lq4llNryJoaVFRm google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 90d56d22ac8c..ad7a3d555ce9 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod index 57bb3237258e..9fae0975721e 100644 --- a/internal/examples/fake/go.mod +++ b/internal/examples/fake/go.mod @@ -7,6 +7,6 @@ require ( github.com/golang/protobuf v1.4.3 // indirect golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.32.0 ) diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum index 3a88d01246a8..1b01e6e8ecbc 100644 --- a/internal/examples/fake/go.sum +++ b/internal/examples/fake/go.sum @@ -353,8 +353,8 @@ google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201002142447-3860012362da h1:DTQYk4u7nICKkkVZsBv0/0po0ChISxAJ5CTAfUhO0PQ= google.golang.org/genproto v0.0.0-20201002142447-3860012362da/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod index a4149ded8551..f88462285500 100644 --- a/internal/examples/mock/go.mod +++ b/internal/examples/mock/go.mod @@ -8,7 +8,7 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.31.1 // indirect google.golang.org/protobuf v1.25.0 // indirect ) diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum index 9ae7d1382a5c..68dc9e9785a9 100644 --- a/internal/examples/mock/go.sum +++ b/internal/examples/mock/go.sum @@ -76,8 +76,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/godocfx/go.mod b/internal/godocfx/go.mod index 1e9cad2a08ab..f2608ad5e038 100644 --- a/internal/godocfx/go.mod +++ b/internal/godocfx/go.mod @@ -8,7 +8,7 @@ require ( cloud.google.com/go/datastore v1.1.0 cloud.google.com/go/storage v1.11.0 github.com/kr/pretty v0.2.1 // indirect - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 gopkg.in/yaml.v2 v2.3.0 ) diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 048ea4e2750b..0ce120316dc9 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -243,8 +243,8 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200827163409-021d7c6f1ec3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -295,8 +295,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc 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-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index 92bc48b967d3..9a2794a36d63 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 166505d33d9a..46a99f53b92d 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 aed5610f028d..9f6e7d00479f 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ef3a80b4f7ed..fdc6627a8e23 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 b2d8dde60300..02cb5da48775 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 10e752237007..1e4911a8924b 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -10,8 +10,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 go.opencensus.io v0.22.5 golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/logging/go.sum b/logging/go.sum index 194d096789b7..648dac0be881 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -414,8 +414,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -477,8 +477,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index ecc548e98b7d..abaffd8cba00 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 a4d97d27a1d1..0751b7b59898 100644 --- a/managedidentities/apiv1/doc.go +++ b/managedidentities/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 6bf32c8a4be6..cd283bc86ffd 100644 --- a/memcache/apiv1beta2/doc.go +++ b/memcache/apiv1beta2/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index 2d07e9b79bd2..cb156836933a 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go index 87008baaffdc..b51a883654e9 100644 --- a/monitoring/dashboard/apiv1/doc.go +++ b/monitoring/dashboard/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 36b342e2aeb1..f3c392f512bd 100644 --- a/notebooks/apiv1beta1/doc.go +++ b/notebooks/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ae4cd6bf9d89..818f1cba7f47 100644 --- a/osconfig/agentendpoint/apiv1/doc.go +++ b/osconfig/agentendpoint/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 b532d640ce6e..fab850808035 100644 --- a/osconfig/agentendpoint/apiv1beta/doc.go +++ b/osconfig/agentendpoint/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 93a61105ce74..dfd69cfe0bb0 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 fa1d3ccfc98f..339f187015dc 100644 --- a/osconfig/apiv1beta/doc.go +++ b/osconfig/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 9bccdd0a3400..7a2eb46c3ad9 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ee3ee0e95674..05383ced7850 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 f116ad9e4b36..0bb81aa7cb99 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 e2cc1a4a088f..9c59e3ef39c0 100644 --- a/policytroubleshooter/apiv1/doc.go +++ b/policytroubleshooter/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 81bf1be3bf4c..ec9df35dac72 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 1c6cbb253704..ff351509cf31 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -11,8 +11,8 @@ require ( golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index 11de52bd0037..e44b4e14b36a 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -347,8 +347,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -410,8 +410,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsub/message.go b/pubsub/message.go index 54be363eefad..c09a7e51c408 100644 --- a/pubsub/message.go +++ b/pubsub/message.go @@ -61,12 +61,6 @@ type Message struct { ackh ackHandler } -// NewMessage creates a message with a custom ack/nack handler, which should not -// be nil. -func NewMessage(ackh ackHandler) *Message { - return &Message{ackh: ackh} -} - func toMessage(resp *pb.ReceivedMessage) (*Message, error) { if resp.Message == nil { return &Message{ackh: &psAckHandler{ackID: resp.AckId}}, nil diff --git a/pubsub/topic.go b/pubsub/topic.go index 1dd50c002912..07e392e08695 100644 --- a/pubsub/topic.go +++ b/pubsub/topic.go @@ -470,13 +470,6 @@ type PublishResult struct { err error } -// NewPublishResult returns the set() function to enable callers from outside -// this package to store and call it (e.g. unit tests). -func NewPublishResult() (*PublishResult, func(string, error)) { - result := &PublishResult{ready: make(chan struct{})} - return result, result.set -} - // Ready returns a channel that is closed when the result is ready. // When the Ready channel is closed, Get is guaranteed not to block. func (r *PublishResult) Ready() <-chan struct{} { return r.ready } diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index 541fdf0bbcc1..e2de6d4317fb 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -44,7 +44,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 32e41180b0bb..09727ba19869 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -7,8 +7,8 @@ require ( github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index b47162093a13..bd119db5e1d8 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -299,8 +299,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -362,8 +362,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/internal/wire/flow_control.go b/pubsublite/internal/wire/flow_control.go index 785cdd097bb5..3ac3a848bd04 100644 --- a/pubsublite/internal/wire/flow_control.go +++ b/pubsublite/internal/wire/flow_control.go @@ -32,7 +32,7 @@ type flowControlTokens struct { Messages int64 } -// A TokenCounter stores the amount of outstanding byte and message flow control +// A tokenCounter stores the amount of outstanding byte and message flow control // tokens that the client believes exists for the stream. type tokenCounter struct { Bytes int64 @@ -81,7 +81,7 @@ func (tc *tokenCounter) ToFlowControlRequest() *pb.FlowControlRequest { // flowControlBatcher tracks flow control tokens and manages batching of flow // control requests to avoid overwhelming the server. It is only accessed by -// the wireSubscriber. +// the subscribeStream. type flowControlBatcher struct { // The current amount of outstanding byte and message flow control tokens. clientTokens tokenCounter @@ -142,7 +142,7 @@ func (fc *flowControlBatcher) ShouldExpediteBatchRequest() bool { } // subscriberOffsetTracker tracks the expected offset of the next message -// received from the server. It is only accessed by the wireSubscriber. +// received from the server. It is only accessed by the subscribeStream. type subscriberOffsetTracker struct { minNextOffset int64 } diff --git a/pubsublite/internal/wire/subscriber.go b/pubsublite/internal/wire/subscriber.go new file mode 100644 index 000000000000..9aee40b07221 --- /dev/null +++ b/pubsublite/internal/wire/subscriber.go @@ -0,0 +1,327 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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 wire + +import ( + "context" + "errors" + "reflect" + "time" + + "google.golang.org/grpc" + + vkit "cloud.google.com/go/pubsublite/apiv1" + pb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" +) + +var ( + errServerNoMessages = errors.New("pubsublite: server delivered no messages") + errInvalidInitialSubscribeResponse = errors.New("pubsublite: first response from server was not an initial response for subscribe") + errInvalidSubscribeResponse = errors.New("pubsublite: received invalid subscribe response from server") + errNoInFlightSeek = errors.New("pubsublite: received seek response for no in-flight seek") +) + +// ReceivedMessage stores a received Pub/Sub message and AckConsumer for +// acknowledging the message. +type ReceivedMessage struct { + Msg *pb.SequencedMessage + Ack AckConsumer +} + +// MessageReceiverFunc receives a batch of Pub/Sub messages from a topic +// partition. +type MessageReceiverFunc func([]*ReceivedMessage) + +// The frequency of sending batch flow control requests. +const batchFlowControlPeriod = 100 * time.Millisecond + +// subscribeStream directly wraps the subscribe client stream. It passes +// messages to the message receiver and manages flow control. Flow control +// tokens are batched and sent to the stream via a periodic background task, +// although it can be expedited if the user is rapidly acking messages. +// +// Client-initiated seek unsupported. +type subscribeStream struct { + // Immutable after creation. + subClient *vkit.SubscriberClient + settings ReceiveSettings + subscription subscriptionPartition + initialReq *pb.SubscribeRequest + receiver MessageReceiverFunc + + // Fields below must be guarded with mutex. + stream *retryableStream + acks *ackTracker + offsetTracker subscriberOffsetTracker + flowControl flowControlBatcher + pollFlowControl *periodicTask + seekInFlight bool + + abstractService +} + +func newSubscribeStream(ctx context.Context, subClient *vkit.SubscriberClient, settings ReceiveSettings, + receiver MessageReceiverFunc, subscription subscriptionPartition, acks *ackTracker, disableTasks bool) *subscribeStream { + + s := &subscribeStream{ + subClient: subClient, + settings: settings, + subscription: subscription, + initialReq: &pb.SubscribeRequest{ + Request: &pb.SubscribeRequest_Initial{ + Initial: &pb.InitialSubscribeRequest{ + Subscription: subscription.Path, + Partition: int64(subscription.Partition), + }, + }, + }, + receiver: receiver, + acks: acks, + } + s.stream = newRetryableStream(ctx, s, settings.Timeout, reflect.TypeOf(pb.SubscribeResponse{})) + + backgroundTask := s.sendBatchFlowControl + if disableTasks { + backgroundTask = func() {} + } + s.pollFlowControl = newPeriodicTask(batchFlowControlPeriod, backgroundTask) + return s +} + +// Start establishes a subscribe stream connection and initializes flow control +// tokens from ReceiveSettings. +func (s *subscribeStream) Start() { + s.mu.Lock() + defer s.mu.Unlock() + + if s.unsafeUpdateStatus(serviceStarting, nil) { + s.stream.Start() + s.pollFlowControl.Start() + + s.flowControl.OnClientFlow(flowControlTokens{ + Bytes: int64(s.settings.MaxOutstandingBytes), + Messages: int64(s.settings.MaxOutstandingMessages), + }) + } +} + +// Stop immediately terminates the subscribe stream. +func (s *subscribeStream) Stop() { + s.mu.Lock() + defer s.mu.Unlock() + s.unsafeInitiateShutdown(serviceTerminating, nil) +} + +func (s *subscribeStream) newStream(ctx context.Context) (grpc.ClientStream, error) { + return s.subClient.Subscribe(addSubscriptionRoutingMetadata(ctx, s.subscription)) +} + +func (s *subscribeStream) initialRequest() (interface{}, bool) { + return s.initialReq, true +} + +func (s *subscribeStream) validateInitialResponse(response interface{}) error { + subscribeResponse, _ := response.(*pb.SubscribeResponse) + if subscribeResponse.GetInitial() == nil { + return errInvalidInitialSubscribeResponse + } + return nil +} + +func (s *subscribeStream) onStreamStatusChange(status streamStatus) { + s.mu.Lock() + defer s.mu.Unlock() + + switch status { + case streamConnected: + s.unsafeUpdateStatus(serviceActive, nil) + + // Reinitialize the offset and flow control tokens when a new subscribe + // stream instance is connected. + if seekReq := s.offsetTracker.RequestForRestart(); seekReq != nil { + // Note: If Send() returns false, the subscriber will either terminate or + // the stream will be reconnected. + if s.stream.Send(&pb.SubscribeRequest{ + Request: &pb.SubscribeRequest_Seek{Seek: seekReq}, + }) { + s.seekInFlight = true + } + } + s.unsafeSendFlowControl(s.flowControl.RequestForRestart()) + s.pollFlowControl.Start() + + case streamReconnecting: + s.seekInFlight = false + s.pollFlowControl.Stop() + + case streamTerminated: + s.unsafeInitiateShutdown(serviceTerminated, s.stream.Error()) + } +} + +func (s *subscribeStream) onResponse(response interface{}) { + var receivedMsgs []*ReceivedMessage + var err error + s.mu.Lock() + + subscribeResponse, _ := response.(*pb.SubscribeResponse) + switch { + case subscribeResponse.GetMessages() != nil: + receivedMsgs, err = s.unsafeOnMessageResponse(subscribeResponse.GetMessages()) + case subscribeResponse.GetSeek() != nil: + err = s.unsafeOnSeekResponse(subscribeResponse.GetSeek()) + default: + err = errInvalidSubscribeResponse + } + + if receivedMsgs != nil { + // Deliver messages without holding the mutex to prevent deadlocks. + s.mu.Unlock() + s.receiver(receivedMsgs) + return + } + if err != nil { + s.unsafeInitiateShutdown(serviceTerminated, err) + } + s.mu.Unlock() +} + +func (s *subscribeStream) unsafeOnSeekResponse(response *pb.SeekResponse) error { + if !s.seekInFlight { + return errNoInFlightSeek + } + s.seekInFlight = false + return nil +} + +func (s *subscribeStream) unsafeOnMessageResponse(response *pb.MessageResponse) ([]*ReceivedMessage, error) { + if len(response.Messages) == 0 { + return nil, errServerNoMessages + } + if err := s.offsetTracker.OnMessages(response.Messages); err != nil { + return nil, err + } + if err := s.flowControl.OnMessages(response.Messages); err != nil { + return nil, err + } + + var receivedMsgs []*ReceivedMessage + for _, msg := range response.Messages { + // Register outstanding acks, which are primarily handled by the + // `committer`. + ack := newAckConsumer(msg.GetCursor().GetOffset(), msg.GetSizeBytes(), s.onAck) + if err := s.acks.Push(ack); err != nil { + return nil, err + } + receivedMsgs = append(receivedMsgs, &ReceivedMessage{Msg: msg, Ack: ack}) + } + return receivedMsgs, nil +} + +func (s *subscribeStream) onAck(ac *ackConsumer) { + // Don't block the user's goroutine with potentially expensive ack processing. + go s.onAckAsync(ac.MsgBytes) +} + +func (s *subscribeStream) onAckAsync(msgBytes int64) { + s.mu.Lock() + defer s.mu.Unlock() + + if s.status == serviceActive { + s.unsafeAllowFlow(flowControlTokens{Bytes: msgBytes, Messages: 1}) + } +} + +// sendBatchFlowControl is called by the periodic background task. +func (s *subscribeStream) sendBatchFlowControl() { + s.mu.Lock() + defer s.mu.Unlock() + s.unsafeSendFlowControl(s.flowControl.ReleasePendingRequest()) +} + +func (s *subscribeStream) unsafeAllowFlow(allow flowControlTokens) { + s.flowControl.OnClientFlow(allow) + if s.flowControl.ShouldExpediteBatchRequest() { + s.unsafeSendFlowControl(s.flowControl.ReleasePendingRequest()) + } +} + +func (s *subscribeStream) unsafeSendFlowControl(req *pb.FlowControlRequest) { + if req == nil { + return + } + + // Note: If Send() returns false, the stream will be reconnected and + // flowControlBatcher.RequestForRestart() will be sent when the stream + // reconnects. So its return value is ignored. + s.stream.Send(&pb.SubscribeRequest{ + Request: &pb.SubscribeRequest_FlowControl{FlowControl: req}, + }) +} + +func (s *subscribeStream) unsafeInitiateShutdown(targetStatus serviceStatus, err error) { + if !s.unsafeUpdateStatus(targetStatus, err) { + return + } + + // No data to send. Immediately terminate the stream. + s.pollFlowControl.Stop() + s.stream.Stop() +} + +// singlePartitionSubscriber receives messages from a single topic partition. +// It requires 2 child services: +// - subscribeStream to receive messages from the subscribe stream. +// - committer to commit cursor offsets to the streaming commit cursor stream. +type singlePartitionSubscriber struct { + compositeService +} + +type singlePartitionSubscriberFactory struct { + ctx context.Context + subClient *vkit.SubscriberClient + cursorClient *vkit.CursorClient + settings ReceiveSettings + subscriptionPath string + receiver MessageReceiverFunc + disableTasks bool +} + +func (f *singlePartitionSubscriberFactory) New(partition int) *singlePartitionSubscriber { + subscription := subscriptionPartition{Path: f.subscriptionPath, Partition: partition} + acks := newAckTracker() + commit := newCommitter(f.ctx, f.cursorClient, f.settings, subscription, acks, f.disableTasks) + sub := newSubscribeStream(f.ctx, f.subClient, f.settings, f.receiver, subscription, acks, f.disableTasks) + ps := new(singlePartitionSubscriber) + ps.init() + ps.unsafeAddServices(sub, commit) + return ps +} + +// multiPartitionSubscriber receives messages from a fixed set of topic +// partitions. +type multiPartitionSubscriber struct { + compositeService +} + +func newMultiPartitionSubscriber(subFactory *singlePartitionSubscriberFactory) *multiPartitionSubscriber { + ms := new(multiPartitionSubscriber) + ms.init() + + for _, partition := range subFactory.settings.Partitions { + subscriber := subFactory.New(partition) + ms.unsafeAddServices(subscriber) + } + return ms +} diff --git a/pubsublite/internal/wire/subscriber_test.go b/pubsublite/internal/wire/subscriber_test.go new file mode 100644 index 000000000000..385c971543dc --- /dev/null +++ b/pubsublite/internal/wire/subscriber_test.go @@ -0,0 +1,595 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// 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 wire + +import ( + "context" + "sort" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/pubsublite/internal/test" + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + pb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" +) + +func testSubscriberSettings() ReceiveSettings { + settings := testReceiveSettings() + settings.MaxOutstandingMessages = 10 + settings.MaxOutstandingBytes = 1000 + return settings +} + +// initFlowControlReq returns the first expected flow control request when +// testSubscriberSettings are used. +func initFlowControlReq() *pb.SubscribeRequest { + return flowControlSubReq(flowControlTokens{Bytes: 1000, Messages: 10}) +} + +type testMessageReceiver struct { + t *testing.T + received chan *ReceivedMessage +} + +func newTestMessageReceiver(t *testing.T) *testMessageReceiver { + return &testMessageReceiver{ + t: t, + received: make(chan *ReceivedMessage, 5), + } +} + +func (tr *testMessageReceiver) onMessages(msgs []*ReceivedMessage) { + for _, msg := range msgs { + tr.received <- msg + } +} + +func (tr *testMessageReceiver) ValidateMsg(want *pb.SequencedMessage) AckConsumer { + select { + case <-time.After(serviceTestWaitTimeout): + tr.t.Errorf("Message (%v) not received within %v", want, serviceTestWaitTimeout) + return nil + case got := <-tr.received: + if !proto.Equal(got.Msg, want) { + tr.t.Errorf("Received message: got (%v), want (%v)", got.Msg, want) + } + return got.Ack + } +} + +type ByMsgOffset []*pb.SequencedMessage + +func (m ByMsgOffset) Len() int { return len(m) } +func (m ByMsgOffset) Swap(i, j int) { m[i], m[j] = m[j], m[i] } +func (m ByMsgOffset) Less(i, j int) bool { + return m[i].GetCursor().GetOffset() < m[j].GetCursor().GetOffset() +} + +func (tr *testMessageReceiver) ValidateMsgs(want []*pb.SequencedMessage) { + var got []*pb.SequencedMessage + for count := 0; count < len(want); count++ { + select { + case <-time.After(serviceTestWaitTimeout): + tr.t.Errorf("Received messages count: got %d, want %d", count, len(want)) + case received := <-tr.received: + received.Ack.Ack() + got = append(got, received.Msg) + } + } + + sort.Sort(ByMsgOffset(want)) + sort.Sort(ByMsgOffset(got)) + if !testutil.Equal(got, want) { + tr.t.Errorf("Received messages: got: %v\nwant: %v", got, want) + } +} + +func (tr *testMessageReceiver) VerifyNoMsgs() { + select { + case got := <-tr.received: + tr.t.Errorf("Got unexpected message: %v", got.Msg) + case <-time.After(20 * time.Millisecond): + // Wait to ensure no messages received. + } +} + +// testSubscribeStream wraps a subscribeStream for ease of testing. +type testSubscribeStream struct { + Receiver *testMessageReceiver + t *testing.T + sub *subscribeStream + serviceTestProxy +} + +func newTestSubscribeStream(t *testing.T, subscription subscriptionPartition, settings ReceiveSettings, acks *ackTracker) *testSubscribeStream { + ctx := context.Background() + subClient, err := newSubscriberClient(ctx, "ignored", testClientOpts...) + if err != nil { + t.Fatal(err) + } + + ts := &testSubscribeStream{ + Receiver: newTestMessageReceiver(t), + t: t, + } + ts.sub = newSubscribeStream(ctx, subClient, settings, ts.Receiver.onMessages, subscription, acks, true) + ts.initAndStart(t, ts.sub, "Subscriber") + return ts +} + +// SendBatchFlowControl invokes the periodic background batch flow control. Note +// that the periodic task is disabled in tests. +func (ts *testSubscribeStream) SendBatchFlowControl() { + ts.sub.sendBatchFlowControl() +} + +func TestSubscribeStreamReconnect(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + msg1 := seqMsgWithOffsetAndSize(67, 200) + msg2 := seqMsgWithOffsetAndSize(68, 100) + permanentErr := status.Error(codes.FailedPrecondition, "permanent failure") + + verifiers := test.NewVerifiers(t) + + stream1 := test.NewRPCVerifier(t) + stream1.Push(initSubReq(subscription), initSubResp(), nil) + stream1.Push(initFlowControlReq(), msgSubResp(msg1), nil) + stream1.Push(nil, nil, status.Error(codes.Unavailable, "server unavailable")) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream1) + + // When reconnected, the subscribeStream should seek to msg2 and have + // subtracted flow control tokens. + stream2 := test.NewRPCVerifier(t) + stream2.Push(initSubReq(subscription), initSubResp(), nil) + stream2.Push(seekReq(68), seekResp(68), nil) + stream2.Push(flowControlSubReq(flowControlTokens{Bytes: 800, Messages: 9}), msgSubResp(msg2), nil) + // Subscriber should terminate on permanent error. + stream2.Push(nil, nil, permanentErr) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream2) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + sub.Receiver.ValidateMsg(msg1) + sub.Receiver.ValidateMsg(msg2) + if gotErr := sub.FinalError(); !test.ErrorEqual(gotErr, permanentErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, permanentErr) + } +} + +func TestSubscribeStreamFlowControlBatching(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + msg1 := seqMsgWithOffsetAndSize(67, 200) + msg2 := seqMsgWithOffsetAndSize(68, 100) + serverErr := status.Error(codes.InvalidArgument, "verifies flow control received") + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), msgSubResp(msg1, msg2), nil) + // Batch flow control request expected. + stream.Push(flowControlSubReq(flowControlTokens{Bytes: 300, Messages: 2}), nil, serverErr) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + sub.Receiver.ValidateMsg(msg1) + sub.Receiver.ValidateMsg(msg2) + sub.sub.onAckAsync(msg1.SizeBytes) + sub.sub.onAckAsync(msg2.SizeBytes) + sub.sub.sendBatchFlowControl() + if gotErr := sub.FinalError(); !test.ErrorEqual(gotErr, serverErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, serverErr) + } +} + +func TestSubscribeStreamExpediteFlowControl(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + msg1 := seqMsgWithOffsetAndSize(67, 250) + // MaxOutstandingBytes = 1000, so msg2 pushes the pending flow control bytes + // over the expediteBatchRequestRatio=50% threshold in flowControlBatcher. + msg2 := seqMsgWithOffsetAndSize(68, 251) + serverErr := status.Error(codes.InvalidArgument, "verifies flow control received") + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), msgSubResp(msg1, msg2), nil) + // Batch flow control request expected. + stream.Push(flowControlSubReq(flowControlTokens{Bytes: 501, Messages: 2}), nil, serverErr) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + sub.Receiver.ValidateMsg(msg1) + sub.Receiver.ValidateMsg(msg2) + sub.sub.onAckAsync(msg1.SizeBytes) + sub.sub.onAckAsync(msg2.SizeBytes) + // Note: the ack for msg2 automatically triggers sending the flow control. + if gotErr := sub.FinalError(); !test.ErrorEqual(gotErr, serverErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, serverErr) + } +} + +func TestSubscribeStreamInvalidInitialResponse(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), seekResp(0), nil) // Seek instead of init response + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr, wantErr := sub.StartError(), errInvalidInitialSubscribeResponse; !test.ErrorEqual(gotErr, wantErr) { + t.Errorf("Start got err: (%v), want: (%v)", gotErr, wantErr) + } +} + +func TestSubscribeStreamDuplicateInitialResponse(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), initSubResp(), nil) // Second initial response + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + if gotErr, wantErr := sub.FinalError(), errInvalidSubscribeResponse; !test.ErrorEqual(gotErr, wantErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr) + } +} + +func TestSubscribeStreamSpuriousSeekResponse(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), seekResp(1), nil) // Seek response with no seek request + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + if gotErr, wantErr := sub.FinalError(), errNoInFlightSeek; !test.ErrorEqual(gotErr, wantErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr) + } +} + +func TestSubscribeStreamNoMessages(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), msgSubResp(), nil) // No messages in response + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + if gotErr, wantErr := sub.FinalError(), errServerNoMessages; !test.ErrorEqual(gotErr, wantErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr) + } +} + +func TestSubscribeStreamMessagesOutOfOrder(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + msg1 := seqMsgWithOffsetAndSize(56, 100) + msg2 := seqMsgWithOffsetAndSize(55, 100) // Offset before msg1 + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), msgSubResp(msg1), nil) + stream.Push(nil, msgSubResp(msg2), nil) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + sub.Receiver.ValidateMsg(msg1) + if gotErr, msg := sub.FinalError(), "start offset = 55, expected >= 57"; !test.ErrorHasMsg(gotErr, msg) { + t.Errorf("Final err: (%v), want msg: %q", gotErr, msg) + } +} + +func TestSubscribeStreamFlowControlOverflow(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + acks := newAckTracker() + msg1 := seqMsgWithOffsetAndSize(56, 900) + msg2 := seqMsgWithOffsetAndSize(57, 101) // Overflows ReceiveSettings.MaxOutstandingBytes = 1000 + + verifiers := test.NewVerifiers(t) + stream := test.NewRPCVerifier(t) + stream.Push(initSubReq(subscription), initSubResp(), nil) + stream.Push(initFlowControlReq(), msgSubResp(msg1), nil) + stream.Push(nil, msgSubResp(msg2), nil) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSubscribeStream(t, subscription, testSubscriberSettings(), acks) + if gotErr := sub.StartError(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + sub.Receiver.ValidateMsg(msg1) + if gotErr, wantErr := sub.FinalError(), errTokenCounterBytesNegative; !test.ErrorEqual(gotErr, wantErr) { + t.Errorf("Final err: (%v), want: (%v)", gotErr, wantErr) + } +} + +func newTestSinglePartitionSubscriber(t *testing.T, receiverFunc MessageReceiverFunc, subscription subscriptionPartition) *singlePartitionSubscriber { + ctx := context.Background() + subClient, err := newSubscriberClient(ctx, "ignored", testClientOpts...) + if err != nil { + t.Fatal(err) + } + cursorClient, err := newCursorClient(ctx, "ignored", testClientOpts...) + if err != nil { + t.Fatal(err) + } + + f := &singlePartitionSubscriberFactory{ + ctx: ctx, + subClient: subClient, + cursorClient: cursorClient, + settings: testSubscriberSettings(), + subscriptionPath: subscription.Path, + receiver: receiverFunc, + disableTasks: true, // Background tasks disabled to control event order + } + sub := f.New(subscription.Partition) + sub.Start() + return sub +} + +func TestSinglePartitionSubscriberStartStop(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + receiver := newTestMessageReceiver(t) + + verifiers := test.NewVerifiers(t) + + // Verifies the behavior of the subscribeStream and committer when they are + // stopped before any messages are received. + subStream := test.NewRPCVerifier(t) + subStream.Push(initSubReq(subscription), initSubResp(), nil) + barrier := subStream.PushWithBarrier(initFlowControlReq(), nil, nil) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, subStream) + + cmtStream := test.NewRPCVerifier(t) + cmtStream.Push(initCommitReq(subscription), initCommitResp(), nil) + verifiers.AddCommitStream(subscription.Path, subscription.Partition, cmtStream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSinglePartitionSubscriber(t, receiver.onMessages, subscription) + if gotErr := sub.WaitStarted(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + barrier.Release() // To ensure the test is deterministic (i.e. flow control req always received) + sub.Stop() + if gotErr := sub.WaitStopped(); gotErr != nil { + t.Errorf("Stop() got err: (%v)", gotErr) + } +} + +func TestSinglePartitionSubscriberSimpleMsgAck(t *testing.T) { + subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} + receiver := newTestMessageReceiver(t) + msg1 := seqMsgWithOffsetAndSize(22, 100) + msg2 := seqMsgWithOffsetAndSize(23, 200) + + verifiers := test.NewVerifiers(t) + + subStream := test.NewRPCVerifier(t) + subStream.Push(initSubReq(subscription), initSubResp(), nil) + subStream.Push(initFlowControlReq(), msgSubResp(msg1, msg2), nil) + verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, subStream) + + cmtStream := test.NewRPCVerifier(t) + cmtStream.Push(initCommitReq(subscription), initCommitResp(), nil) + cmtStream.Push(commitReq(24), commitResp(1), nil) + verifiers.AddCommitStream(subscription.Path, subscription.Partition, cmtStream) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestSinglePartitionSubscriber(t, receiver.onMessages, subscription) + if gotErr := sub.WaitStarted(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + receiver.ValidateMsg(msg1).Ack() + receiver.ValidateMsg(msg2).Ack() + sub.Stop() + if gotErr := sub.WaitStopped(); gotErr != nil { + t.Errorf("Stop() got err: (%v)", gotErr) + } +} + +func newTestMultiPartitionSubscriber(t *testing.T, receiverFunc MessageReceiverFunc, subscriptionPath string, partitions []int) *multiPartitionSubscriber { + ctx := context.Background() + subClient, err := newSubscriberClient(ctx, "ignored", testClientOpts...) + if err != nil { + t.Fatal(err) + } + cursorClient, err := newCursorClient(ctx, "ignored", testClientOpts...) + if err != nil { + t.Fatal(err) + } + + f := &singlePartitionSubscriberFactory{ + ctx: ctx, + subClient: subClient, + cursorClient: cursorClient, + settings: testSubscriberSettings(), + subscriptionPath: subscriptionPath, + receiver: receiverFunc, + disableTasks: true, // Background tasks disabled to control event order + } + f.settings.Partitions = partitions + sub := newMultiPartitionSubscriber(f) + sub.Start() + return sub +} + +func TestMultiPartitionSubscriberMultipleMessages(t *testing.T) { + subscription := "projects/123456/locations/us-central1-b/subscriptions/my-sub" + receiver := newTestMessageReceiver(t) + msg1 := seqMsgWithOffsetAndSize(22, 100) + msg2 := seqMsgWithOffsetAndSize(23, 200) + msg3 := seqMsgWithOffsetAndSize(44, 100) + msg4 := seqMsgWithOffsetAndSize(45, 200) + + verifiers := test.NewVerifiers(t) + + // Partition 1 + subStream1 := test.NewRPCVerifier(t) + subStream1.Push(initSubReq(subscriptionPartition{Path: subscription, Partition: 1}), initSubResp(), nil) + subStream1.Push(initFlowControlReq(), msgSubResp(msg1), nil) + subStream1.Push(nil, msgSubResp(msg2), nil) + verifiers.AddSubscribeStream(subscription, 1, subStream1) + + cmtStream1 := test.NewRPCVerifier(t) + cmtStream1.Push(initCommitReq(subscriptionPartition{Path: subscription, Partition: 1}), initCommitResp(), nil) + cmtStream1.Push(commitReq(24), commitResp(1), nil) + verifiers.AddCommitStream(subscription, 1, cmtStream1) + + // Partition 2 + subStream2 := test.NewRPCVerifier(t) + subStream2.Push(initSubReq(subscriptionPartition{Path: subscription, Partition: 2}), initSubResp(), nil) + subStream2.Push(initFlowControlReq(), msgSubResp(msg3), nil) + subStream2.Push(nil, msgSubResp(msg4), nil) + verifiers.AddSubscribeStream(subscription, 2, subStream2) + + cmtStream2 := test.NewRPCVerifier(t) + cmtStream2.Push(initCommitReq(subscriptionPartition{Path: subscription, Partition: 2}), initCommitResp(), nil) + cmtStream2.Push(commitReq(46), commitResp(1), nil) + verifiers.AddCommitStream(subscription, 2, cmtStream2) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestMultiPartitionSubscriber(t, receiver.onMessages, subscription, []int{1, 2}) + if gotErr := sub.WaitStarted(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + receiver.ValidateMsgs([]*pb.SequencedMessage{msg1, msg2, msg3, msg4}) + sub.Stop() + if gotErr := sub.WaitStopped(); gotErr != nil { + t.Errorf("Stop() got err: (%v)", gotErr) + } +} + +func TestMultiPartitionSubscriberPermanentError(t *testing.T) { + subscription := "projects/123456/locations/us-central1-b/subscriptions/my-sub" + receiver := newTestMessageReceiver(t) + msg1 := seqMsgWithOffsetAndSize(22, 100) + msg2 := seqMsgWithOffsetAndSize(23, 200) + msg3 := seqMsgWithOffsetAndSize(44, 100) + serverErr := status.Error(codes.FailedPrecondition, "failed") + + verifiers := test.NewVerifiers(t) + + // Partition 1 + subStream1 := test.NewRPCVerifier(t) + subStream1.Push(initSubReq(subscriptionPartition{Path: subscription, Partition: 1}), initSubResp(), nil) + subStream1.Push(initFlowControlReq(), msgSubResp(msg1), nil) + msg2Barrier := subStream1.PushWithBarrier(nil, msgSubResp(msg2), nil) + verifiers.AddSubscribeStream(subscription, 1, subStream1) + + cmtStream1 := test.NewRPCVerifier(t) + cmtStream1.Push(initCommitReq(subscriptionPartition{Path: subscription, Partition: 1}), initCommitResp(), nil) + cmtStream1.Push(commitReq(23), commitResp(1), nil) + verifiers.AddCommitStream(subscription, 1, cmtStream1) + + // Partition 2 + subStream2 := test.NewRPCVerifier(t) + subStream2.Push(initSubReq(subscriptionPartition{Path: subscription, Partition: 2}), initSubResp(), nil) + subStream2.Push(initFlowControlReq(), msgSubResp(msg3), nil) + errorBarrier := subStream2.PushWithBarrier(nil, nil, serverErr) + verifiers.AddSubscribeStream(subscription, 2, subStream2) + + cmtStream2 := test.NewRPCVerifier(t) + cmtStream2.Push(initCommitReq(subscriptionPartition{Path: subscription, Partition: 2}), initCommitResp(), nil) + cmtStream2.Push(commitReq(45), commitResp(1), nil) + verifiers.AddCommitStream(subscription, 2, cmtStream2) + + mockServer.OnTestStart(verifiers) + defer mockServer.OnTestEnd() + + sub := newTestMultiPartitionSubscriber(t, receiver.onMessages, subscription, []int{1, 2}) + if gotErr := sub.WaitStarted(); gotErr != nil { + t.Errorf("Start() got err: (%v)", gotErr) + } + receiver.ValidateMsgs([]*pb.SequencedMessage{msg1, msg3}) + errorBarrier.Release() // Send server error + if gotErr := sub.WaitStopped(); !test.ErrorEqual(gotErr, serverErr) { + t.Errorf("Final error got: (%v), want: (%v)", gotErr, serverErr) + } + + // Verify msg2 never received as subscriber has terminated. + msg2Barrier.Release() + receiver.VerifyNoMsgs() +} diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go index 04e68a6cd864..d4c84e3efabc 100644 --- a/recaptchaenterprise/apiv1/doc.go +++ b/recaptchaenterprise/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 09b0b891b904..f90d75ea3640 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 4ec48c434e07..010352c6b3de 100644 --- a/recommender/apiv1/doc.go +++ b/recommender/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 98d11840ab3b..ee02a8e8bd62 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 c04e6209c063..e81c7d368247 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 0f8e101495a2..c45aac4646c2 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 8661ef974fb4..c7ad6812ef70 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 76cdf07ab40e..bce63631a4d2 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 f7448c1d9710..6188408b2721 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 793621e6cf1e..f23c361b6d37 100644 --- a/secretmanager/apiv1beta1/doc.go +++ b/secretmanager/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 11ab7aa925c1..cf4a311347a7 100644 --- a/security/privateca/apiv1beta1/doc.go +++ b/security/privateca/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 afda5d181390..d6008b703329 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 a83049384f36..33431ee335cd 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 0ddacd6806b4..cab13d5b919d 100644 --- a/securitycenter/apiv1p1beta1/doc.go +++ b/securitycenter/apiv1p1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 990c3535143b..a7211690dc05 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 02966b02635c..3c588b84a526 100644 --- a/servicedirectory/apiv1beta1/doc.go +++ b/servicedirectory/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index 4c207c83fc4f..47535dfd8630 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 b0b242e6e6a6..938d22b8f47f 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 8928c787d4a2..c8e4c493ee11 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 f8af1964e8b3..7400a6c4c2eb 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -8,10 +8,10 @@ require ( github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 go.opencensus.io v0.22.5 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 google.golang.org/protobuf v1.25.0 ) diff --git a/spanner/go.sum b/spanner/go.sum index d70b8fed5953..2145815350e3 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -404,8 +404,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -467,8 +467,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/spanner/session_test.go b/spanner/session_test.go index b868ee839ced..4f4fdfc1a1ea 100644 --- a/spanner/session_test.go +++ b/spanner/session_test.go @@ -1557,7 +1557,7 @@ func TestMaintainer(t *testing.T) { waitFor(t, func() error { sp.mu.Lock() defer sp.mu.Unlock() - if sp.numOpened != 5 { + if sp.numOpened != minOpened { return fmt.Errorf("Replenish. Expect %d open, got %d", sp.MinOpened, sp.numOpened) } return nil @@ -1574,12 +1574,22 @@ func TestMaintainer(t *testing.T) { t.Fatalf("cannot get session from session pool: %v", err) } } - sp.mu.Lock() - g, w := sp.numOpened, sp.MinOpened+sp.incStep - sp.mu.Unlock() - if g != w { - t.Fatalf("numOpened sessions mismatch\nGot: %d\nWant: %d", g, w) - } + // Wait for all sessions to be added to the pool. + // The pool already contained 5 sessions (MinOpened=5). + // The test took 20 sessions from the pool. That initiated the creation of + // additional sessions, and that is done in batches of 25 sessions, so the + // pool should contain 30 sessions (with 20 currently checked out). It + // could take a couple of milliseconds before all sessions have been + // created and added to the pool. + waitFor(t, func() error { + sp.mu.Lock() + defer sp.mu.Unlock() + g, w := sp.numOpened, sp.MinOpened+sp.incStep + if g != w { + return fmt.Errorf("numOpened sessions mismatch\nGot: %d\nWant: %d", g, w) + } + return nil + }) // Return 14 sessions to the pool. There are still 6 sessions checked out. for _, sh := range shs[:14] { diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index 5cec10edacaa..a3a34630a6e7 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 6b01a9858865..ab8a699200e9 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 a8e657854a7e..38d4ac7af9ba 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -8,8 +8,8 @@ require ( github.com/google/go-cmp v0.5.3 github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 - golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect + golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 // indirect google.golang.org/api v0.35.0 - google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.2 ) diff --git a/storage/go.sum b/storage/go.sum index e6bfe9c50b41..910735e66d89 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -391,8 +391,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg= -golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0 h1:26vapYZ9m+DJd68m3DCFP/swNNErXAU7tOMFG7NyUuM= +golang.org/x/tools v0.0.0-20201119132711-4783bc9bebf0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -454,8 +454,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1 h1:EVow1AaDgdoMjdO64/fntn4+RGTVor8YE/mkmIYsqFM= -google.golang.org/genproto v0.0.0-20201117123952-62d171c70ae1/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go index 7967343bbd0f..2e5998670228 100644 --- a/talent/apiv4/doc.go +++ b/talent/apiv4/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 22f0a71fbb30..9f6b39c1acb1 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 75beaaecd420..e1f085189d1e 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 d516a894d0bb..87e02392c93b 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 d604b8d2b84d..eefc9d3f5c17 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 e492bb30719a..92137268e2e7 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 5206a8e00b5f..f1e78ee1aed1 100644 --- a/video/transcoder/apiv1beta1/doc.go +++ b/video/transcoder/apiv1beta1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 2bab2f8b5f53..879209d1626c 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 c497793b6a37..57ccbc3cc184 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 eb27b71b4b04..333f078ab3f0 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 4c3115c4a356..9e24fb818944 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 1e796e3a6a40..13fb565a8fde 100644 --- a/webrisk/apiv1/doc.go +++ b/webrisk/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ecb2b4212905..95103a359734 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 ff11e71bb313..f8e51a9dd897 100644 --- a/websecurityscanner/apiv1/doc.go +++ b/websecurityscanner/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 8baac774c688..0413da6c4ef0 100644 --- a/workflows/apiv1beta/doc.go +++ b/workflows/apiv1beta/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" 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 59930cb804c0..37cd8798f845 100644 --- a/workflows/executions/apiv1beta/doc.go +++ b/workflows/executions/apiv1beta/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20201117" +const versionClient = "20201119" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)