diff --git a/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json b/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json index df5eecb..31e8938 100644 --- a/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json +++ b/samples/generated/v1/snippet_metadata.google.storagetransfer.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -102,7 +102,7 @@ "segments": [ { "start": 25, - "end": 83, + "end": 86, "type": "FULL" } ], @@ -154,7 +154,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 70, + "end": 73, "type": "FULL" } ], @@ -246,7 +246,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -286,7 +286,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -326,7 +326,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -370,7 +370,7 @@ "segments": [ { "start": 25, - "end": 70, + "end": 73, "type": "FULL" } ], @@ -418,7 +418,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -462,7 +462,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -502,7 +502,7 @@ "segments": [ { "start": 25, - "end": 69, + "end": 72, "type": "FULL" } ], @@ -554,7 +554,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], diff --git a/samples/generated/v1/storage_transfer_service.create_agent_pool.js b/samples/generated/v1/storage_transfer_service.create_agent_pool.js index b8ab5e8..ed5464a 100644 --- a/samples/generated/v1/storage_transfer_service.create_agent_pool.js +++ b/samples/generated/v1/storage_transfer_service.create_agent_pool.js @@ -23,6 +23,9 @@ function main(projectId, agentPool, agentPoolId) { // [START storagetransfer_v1_generated_StorageTransferService_CreateAgentPool_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.create_transfer_job.js b/samples/generated/v1/storage_transfer_service.create_transfer_job.js index 60f7402..5daf776 100644 --- a/samples/generated/v1/storage_transfer_service.create_transfer_job.js +++ b/samples/generated/v1/storage_transfer_service.create_transfer_job.js @@ -23,6 +23,9 @@ function main(transferJob) { // [START storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.delete_agent_pool.js b/samples/generated/v1/storage_transfer_service.delete_agent_pool.js index 2435903..fe2d324 100644 --- a/samples/generated/v1/storage_transfer_service.delete_agent_pool.js +++ b/samples/generated/v1/storage_transfer_service.delete_agent_pool.js @@ -23,6 +23,9 @@ function main(name) { // [START storagetransfer_v1_generated_StorageTransferService_DeleteAgentPool_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.get_agent_pool.js b/samples/generated/v1/storage_transfer_service.get_agent_pool.js index fa2a1ef..4b30734 100644 --- a/samples/generated/v1/storage_transfer_service.get_agent_pool.js +++ b/samples/generated/v1/storage_transfer_service.get_agent_pool.js @@ -23,6 +23,9 @@ function main(name) { // [START storagetransfer_v1_generated_StorageTransferService_GetAgentPool_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.get_google_service_account.js b/samples/generated/v1/storage_transfer_service.get_google_service_account.js index 7c588b9..1b8411e 100644 --- a/samples/generated/v1/storage_transfer_service.get_google_service_account.js +++ b/samples/generated/v1/storage_transfer_service.get_google_service_account.js @@ -23,6 +23,9 @@ function main(projectId) { // [START storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.get_transfer_job.js b/samples/generated/v1/storage_transfer_service.get_transfer_job.js index 46ff036..c7cbd13 100644 --- a/samples/generated/v1/storage_transfer_service.get_transfer_job.js +++ b/samples/generated/v1/storage_transfer_service.get_transfer_job.js @@ -23,6 +23,9 @@ function main(jobName, projectId) { // [START storagetransfer_v1_generated_StorageTransferService_GetTransferJob_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.list_agent_pools.js b/samples/generated/v1/storage_transfer_service.list_agent_pools.js index 2fadae1..636a133 100644 --- a/samples/generated/v1/storage_transfer_service.list_agent_pools.js +++ b/samples/generated/v1/storage_transfer_service.list_agent_pools.js @@ -23,6 +23,9 @@ function main(projectId) { // [START storagetransfer_v1_generated_StorageTransferService_ListAgentPools_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js b/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js index 09b0a5a..fa1d170 100644 --- a/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js +++ b/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js @@ -23,6 +23,9 @@ function main(filter) { // [START storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js b/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js index 8c92715..9a11fd3 100644 --- a/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js +++ b/samples/generated/v1/storage_transfer_service.pause_transfer_operation.js @@ -23,6 +23,9 @@ function main(name) { // [START storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js b/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js index 826857f..565ac82 100644 --- a/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js +++ b/samples/generated/v1/storage_transfer_service.resume_transfer_operation.js @@ -23,6 +23,9 @@ function main(name) { // [START storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.run_transfer_job.js b/samples/generated/v1/storage_transfer_service.run_transfer_job.js index ef1e7da..ce83387 100644 --- a/samples/generated/v1/storage_transfer_service.run_transfer_job.js +++ b/samples/generated/v1/storage_transfer_service.run_transfer_job.js @@ -23,6 +23,9 @@ function main(jobName, projectId) { // [START storagetransfer_v1_generated_StorageTransferService_RunTransferJob_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.update_agent_pool.js b/samples/generated/v1/storage_transfer_service.update_agent_pool.js index 5b9d842..b2cf855 100644 --- a/samples/generated/v1/storage_transfer_service.update_agent_pool.js +++ b/samples/generated/v1/storage_transfer_service.update_agent_pool.js @@ -23,6 +23,9 @@ function main(agentPool) { // [START storagetransfer_v1_generated_StorageTransferService_UpdateAgentPool_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/samples/generated/v1/storage_transfer_service.update_transfer_job.js b/samples/generated/v1/storage_transfer_service.update_transfer_job.js index 161e303..2ae0d93 100644 --- a/samples/generated/v1/storage_transfer_service.update_transfer_job.js +++ b/samples/generated/v1/storage_transfer_service.update_transfer_job.js @@ -23,6 +23,9 @@ function main(jobName, projectId, transferJob) { // [START storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/src/v1/storage_transfer_service_client.ts b/src/v1/storage_transfer_service_client.ts index 3248286..c32b4f8 100644 --- a/src/v1/storage_transfer_service_client.ts +++ b/src/v1/storage_transfer_service_client.ts @@ -30,7 +30,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -321,7 +320,8 @@ export class StorageTransferServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1527,7 +1527,7 @@ export class StorageTransferServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.runTransferJob, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1685,7 +1685,7 @@ export class StorageTransferServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listTransferJobs.createStream( - this.innerApiCalls.listTransferJobs as gax.GaxCall, + this.innerApiCalls.listTransferJobs as GaxCall, request, callSettings ); @@ -1740,7 +1740,7 @@ export class StorageTransferServiceClient { this.initialize(); return this.descriptors.page.listTransferJobs.asyncIterate( this.innerApiCalls['listTransferJobs'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -1899,7 +1899,7 @@ export class StorageTransferServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAgentPools.createStream( - this.innerApiCalls.listAgentPools as gax.GaxCall, + this.innerApiCalls.listAgentPools as GaxCall, request, callSettings ); @@ -1956,7 +1956,7 @@ export class StorageTransferServiceClient { this.initialize(); return this.descriptors.page.listAgentPools.asyncIterate( this.innerApiCalls['listAgentPools'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/test/gapic_storage_transfer_service_v1.ts b/test/gapic_storage_transfer_service_v1.ts index 99d5cd7..433e373 100644 --- a/test/gapic_storage_transfer_service_v1.ts +++ b/test/gapic_storage_transfer_service_v1.ts @@ -145,109 +145,113 @@ function stubAsyncIterationCall( } describe('v1.StorageTransferServiceClient', () => { - it('has servicePath', () => { - const servicePath = - storagetransferserviceModule.v1.StorageTransferServiceClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + storagetransferserviceModule.v1.StorageTransferServiceClient + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - storagetransferserviceModule.v1.StorageTransferServiceClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + storagetransferserviceModule.v1.StorageTransferServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - storagetransferserviceModule.v1.StorageTransferServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + storagetransferserviceModule.v1.StorageTransferServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.storageTransferServiceStub, undefined); - await client.initialize(); - assert(client.storageTransferServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.storageTransferServiceStub, undefined); + await client.initialize(); + assert(client.storageTransferServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.storageTransferServiceStub); + client.close().then(() => { + done(); }); - client.initialize(); - assert(client.storageTransferServiceStub); - client.close().then(() => { - done(); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.storageTransferServiceStub, undefined); + client.close().then(() => { + done(); }); - assert.strictEqual(client.storageTransferServiceStub, undefined); - client.close().then(() => { - done(); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new storagetransferserviceModule.v1.StorageTransferServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new storagetransferserviceModule.v1.StorageTransferServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getGoogleServiceAccount', () => {