diff --git a/packages/google-cloud-scheduler/src/v1/cloud_scheduler_client.ts b/packages/google-cloud-scheduler/src/v1/cloud_scheduler_client.ts index 0091e655c82..c300ed9a0ee 100644 --- a/packages/google-cloud-scheduler/src/v1/cloud_scheduler_client.ts +++ b/packages/google-cloud-scheduler/src/v1/cloud_scheduler_client.ts @@ -45,8 +45,13 @@ export class CloudSchedulerClient { private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - cloudSchedulerStub: Promise<{[name: string]: Function}>; + cloudSchedulerStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudSchedulerClient. @@ -70,8 +75,6 @@ export class CloudSchedulerClient { * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. */ @@ -101,25 +104,28 @@ export class CloudSchedulerClient { // If we are in browser, we are already using fallback because of the // "browser" field in package.json. // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = (this.constructor as typeof CloudSchedulerClient).scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth as gax.GoogleAuth; + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { - clientHeader.push(`gl-web/${gaxModule.version}`); + clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); @@ -135,7 +141,7 @@ export class CloudSchedulerClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -143,20 +149,22 @@ export class CloudSchedulerClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - jobPathTemplate: new gaxModule.PathTemplate( + jobPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/jobs/{job}' ), - locationPathTemplate: new gaxModule.PathTemplate( + locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), - projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), }; // Some of the methods on this service return "paged" results, // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listJobs: new gaxModule.PageDescriptor( + listJobs: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'jobs' @@ -164,7 +172,7 @@ export class CloudSchedulerClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.scheduler.v1.CloudScheduler', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -175,17 +183,35 @@ export class CloudSchedulerClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this._innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudSchedulerStub) { + return this.cloudSchedulerStub; + } // Put together the "service stub" for // google.cloud.scheduler.v1.CloudScheduler. - this.cloudSchedulerStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudSchedulerStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.scheduler.v1.CloudScheduler' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.scheduler.v1.CloudScheduler, - opts + (this._protos as any).google.cloud.scheduler.v1.CloudScheduler, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -214,9 +240,9 @@ export class CloudSchedulerClient { } ); - const apiCall = gaxModule.createApiCall( + const apiCall = this._gaxModule.createApiCall( innerCallPromise, - defaults[methodName], + this._defaults[methodName], this._descriptors.page[methodName] || this._descriptors.stream[methodName] || this._descriptors.longrunning[methodName] @@ -230,6 +256,8 @@ export class CloudSchedulerClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudSchedulerStub; } /** @@ -352,6 +380,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getJob(request, options, callback); } createJob( @@ -383,10 +412,10 @@ export class CloudSchedulerClient { * `projects/PROJECT_ID/locations/LOCATION_ID`. * @param {google.cloud.scheduler.v1.Job} request.job * Required. The job to add. The user can optionally specify a name for the - * job in [name][google.cloud.scheduler.v1.Job.name]. [name][google.cloud.scheduler.v1.Job.name] cannot be the same as an + * job in {@link google.cloud.scheduler.v1.Job.name|name}. {@link google.cloud.scheduler.v1.Job.name|name} cannot be the same as an * existing job. If a name is not specified then the system will * generate a random unique name that will be returned - * ([name][google.cloud.scheduler.v1.Job.name]) in the response. + * ({@link google.cloud.scheduler.v1.Job.name|name}) in the response. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -430,6 +459,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createJob(request, options, callback); } updateJob( @@ -454,18 +484,18 @@ export class CloudSchedulerClient { /** * Updates a job. * - * If successful, the updated [Job][google.cloud.scheduler.v1.Job] is returned. If the job does + * If successful, the updated {@link google.cloud.scheduler.v1.Job|Job} is returned. If the job does * not exist, `NOT_FOUND` is returned. * * If UpdateJob does not successfully return, it is possible for the - * job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1.Job.State.UPDATE_FAILED] state. A job in this state may + * job to be in an {@link google.cloud.scheduler.v1.Job.State.UPDATE_FAILED|Job.State.UPDATE_FAILED} state. A job in this state may * not be executed. If this happens, retry the UpdateJob request * until a successful response is received. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.scheduler.v1.Job} request.job - * Required. The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be specified. + * Required. The new job properties. {@link google.cloud.scheduler.v1.Job.name|name} must be specified. * * Output only fields cannot be modified using UpdateJob. * Any value specified for an output only field will be ignored. @@ -514,6 +544,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ 'job.name': request.job!.name || '', }); + this.initialize(); return this._innerApiCalls.updateJob(request, options, callback); } deleteJob( @@ -586,6 +617,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteJob(request, options, callback); } pauseJob( @@ -611,9 +643,9 @@ export class CloudSchedulerClient { * Pauses a job. * * If a job is paused then the system will stop executing the job - * until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob]. The - * state of the job is stored in [state][google.cloud.scheduler.v1.Job.state]; if paused it - * will be set to [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] + * until it is re-enabled via {@link google.cloud.scheduler.v1.CloudScheduler.ResumeJob|ResumeJob}. The + * state of the job is stored in {@link google.cloud.scheduler.v1.Job.state|state}; if paused it + * will be set to {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED}. A job must be in {@link google.cloud.scheduler.v1.Job.State.ENABLED|Job.State.ENABLED} * to be paused. * * @param {Object} request @@ -664,6 +696,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.pauseJob(request, options, callback); } resumeJob( @@ -688,10 +721,10 @@ export class CloudSchedulerClient { /** * Resume a job. * - * This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. The - * state of a job is stored in [Job.state][google.cloud.scheduler.v1.Job.state]; after calling this method it - * will be set to [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in - * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. + * This method reenables a job after it has been {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED}. The + * state of a job is stored in {@link google.cloud.scheduler.v1.Job.state|Job.state}; after calling this method it + * will be set to {@link google.cloud.scheduler.v1.Job.State.ENABLED|Job.State.ENABLED}. A job must be in + * {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED} to be resumed. * * @param {Object} request * The request object that will be sent. @@ -741,6 +774,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.resumeJob(request, options, callback); } runJob( @@ -816,6 +850,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.runJob(request, options, callback); } @@ -857,10 +892,10 @@ export class CloudSchedulerClient { * A token identifying a page of results the server will return. To * request the first page results, page_token must be empty. To * request the next page of results, page_token must be the value of - * [next_page_token][google.cloud.scheduler.v1.ListJobsResponse.next_page_token] returned from - * the previous call to [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. It is an error to - * switch the value of [filter][google.cloud.scheduler.v1.ListJobsRequest.filter] or - * [order_by][google.cloud.scheduler.v1.ListJobsRequest.order_by] while iterating through pages. + * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -916,6 +951,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listJobs(request, options, callback); } @@ -948,10 +984,10 @@ export class CloudSchedulerClient { * A token identifying a page of results the server will return. To * request the first page results, page_token must be empty. To * request the next page of results, page_token must be the value of - * [next_page_token][google.cloud.scheduler.v1.ListJobsResponse.next_page_token] returned from - * the previous call to [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. It is an error to - * switch the value of [filter][google.cloud.scheduler.v1.ListJobsRequest.filter] or - * [order_by][google.cloud.scheduler.v1.ListJobsRequest.order_by] while iterating through pages. + * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -971,6 +1007,7 @@ export class CloudSchedulerClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listJobs.createStream( this._innerApiCalls.listJobs as gax.GaxCall, request, @@ -1096,8 +1133,9 @@ export class CloudSchedulerClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudSchedulerStub.then(stub => { + return this.cloudSchedulerStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-scheduler/src/v1beta1/cloud_scheduler_client.ts b/packages/google-cloud-scheduler/src/v1beta1/cloud_scheduler_client.ts index 1e9bca64d25..40f87e797ba 100644 --- a/packages/google-cloud-scheduler/src/v1beta1/cloud_scheduler_client.ts +++ b/packages/google-cloud-scheduler/src/v1beta1/cloud_scheduler_client.ts @@ -45,8 +45,13 @@ export class CloudSchedulerClient { private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - cloudSchedulerStub: Promise<{[name: string]: Function}>; + cloudSchedulerStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudSchedulerClient. @@ -70,8 +75,6 @@ export class CloudSchedulerClient { * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. */ @@ -101,25 +104,28 @@ export class CloudSchedulerClient { // If we are in browser, we are already using fallback because of the // "browser" field in package.json. // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = (this.constructor as typeof CloudSchedulerClient).scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth as gax.GoogleAuth; + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { - clientHeader.push(`gl-web/${gaxModule.version}`); + clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); @@ -135,7 +141,7 @@ export class CloudSchedulerClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -143,20 +149,22 @@ export class CloudSchedulerClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - jobPathTemplate: new gaxModule.PathTemplate( + jobPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/jobs/{job}' ), - locationPathTemplate: new gaxModule.PathTemplate( + locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), - projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), }; // Some of the methods on this service return "paged" results, // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listJobs: new gaxModule.PageDescriptor( + listJobs: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'jobs' @@ -164,7 +172,7 @@ export class CloudSchedulerClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.scheduler.v1beta1.CloudScheduler', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -175,17 +183,35 @@ export class CloudSchedulerClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this._innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudSchedulerStub) { + return this.cloudSchedulerStub; + } // Put together the "service stub" for // google.cloud.scheduler.v1beta1.CloudScheduler. - this.cloudSchedulerStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudSchedulerStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.scheduler.v1beta1.CloudScheduler' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.scheduler.v1beta1.CloudScheduler, - opts + (this._protos as any).google.cloud.scheduler.v1beta1.CloudScheduler, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -214,9 +240,9 @@ export class CloudSchedulerClient { } ); - const apiCall = gaxModule.createApiCall( + const apiCall = this._gaxModule.createApiCall( innerCallPromise, - defaults[methodName], + this._defaults[methodName], this._descriptors.page[methodName] || this._descriptors.stream[methodName] || this._descriptors.longrunning[methodName] @@ -230,6 +256,8 @@ export class CloudSchedulerClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudSchedulerStub; } /** @@ -352,6 +380,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getJob(request, options, callback); } createJob( @@ -383,10 +412,10 @@ export class CloudSchedulerClient { * `projects/PROJECT_ID/locations/LOCATION_ID`. * @param {google.cloud.scheduler.v1beta1.Job} request.job * Required. The job to add. The user can optionally specify a name for the - * job in [name][google.cloud.scheduler.v1beta1.Job.name]. [name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an + * job in {@link google.cloud.scheduler.v1beta1.Job.name|name}. {@link google.cloud.scheduler.v1beta1.Job.name|name} cannot be the same as an * existing job. If a name is not specified then the system will * generate a random unique name that will be returned - * ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response. + * ({@link google.cloud.scheduler.v1beta1.Job.name|name}) in the response. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -431,6 +460,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createJob(request, options, callback); } updateJob( @@ -455,18 +485,18 @@ export class CloudSchedulerClient { /** * Updates a job. * - * If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does + * If successful, the updated {@link google.cloud.scheduler.v1beta1.Job|Job} is returned. If the job does * not exist, `NOT_FOUND` is returned. * * If UpdateJob does not successfully return, it is possible for the - * job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may + * job to be in an {@link google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED|Job.State.UPDATE_FAILED} state. A job in this state may * not be executed. If this happens, retry the UpdateJob request * until a successful response is received. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.scheduler.v1beta1.Job} request.job - * Required. The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified. + * Required. The new job properties. {@link google.cloud.scheduler.v1beta1.Job.name|name} must be specified. * * Output only fields cannot be modified using UpdateJob. * Any value specified for an output only field will be ignored. @@ -516,6 +546,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ 'job.name': request.job!.name || '', }); + this.initialize(); return this._innerApiCalls.updateJob(request, options, callback); } deleteJob( @@ -589,6 +620,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteJob(request, options, callback); } pauseJob( @@ -614,9 +646,9 @@ export class CloudSchedulerClient { * Pauses a job. * * If a job is paused then the system will stop executing the job - * until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The - * state of the job is stored in [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it - * will be set to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] + * until it is re-enabled via {@link google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob|ResumeJob}. The + * state of the job is stored in {@link google.cloud.scheduler.v1beta1.Job.state|state}; if paused it + * will be set to {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED}. A job must be in {@link google.cloud.scheduler.v1beta1.Job.State.ENABLED|Job.State.ENABLED} * to be paused. * * @param {Object} request @@ -668,6 +700,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.pauseJob(request, options, callback); } resumeJob( @@ -692,10 +725,10 @@ export class CloudSchedulerClient { /** * Resume a job. * - * This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The - * state of a job is stored in [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this method it - * will be set to [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A job must be in - * [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed. + * This method reenables a job after it has been {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED}. The + * state of a job is stored in {@link google.cloud.scheduler.v1beta1.Job.state|Job.state}; after calling this method it + * will be set to {@link google.cloud.scheduler.v1beta1.Job.State.ENABLED|Job.State.ENABLED}. A job must be in + * {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED} to be resumed. * * @param {Object} request * The request object that will be sent. @@ -746,6 +779,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.resumeJob(request, options, callback); } runJob( @@ -821,6 +855,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.runJob(request, options, callback); } @@ -862,10 +897,10 @@ export class CloudSchedulerClient { * A token identifying a page of results the server will return. To * request the first page results, page_token must be empty. To * request the next page of results, page_token must be the value of - * [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token] returned from - * the previous call to [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is an error to - * switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or - * [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages. + * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -921,6 +956,7 @@ export class CloudSchedulerClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listJobs(request, options, callback); } @@ -953,10 +989,10 @@ export class CloudSchedulerClient { * A token identifying a page of results the server will return. To * request the first page results, page_token must be empty. To * request the next page of results, page_token must be the value of - * [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token] returned from - * the previous call to [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is an error to - * switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or - * [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages. + * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -976,6 +1012,7 @@ export class CloudSchedulerClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listJobs.createStream( this._innerApiCalls.listJobs as gax.GaxCall, request, @@ -1101,8 +1138,9 @@ export class CloudSchedulerClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudSchedulerStub.then(stub => { + return this.cloudSchedulerStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-scheduler/synth.metadata b/packages/google-cloud-scheduler/synth.metadata index dcfa04e9140..64c8d834ce0 100644 --- a/packages/google-cloud-scheduler/synth.metadata +++ b/packages/google-cloud-scheduler/synth.metadata @@ -1,13 +1,13 @@ { - "updateTime": "2020-02-07T12:35:27.753088Z", + "updateTime": "2020-03-05T23:14:45.035617Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585", - "internalRef": "293710856", - "log": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585\nGenerate the Bazel build file for recommendengine public api\n\nPiperOrigin-RevId: 293710856\n\n68477017c4173c98addac0373950c6aa9d7b375f\nMake `language_code` optional for UpdateIntentRequest and BatchUpdateIntentsRequest.\n\nThe comments and proto annotations describe this parameter as optional.\n\nPiperOrigin-RevId: 293703548\n\n16f823f578bca4e845a19b88bb9bc5870ea71ab2\nAdd BUILD.bazel files for managedidentities API\n\nPiperOrigin-RevId: 293698246\n\n2f53fd8178c9a9de4ad10fae8dd17a7ba36133f2\nAdd v1p1beta1 config file\n\nPiperOrigin-RevId: 293696729\n\n052b274138fce2be80f97b6dcb83ab343c7c8812\nAdd source field for user event and add field behavior annotations\n\nPiperOrigin-RevId: 293693115\n\n1e89732b2d69151b1b3418fff3d4cc0434f0dded\ndatacatalog: v1beta1 add three new RPCs to gapic v1beta1 config\n\nPiperOrigin-RevId: 293692823\n\n9c8bd09bbdc7c4160a44f1fbab279b73cd7a2337\nchange the name of AccessApproval service to AccessApprovalAdmin\n\nPiperOrigin-RevId: 293690934\n\n2e23b8fbc45f5d9e200572ca662fe1271bcd6760\nAdd ListEntryGroups method, add http bindings to support entry group tagging, and update some comments.\n\nPiperOrigin-RevId: 293666452\n\n0275e38a4ca03a13d3f47a9613aac8c8b0d3f1f2\nAdd proto_package field to managedidentities API. It is needed for APIs that still depend on artman generation.\n\nPiperOrigin-RevId: 293643323\n\n4cdfe8278cb6f308106580d70648001c9146e759\nRegenerating public protos for Data Catalog to add new Custom Type Entry feature.\n\nPiperOrigin-RevId: 293614782\n\n45d2a569ab526a1fad3720f95eefb1c7330eaada\nEnable client generation for v1 ManagedIdentities API.\n\nPiperOrigin-RevId: 293515675\n\n2c17086b77e6f3bcf04a1f65758dfb0c3da1568f\nAdd the Actions on Google common types (//google/actions/type/*).\n\nPiperOrigin-RevId: 293478245\n\n781aadb932e64a12fb6ead7cd842698d99588433\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293443396\n\ne2602608c9138c2fca24162720e67f9307c30b95\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293442964\n\nc8aef82028d06b7992278fa9294c18570dc86c3d\nAdd cc_proto_library and cc_grpc_library targets for Bigtable protos.\n\nAlso fix indentation of cc_grpc_library targets in Spanner and IAM protos.\n\nPiperOrigin-RevId: 293440538\n\ne2faab04f4cb7f9755072330866689b1943a16e9\ncloudtasks: v2 replace non-standard retry params in gapic config v2\n\nPiperOrigin-RevId: 293424055\n\ndfb4097ea628a8470292c6590a4313aee0c675bd\nerrorreporting: v1beta1 add legacy artman config for php\n\nPiperOrigin-RevId: 293423790\n\nb18aed55b45bfe5b62476292c72759e6c3e573c6\nasset: v1p1beta1 updated comment for `page_size` limit.\n\nPiperOrigin-RevId: 293421386\n\nc9ef36b7956d9859a2fc86ad35fcaa16958ab44f\nbazel: Refactor CI build scripts\n\nPiperOrigin-RevId: 293387911\n\na8ed9d921fdddc61d8467bfd7c1668f0ad90435c\nfix: set Ruby module name for OrgPolicy\n\nPiperOrigin-RevId: 293257997\n\n6c7d28509bd8315de8af0889688ee20099594269\nredis: v1beta1 add UpgradeInstance and connect_mode field to Instance\n\nPiperOrigin-RevId: 293242878\n\nae0abed4fcb4c21f5cb67a82349a049524c4ef68\nredis: v1 add connect_mode field to Instance\n\nPiperOrigin-RevId: 293241914\n\n3f7a0d29b28ee9365771da2b66edf7fa2b4e9c56\nAdds service config definition for bigqueryreservation v1beta1\n\nPiperOrigin-RevId: 293234418\n\n0c88168d5ed6fe353a8cf8cbdc6bf084f6bb66a5\naddition of BUILD & configuration for accessapproval v1\n\nPiperOrigin-RevId: 293219198\n\n39bedc2e30f4778ce81193f6ba1fec56107bcfc4\naccessapproval: v1 publish protos\n\nPiperOrigin-RevId: 293167048\n\n69d9945330a5721cd679f17331a78850e2618226\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080182\n\nf6a1a6b417f39694275ca286110bc3c1ca4db0dc\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080178\n\n29d40b78e3dc1579b0b209463fbcb76e5767f72a\nExpose managedidentities/v1beta1/ API for client library usage.\n\nPiperOrigin-RevId: 292979741\n\na22129a1fb6e18056d576dfb7717aef74b63734a\nExpose managedidentities/v1/ API for client library usage.\n\nPiperOrigin-RevId: 292968186\n\nb5cbe4a4ba64ab19e6627573ff52057a1657773d\nSecurityCenter v1p1beta1: move file-level option on top to workaround protobuf.js bug.\n\nPiperOrigin-RevId: 292647187\n\nb224b317bf20c6a4fbc5030b4a969c3147f27ad3\nAdds API definitions for bigqueryreservation v1beta1.\n\nPiperOrigin-RevId: 292634722\n\nc1468702f9b17e20dd59007c0804a089b83197d2\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 292626173\n\nffdfa4f55ab2f0afc11d0eb68f125ccbd5e404bd\nvision: v1p3beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605599\n\n78f61482cd028fc1d9892aa5d89d768666a954cd\nvision: v1p1beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605125\n\n60bb5a294a604fd1778c7ec87b265d13a7106171\nvision: v1p2beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604980\n\n3bcf7aa79d45eb9ec29ab9036e9359ea325a7fc3\nvision: v1p4beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604656\n\n2717b8a1c762b26911b45ecc2e4ee01d98401b28\nFix dataproc artman client library generation.\n\nPiperOrigin-RevId: 292555664\n\n7ac66d9be8a7d7de4f13566d8663978c9ee9dcd7\nAdd Dataproc Autoscaling API to V1.\n\nPiperOrigin-RevId: 292450564\n\n5d932b2c1be3a6ef487d094e3cf5c0673d0241dd\n- Improve documentation\n- Add a client_id field to StreamingPullRequest\n\nPiperOrigin-RevId: 292434036\n\neaff9fa8edec3e914995ce832b087039c5417ea7\nmonitoring: v3 publish annotations and client retry config\n\nPiperOrigin-RevId: 292425288\n\n70958bab8c5353870d31a23fb2c40305b050d3fe\nBigQuery Storage Read API v1 clients.\n\nPiperOrigin-RevId: 292407644\n\n7a15e7fe78ff4b6d5c9606a3264559e5bde341d1\nUpdate backend proto for Google Cloud Endpoints\n\nPiperOrigin-RevId: 292391607\n\n3ca2c014e24eb5111c8e7248b1e1eb833977c83d\nbazel: Add --flaky_test_attempts=3 argument to prevent CI failures caused by flaky tests\n\nPiperOrigin-RevId: 292382559\n\n9933347c1f677e81e19a844c2ef95bfceaf694fe\nbazel:Integrate latest protoc-java-resource-names-plugin changes (fix for PyYAML dependency in bazel rules)\n\nPiperOrigin-RevId: 292376626\n\nb835ab9d2f62c88561392aa26074c0b849fb0bd3\nasset: v1p2beta1 add client config annotations\n\n* remove unintentionally exposed RPCs\n* remove messages relevant to removed RPCs\n\nPiperOrigin-RevId: 292369593\n\nc1246a29e22b0f98e800a536b5b0da2d933a55f2\nUpdating v1 protos with the latest inline documentation (in comments) and config options. Also adding a per-service .yaml file.\n\nPiperOrigin-RevId: 292310790\n\nb491d07cadaae7cde5608321f913e5ca1459b32d\nRevert accidental local_repository change\n\nPiperOrigin-RevId: 292245373\n\naf3400a8cb6110025198b59a0f7d018ae3cda700\nUpdate gapic-generator dependency (prebuilt PHP binary support).\n\nPiperOrigin-RevId: 292243997\n\n341fd5690fae36f36cf626ef048fbcf4bbe7cee6\ngrafeas: v1 add resource_definition for the grafeas.io/Project and change references for Project.\n\nPiperOrigin-RevId: 292221998\n\n42e915ec2ece1cd37a590fbcd10aa2c0fb0e5b06\nUpdate the gapic-generator, protoc-java-resource-name-plugin and protoc-docs-plugin to the latest commit.\n\nPiperOrigin-RevId: 292182368\n\nf035f47250675d31492a09f4a7586cfa395520a7\nFix grafeas build and update build.sh script to include gerafeas.\n\nPiperOrigin-RevId: 292168753\n\n26ccb214b7bc4a716032a6266bcb0a9ca55d6dbb\nasset: v1p1beta1 add client config annotations and retry config\n\nPiperOrigin-RevId: 292154210\n\n974ee5c0b5d03e81a50dafcedf41e0efebb5b749\nasset: v1beta1 add client config annotations\n\nPiperOrigin-RevId: 292152573\n\ncf3b61102ed5f36b827bc82ec39be09525f018c8\n Fix to protos for v1p1beta1 release of Cloud Security Command Center\n\nPiperOrigin-RevId: 292034635\n\n4e1cfaa7c0fede9e65d64213ca3da1b1255816c0\nUpdate the public proto to support UTF-8 encoded id for CatalogService API, increase the ListCatalogItems deadline to 300s and some minor documentation change\n\nPiperOrigin-RevId: 292030970\n\n9c483584f8fd5a1b862ae07973f4cc7bb3e46648\nasset: add annotations to v1p1beta1\n\nPiperOrigin-RevId: 292009868\n\ne19209fac29731d0baf6d9ac23da1164f7bdca24\nAdd the google.rpc.context.AttributeContext message to the open source\ndirectories.\n\nPiperOrigin-RevId: 291999930\n\nae5662960573f279502bf98a108a35ba1175e782\noslogin API: move file level option on top of the file to avoid protobuf.js bug.\n\nPiperOrigin-RevId: 291990506\n\neba3897fff7c49ed85d3c47fc96fe96e47f6f684\nAdd cc_proto_library and cc_grpc_library targets for Spanner and IAM protos.\n\nPiperOrigin-RevId: 291988651\n\n8e981acfd9b97ea2f312f11bbaa7b6c16e412dea\nBeta launch for PersonDetection and FaceDetection features.\n\nPiperOrigin-RevId: 291821782\n\n994e067fae3b21e195f7da932b08fff806d70b5d\nasset: add annotations to v1p2beta1\n\nPiperOrigin-RevId: 291815259\n\n244e1d2c89346ca2e0701b39e65552330d68545a\nAdd Playable Locations service\n\nPiperOrigin-RevId: 291806349\n\n909f8f67963daf45dd88d020877fb9029b76788d\nasset: add annotations to v1beta2\n\nPiperOrigin-RevId: 291805301\n\n3c39a1d6e23c1ef63c7fba4019c25e76c40dfe19\nKMS: add file-level message for CryptoKeyPath, it is defined in gapic yaml but not\nin proto files.\n\nPiperOrigin-RevId: 291420695\n\nc6f3f350b8387f8d1b85ed4506f30187ebaaddc3\ncontaineranalysis: update v1beta1 and bazel build with annotations\n\nPiperOrigin-RevId: 291401900\n\n92887d74b44e4e636252b7b8477d0d2570cd82db\nfix: fix the location of grpc config file.\n\nPiperOrigin-RevId: 291396015\n\n" + "sha": "f0b581b5bdf803e45201ecdb3688b60e381628a8", + "internalRef": "299181282", + "log": "f0b581b5bdf803e45201ecdb3688b60e381628a8\nfix: recommendationengine/v1beta1 update some comments\n\nPiperOrigin-RevId: 299181282\n\n10e9a0a833dc85ff8f05b2c67ebe5ac785fe04ff\nbuild: add generated BUILD file for Routes Preferred API\n\nPiperOrigin-RevId: 299164808\n\n86738c956a8238d7c77f729be78b0ed887a6c913\npublish v1p1beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299152383\n\n73d9f2ad4591de45c2e1f352bc99d70cbd2a6d95\npublish v1: update with absolute address in comments\n\nPiperOrigin-RevId: 299147194\n\nd2158f24cb77b0b0ccfe68af784c6a628705e3c6\npublish v1beta2: update with absolute address in comments\n\nPiperOrigin-RevId: 299147086\n\n7fca61292c11b4cd5b352cee1a50bf88819dd63b\npublish v1p2beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146903\n\n583b7321624736e2c490e328f4b1957335779295\npublish v1p3beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146674\n\n638253bf86d1ce1c314108a089b7351440c2f0bf\nfix: add java_multiple_files option for automl text_sentiment.proto\n\nPiperOrigin-RevId: 298971070\n\n373d655703bf914fb8b0b1cc4071d772bac0e0d1\nUpdate Recs AI Beta public bazel file\n\nPiperOrigin-RevId: 298961623\n\ndcc5d00fc8a8d8b56f16194d7c682027b2c66a3b\nfix: add java_multiple_files option for automl classification.proto\n\nPiperOrigin-RevId: 298953301\n\na3f791827266f3496a6a5201d58adc4bb265c2a3\nchore: automl/v1 publish annotations and retry config\n\nPiperOrigin-RevId: 298942178\n\n01c681586d8d6dbd60155289b587aee678530bd9\nMark return_immediately in PullRequest deprecated.\n\nPiperOrigin-RevId: 298893281\n\nc9f5e9c4bfed54bbd09227e990e7bded5f90f31c\nRemove out of date documentation for predicate support on the Storage API\n\nPiperOrigin-RevId: 298883309\n\nfd5b3b8238d783b04692a113ffe07c0363f5de0f\ngenerate webrisk v1 proto\n\nPiperOrigin-RevId: 298847934\n\n541b1ded4abadcc38e8178680b0677f65594ea6f\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 298686266\n\nc0d171acecb4f5b0bfd2c4ca34fc54716574e300\n Updated to include the Notification v1 API.\n\nPiperOrigin-RevId: 298652775\n\n2346a9186c0bff2c9cc439f2459d558068637e05\nAdd Service Directory v1beta1 protos and configs\n\nPiperOrigin-RevId: 298625638\n\na78ed801b82a5c6d9c5368e24b1412212e541bb7\nPublishing v3 protos and configs.\n\nPiperOrigin-RevId: 298607357\n\n4a180bfff8a21645b3a935c2756e8d6ab18a74e0\nautoml/v1beta1 publish proto updates\n\nPiperOrigin-RevId: 298484782\n\n6de6e938b7df1cd62396563a067334abeedb9676\nchore: use the latest gapic-generator and protoc-java-resource-name-plugin in Bazel workspace.\n\nPiperOrigin-RevId: 298474513\n\n244ab2b83a82076a1fa7be63b7e0671af73f5c02\nAdds service config definition for bigqueryreservation v1\n\nPiperOrigin-RevId: 298455048\n\n83c6f84035ee0f80eaa44d8b688a010461cc4080\nUpdate google/api/auth.proto to make AuthProvider to have JwtLocation\n\nPiperOrigin-RevId: 297918498\n\ne9e90a787703ec5d388902e2cb796aaed3a385b4\nDialogflow weekly v2/v2beta1 library update:\n - adding get validation result\n - adding field mask override control for output audio config\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 297671458\n\n1a2b05cc3541a5f7714529c665aecc3ea042c646\nAdding .yaml and .json config files.\n\nPiperOrigin-RevId: 297570622\n\ndfe1cf7be44dee31d78f78e485d8c95430981d6e\nPublish `QueryOptions` proto.\n\nIntroduced a `query_options` input in `ExecuteSqlRequest`.\n\nPiperOrigin-RevId: 297497710\n\ndafc905f71e5d46f500b41ed715aad585be062c3\npubsub: revert pull init_rpc_timeout & max_rpc_timeout back to 25 seconds and reset multiplier to 1.0\n\nPiperOrigin-RevId: 297486523\n\nf077632ba7fee588922d9e8717ee272039be126d\nfirestore: add update_transform\n\nPiperOrigin-RevId: 297405063\n\n0aba1900ffef672ec5f0da677cf590ee5686e13b\ncluster: use square brace for cross-reference\n\nPiperOrigin-RevId: 297204568\n\n5dac2da18f6325cbaed54603c43f0667ecd50247\nRestore retry params in gapic config because securitycenter has non-standard default retry params.\nRestore a few retry codes for some idempotent methods.\n\nPiperOrigin-RevId: 297196720\n\n1eb61455530252bba8b2c8d4bc9832960e5a56f6\npubsub: v1 replace IAM HTTP rules\n\nPiperOrigin-RevId: 297188590\n\n80b2d25f8d43d9d47024ff06ead7f7166548a7ba\nDialogflow weekly v2/v2beta1 library update:\n - updates to mega agent api\n - adding field mask override control for output audio config\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 297187629\n\n0b1876b35e98f560f9c9ca9797955f020238a092\nUse an older version of protoc-docs-plugin that is compatible with the specified gapic-generator and protobuf versions.\n\nprotoc-docs-plugin >=0.4.0 (see commit https://github.com/googleapis/protoc-docs-plugin/commit/979f03ede6678c487337f3d7e88bae58df5207af) is incompatible with protobuf 3.9.1.\n\nPiperOrigin-RevId: 296986742\n\n1e47e676cddbbd8d93f19ba0665af15b5532417e\nFix: Restore a method signature for UpdateCluster\n\nPiperOrigin-RevId: 296901854\n\n7f910bcc4fc4704947ccfd3ceed015d16b9e00c2\nUpdate Dataproc v1beta2 client.\n\nPiperOrigin-RevId: 296451205\n\nde287524405a3dce124d301634731584fc0432d7\nFix: Reinstate method signatures that had been missed off some RPCs\nFix: Correct resource types for two fields\n\nPiperOrigin-RevId: 296435091\n\ne5bc9566ae057fb4c92f8b7e047f1c8958235b53\nDeprecate the endpoint_uris field, as it is unused.\n\nPiperOrigin-RevId: 296357191\n\n8c12e2b4dca94e12bff9f538bdac29524ff7ef7a\nUpdate Dataproc v1 client.\n\nPiperOrigin-RevId: 296336662\n\n17567c4a1ef0a9b50faa87024d66f8acbb561089\nRemoving erroneous comment, a la https://github.com/googleapis/java-speech/pull/103\n\nPiperOrigin-RevId: 296332968\n\n3eaaaf8626ce5b0c0bc7eee05e143beffa373b01\nAdd BUILD.bazel for v1 secretmanager.googleapis.com\n\nPiperOrigin-RevId: 296274723\n\ne76149c3d992337f85eeb45643106aacae7ede82\nMove securitycenter v1 to use generate from annotations.\n\nPiperOrigin-RevId: 296266862\n\n203740c78ac69ee07c3bf6be7408048751f618f8\nAdd StackdriverLoggingConfig field to Cloud Tasks v2 API.\n\nPiperOrigin-RevId: 296256388\n\ne4117d5e9ed8bbca28da4a60a94947ca51cb2083\nCreate a Bazel BUILD file for the google.actions.type export.\n\nPiperOrigin-RevId: 296212567\n\na9639a0a9854fd6e1be08bba1ac3897f4f16cb2f\nAdd secretmanager.googleapis.com v1 protos\n\nPiperOrigin-RevId: 295983266\n\nce4f4c21d9dd2bfab18873a80449b9d9851efde8\nasset: v1p1beta1 remove SearchResources and SearchIamPolicies\n\nPiperOrigin-RevId: 295861722\n\ncb61d6c2d070b589980c779b68ffca617f789116\nasset: v1p1beta1 remove SearchResources and SearchIamPolicies\n\nPiperOrigin-RevId: 295855449\n\nab2685d8d3a0e191dc8aef83df36773c07cb3d06\nfix: Dataproc v1 - AutoscalingPolicy annotation\n\nThis adds the second resource name pattern to the\nAutoscalingPolicy resource.\n\nCommitter: @lukesneeringer\nPiperOrigin-RevId: 295738415\n\n8a1020bf6828f6e3c84c3014f2c51cb62b739140\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 295286165\n\n5cfa105206e77670369e4b2225597386aba32985\nAdd service control related proto build rule.\n\nPiperOrigin-RevId: 295262088\n\nee4dddf805072004ab19ac94df2ce669046eec26\nmonitoring v3: Add prefix \"https://cloud.google.com/\" into the link for global access\ncl 295167522, get ride of synth.py hacks\n\nPiperOrigin-RevId: 295238095\n\nd9835e922ea79eed8497db270d2f9f85099a519c\nUpdate some minor docs changes about user event proto\n\nPiperOrigin-RevId: 295185610\n\n5f311e416e69c170243de722023b22f3df89ec1c\nfix: use correct PHP package name in gapic configuration\n\nPiperOrigin-RevId: 295161330\n\n6cdd74dcdb071694da6a6b5a206e3a320b62dd11\npubsub: v1 add client config annotations and retry config\n\nPiperOrigin-RevId: 295158776\n\n5169f46d9f792e2934d9fa25c36d0515b4fd0024\nAdded cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 295026522\n\n56b55aa8818cd0a532a7d779f6ef337ba809ccbd\nFix: Resource annotations for CreateTimeSeriesRequest and ListTimeSeriesRequest should refer to valid resources. TimeSeries is not a named resource.\n\nPiperOrigin-RevId: 294931650\n\n0646bc775203077226c2c34d3e4d50cc4ec53660\nRemove unnecessary languages from bigquery-related artman configuration files.\n\nPiperOrigin-RevId: 294809380\n\n8b78aa04382e3d4147112ad6d344666771bb1909\nUpdate backend.proto for schemes and protocol\n\nPiperOrigin-RevId: 294788800\n\n80b8f8b3de2359831295e24e5238641a38d8488f\nAdds artman config files for bigquerystorage endpoints v1beta2, v1alpha2, v1\n\nPiperOrigin-RevId: 294763931\n\n2c17ac33b226194041155bb5340c3f34733f1b3a\nAdd parameter to sample generated for UpdateInstance. Related to https://github.com/googleapis/python-redis/issues/4\n\nPiperOrigin-RevId: 294734008\n\nd5e8a8953f2acdfe96fb15e85eb2f33739623957\nMove bigquery datatransfer to gapic v2.\n\nPiperOrigin-RevId: 294703703\n\nefd36705972cfcd7d00ab4c6dfa1135bafacd4ae\nfix: Add two annotations that we missed.\n\nPiperOrigin-RevId: 294664231\n\n8a36b928873ff9c05b43859b9d4ea14cd205df57\nFix: Define the \"bigquery.googleapis.com/Table\" resource in the BigQuery Storage API (v1beta2).\n\nPiperOrigin-RevId: 294459768\n\nc7a3caa2c40c49f034a3c11079dd90eb24987047\nFix: Define the \"bigquery.googleapis.com/Table\" resource in the BigQuery Storage API (v1).\n\nPiperOrigin-RevId: 294456889\n\n5006247aa157e59118833658084345ee59af7c09\nFix: Make deprecated fields optional\nFix: Deprecate SetLoggingServiceRequest.zone in line with the comments\nFeature: Add resource name method signatures where appropriate\n\nPiperOrigin-RevId: 294383128\n\neabba40dac05c5cbe0fca3a35761b17e372036c4\nFix: C# and PHP package/namespace capitalization for BigQuery Storage v1.\n\nPiperOrigin-RevId: 294382444\n\nf8d9a858a7a55eba8009a23aa3f5cc5fe5e88dde\nfix: artman configuration file for bigtable-admin\n\nPiperOrigin-RevId: 294322616\n\n0f29555d1cfcf96add5c0b16b089235afbe9b1a9\nAPI definition for (not-yet-launched) GCS gRPC.\n\nPiperOrigin-RevId: 294321472\n\nfcc86bee0e84dc11e9abbff8d7c3529c0626f390\nfix: Bigtable Admin v2\n\nChange LRO metadata from PartialUpdateInstanceMetadata\nto UpdateInstanceMetadata. (Otherwise, it will not build.)\n\nPiperOrigin-RevId: 294264582\n\n6d9361eae2ebb3f42d8c7ce5baf4bab966fee7c0\nrefactor: Add annotations to Bigtable Admin v2.\n\nPiperOrigin-RevId: 294243406\n\nad7616f3fc8e123451c8b3a7987bc91cea9e6913\nFix: Resource type in CreateLogMetricRequest should use logging.googleapis.com.\nFix: ListLogEntries should have a method signature for convenience of calling it.\n\nPiperOrigin-RevId: 294222165\n\n63796fcbb08712676069e20a3e455c9f7aa21026\nFix: Remove extraneous resource definition for cloudkms.googleapis.com/CryptoKey.\n\nPiperOrigin-RevId: 294176658\n\ne7d8a694f4559201e6913f6610069cb08b39274e\nDepend on the latest gapic-generator and resource names plugin.\n\nThis fixes the very old an very annoying bug: https://github.com/googleapis/gapic-generator/pull/3087\n\nPiperOrigin-RevId: 293903652\n\n806b2854a966d55374ee26bb0cef4e30eda17b58\nfix: correct capitalization of Ruby namespaces in SecurityCenter V1p1beta1\n\nPiperOrigin-RevId: 293903613\n\n1b83c92462b14d67a7644e2980f723112472e03a\nPublish annotations and grpc service config for Logging API.\n\nPiperOrigin-RevId: 293893514\n\n" } }, { diff --git a/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1.ts b/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1.ts index 656f12c5077..f8e6d84af71 100644 --- a/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1.ts +++ b/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1.ts @@ -83,12 +83,30 @@ describe('v1.CloudSchedulerClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudSchedulerStub, undefined); + await client.initialize(); + assert(client.cloudSchedulerStub); + }); + it('has close method', () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('getJob', () => { it('invokes getJob without error', done => { const client = new cloudschedulerModule.v1.CloudSchedulerClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IGetJobRequest = {}; request.name = ''; @@ -112,6 +130,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IGetJobRequest = {}; request.name = ''; @@ -133,6 +153,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.ICreateJobRequest = {}; request.parent = ''; @@ -156,6 +178,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.ICreateJobRequest = {}; request.parent = ''; @@ -181,6 +205,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IUpdateJobRequest = {}; request.job = {}; @@ -205,6 +231,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IUpdateJobRequest = {}; request.job = {}; @@ -231,6 +259,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IDeleteJobRequest = {}; request.name = ''; @@ -254,6 +284,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IDeleteJobRequest = {}; request.name = ''; @@ -279,6 +311,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IPauseJobRequest = {}; request.name = ''; @@ -302,6 +336,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IPauseJobRequest = {}; request.name = ''; @@ -327,6 +363,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IResumeJobRequest = {}; request.name = ''; @@ -350,6 +388,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IResumeJobRequest = {}; request.name = ''; @@ -375,6 +415,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IRunJobRequest = {}; request.name = ''; @@ -398,6 +440,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IRunJobRequest = {}; request.name = ''; @@ -419,6 +463,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IListJobsRequest = {}; request.parent = ''; @@ -446,6 +492,8 @@ describe('v1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1.IListJobsRequest = {}; request.parent = ''; diff --git a/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1beta1.ts b/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1beta1.ts index fbec3e65dd6..d5fa0513223 100644 --- a/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1beta1.ts +++ b/packages/google-cloud-scheduler/test/gapic-cloud_scheduler-v1beta1.ts @@ -83,12 +83,30 @@ describe('v1beta1.CloudSchedulerClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudSchedulerStub, undefined); + await client.initialize(); + assert(client.cloudSchedulerStub); + }); + it('has close method', () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('getJob', () => { it('invokes getJob without error', done => { const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IGetJobRequest = {}; request.name = ''; @@ -112,6 +130,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IGetJobRequest = {}; request.name = ''; @@ -133,6 +153,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.ICreateJobRequest = {}; request.parent = ''; @@ -156,6 +178,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.ICreateJobRequest = {}; request.parent = ''; @@ -181,6 +205,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IUpdateJobRequest = {}; request.job = {}; @@ -205,6 +231,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IUpdateJobRequest = {}; request.job = {}; @@ -231,6 +259,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IDeleteJobRequest = {}; request.name = ''; @@ -254,6 +284,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IDeleteJobRequest = {}; request.name = ''; @@ -279,6 +311,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IPauseJobRequest = {}; request.name = ''; @@ -302,6 +336,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IPauseJobRequest = {}; request.name = ''; @@ -327,6 +363,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IResumeJobRequest = {}; request.name = ''; @@ -350,6 +388,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IResumeJobRequest = {}; request.name = ''; @@ -375,6 +415,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IRunJobRequest = {}; request.name = ''; @@ -398,6 +440,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IRunJobRequest = {}; request.name = ''; @@ -419,6 +463,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IListJobsRequest = {}; request.parent = ''; @@ -446,6 +492,8 @@ describe('v1beta1.CloudSchedulerClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.scheduler.v1beta1.IListJobsRequest = {}; request.parent = '';