diff --git a/src/v2/cloud_tasks_client.ts b/src/v2/cloud_tasks_client.ts index 810494b1..73d71490 100644 --- a/src/v2/cloud_tasks_client.ts +++ b/src/v2/cloud_tasks_client.ts @@ -45,8 +45,13 @@ export class CloudTasksClient { 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; - cloudTasksStub: Promise<{[name: string]: Function}>; + cloudTasksStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudTasksClient. @@ -70,8 +75,6 @@ export class CloudTasksClient { * 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 CloudTasksClient { // 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 CloudTasksClient).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 CloudTasksClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -143,14 +149,16 @@ export class CloudTasksClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( + locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), - projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'), - queuePathTemplate: new gaxModule.PathTemplate( + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + queuePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queues/{queue}' ), - taskPathTemplate: new gaxModule.PathTemplate( + taskPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}' ), }; @@ -159,12 +167,12 @@ export class CloudTasksClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listQueues: new gaxModule.PageDescriptor( + listQueues: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'queues' ), - listTasks: new gaxModule.PageDescriptor( + listTasks: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'tasks' @@ -172,7 +180,7 @@ export class CloudTasksClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.tasks.v2.CloudTasks', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -183,17 +191,35 @@ export class CloudTasksClient { // 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.cloudTasksStub) { + return this.cloudTasksStub; + } // Put together the "service stub" for // google.cloud.tasks.v2.CloudTasks. - this.cloudTasksStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudTasksStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.tasks.v2.CloudTasks' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.tasks.v2.CloudTasks, - opts + (this._protos as any).google.cloud.tasks.v2.CloudTasks, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -230,9 +256,9 @@ export class CloudTasksClient { } ); - 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] @@ -246,6 +272,8 @@ export class CloudTasksClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudTasksStub; } /** @@ -368,6 +396,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getQueue(request, options, callback); } createQueue( @@ -411,11 +440,11 @@ export class CloudTasksClient { * * The list of allowed locations can be obtained by calling Cloud * Tasks' implementation of - * [ListLocations][google.cloud.location.Locations.ListLocations]. + * {@link google.cloud.location.Locations.ListLocations|ListLocations}. * @param {google.cloud.tasks.v2.Queue} request.queue * Required. The queue to create. * - * [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue. + * {@link google.cloud.tasks.v2.Queue.name|Queue's name} cannot be the same as an existing queue. * @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. @@ -459,6 +488,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createQueue(request, options, callback); } updateQueue( @@ -502,11 +532,11 @@ export class CloudTasksClient { * @param {google.cloud.tasks.v2.Queue} request.queue * Required. The queue to create or update. * - * The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified. + * The queue's {@link google.cloud.tasks.v2.Queue.name|name} must be specified. * * Output only fields cannot be modified using UpdateQueue. * Any value specified for an output only field will be ignored. - * The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed. + * The queue's {@link google.cloud.tasks.v2.Queue.name|name} cannot be changed. * @param {google.protobuf.FieldMask} request.updateMask * A mask used to specify which fields of the queue are being updated. * @@ -554,6 +584,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ 'queue.name': request.queue!.name || '', }); + this.initialize(); return this._innerApiCalls.updateQueue(request, options, callback); } deleteQueue( @@ -638,6 +669,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteQueue(request, options, callback); } purgeQueue( @@ -715,6 +747,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.purgeQueue(request, options, callback); } pauseQueue( @@ -741,9 +774,9 @@ export class CloudTasksClient { * * If a queue is paused then the system will stop dispatching tasks * until the queue is resumed via - * [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added + * {@link google.cloud.tasks.v2.CloudTasks.ResumeQueue|ResumeQueue}. Tasks can still be added * when the queue is paused. A queue is paused if its - * [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. + * {@link google.cloud.tasks.v2.Queue.state|state} is {@link google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED}. * * @param {Object} request * The request object that will be sent. @@ -793,6 +826,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.pauseQueue(request, options, callback); } resumeQueue( @@ -818,10 +852,10 @@ export class CloudTasksClient { * Resume a queue. * * This method resumes a queue after it has been - * [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or - * [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored - * in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it - * will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING]. + * {@link google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED} or + * {@link google.cloud.tasks.v2.Queue.State.DISABLED|DISABLED}. The state of a queue is stored + * in the queue's {@link google.cloud.tasks.v2.Queue.state|state}; after calling this method it + * will be set to {@link google.cloud.tasks.v2.Queue.State.RUNNING|RUNNING}. * * WARNING: Resuming many high-QPS queues at the same time can * lead to target overloading. If you are resuming high-QPS @@ -877,6 +911,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.resumeQueue(request, options, callback); } getIamPolicy( @@ -899,7 +934,7 @@ export class CloudTasksClient { > ): void; /** - * Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. + * Gets the access control policy for a {@link google.cloud.tasks.v2.Queue|Queue}. * Returns an empty policy if the resource exists and does not have a policy * set. * @@ -954,6 +989,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( @@ -976,7 +1012,7 @@ export class CloudTasksClient { > ): void; /** - * Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any existing + * Sets the access control policy for a {@link google.cloud.tasks.v2.Queue|Queue}. Replaces any existing * policy. * * Note: The Cloud Console does not check queue-level IAM permissions yet. @@ -1033,6 +1069,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( @@ -1055,9 +1092,9 @@ export class CloudTasksClient { > ): void; /** - * Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue]. + * Returns permissions that a caller has on a {@link google.cloud.tasks.v2.Queue|Queue}. * If the resource does not exist, this will return an empty set of - * permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. + * permissions, not a {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} error. * * Note: This operation is designed to be used for building permission-aware * UIs and command-line tools, not for authorization checking. This operation @@ -1108,6 +1145,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.testIamPermissions(request, options, callback); } getTask( @@ -1138,18 +1176,18 @@ export class CloudTasksClient { * Required. The task name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2.Task] resource. + * permission on the {@link google.cloud.tasks.v2.Task|Task} resource. * @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. @@ -1193,6 +1231,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getTask(request, options, callback); } createTask( @@ -1233,12 +1272,12 @@ export class CloudTasksClient { * * Task names have the following format: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task [name][google.cloud.tasks.v2.Task.name]. If a + * The user can optionally specify a task {@link google.cloud.tasks.v2.Task.name|name}. If a * name is not specified then the system will generate a random * unique task id, which will be set in the task returned in the - * [response][google.cloud.tasks.v2.Task.name]. + * {@link google.cloud.tasks.v2.Task.name|response}. * - * If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or is in the + * If {@link google.cloud.tasks.v2.Task.schedule_time|schedule_time} is not set or is in the * past then Cloud Tasks will set it to the current time. * * Task De-duplication: @@ -1246,7 +1285,7 @@ export class CloudTasksClient { * Explicitly specifying a task ID enables task de-duplication. If * a task's ID is identical to that of an existing task or a task * that was deleted or executed recently then the call will fail - * with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. + * with {@link google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS}. * If the task's queue was created using Cloud Tasks, then another task with * the same name can't be created for ~1hour after the original task was * deleted or executed. If the task's queue was created using queue.yaml or @@ -1254,7 +1293,7 @@ export class CloudTasksClient { * for ~9days after the original task was deleted or executed. * * Because there is an extra lookup cost to identify duplicate task - * names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] calls have significantly + * names, these {@link google.cloud.tasks.v2.CloudTasks.CreateTask|CreateTask} calls have significantly * increased latency. Using hashed strings for the task id or for * the prefix of the task id is recommended. Choosing task ids that * are sequential or have sequential prefixes, for example using a @@ -1263,18 +1302,18 @@ export class CloudTasksClient { * uniform distribution of task ids to store and serve tasks * efficiently. * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2.Task] resource. + * permission on the {@link google.cloud.tasks.v2.Task|Task} resource. * @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. @@ -1318,6 +1357,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createTask(request, options, callback); } deleteTask( @@ -1394,6 +1434,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteTask(request, options, callback); } runTask( @@ -1419,26 +1460,26 @@ export class CloudTasksClient { * Forces a task to run now. * * When this method is called, Cloud Tasks will dispatch the task, even if - * the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or - * is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. + * the task is already running, the queue has reached its {@link google.cloud.tasks.v2.RateLimits|RateLimits} or + * is {@link google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED}. * * This command is meant to be used for manual debugging. For - * example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed + * example, {@link google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} can be used to retry a failed * task after a fix has been made or to manually force a task to be * dispatched now. * * The dispatched task is returned. That is, the task that is returned - * contains the [status][Task.status] after the task is dispatched but + * contains the {@link Task.status|status} after the task is dispatched but * before the task is received by its target. * * If Cloud Tasks receives a successful response from the task's * target, then the task will be deleted; otherwise the task's - * [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that - * [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified - * in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig]. + * {@link google.cloud.tasks.v2.Task.schedule_time|schedule_time} will be reset to the time that + * {@link google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} was called plus the retry delay specified + * in the queue's {@link google.cloud.tasks.v2.RetryConfig|RetryConfig}. * - * [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns - * [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a + * {@link google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} returns + * {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} when it is called on a * task that has already succeeded or permanently failed. * * @param {Object} request @@ -1447,18 +1488,18 @@ export class CloudTasksClient { * Required. The task name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2.Task] resource. + * permission on the {@link google.cloud.tasks.v2.Task|Task} resource. * @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. @@ -1502,6 +1543,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.runTask(request, options, callback); } @@ -1535,7 +1577,7 @@ export class CloudTasksClient { * Required. The location name. * For example: `projects/PROJECT_ID/locations/LOCATION_ID` * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2.Queue] + * `filter` can be used to specify a subset of queues. Any {@link google.cloud.tasks.v2.Queue|Queue} * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in @@ -1552,17 +1594,17 @@ export class CloudTasksClient { * The maximum page size is 9800. If unspecified, the page size will * be the maximum. Fewer queues than requested might be returned, * even if more queues exist; use the - * [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token] in the + * {@link google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the * response to determine if more queues exist. * @param {string} request.pageToken * A token identifying the page of results to 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.tasks.v2.ListQueuesResponse.next_page_token] returned - * from the previous call to [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] + * {@link google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} * method. It is an error to switch the value of the - * [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating through pages. + * {@link google.cloud.tasks.v2.ListQueuesRequest.filter|filter} 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. @@ -1618,6 +1660,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listQueues(request, options, callback); } @@ -1640,7 +1683,7 @@ export class CloudTasksClient { * Required. The location name. * For example: `projects/PROJECT_ID/locations/LOCATION_ID` * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2.Queue] + * `filter` can be used to specify a subset of queues. Any {@link google.cloud.tasks.v2.Queue|Queue} * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in @@ -1657,17 +1700,17 @@ export class CloudTasksClient { * The maximum page size is 9800. If unspecified, the page size will * be the maximum. Fewer queues than requested might be returned, * even if more queues exist; use the - * [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token] in the + * {@link google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the * response to determine if more queues exist. * @param {string} request.pageToken * A token identifying the page of results to 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.tasks.v2.ListQueuesResponse.next_page_token] returned - * from the previous call to [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] + * {@link google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} * method. It is an error to switch the value of the - * [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating through pages. + * {@link google.cloud.tasks.v2.ListQueuesRequest.filter|filter} 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} @@ -1687,6 +1730,7 @@ export class CloudTasksClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listQueues.createStream( this._innerApiCalls.listQueues as gax.GaxCall, request, @@ -1715,9 +1759,9 @@ export class CloudTasksClient { /** * Lists the tasks in a queue. * - * By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved + * By default, only the {@link google.cloud.tasks.v2.Task.View.BASIC|BASIC} view is retrieved * due to performance considerations; - * [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the + * {@link google.cloud.tasks.v2.ListTasksRequest.response_view|response_view} controls the * subset of information which is returned. * * The tasks may be returned in any order. The ordering may change at any @@ -1729,23 +1773,23 @@ export class CloudTasksClient { * Required. The queue name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2.Task] resource. + * permission on the {@link google.cloud.tasks.v2.Task|Task} resource. * @param {number} request.pageSize * Maximum page size. * * Fewer tasks than requested might be returned, even if more tasks exist; use - * [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token] in the response to + * {@link google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to * determine if more tasks exist. * * The maximum page size is 1000. If unspecified, the page size will be the @@ -1755,8 +1799,8 @@ export class CloudTasksClient { * * 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.tasks.v2.ListTasksResponse.next_page_token] returned - * from the previous call to [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] + * {@link google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} * method. * * The page token is valid for only 2 hours. @@ -1815,6 +1859,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listTasks(request, options, callback); } @@ -1837,23 +1882,23 @@ export class CloudTasksClient { * Required. The queue name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2.Task] resource. + * permission on the {@link google.cloud.tasks.v2.Task|Task} resource. * @param {number} request.pageSize * Maximum page size. * * Fewer tasks than requested might be returned, even if more tasks exist; use - * [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token] in the response to + * {@link google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to * determine if more tasks exist. * * The maximum page size is 1000. If unspecified, the page size will be the @@ -1863,8 +1908,8 @@ export class CloudTasksClient { * * 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.tasks.v2.ListTasksResponse.next_page_token] returned - * from the previous call to [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] + * {@link google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} * method. * * The page token is valid for only 2 hours. @@ -1887,6 +1932,7 @@ export class CloudTasksClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listTasks.createStream( this._innerApiCalls.listTasks as gax.GaxCall, request, @@ -2074,8 +2120,9 @@ export class CloudTasksClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudTasksStub.then(stub => { + return this.cloudTasksStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/src/v2beta2/cloud_tasks_client.ts b/src/v2beta2/cloud_tasks_client.ts index 6586bee6..fc1691db 100644 --- a/src/v2beta2/cloud_tasks_client.ts +++ b/src/v2beta2/cloud_tasks_client.ts @@ -45,8 +45,13 @@ export class CloudTasksClient { 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; - cloudTasksStub: Promise<{[name: string]: Function}>; + cloudTasksStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudTasksClient. @@ -70,8 +75,6 @@ export class CloudTasksClient { * 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 CloudTasksClient { // 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 CloudTasksClient).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 CloudTasksClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -143,14 +149,16 @@ export class CloudTasksClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( + locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), - projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'), - queuePathTemplate: new gaxModule.PathTemplate( + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + queuePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queues/{queue}' ), - taskPathTemplate: new gaxModule.PathTemplate( + taskPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}' ), }; @@ -159,12 +167,12 @@ export class CloudTasksClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listQueues: new gaxModule.PageDescriptor( + listQueues: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'queues' ), - listTasks: new gaxModule.PageDescriptor( + listTasks: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'tasks' @@ -172,7 +180,7 @@ export class CloudTasksClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.tasks.v2beta2.CloudTasks', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -183,17 +191,35 @@ export class CloudTasksClient { // 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.cloudTasksStub) { + return this.cloudTasksStub; + } // Put together the "service stub" for // google.cloud.tasks.v2beta2.CloudTasks. - this.cloudTasksStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudTasksStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.tasks.v2beta2.CloudTasks' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.tasks.v2beta2.CloudTasks, - opts + (this._protos as any).google.cloud.tasks.v2beta2.CloudTasks, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -234,9 +260,9 @@ export class CloudTasksClient { } ); - 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] @@ -250,6 +276,8 @@ export class CloudTasksClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudTasksStub; } /** @@ -372,6 +400,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getQueue(request, options, callback); } createQueue( @@ -415,11 +444,11 @@ export class CloudTasksClient { * * The list of allowed locations can be obtained by calling Cloud * Tasks' implementation of - * [ListLocations][google.cloud.location.Locations.ListLocations]. + * {@link google.cloud.location.Locations.ListLocations|ListLocations}. * @param {google.cloud.tasks.v2beta2.Queue} request.queue * Required. The queue to create. * - * [Queue's name][google.cloud.tasks.v2beta2.Queue.name] cannot be the same as an existing queue. + * {@link google.cloud.tasks.v2beta2.Queue.name|Queue's name} cannot be the same as an existing queue. * @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. @@ -464,6 +493,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createQueue(request, options, callback); } updateQueue( @@ -507,11 +537,11 @@ export class CloudTasksClient { * @param {google.cloud.tasks.v2beta2.Queue} request.queue * Required. The queue to create or update. * - * The queue's [name][google.cloud.tasks.v2beta2.Queue.name] must be specified. + * The queue's {@link google.cloud.tasks.v2beta2.Queue.name|name} must be specified. * * Output only fields cannot be modified using UpdateQueue. * Any value specified for an output only field will be ignored. - * The queue's [name][google.cloud.tasks.v2beta2.Queue.name] cannot be changed. + * The queue's {@link google.cloud.tasks.v2beta2.Queue.name|name} cannot be changed. * @param {google.protobuf.FieldMask} request.updateMask * A mask used to specify which fields of the queue are being updated. * @@ -560,6 +590,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ 'queue.name': request.queue!.name || '', }); + this.initialize(); return this._innerApiCalls.updateQueue(request, options, callback); } deleteQueue( @@ -645,6 +676,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteQueue(request, options, callback); } purgeQueue( @@ -722,6 +754,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.purgeQueue(request, options, callback); } pauseQueue( @@ -748,9 +781,9 @@ export class CloudTasksClient { * * If a queue is paused then the system will stop dispatching tasks * until the queue is resumed via - * [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue]. Tasks can still be added + * {@link google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue|ResumeQueue}. Tasks can still be added * when the queue is paused. A queue is paused if its - * [state][google.cloud.tasks.v2beta2.Queue.state] is [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED]. + * {@link google.cloud.tasks.v2beta2.Queue.state|state} is {@link google.cloud.tasks.v2beta2.Queue.State.PAUSED|PAUSED}. * * @param {Object} request * The request object that will be sent. @@ -800,6 +833,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.pauseQueue(request, options, callback); } resumeQueue( @@ -825,10 +859,10 @@ export class CloudTasksClient { * Resume a queue. * * This method resumes a queue after it has been - * [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED] or - * [DISABLED][google.cloud.tasks.v2beta2.Queue.State.DISABLED]. The state of a queue is stored - * in the queue's [state][google.cloud.tasks.v2beta2.Queue.state]; after calling this method it - * will be set to [RUNNING][google.cloud.tasks.v2beta2.Queue.State.RUNNING]. + * {@link google.cloud.tasks.v2beta2.Queue.State.PAUSED|PAUSED} or + * {@link google.cloud.tasks.v2beta2.Queue.State.DISABLED|DISABLED}. The state of a queue is stored + * in the queue's {@link google.cloud.tasks.v2beta2.Queue.state|state}; after calling this method it + * will be set to {@link google.cloud.tasks.v2beta2.Queue.State.RUNNING|RUNNING}. * * WARNING: Resuming many high-QPS queues at the same time can * lead to target overloading. If you are resuming high-QPS @@ -885,6 +919,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.resumeQueue(request, options, callback); } getIamPolicy( @@ -907,7 +942,7 @@ export class CloudTasksClient { > ): void; /** - * Gets the access control policy for a [Queue][google.cloud.tasks.v2beta2.Queue]. + * Gets the access control policy for a {@link google.cloud.tasks.v2beta2.Queue|Queue}. * Returns an empty policy if the resource exists and does not have a policy * set. * @@ -962,6 +997,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( @@ -984,7 +1020,7 @@ export class CloudTasksClient { > ): void; /** - * Sets the access control policy for a [Queue][google.cloud.tasks.v2beta2.Queue]. Replaces any existing + * Sets the access control policy for a {@link google.cloud.tasks.v2beta2.Queue|Queue}. Replaces any existing * policy. * * Note: The Cloud Console does not check queue-level IAM permissions yet. @@ -1041,6 +1077,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( @@ -1063,9 +1100,9 @@ export class CloudTasksClient { > ): void; /** - * Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta2.Queue]. + * Returns permissions that a caller has on a {@link google.cloud.tasks.v2beta2.Queue|Queue}. * If the resource does not exist, this will return an empty set of - * permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. + * permissions, not a {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} error. * * Note: This operation is designed to be used for building permission-aware * UIs and command-line tools, not for authorization checking. This operation @@ -1116,6 +1153,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.testIamPermissions(request, options, callback); } getTask( @@ -1146,18 +1184,18 @@ export class CloudTasksClient { * Required. The task name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @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. @@ -1201,6 +1239,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getTask(request, options, callback); } createTask( @@ -1227,9 +1266,9 @@ export class CloudTasksClient { * * Tasks cannot be updated after creation; there is no UpdateTask command. * - * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is + * * For {@link google.cloud.tasks.v2beta2.AppEngineHttpTarget|App Engine queues}, the maximum task size is * 100KB. - * * For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. + * * For {@link google.cloud.tasks.v2beta2.PullTarget|pull queues}, the maximum task size is 1MB. * * @param {Object} request * The request object that will be sent. @@ -1243,12 +1282,12 @@ export class CloudTasksClient { * * Task names have the following format: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task [name][google.cloud.tasks.v2beta2.Task.name]. If a + * The user can optionally specify a task {@link google.cloud.tasks.v2beta2.Task.name|name}. If a * name is not specified then the system will generate a random * unique task id, which will be set in the task returned in the - * [response][google.cloud.tasks.v2beta2.Task.name]. + * {@link google.cloud.tasks.v2beta2.Task.name|response}. * - * If [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] is not set or is in the + * If {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} is not set or is in the * past then Cloud Tasks will set it to the current time. * * Task De-duplication: @@ -1256,7 +1295,7 @@ export class CloudTasksClient { * Explicitly specifying a task ID enables task de-duplication. If * a task's ID is identical to that of an existing task or a task * that was deleted or completed recently then the call will fail - * with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. + * with {@link google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS}. * If the task's queue was created using Cloud Tasks, then another task with * the same name can't be created for ~1hour after the original task was * deleted or completed. If the task's queue was created using queue.yaml or @@ -1264,7 +1303,7 @@ export class CloudTasksClient { * for ~9days after the original task was deleted or completed. * * Because there is an extra lookup cost to identify duplicate task - * names, these [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] calls have significantly + * names, these {@link google.cloud.tasks.v2beta2.CloudTasks.CreateTask|CreateTask} calls have significantly * increased latency. Using hashed strings for the task id or for * the prefix of the task id is recommended. Choosing task ids that * are sequential or have sequential prefixes, for example using a @@ -1273,18 +1312,18 @@ export class CloudTasksClient { * uniform distribution of task ids to store and serve tasks * efficiently. * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @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. @@ -1328,6 +1367,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createTask(request, options, callback); } deleteTask( @@ -1404,6 +1444,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteTask(request, options, callback); } leaseTasks( @@ -1427,26 +1468,26 @@ export class CloudTasksClient { ): void; /** * Leases tasks from a pull queue for - * [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration]. + * {@link google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration|lease_duration}. * * This method is invoked by the worker to obtain a lease. The * worker must acknowledge the task via - * [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask] after they have + * {@link google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask|AcknowledgeTask} after they have * performed the work associated with the task. * - * The [payload][google.cloud.tasks.v2beta2.PullMessage.payload] is intended to store data that + * The {@link google.cloud.tasks.v2beta2.PullMessage.payload|payload} is intended to store data that * the worker needs to perform the work associated with the task. To - * return the payloads in the [response][google.cloud.tasks.v2beta2.LeaseTasksResponse], set - * [response_view][google.cloud.tasks.v2beta2.LeaseTasksRequest.response_view] to - * [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]. + * return the payloads in the {@link google.cloud.tasks.v2beta2.LeaseTasksResponse|response}, set + * {@link google.cloud.tasks.v2beta2.LeaseTasksRequest.response_view|response_view} to + * {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL}. * - * A maximum of 10 qps of [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] + * A maximum of 10 qps of {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks} * requests are allowed per - * queue. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED] + * queue. {@link google.rpc.Code.RESOURCE_EXHAUSTED|RESOURCE_EXHAUSTED} * is returned when this limit is - * exceeded. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED] + * exceeded. {@link google.rpc.Code.RESOURCE_EXHAUSTED|RESOURCE_EXHAUSTED} * is also returned when - * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second] + * {@link google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second|max_tasks_dispatched_per_second} * is exceeded. * * @param {Object} request @@ -1462,53 +1503,53 @@ export class CloudTasksClient { * * The largest that `max_tasks` can be is 1000. * - * The maximum total size of a [lease tasks response][google.cloud.tasks.v2beta2.LeaseTasksResponse] is + * The maximum total size of a {@link google.cloud.tasks.v2beta2.LeaseTasksResponse|lease tasks response} is * 32 MB. If the sum of all task sizes requested reaches this limit, * fewer tasks than requested are returned. * @param {google.protobuf.Duration} request.leaseDuration * Required. The duration of the lease. * - * Each task returned in the [response][google.cloud.tasks.v2beta2.LeaseTasksResponse] will - * have its [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] set to the current + * Each task returned in the {@link google.cloud.tasks.v2beta2.LeaseTasksResponse|response} will + * have its {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} set to the current * time plus the `lease_duration`. The task is leased until its - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]; thus, the task will not be - * returned to another [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] call - * before its [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]. + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time}; thus, the task will not be + * returned to another {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks} call + * before its {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time}. * * * After the worker has successfully finished the work associated * with the task, the worker must call via - * [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask] before the - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]. Otherwise the task will be - * returned to a later [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] call so + * {@link google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask|AcknowledgeTask} before the + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time}. Otherwise the task will be + * returned to a later {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks} call so * that another worker can retry it. * * The maximum lease duration is 1 week. * `lease_duration` will be truncated to the nearest second. * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @param {string} request.filter * `filter` can be used to specify a subset of tasks to lease. * * When `filter` is set to `tag=` then the - * [response][google.cloud.tasks.v2beta2.LeaseTasksResponse] will contain only tasks whose - * [tag][google.cloud.tasks.v2beta2.PullMessage.tag] is equal to ``. `` must be + * {@link google.cloud.tasks.v2beta2.LeaseTasksResponse|response} will contain only tasks whose + * {@link google.cloud.tasks.v2beta2.PullMessage.tag|tag} is equal to ``. `` must be * less than 500 characters. * * When `filter` is set to `tag_function=oldest_tag()`, only tasks which have * the same tag as the task with the oldest - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] will be returned. + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} will be returned. * * Grammar Syntax: * @@ -1526,8 +1567,8 @@ export class CloudTasksClient { * [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. Tag which * aren't UTF-8 encoded can't be used in the - * [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter] and the task's - * [tag][google.cloud.tasks.v2beta2.PullMessage.tag] will be displayed as empty in Cloud Tasks. + * {@link google.cloud.tasks.v2beta2.LeaseTasksRequest.filter|filter} and the task's + * {@link google.cloud.tasks.v2beta2.PullMessage.tag|tag} will be displayed as empty in Cloud Tasks. * @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. @@ -1571,6 +1612,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.leaseTasks(request, options, callback); } acknowledgeTask( @@ -1600,16 +1642,16 @@ export class CloudTasksClient { * Acknowledges a pull task. * * The worker, that is, the entity that - * [leased][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] this task must call this method + * {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|leased} this task must call this method * to indicate that the work associated with the task has finished. * * The worker must acknowledge a task within the - * [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration] or the lease + * {@link google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration|lease_duration} or the lease * will expire and the task will become available to be leased * again. After the task is acknowledged, it will not be returned - * by a later [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks], - * [GetTask][google.cloud.tasks.v2beta2.CloudTasks.GetTask], or - * [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks]. + * by a later {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks}, + * {@link google.cloud.tasks.v2beta2.CloudTasks.GetTask|GetTask}, or + * {@link google.cloud.tasks.v2beta2.CloudTasks.ListTasks|ListTasks}. * * @param {Object} request * The request object that will be sent. @@ -1618,9 +1660,9 @@ export class CloudTasksClient { * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.protobuf.Timestamp} request.scheduleTime * Required. The task's current schedule time, available in the - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by - * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or - * [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} returned by + * {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks} response or + * {@link google.cloud.tasks.v2beta2.CloudTasks.RenewLease|RenewLease} response. This restriction is * to ensure that your worker currently holds the lease. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1670,6 +1712,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.acknowledgeTask(request, options, callback); } renewLease( @@ -1696,7 +1739,7 @@ export class CloudTasksClient { * * The worker can use this method to extend the lease by a new * duration, starting from now. The new task lease will be - * returned in the task's [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]. + * returned in the task's {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time}. * * @param {Object} request * The request object that will be sent. @@ -1705,9 +1748,9 @@ export class CloudTasksClient { * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.protobuf.Timestamp} request.scheduleTime * Required. The task's current schedule time, available in the - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by - * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or - * [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} returned by + * {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks} response or + * {@link google.cloud.tasks.v2beta2.CloudTasks.RenewLease|RenewLease} response. This restriction is * to ensure that your worker currently holds the lease. * @param {google.protobuf.Duration} request.leaseDuration * Required. The desired new lease duration, starting from now. @@ -1716,18 +1759,18 @@ export class CloudTasksClient { * The maximum lease duration is 1 week. * `lease_duration` will be truncated to the nearest second. * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @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. @@ -1771,6 +1814,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.renewLease(request, options, callback); } cancelLease( @@ -1796,9 +1840,9 @@ export class CloudTasksClient { * Cancel a pull task's lease. * * The worker can use this method to cancel a task's lease by - * setting its [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] to now. This will + * setting its {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} to now. This will * make the task available to be leased to the next caller of - * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks]. + * {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks}. * * @param {Object} request * The request object that will be sent. @@ -1807,23 +1851,23 @@ export class CloudTasksClient { * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.protobuf.Timestamp} request.scheduleTime * Required. The task's current schedule time, available in the - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by - * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or - * [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} returned by + * {@link google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks|LeaseTasks} response or + * {@link google.cloud.tasks.v2beta2.CloudTasks.RenewLease|RenewLease} response. This restriction is * to ensure that your worker currently holds the lease. * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @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. @@ -1868,6 +1912,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.cancelLease(request, options, callback); } runTask( @@ -1893,30 +1938,30 @@ export class CloudTasksClient { * Forces a task to run now. * * When this method is called, Cloud Tasks will dispatch the task, even if - * the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2beta2.RateLimits] or - * is [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED]. + * the task is already running, the queue has reached its {@link google.cloud.tasks.v2beta2.RateLimits|RateLimits} or + * is {@link google.cloud.tasks.v2beta2.Queue.State.PAUSED|PAUSED}. * * This command is meant to be used for manual debugging. For - * example, [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] can be used to retry a failed + * example, {@link google.cloud.tasks.v2beta2.CloudTasks.RunTask|RunTask} can be used to retry a failed * task after a fix has been made or to manually force a task to be * dispatched now. * * The dispatched task is returned. That is, the task that is returned - * contains the [status][google.cloud.tasks.v2beta2.Task.status] after the task is dispatched but + * contains the {@link google.cloud.tasks.v2beta2.Task.status|status} after the task is dispatched but * before the task is received by its target. * * If Cloud Tasks receives a successful response from the task's * target, then the task will be deleted; otherwise the task's - * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] will be reset to the time that - * [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] was called plus the retry delay specified - * in the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig]. + * {@link google.cloud.tasks.v2beta2.Task.schedule_time|schedule_time} will be reset to the time that + * {@link google.cloud.tasks.v2beta2.CloudTasks.RunTask|RunTask} was called plus the retry delay specified + * in the queue's {@link google.cloud.tasks.v2beta2.RetryConfig|RetryConfig}. * - * [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] returns - * [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a + * {@link google.cloud.tasks.v2beta2.CloudTasks.RunTask|RunTask} returns + * {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} when it is called on a * task that has already succeeded or permanently failed. * - * [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] cannot be called on a - * [pull task][google.cloud.tasks.v2beta2.PullMessage]. + * {@link google.cloud.tasks.v2beta2.CloudTasks.RunTask|RunTask} cannot be called on a + * {@link google.cloud.tasks.v2beta2.PullMessage|pull task}. * * @param {Object} request * The request object that will be sent. @@ -1924,18 +1969,18 @@ export class CloudTasksClient { * Required. The task name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @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. @@ -1979,6 +2024,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.runTask(request, options, callback); } @@ -2012,7 +2058,7 @@ export class CloudTasksClient { * Required. The location name. * For example: `projects/PROJECT_ID/locations/LOCATION_ID` * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2beta2.Queue] + * `filter` can be used to specify a subset of queues. Any {@link google.cloud.tasks.v2beta2.Queue|Queue} * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in @@ -2029,17 +2075,17 @@ export class CloudTasksClient { * The maximum page size is 9800. If unspecified, the page size will * be the maximum. Fewer queues than requested might be returned, * even if more queues exist; use the - * [next_page_token][google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token] in the + * {@link google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token|next_page_token} in the * response to determine if more queues exist. * @param {string} request.pageToken * A token identifying the page of results to 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.tasks.v2beta2.ListQueuesResponse.next_page_token] returned - * from the previous call to [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues] + * {@link google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta2.CloudTasks.ListQueues|ListQueues} * method. It is an error to switch the value of the - * [filter][google.cloud.tasks.v2beta2.ListQueuesRequest.filter] while iterating through pages. + * {@link google.cloud.tasks.v2beta2.ListQueuesRequest.filter|filter} 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. @@ -2095,6 +2141,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listQueues(request, options, callback); } @@ -2117,7 +2164,7 @@ export class CloudTasksClient { * Required. The location name. * For example: `projects/PROJECT_ID/locations/LOCATION_ID` * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2beta2.Queue] + * `filter` can be used to specify a subset of queues. Any {@link google.cloud.tasks.v2beta2.Queue|Queue} * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in @@ -2134,17 +2181,17 @@ export class CloudTasksClient { * The maximum page size is 9800. If unspecified, the page size will * be the maximum. Fewer queues than requested might be returned, * even if more queues exist; use the - * [next_page_token][google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token] in the + * {@link google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token|next_page_token} in the * response to determine if more queues exist. * @param {string} request.pageToken * A token identifying the page of results to 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.tasks.v2beta2.ListQueuesResponse.next_page_token] returned - * from the previous call to [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues] + * {@link google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta2.CloudTasks.ListQueues|ListQueues} * method. It is an error to switch the value of the - * [filter][google.cloud.tasks.v2beta2.ListQueuesRequest.filter] while iterating through pages. + * {@link google.cloud.tasks.v2beta2.ListQueuesRequest.filter|filter} 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} @@ -2164,6 +2211,7 @@ export class CloudTasksClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listQueues.createStream( this._innerApiCalls.listQueues as gax.GaxCall, request, @@ -2192,9 +2240,9 @@ export class CloudTasksClient { /** * Lists the tasks in a queue. * - * By default, only the [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC] view is retrieved + * By default, only the {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC} view is retrieved * due to performance considerations; - * [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view] controls the + * {@link google.cloud.tasks.v2beta2.ListTasksRequest.response_view|response_view} controls the * subset of information which is returned. * * The tasks may be returned in any order. The ordering may change at any @@ -2206,23 +2254,23 @@ export class CloudTasksClient { * Required. The queue name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @param {number} request.pageSize * Maximum page size. * * Fewer tasks than requested might be returned, even if more tasks exist; use - * [next_page_token][google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token] in the response to + * {@link google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token|next_page_token} in the response to * determine if more tasks exist. * * The maximum page size is 1000. If unspecified, the page size will be the @@ -2232,8 +2280,8 @@ export class CloudTasksClient { * * 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.tasks.v2beta2.ListTasksResponse.next_page_token] returned - * from the previous call to [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks] + * {@link google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta2.CloudTasks.ListTasks|ListTasks} * method. * * The page token is valid for only 2 hours. @@ -2292,6 +2340,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listTasks(request, options, callback); } @@ -2314,23 +2363,23 @@ export class CloudTasksClient { * Required. The queue name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * @param {google.cloud.tasks.v2beta2.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta2.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta2.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta2.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta2.Task|Task} resource. * @param {number} request.pageSize * Maximum page size. * * Fewer tasks than requested might be returned, even if more tasks exist; use - * [next_page_token][google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token] in the response to + * {@link google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token|next_page_token} in the response to * determine if more tasks exist. * * The maximum page size is 1000. If unspecified, the page size will be the @@ -2340,8 +2389,8 @@ export class CloudTasksClient { * * 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.tasks.v2beta2.ListTasksResponse.next_page_token] returned - * from the previous call to [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks] + * {@link google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta2.CloudTasks.ListTasks|ListTasks} * method. * * The page token is valid for only 2 hours. @@ -2364,6 +2413,7 @@ export class CloudTasksClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listTasks.createStream( this._innerApiCalls.listTasks as gax.GaxCall, request, @@ -2551,8 +2601,9 @@ export class CloudTasksClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudTasksStub.then(stub => { + return this.cloudTasksStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/src/v2beta3/cloud_tasks_client.ts b/src/v2beta3/cloud_tasks_client.ts index b08a0364..3939ca5c 100644 --- a/src/v2beta3/cloud_tasks_client.ts +++ b/src/v2beta3/cloud_tasks_client.ts @@ -45,8 +45,13 @@ export class CloudTasksClient { 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; - cloudTasksStub: Promise<{[name: string]: Function}>; + cloudTasksStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudTasksClient. @@ -70,8 +75,6 @@ export class CloudTasksClient { * 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 CloudTasksClient { // 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 CloudTasksClient).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 CloudTasksClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -143,14 +149,16 @@ export class CloudTasksClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( + locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), - projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'), - queuePathTemplate: new gaxModule.PathTemplate( + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + queuePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queues/{queue}' ), - taskPathTemplate: new gaxModule.PathTemplate( + taskPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}' ), }; @@ -159,12 +167,12 @@ export class CloudTasksClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listQueues: new gaxModule.PageDescriptor( + listQueues: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'queues' ), - listTasks: new gaxModule.PageDescriptor( + listTasks: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'tasks' @@ -172,7 +180,7 @@ export class CloudTasksClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.tasks.v2beta3.CloudTasks', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -183,17 +191,35 @@ export class CloudTasksClient { // 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.cloudTasksStub) { + return this.cloudTasksStub; + } // Put together the "service stub" for // google.cloud.tasks.v2beta3.CloudTasks. - this.cloudTasksStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudTasksStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.tasks.v2beta3.CloudTasks' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.tasks.v2beta3.CloudTasks, - opts + (this._protos as any).google.cloud.tasks.v2beta3.CloudTasks, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -230,9 +256,9 @@ export class CloudTasksClient { } ); - 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] @@ -246,6 +272,8 @@ export class CloudTasksClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudTasksStub; } /** @@ -368,6 +396,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getQueue(request, options, callback); } createQueue( @@ -411,11 +440,11 @@ export class CloudTasksClient { * * The list of allowed locations can be obtained by calling Cloud * Tasks' implementation of - * [ListLocations][google.cloud.location.Locations.ListLocations]. + * {@link google.cloud.location.Locations.ListLocations|ListLocations}. * @param {google.cloud.tasks.v2beta3.Queue} request.queue * Required. The queue to create. * - * [Queue's name][google.cloud.tasks.v2beta3.Queue.name] cannot be the same as an existing queue. + * {@link google.cloud.tasks.v2beta3.Queue.name|Queue's name} cannot be the same as an existing queue. * @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. @@ -460,6 +489,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createQueue(request, options, callback); } updateQueue( @@ -503,11 +533,11 @@ export class CloudTasksClient { * @param {google.cloud.tasks.v2beta3.Queue} request.queue * Required. The queue to create or update. * - * The queue's [name][google.cloud.tasks.v2beta3.Queue.name] must be specified. + * The queue's {@link google.cloud.tasks.v2beta3.Queue.name|name} must be specified. * * Output only fields cannot be modified using UpdateQueue. * Any value specified for an output only field will be ignored. - * The queue's [name][google.cloud.tasks.v2beta3.Queue.name] cannot be changed. + * The queue's {@link google.cloud.tasks.v2beta3.Queue.name|name} cannot be changed. * @param {google.protobuf.FieldMask} request.updateMask * A mask used to specify which fields of the queue are being updated. * @@ -556,6 +586,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ 'queue.name': request.queue!.name || '', }); + this.initialize(); return this._innerApiCalls.updateQueue(request, options, callback); } deleteQueue( @@ -641,6 +672,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteQueue(request, options, callback); } purgeQueue( @@ -718,6 +750,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.purgeQueue(request, options, callback); } pauseQueue( @@ -744,9 +777,9 @@ export class CloudTasksClient { * * If a queue is paused then the system will stop dispatching tasks * until the queue is resumed via - * [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can still be added + * {@link google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue|ResumeQueue}. Tasks can still be added * when the queue is paused. A queue is paused if its - * [state][google.cloud.tasks.v2beta3.Queue.state] is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED]. + * {@link google.cloud.tasks.v2beta3.Queue.state|state} is {@link google.cloud.tasks.v2beta3.Queue.State.PAUSED|PAUSED}. * * @param {Object} request * The request object that will be sent. @@ -796,6 +829,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.pauseQueue(request, options, callback); } resumeQueue( @@ -821,10 +855,10 @@ export class CloudTasksClient { * Resume a queue. * * This method resumes a queue after it has been - * [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED] or - * [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a queue is stored - * in the queue's [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method it - * will be set to [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING]. + * {@link google.cloud.tasks.v2beta3.Queue.State.PAUSED|PAUSED} or + * {@link google.cloud.tasks.v2beta3.Queue.State.DISABLED|DISABLED}. The state of a queue is stored + * in the queue's {@link google.cloud.tasks.v2beta3.Queue.state|state}; after calling this method it + * will be set to {@link google.cloud.tasks.v2beta3.Queue.State.RUNNING|RUNNING}. * * WARNING: Resuming many high-QPS queues at the same time can * lead to target overloading. If you are resuming high-QPS @@ -881,6 +915,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.resumeQueue(request, options, callback); } getIamPolicy( @@ -903,7 +938,7 @@ export class CloudTasksClient { > ): void; /** - * Gets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. + * Gets the access control policy for a {@link google.cloud.tasks.v2beta3.Queue|Queue}. * Returns an empty policy if the resource exists and does not have a policy * set. * @@ -958,6 +993,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( @@ -980,7 +1016,7 @@ export class CloudTasksClient { > ): void; /** - * Sets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing + * Sets the access control policy for a {@link google.cloud.tasks.v2beta3.Queue|Queue}. Replaces any existing * policy. * * Note: The Cloud Console does not check queue-level IAM permissions yet. @@ -1037,6 +1073,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( @@ -1059,9 +1096,9 @@ export class CloudTasksClient { > ): void; /** - * Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta3.Queue]. + * Returns permissions that a caller has on a {@link google.cloud.tasks.v2beta3.Queue|Queue}. * If the resource does not exist, this will return an empty set of - * permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. + * permissions, not a {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} error. * * Note: This operation is designed to be used for building permission-aware * UIs and command-line tools, not for authorization checking. This operation @@ -1112,6 +1149,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.testIamPermissions(request, options, callback); } getTask( @@ -1142,18 +1180,18 @@ export class CloudTasksClient { * Required. The task name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.cloud.tasks.v2beta3.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta3.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta3.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta3.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta3.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta3.Task|Task} resource. * @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. @@ -1197,6 +1235,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getTask(request, options, callback); } createTask( @@ -1237,12 +1276,12 @@ export class CloudTasksClient { * * Task names have the following format: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task [name][google.cloud.tasks.v2beta3.Task.name]. If a + * The user can optionally specify a task {@link google.cloud.tasks.v2beta3.Task.name|name}. If a * name is not specified then the system will generate a random * unique task id, which will be set in the task returned in the - * [response][google.cloud.tasks.v2beta3.Task.name]. + * {@link google.cloud.tasks.v2beta3.Task.name|response}. * - * If [schedule_time][google.cloud.tasks.v2beta3.Task.schedule_time] is not set or is in the + * If {@link google.cloud.tasks.v2beta3.Task.schedule_time|schedule_time} is not set or is in the * past then Cloud Tasks will set it to the current time. * * Task De-duplication: @@ -1250,7 +1289,7 @@ export class CloudTasksClient { * Explicitly specifying a task ID enables task de-duplication. If * a task's ID is identical to that of an existing task or a task * that was deleted or executed recently then the call will fail - * with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. + * with {@link google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS}. * If the task's queue was created using Cloud Tasks, then another task with * the same name can't be created for ~1hour after the original task was * deleted or executed. If the task's queue was created using queue.yaml or @@ -1258,7 +1297,7 @@ export class CloudTasksClient { * for ~9days after the original task was deleted or executed. * * Because there is an extra lookup cost to identify duplicate task - * names, these [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask] calls have significantly + * names, these {@link google.cloud.tasks.v2beta3.CloudTasks.CreateTask|CreateTask} calls have significantly * increased latency. Using hashed strings for the task id or for * the prefix of the task id is recommended. Choosing task ids that * are sequential or have sequential prefixes, for example using a @@ -1267,18 +1306,18 @@ export class CloudTasksClient { * uniform distribution of task ids to store and serve tasks * efficiently. * @param {google.cloud.tasks.v2beta3.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta3.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta3.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta3.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta3.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta3.Task|Task} resource. * @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. @@ -1322,6 +1361,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.createTask(request, options, callback); } deleteTask( @@ -1398,6 +1438,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.deleteTask(request, options, callback); } runTask( @@ -1423,26 +1464,26 @@ export class CloudTasksClient { * Forces a task to run now. * * When this method is called, Cloud Tasks will dispatch the task, even if - * the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2beta3.RateLimits] or - * is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED]. + * the task is already running, the queue has reached its {@link google.cloud.tasks.v2beta3.RateLimits|RateLimits} or + * is {@link google.cloud.tasks.v2beta3.Queue.State.PAUSED|PAUSED}. * * This command is meant to be used for manual debugging. For - * example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] can be used to retry a failed + * example, {@link google.cloud.tasks.v2beta3.CloudTasks.RunTask|RunTask} can be used to retry a failed * task after a fix has been made or to manually force a task to be * dispatched now. * * The dispatched task is returned. That is, the task that is returned - * contains the [status][Task.status] after the task is dispatched but + * contains the {@link Task.status|status} after the task is dispatched but * before the task is received by its target. * * If Cloud Tasks receives a successful response from the task's * target, then the task will be deleted; otherwise the task's - * [schedule_time][google.cloud.tasks.v2beta3.Task.schedule_time] will be reset to the time that - * [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus the retry delay specified - * in the queue's [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig]. + * {@link google.cloud.tasks.v2beta3.Task.schedule_time|schedule_time} will be reset to the time that + * {@link google.cloud.tasks.v2beta3.CloudTasks.RunTask|RunTask} was called plus the retry delay specified + * in the queue's {@link google.cloud.tasks.v2beta3.RetryConfig|RetryConfig}. * - * [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] returns - * [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a + * {@link google.cloud.tasks.v2beta3.CloudTasks.RunTask|RunTask} returns + * {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} when it is called on a * task that has already succeeded or permanently failed. * * @param {Object} request @@ -1451,18 +1492,18 @@ export class CloudTasksClient { * Required. The task name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` * @param {google.cloud.tasks.v2beta3.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta3.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta3.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta3.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta3.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta3.Task|Task} resource. * @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. @@ -1506,6 +1547,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.runTask(request, options, callback); } @@ -1539,7 +1581,7 @@ export class CloudTasksClient { * Required. The location name. * For example: `projects/PROJECT_ID/locations/LOCATION_ID` * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2beta3.Queue] + * `filter` can be used to specify a subset of queues. Any {@link google.cloud.tasks.v2beta3.Queue|Queue} * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in @@ -1556,17 +1598,17 @@ export class CloudTasksClient { * The maximum page size is 9800. If unspecified, the page size will * be the maximum. Fewer queues than requested might be returned, * even if more queues exist; use the - * [next_page_token][google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token] in the + * {@link google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token|next_page_token} in the * response to determine if more queues exist. * @param {string} request.pageToken * A token identifying the page of results to 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.tasks.v2beta3.ListQueuesResponse.next_page_token] returned - * from the previous call to [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues] + * {@link google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta3.CloudTasks.ListQueues|ListQueues} * method. It is an error to switch the value of the - * [filter][google.cloud.tasks.v2beta3.ListQueuesRequest.filter] while iterating through pages. + * {@link google.cloud.tasks.v2beta3.ListQueuesRequest.filter|filter} 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. @@ -1622,6 +1664,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listQueues(request, options, callback); } @@ -1644,7 +1687,7 @@ export class CloudTasksClient { * Required. The location name. * For example: `projects/PROJECT_ID/locations/LOCATION_ID` * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2beta3.Queue] + * `filter` can be used to specify a subset of queues. Any {@link google.cloud.tasks.v2beta3.Queue|Queue} * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in @@ -1661,17 +1704,17 @@ export class CloudTasksClient { * The maximum page size is 9800. If unspecified, the page size will * be the maximum. Fewer queues than requested might be returned, * even if more queues exist; use the - * [next_page_token][google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token] in the + * {@link google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token|next_page_token} in the * response to determine if more queues exist. * @param {string} request.pageToken * A token identifying the page of results to 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.tasks.v2beta3.ListQueuesResponse.next_page_token] returned - * from the previous call to [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues] + * {@link google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta3.CloudTasks.ListQueues|ListQueues} * method. It is an error to switch the value of the - * [filter][google.cloud.tasks.v2beta3.ListQueuesRequest.filter] while iterating through pages. + * {@link google.cloud.tasks.v2beta3.ListQueuesRequest.filter|filter} 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} @@ -1691,6 +1734,7 @@ export class CloudTasksClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listQueues.createStream( this._innerApiCalls.listQueues as gax.GaxCall, request, @@ -1719,9 +1763,9 @@ export class CloudTasksClient { /** * Lists the tasks in a queue. * - * By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC] view is retrieved + * By default, only the {@link google.cloud.tasks.v2beta3.Task.View.BASIC|BASIC} view is retrieved * due to performance considerations; - * [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.response_view] controls the + * {@link google.cloud.tasks.v2beta3.ListTasksRequest.response_view|response_view} controls the * subset of information which is returned. * * The tasks may be returned in any order. The ordering may change at any @@ -1733,23 +1777,23 @@ export class CloudTasksClient { * Required. The queue name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * @param {google.cloud.tasks.v2beta3.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta3.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta3.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta3.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta3.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta3.Task|Task} resource. * @param {number} request.pageSize * Maximum page size. * * Fewer tasks than requested might be returned, even if more tasks exist; use - * [next_page_token][google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token] in the response to + * {@link google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token|next_page_token} in the response to * determine if more tasks exist. * * The maximum page size is 1000. If unspecified, the page size will be the @@ -1759,8 +1803,8 @@ export class CloudTasksClient { * * 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.tasks.v2beta3.ListTasksResponse.next_page_token] returned - * from the previous call to [ListTasks][google.cloud.tasks.v2beta3.CloudTasks.ListTasks] + * {@link google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta3.CloudTasks.ListTasks|ListTasks} * method. * * The page token is valid for only 2 hours. @@ -1819,6 +1863,7 @@ export class CloudTasksClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listTasks(request, options, callback); } @@ -1841,23 +1886,23 @@ export class CloudTasksClient { * Required. The queue name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * @param {google.cloud.tasks.v2beta3.Task.View} request.responseView - * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] will be + * The response_view specifies which subset of the {@link google.cloud.tasks.v2beta3.Task|Task} will be * returned. * - * By default response_view is [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC]; not all + * By default response_view is {@link google.cloud.tasks.v2beta3.Task.View.BASIC|BASIC}; not all * information is retrieved by default because some data, such as * payloads, might be desirable to return only when needed because * of its large size or because of the sensitivity of data that it * contains. * - * Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires + * Authorization for {@link google.cloud.tasks.v2beta3.Task.View.FULL|FULL} requires * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Task][google.cloud.tasks.v2beta3.Task] resource. + * permission on the {@link google.cloud.tasks.v2beta3.Task|Task} resource. * @param {number} request.pageSize * Maximum page size. * * Fewer tasks than requested might be returned, even if more tasks exist; use - * [next_page_token][google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token] in the response to + * {@link google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token|next_page_token} in the response to * determine if more tasks exist. * * The maximum page size is 1000. If unspecified, the page size will be the @@ -1867,8 +1912,8 @@ export class CloudTasksClient { * * 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.tasks.v2beta3.ListTasksResponse.next_page_token] returned - * from the previous call to [ListTasks][google.cloud.tasks.v2beta3.CloudTasks.ListTasks] + * {@link google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token|next_page_token} returned + * from the previous call to {@link google.cloud.tasks.v2beta3.CloudTasks.ListTasks|ListTasks} * method. * * The page token is valid for only 2 hours. @@ -1891,6 +1936,7 @@ export class CloudTasksClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listTasks.createStream( this._innerApiCalls.listTasks as gax.GaxCall, request, @@ -2078,8 +2124,9 @@ export class CloudTasksClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudTasksStub.then(stub => { + return this.cloudTasksStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/synth.metadata b/synth.metadata index 4a13feef..7013c482 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,13 +1,13 @@ { - "updateTime": "2020-02-29T12:46:32.088143Z", + "updateTime": "2020-03-05T23:17:35.829582Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "83c6f84035ee0f80eaa44d8b688a010461cc4080", - "internalRef": "297918498", - "log": "83c6f84035ee0f80eaa44d8b688a010461cc4080\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" + "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\n" } }, { diff --git a/test/gapic-cloud_tasks-v2.ts b/test/gapic-cloud_tasks-v2.ts index f9280a7e..67cc448c 100644 --- a/test/gapic-cloud_tasks-v2.ts +++ b/test/gapic-cloud_tasks-v2.ts @@ -81,12 +81,30 @@ describe('v2.CloudTasksClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudtasksModule.v2.CloudTasksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudTasksStub, undefined); + await client.initialize(); + assert(client.cloudTasksStub); + }); + it('has close method', () => { + const client = new cloudtasksModule.v2.CloudTasksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('getQueue', () => { it('invokes getQueue without error', done => { const client = new cloudtasksModule.v2.CloudTasksClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IGetQueueRequest = {}; request.name = ''; @@ -110,6 +128,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IGetQueueRequest = {}; request.name = ''; @@ -135,6 +155,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.ICreateQueueRequest = {}; request.parent = ''; @@ -158,6 +180,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.ICreateQueueRequest = {}; request.parent = ''; @@ -183,6 +207,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IUpdateQueueRequest = {}; request.queue = {}; @@ -207,6 +233,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IUpdateQueueRequest = {}; request.queue = {}; @@ -233,6 +261,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IDeleteQueueRequest = {}; request.name = ''; @@ -256,6 +286,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IDeleteQueueRequest = {}; request.name = ''; @@ -281,6 +313,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IPurgeQueueRequest = {}; request.name = ''; @@ -304,6 +338,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IPurgeQueueRequest = {}; request.name = ''; @@ -329,6 +365,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IPauseQueueRequest = {}; request.name = ''; @@ -352,6 +390,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IPauseQueueRequest = {}; request.name = ''; @@ -377,6 +417,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IResumeQueueRequest = {}; request.name = ''; @@ -400,6 +442,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IResumeQueueRequest = {}; request.name = ''; @@ -425,6 +469,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -448,6 +494,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -473,6 +521,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -496,6 +546,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -521,6 +573,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -544,6 +598,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -569,6 +625,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IGetTaskRequest = {}; request.name = ''; @@ -592,6 +650,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IGetTaskRequest = {}; request.name = ''; @@ -617,6 +677,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.ICreateTaskRequest = {}; request.parent = ''; @@ -640,6 +702,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.ICreateTaskRequest = {}; request.parent = ''; @@ -665,6 +729,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IDeleteTaskRequest = {}; request.name = ''; @@ -688,6 +754,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IDeleteTaskRequest = {}; request.name = ''; @@ -713,6 +781,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IRunTaskRequest = {}; request.name = ''; @@ -736,6 +806,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IRunTaskRequest = {}; request.name = ''; @@ -761,6 +833,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IListQueuesRequest = {}; request.parent = ''; @@ -788,6 +862,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IListQueuesRequest = {}; request.parent = ''; @@ -820,6 +896,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IListTasksRequest = {}; request.parent = ''; @@ -847,6 +925,8 @@ describe('v2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2.IListTasksRequest = {}; request.parent = ''; diff --git a/test/gapic-cloud_tasks-v2beta2.ts b/test/gapic-cloud_tasks-v2beta2.ts index c00bf510..0f5ca6a9 100644 --- a/test/gapic-cloud_tasks-v2beta2.ts +++ b/test/gapic-cloud_tasks-v2beta2.ts @@ -81,12 +81,30 @@ describe('v2beta2.CloudTasksClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudtasksModule.v2beta2.CloudTasksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudTasksStub, undefined); + await client.initialize(); + assert(client.cloudTasksStub); + }); + it('has close method', () => { + const client = new cloudtasksModule.v2beta2.CloudTasksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('getQueue', () => { it('invokes getQueue without error', done => { const client = new cloudtasksModule.v2beta2.CloudTasksClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IGetQueueRequest = {}; request.name = ''; @@ -110,6 +128,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IGetQueueRequest = {}; request.name = ''; @@ -135,6 +155,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ICreateQueueRequest = {}; request.parent = ''; @@ -158,6 +180,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ICreateQueueRequest = {}; request.parent = ''; @@ -183,6 +207,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IUpdateQueueRequest = {}; request.queue = {}; @@ -207,6 +233,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IUpdateQueueRequest = {}; request.queue = {}; @@ -233,6 +261,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IDeleteQueueRequest = {}; request.name = ''; @@ -256,6 +286,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IDeleteQueueRequest = {}; request.name = ''; @@ -281,6 +313,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IPurgeQueueRequest = {}; request.name = ''; @@ -304,6 +338,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IPurgeQueueRequest = {}; request.name = ''; @@ -329,6 +365,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IPauseQueueRequest = {}; request.name = ''; @@ -352,6 +390,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IPauseQueueRequest = {}; request.name = ''; @@ -377,6 +417,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IResumeQueueRequest = {}; request.name = ''; @@ -400,6 +442,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IResumeQueueRequest = {}; request.name = ''; @@ -425,6 +469,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -448,6 +494,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -473,6 +521,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -496,6 +546,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -521,6 +573,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -544,6 +598,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -569,6 +625,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IGetTaskRequest = {}; request.name = ''; @@ -592,6 +650,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IGetTaskRequest = {}; request.name = ''; @@ -617,6 +677,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ICreateTaskRequest = {}; request.parent = ''; @@ -640,6 +702,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ICreateTaskRequest = {}; request.parent = ''; @@ -665,6 +729,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IDeleteTaskRequest = {}; request.name = ''; @@ -688,6 +754,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IDeleteTaskRequest = {}; request.name = ''; @@ -713,6 +781,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ILeaseTasksRequest = {}; request.parent = ''; @@ -736,6 +806,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ILeaseTasksRequest = {}; request.parent = ''; @@ -761,6 +833,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IAcknowledgeTaskRequest = {}; request.name = ''; @@ -784,6 +858,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IAcknowledgeTaskRequest = {}; request.name = ''; @@ -809,6 +885,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IRenewLeaseRequest = {}; request.name = ''; @@ -832,6 +910,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IRenewLeaseRequest = {}; request.name = ''; @@ -857,6 +937,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ICancelLeaseRequest = {}; request.name = ''; @@ -880,6 +962,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.ICancelLeaseRequest = {}; request.name = ''; @@ -905,6 +989,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IRunTaskRequest = {}; request.name = ''; @@ -928,6 +1014,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IRunTaskRequest = {}; request.name = ''; @@ -953,6 +1041,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IListQueuesRequest = {}; request.parent = ''; @@ -980,6 +1070,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IListQueuesRequest = {}; request.parent = ''; @@ -1012,6 +1104,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IListTasksRequest = {}; request.parent = ''; @@ -1039,6 +1133,8 @@ describe('v2beta2.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta2.IListTasksRequest = {}; request.parent = ''; diff --git a/test/gapic-cloud_tasks-v2beta3.ts b/test/gapic-cloud_tasks-v2beta3.ts index 548bdef7..0d7299ab 100644 --- a/test/gapic-cloud_tasks-v2beta3.ts +++ b/test/gapic-cloud_tasks-v2beta3.ts @@ -81,12 +81,30 @@ describe('v2beta3.CloudTasksClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudtasksModule.v2beta3.CloudTasksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudTasksStub, undefined); + await client.initialize(); + assert(client.cloudTasksStub); + }); + it('has close method', () => { + const client = new cloudtasksModule.v2beta3.CloudTasksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('getQueue', () => { it('invokes getQueue without error', done => { const client = new cloudtasksModule.v2beta3.CloudTasksClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IGetQueueRequest = {}; request.name = ''; @@ -110,6 +128,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IGetQueueRequest = {}; request.name = ''; @@ -135,6 +155,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.ICreateQueueRequest = {}; request.parent = ''; @@ -158,6 +180,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.ICreateQueueRequest = {}; request.parent = ''; @@ -183,6 +207,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IUpdateQueueRequest = {}; request.queue = {}; @@ -207,6 +233,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IUpdateQueueRequest = {}; request.queue = {}; @@ -233,6 +261,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IDeleteQueueRequest = {}; request.name = ''; @@ -256,6 +286,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IDeleteQueueRequest = {}; request.name = ''; @@ -281,6 +313,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IPurgeQueueRequest = {}; request.name = ''; @@ -304,6 +338,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IPurgeQueueRequest = {}; request.name = ''; @@ -329,6 +365,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IPauseQueueRequest = {}; request.name = ''; @@ -352,6 +390,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IPauseQueueRequest = {}; request.name = ''; @@ -377,6 +417,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IResumeQueueRequest = {}; request.name = ''; @@ -400,6 +442,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IResumeQueueRequest = {}; request.name = ''; @@ -425,6 +469,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -448,6 +494,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -473,6 +521,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -496,6 +546,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -521,6 +573,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -544,6 +598,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -569,6 +625,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IGetTaskRequest = {}; request.name = ''; @@ -592,6 +650,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IGetTaskRequest = {}; request.name = ''; @@ -617,6 +677,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.ICreateTaskRequest = {}; request.parent = ''; @@ -640,6 +702,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.ICreateTaskRequest = {}; request.parent = ''; @@ -665,6 +729,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IDeleteTaskRequest = {}; request.name = ''; @@ -688,6 +754,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IDeleteTaskRequest = {}; request.name = ''; @@ -713,6 +781,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IRunTaskRequest = {}; request.name = ''; @@ -736,6 +806,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IRunTaskRequest = {}; request.name = ''; @@ -761,6 +833,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IListQueuesRequest = {}; request.parent = ''; @@ -788,6 +862,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IListQueuesRequest = {}; request.parent = ''; @@ -820,6 +896,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IListTasksRequest = {}; request.parent = ''; @@ -847,6 +925,8 @@ describe('v2beta3.CloudTasksClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.tasks.v2beta3.IListTasksRequest = {}; request.parent = '';