From ba6c1902ba5ce19df651ed49d1d9a911c598fe5d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 31 May 2022 22:14:11 +0000 Subject: [PATCH] fix: fixes for dynamic routing and streaming descriptors (#947) - [ ] Regenerate this pull request now. Use gapic-generator-typescript v2.14.5. PiperOrigin-RevId: 450616838 Source-Link: https://github.com/googleapis/googleapis/commit/7a47b72791e0b84d78beca4c2b26bec42ce31572 Source-Link: https://github.com/googleapis/googleapis-gen/commit/42cc6331bae0b99f61b8e01ae15b05211716c4f9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDJjYzYzMzFiYWUwYjk5ZjYxYjhlMDFhZTE1YjA1MjExNzE2YzRmOSJ9 docs: Document encoding of non-UTF-8 key strings in the Cloud Datastore API PiperOrigin-RevId: 450535507 Source-Link: https://github.com/googleapis/googleapis/commit/2f003c03e819c5faa3018c3e0e964e9aeef9c833 Source-Link: https://github.com/googleapis/googleapis-gen/commit/7d78e9ed96dbea6bf5e0179c0ee16561007616ac Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2Q3OGU5ZWQ5NmRiZWE2YmY1ZTAxNzljMGVlMTY1NjEwMDc2MTZhYyJ9 --- protos/google/datastore/v1/entity.proto | 11 +++++++++++ src/v1/datastore_admin_client.ts | 2 ++ test/gapic_datastore_admin_v1.ts | 22 +++++++++++++++------- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/protos/google/datastore/v1/entity.proto b/protos/google/datastore/v1/entity.proto index befbcd7b6..55d7b64fe 100644 --- a/protos/google/datastore/v1/entity.proto +++ b/protos/google/datastore/v1/entity.proto @@ -66,22 +66,33 @@ message Key { // If neither is set, the element is incomplete. message PathElement { // The kind of the entity. + // // A kind matching regex `__.*__` is reserved/read-only. // A kind must not contain more than 1500 bytes when UTF-8 encoded. // Cannot be `""`. + // + // Must be valid UTF-8 bytes. Legacy values that are not valid UTF-8 are + // encoded as `__bytes__` where `` is the base-64 encoding of the + // bytes. string kind = 1; // The type of ID. oneof id_type { // The auto-allocated ID of the entity. + // // Never equal to zero. Values less than zero are discouraged and may not // be supported in the future. int64 id = 2; // The name of the entity. + // // A name matching regex `__.*__` is reserved/read-only. // A name must not be more than 1500 bytes when UTF-8 encoded. // Cannot be `""`. + // + // Must be valid UTF-8 bytes. Legacy values that are not valid UTF-8 are + // encoded as `__bytes__` where `` is the base-64 encoding of the + // bytes. string name = 3; } } diff --git a/src/v1/datastore_admin_client.ts b/src/v1/datastore_admin_client.ts index 3b2d07357..a636e5f57 100644 --- a/src/v1/datastore_admin_client.ts +++ b/src/v1/datastore_admin_client.ts @@ -517,6 +517,7 @@ export class DatastoreAdminClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + index_id: request.indexId || '', }); this.initialize(); return this.innerApiCalls.getIndex(request, options, callback); @@ -1114,6 +1115,7 @@ export class DatastoreAdminClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + index_id: request.indexId || '', }); this.initialize(); return this.innerApiCalls.deleteIndex(request, options, callback); diff --git a/test/gapic_datastore_admin_v1.ts b/test/gapic_datastore_admin_v1.ts index ae17a3512..122789d41 100644 --- a/test/gapic_datastore_admin_v1.ts +++ b/test/gapic_datastore_admin_v1.ts @@ -253,7 +253,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.GetIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: { @@ -284,7 +285,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.GetIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: { @@ -331,7 +333,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.GetIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: { @@ -359,6 +362,7 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.GetIndexRequest() ); request.projectId = ''; + request.indexId = ''; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getIndex(request), expectedError); @@ -954,7 +958,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.DeleteIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: { @@ -986,7 +991,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.DeleteIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: { @@ -1040,7 +1046,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.DeleteIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: { @@ -1071,7 +1078,8 @@ describe('v1.DatastoreAdminClient', () => { new protos.google.datastore.admin.v1.DeleteIndexRequest() ); request.projectId = ''; - const expectedHeaderRequestParams = 'project_id='; + request.indexId = ''; + const expectedHeaderRequestParams = 'project_id=&index_id='; const expectedOptions = { otherArgs: { headers: {