From dfedad5f1098caf1f33a2b58a4e20aa27a8e3a24 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 22 Jun 2021 00:51:18 +0000 Subject: [PATCH 1/2] chore: remove all monolith Bazel deps chore: release gapic-generator-csharp v1.3.7 chore: release gapic-generator-go 0.20.5 chore: release gapic-generator-java 1.0.14 chore: release gapic-generator-php 1.0.1 chore: release gapic-generator-python 0.50.0 chore: update gapic-generator-ruby to the latest commit chore: release gapic-generator-typescript 1.5.0 Committer: @miraleung PiperOrigin-RevId: 380641501 Source-Link: https://github.com/googleapis/googleapis/commit/076f7e9f0b258bdb54338895d7251b202e8f0de3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/27e4c88b4048e5f56508d4e1aa417d60a3380892 --- owl-bot-staging/v1/.eslintignore | 6 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 10 + owl-bot-staging/v1/package.json | 64 + .../cloud/scheduler/v1/cloudscheduler.proto | 268 ++++ .../google/cloud/scheduler/v1/job.proto | 237 ++++ .../google/cloud/scheduler/v1/target.proto | 356 +++++ owl-bot-staging/v1/src/index.ts | 25 + .../v1/src/v1/cloud_scheduler_client.ts | 1168 +++++++++++++++++ .../src/v1/cloud_scheduler_client_config.json | 66 + .../v1/src/v1/cloud_scheduler_proto_list.json | 5 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 107 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_cloud_scheduler_v1.ts | 1097 ++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1beta1/.eslintignore | 6 + owl-bot-staging/v1beta1/.eslintrc.json | 3 + owl-bot-staging/v1beta1/.gitignore | 14 + owl-bot-staging/v1beta1/.jsdoc.js | 55 + owl-bot-staging/v1beta1/.mocharc.js | 33 + owl-bot-staging/v1beta1/.prettierrc.js | 22 + owl-bot-staging/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 10 + owl-bot-staging/v1beta1/package.json | 64 + .../scheduler/v1beta1/cloudscheduler.proto | 267 ++++ .../google/cloud/scheduler/v1beta1/job.proto | 239 ++++ .../cloud/scheduler/v1beta1/target.proto | 356 +++++ owl-bot-staging/v1beta1/src/index.ts | 25 + .../src/v1beta1/cloud_scheduler_client.ts | 1168 +++++++++++++++++ .../cloud_scheduler_client_config.json | 66 + .../v1beta1/cloud_scheduler_proto_list.json | 5 + .../v1beta1/src/v1beta1/gapic_metadata.json | 107 ++ owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + .../test/gapic_cloud_scheduler_v1beta1.ts | 1097 ++++++++++++++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 + 48 files changed, 7495 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts create mode 100644 owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1beta1/.eslintignore create mode 100644 owl-bot-staging/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1beta1/.gitignore create mode 100644 owl-bot-staging/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1beta1/README.md create mode 100644 owl-bot-staging/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1beta1/package.json create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts create mode 100644 owl-bot-staging/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 00000000..521dc25a --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 00000000..a3c17684 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/scheduler', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 00000000..90fa2a2d --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Scheduler: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 00000000..29a223b6 --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 00000000..0d466273 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/scheduler", + "version": "0.1.0", + "description": "Scheduler client for Node.js", + "repository": "googleapis/nodejs-scheduler", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google scheduler", + "scheduler", + "cloud scheduler" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.15.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^8.4.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto new file mode 100644 index 00000000..89ce8cbd --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto @@ -0,0 +1,268 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.scheduler.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/scheduler/v1/job.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler"; +option java_multiple_files = true; +option java_outer_classname = "SchedulerProto"; +option java_package = "com.google.cloud.scheduler.v1"; +option objc_class_prefix = "SCHEDULER"; + +// The Cloud Scheduler API allows external entities to reliably +// schedule asynchronous jobs. +service CloudScheduler { + option (google.api.default_host) = "cloudscheduler.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists jobs. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/jobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a job. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a job. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/jobs" + body: "job" + }; + option (google.api.method_signature) = "parent,job"; + } + + // Updates a job. + // + // If successful, the updated [Job][google.cloud.scheduler.v1.Job] is returned. If the job does + // not exist, `NOT_FOUND` is returned. + // + // If UpdateJob does not successfully return, it is possible for the + // job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1.Job.State.UPDATE_FAILED] state. A job in this state may + // not be executed. If this happens, retry the UpdateJob request + // until a successful response is received. + rpc UpdateJob(UpdateJobRequest) returns (Job) { + option (google.api.http) = { + patch: "/v1/{job.name=projects/*/locations/*/jobs/*}" + body: "job" + }; + option (google.api.method_signature) = "job,update_mask"; + } + + // Deletes a job. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Pauses a job. + // + // If a job is paused then the system will stop executing the job + // until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob]. The + // state of the job is stored in [state][google.cloud.scheduler.v1.Job.state]; if paused it + // will be set to [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] + // to be paused. + rpc PauseJob(PauseJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/jobs/*}:pause" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Resume a job. + // + // This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. The + // state of a job is stored in [Job.state][google.cloud.scheduler.v1.Job.state]; after calling this method it + // will be set to [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in + // [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. + rpc ResumeJob(ResumeJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/jobs/*}:resume" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Forces a job to run now. + // + // When this method is called, Cloud Scheduler will dispatch the job, even + // if the job is already running. + rpc RunJob(RunJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/jobs/*}:run" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. +message ListJobsRequest { + // Required. The location name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudscheduler.googleapis.com/Job" + } + ]; + + // Requested page size. + // + // The maximum page size is 500. If unspecified, the page size will + // be the maximum. Fewer jobs than requested might be returned, + // even if more jobs exist; use next_page_token to determine if more + // jobs exist. + int32 page_size = 5; + + // A token identifying a page of results the server will return. To + // request the first page results, page_token must be empty. To + // request the next page of results, page_token must be the value of + // [next_page_token][google.cloud.scheduler.v1.ListJobsResponse.next_page_token] returned from + // the previous call to [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. It is an error to + // switch the value of [filter][google.cloud.scheduler.v1.ListJobsRequest.filter] or + // [order_by][google.cloud.scheduler.v1.ListJobsRequest.order_by] while iterating through pages. + string page_token = 6; +} + +// Response message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. +message ListJobsResponse { + // The list of jobs. + repeated Job jobs = 1; + + // A token to retrieve next page of results. Pass this value in the + // [page_token][google.cloud.scheduler.v1.ListJobsRequest.page_token] field in the subsequent call to + // [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs] to retrieve the next page of results. + // If this is empty it indicates that there are no more results + // through which to paginate. + // + // The page token is valid for only 2 hours. + string next_page_token = 2; +} + +// Request message for [GetJob][google.cloud.scheduler.v1.CloudScheduler.GetJob]. +message GetJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob]. +message CreateJobRequest { + // Required. The location name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudscheduler.googleapis.com/Job" + } + ]; + + // Required. The job to add. The user can optionally specify a name for the + // job in [name][google.cloud.scheduler.v1.Job.name]. [name][google.cloud.scheduler.v1.Job.name] cannot be the same as an + // existing job. If a name is not specified then the system will + // generate a random unique name that will be returned + // ([name][google.cloud.scheduler.v1.Job.name]) in the response. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]. +message UpdateJobRequest { + // Required. The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be specified. + // + // Output only fields cannot be modified using UpdateJob. + // Any value specified for an output only field will be ignored. + Job job = 1 [(google.api.field_behavior) = REQUIRED]; + + // A mask used to specify which fields of the job are being updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for deleting a job using +// [DeleteJob][google.cloud.scheduler.v1.CloudScheduler.DeleteJob]. +message DeleteJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for [PauseJob][google.cloud.scheduler.v1.CloudScheduler.PauseJob]. +message PauseJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob]. +message ResumeJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for forcing a job to run now using +// [RunJob][google.cloud.scheduler.v1.CloudScheduler.RunJob]. +message RunJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto new file mode 100644 index 00000000..d2607026 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto @@ -0,0 +1,237 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.scheduler.v1; + +import "google/api/resource.proto"; +import "google/cloud/scheduler/v1/target.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler"; +option java_multiple_files = true; +option java_outer_classname = "JobProto"; +option java_package = "com.google.cloud.scheduler.v1"; + +// Configuration for a job. +// The maximum allowed size for a job is 100KB. +message Job { + option (google.api.resource) = { + type: "cloudscheduler.googleapis.com/Job" + pattern: "projects/{project}/locations/{location}/jobs/{job}" + }; + + // State of the job. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The job is executing normally. + ENABLED = 1; + + // The job is paused by the user. It will not execute. A user can + // intentionally pause the job using + // [PauseJobRequest][google.cloud.scheduler.v1.PauseJobRequest]. + PAUSED = 2; + + // The job is disabled by the system due to error. The user + // cannot directly set a job to be disabled. + DISABLED = 3; + + // The job state resulting from a failed [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob] + // operation. To recover a job from this state, retry + // [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob] until a successful response is received. + UPDATE_FAILED = 4; + } + + // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob], after + // which it becomes output only. + // + // The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + // + // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + // hyphens (-), colons (:), or periods (.). + // For more information, see + // [Identifying + // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + // * `LOCATION_ID` is the canonical ID for the job's location. + // The list of available locations can be obtained by calling + // [ListLocations][google.cloud.location.Locations.ListLocations]. + // For more information, see https://cloud.google.com/about/locations/. + // * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + // hyphens (-), or underscores (_). The maximum length is 500 characters. + string name = 1; + + // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob] or + // [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]. + // + // A human-readable description for the job. This string must not contain + // more than 500 characters. + string description = 2; + + // Required. + // + // Delivery settings containing destination and parameters. + oneof target { + // Pub/Sub target. + PubsubTarget pubsub_target = 4; + + // App Engine HTTP target. + AppEngineHttpTarget app_engine_http_target = 5; + + // HTTP target. + HttpTarget http_target = 6; + } + + // Required, except when used with [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]. + // + // Describes the schedule on which the job will be executed. + // + // The schedule can be either of the following types: + // + // * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview) + // * English-like + // [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) + // + // As a general rule, execution `n + 1` of a job will not begin + // until execution `n` has finished. Cloud Scheduler will never + // allow two simultaneously outstanding executions. For example, + // this implies that if the `n+1`th execution is scheduled to run at + // 16:00 but the `n`th execution takes until 16:15, the `n+1`th + // execution will not start until `16:15`. + // A scheduled start time will be delayed if the previous + // execution has not ended when its scheduled time occurs. + // + // If [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] > 0 and a job attempt fails, + // the job will be tried a total of [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] + // times, with exponential backoff, until the next scheduled start + // time. + string schedule = 20; + + // Specifies the time zone to be used in interpreting + // [schedule][google.cloud.scheduler.v1.Job.schedule]. The value of this field must be a time + // zone name from the [tz database](http://en.wikipedia.org/wiki/Tz_database). + // + // Note that some time zones include a provision for + // daylight savings time. The rules for daylight saving time are + // determined by the chosen tz. For UTC use the string "utc". If a + // time zone is not specified, the default will be in UTC (also known + // as GMT). + string time_zone = 21; + + // Output only. The creation time of the job. + google.protobuf.Timestamp user_update_time = 9; + + // Output only. State of the job. + State state = 10; + + // Output only. The response from the target for the last attempted execution. + google.rpc.Status status = 11; + + // Output only. The next time the job is scheduled. Note that this may be a + // retry of a previously failed attempt or the next execution time + // according to the schedule. + google.protobuf.Timestamp schedule_time = 17; + + // Output only. The time the last job attempt started. + google.protobuf.Timestamp last_attempt_time = 18; + + // Settings that determine the retry behavior. + RetryConfig retry_config = 19; + + // The deadline for job attempts. If the request handler does not respond by + // this deadline then the request is cancelled and the attempt is marked as a + // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in + // execution logs. Cloud Scheduler will retry the job according + // to the [RetryConfig][google.cloud.scheduler.v1.RetryConfig]. + // + // The allowed duration for this deadline is: + // * For [HTTP targets][google.cloud.scheduler.v1.Job.http_target], between 15 seconds and 30 minutes. + // * For [App Engine HTTP targets][google.cloud.scheduler.v1.Job.app_engine_http_target], between 15 + // seconds and 24 hours. + google.protobuf.Duration attempt_deadline = 22; +} + +// Settings that determine the retry behavior. +// +// By default, if a job does not complete successfully (meaning that +// an acknowledgement is not received from the handler, then it will be retried +// with exponential backoff according to the settings in [RetryConfig][google.cloud.scheduler.v1.RetryConfig]. +message RetryConfig { + // The number of attempts that the system will make to run a job using the + // exponential backoff procedure described by + // [max_doublings][google.cloud.scheduler.v1.RetryConfig.max_doublings]. + // + // The default value of retry_count is zero. + // + // If retry_count is zero, a job attempt will *not* be retried if + // it fails. Instead the Cloud Scheduler system will wait for the + // next scheduled execution time. + // + // If retry_count is set to a non-zero number then Cloud Scheduler + // will retry failed attempts, using exponential backoff, + // retry_count times, or until the next scheduled execution time, + // whichever comes first. + // + // Values greater than 5 and negative values are not allowed. + int32 retry_count = 1; + + // The time limit for retrying a failed job, measured from time when an + // execution was first attempted. If specified with + // [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count], the job will be retried until both + // limits are reached. + // + // The default value for max_retry_duration is zero, which means retry + // duration is unlimited. + google.protobuf.Duration max_retry_duration = 2; + + // The minimum amount of time to wait before retrying a job after + // it fails. + // + // The default value of this field is 5 seconds. + google.protobuf.Duration min_backoff_duration = 3; + + // The maximum amount of time to wait before retrying a job after + // it fails. + // + // The default value of this field is 1 hour. + google.protobuf.Duration max_backoff_duration = 4; + + // The time between retries will double `max_doublings` times. + // + // A job's retry interval starts at + // [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration], then doubles + // `max_doublings` times, then increases linearly, and finally + // retries retries at intervals of + // [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] up to + // [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times. + // + // For example, if [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration] is + // 10s, [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] is 300s, and + // `max_doublings` is 3, then the a job will first be retried in 10s. The + // retry interval will double three times, and then increase linearly by + // 2^3 * 10s. Finally, the job will retry at intervals of + // [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] until the job has + // been attempted [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times. Thus, the + // requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... + // + // The default value of this field is 5. + int32 max_doublings = 5; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto new file mode 100644 index 00000000..9a8f32f7 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto @@ -0,0 +1,356 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.scheduler.v1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler"; +option java_multiple_files = true; +option java_outer_classname = "TargetProto"; +option java_package = "com.google.cloud.scheduler.v1"; + +// Http target. The job will be pushed to the job handler by means of +// an HTTP request via an [http_method][google.cloud.scheduler.v1.HttpTarget.http_method] such as HTTP +// POST, HTTP GET, etc. The job is acknowledged by means of an HTTP +// response code in the range [200 - 299]. A failure to receive a response +// constitutes a failed execution. For a redirected request, the response +// returned by the redirected request is considered. +message HttpTarget { + // Required. The full URI path that the request will be sent to. This string + // must begin with either "http://" or "https://". Some examples of + // valid values for [uri][google.cloud.scheduler.v1.HttpTarget.uri] are: + // `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will + // encode some characters for safety and compatibility. The maximum allowed + // URL length is 2083 characters after encoding. + string uri = 1; + + // Which HTTP method to use for the request. + HttpMethod http_method = 2; + + // The user can specify HTTP request headers to send with the job's + // HTTP request. This map contains the header field names and + // values. Repeated headers are not supported, but a header value can + // contain commas. These headers represent a subset of the headers + // that will accompany the job's HTTP request. Some HTTP request + // headers will be ignored or replaced. A partial list of headers that + // will be ignored or replaced is below: + // - Host: This will be computed by Cloud Scheduler and derived from + // [uri][google.cloud.scheduler.v1.HttpTarget.uri]. + // * `Content-Length`: This will be computed by Cloud Scheduler. + // * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`. + // * `X-Google-*`: Google internal use only. + // * `X-AppEngine-*`: Google internal use only. + // + // The total size of headers must be less than 80KB. + map headers = 3; + + // HTTP request body. A request body is allowed only if the HTTP + // method is POST, PUT, or PATCH. It is an error to set body on a job with an + // incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod]. + bytes body = 4; + + // The mode for generating an `Authorization` header for HTTP requests. + // + // If specified, all `Authorization` headers in the [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.headers] + // field will be overridden. + oneof authorization_header { + // If specified, an + // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) + // will be generated and attached as an `Authorization` header in the HTTP + // request. + // + // This type of authorization should generally only be used when calling + // Google APIs hosted on *.googleapis.com. + OAuthToken oauth_token = 5; + + // If specified, an + // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) + // token will be generated and attached as an `Authorization` header in the + // HTTP request. + // + // This type of authorization can be used for many scenarios, including + // calling Cloud Run, or endpoints where you intend to validate the token + // yourself. + OidcToken oidc_token = 6; + } +} + +// App Engine target. The job will be pushed to a job handler by means +// of an HTTP request via an [http_method][google.cloud.scheduler.v1.AppEngineHttpTarget.http_method] such +// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an +// HTTP response code in the range [200 - 299]. Error 503 is +// considered an App Engine system error instead of an application +// error. Requests returning error 503 will be retried regardless of +// retry configuration and not counted against retry counts. Any other +// response code, or a failure to receive a response before the +// deadline, constitutes a failed attempt. +message AppEngineHttpTarget { + // The HTTP method to use for the request. PATCH and OPTIONS are not + // permitted. + HttpMethod http_method = 1; + + // App Engine Routing setting for the job. + AppEngineRouting app_engine_routing = 2; + + // The relative URI. + // + // The relative URL must begin with "/" and must be a valid HTTP relative URL. + // It can contain a path, query string arguments, and `#` fragments. + // If the relative URL is empty, then the root path "/" will be used. + // No spaces are allowed, and the maximum length allowed is 2083 characters. + string relative_uri = 3; + + // HTTP request headers. + // + // This map contains the header field names and values. Headers can be set + // when the job is created. + // + // Cloud Scheduler sets some headers to default values: + // + // * `User-Agent`: By default, this header is + // `"AppEngine-Google; (+http://code.google.com/appengine)"`. + // This header can be modified, but Cloud Scheduler will append + // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the + // modified `User-Agent`. + // * `X-CloudScheduler`: This header will be set to true. + // + // If the job has an [body][google.cloud.scheduler.v1.AppEngineHttpTarget.body], Cloud Scheduler sets + // the following headers: + // + // * `Content-Type`: By default, the `Content-Type` header is set to + // `"application/octet-stream"`. The default can be overridden by explictly + // setting `Content-Type` to a particular media type when the job is + // created. + // For example, `Content-Type` can be set to `"application/json"`. + // * `Content-Length`: This is computed by Cloud Scheduler. This value is + // output only. It cannot be changed. + // + // The headers below are output only. They cannot be set or overridden: + // + // * `X-Google-*`: For Google internal use only. + // * `X-AppEngine-*`: For Google internal use only. + // + // In addition, some App Engine headers, which contain + // job-specific information, are also be sent to the job handler. + map headers = 4; + + // Body. + // + // HTTP request body. A request body is allowed only if the HTTP method is + // POST or PUT. It will result in invalid argument error to set a body on a + // job with an incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod]. + bytes body = 5; +} + +// Pub/Sub target. The job will be delivered by publishing a message to +// the given Pub/Sub topic. +message PubsubTarget { + // Required. The name of the Cloud Pub/Sub topic to which messages will + // be published when a job is delivered. The topic name must be in the + // same format as required by PubSub's + // [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), + // for example `projects/PROJECT_ID/topics/TOPIC_ID`. + // + // The topic must be in the same project as the Cloud Scheduler job. + string topic_name = 1 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + + // The message payload for PubsubMessage. + // + // Pubsub message must contain either non-empty data, or at least one + // attribute. + bytes data = 3; + + // Attributes for PubsubMessage. + // + // Pubsub message must contain either non-empty data, or at least one + // attribute. + map attributes = 4; +} + +// App Engine Routing. +// +// For more information about services, versions, and instances see +// [An Overview of App +// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), +// [Microservices Architecture on Google App +// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), +// [App Engine Standard request +// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), +// and [App Engine Flex request +// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). +message AppEngineRouting { + // App service. + // + // By default, the job is sent to the service which is the default + // service when the job is attempted. + string service = 1; + + // App version. + // + // By default, the job is sent to the version which is the default + // version when the job is attempted. + string version = 2; + + // App instance. + // + // By default, the job is sent to an instance which is available when + // the job is attempted. + // + // Requests can only be sent to a specific instance if + // [manual scaling is used in App Engine + // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + // App Engine Flex does not support instances. For more information, see + // [App Engine Standard request + // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + // and [App Engine Flex request + // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + string instance = 3; + + // Output only. The host that the job is sent to. + // + // For more information about how App Engine requests are routed, see + // [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). + // + // The host is constructed as: + // + // + // * `host = [application_domain_name]`
+ // `| [service] + '.' + [application_domain_name]`
+ // `| [version] + '.' + [application_domain_name]`
+ // `| [version_dot_service]+ '.' + [application_domain_name]`
+ // `| [instance] + '.' + [application_domain_name]`
+ // `| [instance_dot_service] + '.' + [application_domain_name]`
+ // `| [instance_dot_version] + '.' + [application_domain_name]`
+ // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` + // + // * `application_domain_name` = The domain name of the app, for + // example .appspot.com, which is associated with the + // job's project ID. + // + // * `service =` [service][google.cloud.scheduler.v1.AppEngineRouting.service] + // + // * `version =` [version][google.cloud.scheduler.v1.AppEngineRouting.version] + // + // * `version_dot_service =` + // [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +` + // [service][google.cloud.scheduler.v1.AppEngineRouting.service] + // + // * `instance =` [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] + // + // * `instance_dot_service =` + // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +` + // [service][google.cloud.scheduler.v1.AppEngineRouting.service] + // + // * `instance_dot_version =` + // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +` + // [version][google.cloud.scheduler.v1.AppEngineRouting.version] + // + // * `instance_dot_version_dot_service =` + // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +` + // [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +` + // [service][google.cloud.scheduler.v1.AppEngineRouting.service] + // + // + // If [service][google.cloud.scheduler.v1.AppEngineRouting.service] is empty, then the job will be sent + // to the service which is the default service when the job is attempted. + // + // If [version][google.cloud.scheduler.v1.AppEngineRouting.version] is empty, then the job will be sent + // to the version which is the default version when the job is attempted. + // + // If [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is empty, then the job will be + // sent to an instance which is available when the job is attempted. + // + // If [service][google.cloud.scheduler.v1.AppEngineRouting.service], + // [version][google.cloud.scheduler.v1.AppEngineRouting.version], or + // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is invalid, then the job will be sent + // to the default version of the default service when the job is attempted. + string host = 4; +} + +// The HTTP method used to execute the job. +enum HttpMethod { + // HTTP method unspecified. Defaults to POST. + HTTP_METHOD_UNSPECIFIED = 0; + + // HTTP POST + POST = 1; + + // HTTP GET + GET = 2; + + // HTTP HEAD + HEAD = 3; + + // HTTP PUT + PUT = 4; + + // HTTP DELETE + DELETE = 5; + + // HTTP PATCH + PATCH = 6; + + // HTTP OPTIONS + OPTIONS = 7; +} + +// Contains information needed for generating an +// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). +// This type of authorization should generally only be used when calling Google +// APIs hosted on *.googleapis.com. +message OAuthToken { + // [Service account email](https://cloud.google.com/iam/docs/service-accounts) + // to be used for generating OAuth token. + // The service account must be within the same project as the job. The caller + // must have iam.serviceAccounts.actAs permission for the service account. + string service_account_email = 1; + + // OAuth scope to be used for generating OAuth access token. + // If not specified, "https://www.googleapis.com/auth/cloud-platform" + // will be used. + string scope = 2; +} + +// Contains information needed for generating an +// [OpenID Connect +// token](https://developers.google.com/identity/protocols/OpenIDConnect). +// This type of authorization can be used for many scenarios, including +// calling Cloud Run, or endpoints where you intend to validate the token +// yourself. +message OidcToken { + // [Service account email](https://cloud.google.com/iam/docs/service-accounts) + // to be used for generating OIDC token. + // The service account must be within the same project as the job. The caller + // must have iam.serviceAccounts.actAs permission for the service account. + string service_account_email = 1; + + // Audience to be used when generating OIDC token. If not specified, the URI + // specified in target will be used. + string audience = 2; +} + +// The Pub/Sub Topic resource definition is in google/cloud/pubsub/v1/, +// but we do not import that proto directly; therefore, we redefine the +// pattern here. +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 00000000..22cac7b5 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const CloudSchedulerClient = v1.CloudSchedulerClient; +type CloudSchedulerClient = v1.CloudSchedulerClient; +export {v1, CloudSchedulerClient}; +export default {v1, CloudSchedulerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts b/owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts new file mode 100644 index 00000000..92fecf17 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts @@ -0,0 +1,1168 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_scheduler_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_scheduler_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The Cloud Scheduler API allows external entities to reliably + * schedule asynchronous jobs. + * @class + * @memberof v1 + */ +export class CloudSchedulerClient { + 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; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + cloudSchedulerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudSchedulerClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * 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 {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudSchedulerClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + 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 = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + 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/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/jobs/{job}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.scheduler.v1.CloudScheduler', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudSchedulerStub) { + return this.cloudSchedulerStub; + } + + // Put together the "service stub" for + // google.cloud.scheduler.v1.CloudScheduler. + this.cloudSchedulerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.scheduler.v1.CloudScheduler') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.scheduler.v1.CloudScheduler, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudSchedulerStubMethods = + ['listJobs', 'getJob', 'createJob', 'updateJob', 'deleteJob', 'pauseJob', 'resumeJob', 'runJob']; + for (const methodName of cloudSchedulerStubMethods) { + const callPromise = this.cloudSchedulerStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudSchedulerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudscheduler.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudscheduler.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getJob( + request?: protos.google.cloud.scheduler.v1.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.cloud.scheduler.v1.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.cloud.scheduler.v1.IGetJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getJob(request); + */ + getJob( + request?: protos.google.cloud.scheduler.v1.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } + createJob( + request?: protos.google.cloud.scheduler.v1.ICreateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.ICreateJobRequest|undefined, {}|undefined + ]>; + createJob( + request: protos.google.cloud.scheduler.v1.ICreateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request: protos.google.cloud.scheduler.v1.ICreateJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {google.cloud.scheduler.v1.Job} request.job + * Required. The job to add. The user can optionally specify a name for the + * job in {@link google.cloud.scheduler.v1.Job.name|name}. {@link google.cloud.scheduler.v1.Job.name|name} cannot be the same as an + * existing job. If a name is not specified then the system will + * generate a random unique name that will be returned + * ({@link google.cloud.scheduler.v1.Job.name|name}) in the response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createJob(request); + */ + createJob( + request?: protos.google.cloud.scheduler.v1.ICreateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.ICreateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createJob(request, options, callback); + } + updateJob( + request?: protos.google.cloud.scheduler.v1.IUpdateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IUpdateJobRequest|undefined, {}|undefined + ]>; + updateJob( + request: protos.google.cloud.scheduler.v1.IUpdateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request: protos.google.cloud.scheduler.v1.IUpdateJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a job. + * + * If successful, the updated {@link google.cloud.scheduler.v1.Job|Job} is returned. If the job does + * not exist, `NOT_FOUND` is returned. + * + * If UpdateJob does not successfully return, it is possible for the + * job to be in an {@link google.cloud.scheduler.v1.Job.State.UPDATE_FAILED|Job.State.UPDATE_FAILED} state. A job in this state may + * not be executed. If this happens, retry the UpdateJob request + * until a successful response is received. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.scheduler.v1.Job} request.job + * Required. The new job properties. {@link google.cloud.scheduler.v1.Job.name|name} must be specified. + * + * Output only fields cannot be modified using UpdateJob. + * Any value specified for an output only field will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * A mask used to specify which fields of the job are being updated. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateJob(request); + */ + updateJob( + request?: protos.google.cloud.scheduler.v1.IUpdateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IUpdateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'job.name': request.job!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateJob(request, options, callback); + } + deleteJob( + request?: protos.google.cloud.scheduler.v1.IDeleteJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1.IDeleteJobRequest|undefined, {}|undefined + ]>; + deleteJob( + request: protos.google.cloud.scheduler.v1.IDeleteJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request: protos.google.cloud.scheduler.v1.IDeleteJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteJob(request); + */ + deleteJob( + request?: protos.google.cloud.scheduler.v1.IDeleteJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1.IDeleteJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteJob(request, options, callback); + } + pauseJob( + request?: protos.google.cloud.scheduler.v1.IPauseJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IPauseJobRequest|undefined, {}|undefined + ]>; + pauseJob( + request: protos.google.cloud.scheduler.v1.IPauseJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, + {}|null|undefined>): void; + pauseJob( + request: protos.google.cloud.scheduler.v1.IPauseJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Pauses a job. + * + * If a job is paused then the system will stop executing the job + * until it is re-enabled via {@link google.cloud.scheduler.v1.CloudScheduler.ResumeJob|ResumeJob}. The + * state of the job is stored in {@link google.cloud.scheduler.v1.Job.state|state}; if paused it + * will be set to {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED}. A job must be in {@link google.cloud.scheduler.v1.Job.State.ENABLED|Job.State.ENABLED} + * to be paused. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.pauseJob(request); + */ + pauseJob( + request?: protos.google.cloud.scheduler.v1.IPauseJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IPauseJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.pauseJob(request, options, callback); + } + resumeJob( + request?: protos.google.cloud.scheduler.v1.IResumeJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IResumeJobRequest|undefined, {}|undefined + ]>; + resumeJob( + request: protos.google.cloud.scheduler.v1.IResumeJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, + {}|null|undefined>): void; + resumeJob( + request: protos.google.cloud.scheduler.v1.IResumeJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Resume a job. + * + * This method reenables a job after it has been {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED}. The + * state of a job is stored in {@link google.cloud.scheduler.v1.Job.state|Job.state}; after calling this method it + * will be set to {@link google.cloud.scheduler.v1.Job.State.ENABLED|Job.State.ENABLED}. A job must be in + * {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED} to be resumed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.resumeJob(request); + */ + resumeJob( + request?: protos.google.cloud.scheduler.v1.IResumeJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IResumeJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.resumeJob(request, options, callback); + } + runJob( + request?: protos.google.cloud.scheduler.v1.IRunJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IRunJobRequest|undefined, {}|undefined + ]>; + runJob( + request: protos.google.cloud.scheduler.v1.IRunJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, + {}|null|undefined>): void; + runJob( + request: protos.google.cloud.scheduler.v1.IRunJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Forces a job to run now. + * + * When this method is called, Cloud Scheduler will dispatch the job, even + * if the job is already running. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.runJob(request); + */ + runJob( + request?: protos.google.cloud.scheduler.v1.IRunJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob, + protos.google.cloud.scheduler.v1.IRunJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.runJob(request, options, callback); + } + + listJobs( + request?: protos.google.cloud.scheduler.v1.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1.IJob[], + protos.google.cloud.scheduler.v1.IListJobsRequest|null, + protos.google.cloud.scheduler.v1.IListJobsResponse + ]>; + listJobs( + request: protos.google.cloud.scheduler.v1.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.scheduler.v1.IListJobsRequest, + protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1.IJob>): void; + listJobs( + request: protos.google.cloud.scheduler.v1.IListJobsRequest, + callback: PaginationCallback< + protos.google.cloud.scheduler.v1.IListJobsRequest, + protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1.IJob>): void; +/** + * Lists jobs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {number} request.pageSize + * Requested page size. + * + * The maximum page size is 500. If unspecified, the page size will + * be the maximum. Fewer jobs than requested might be returned, + * even if more jobs exist; use next_page_token to determine if more + * jobs exist. + * @param {string} request.pageToken + * A token identifying a page of results the server will return. To + * request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Job]{@link google.cloud.scheduler.v1.Job}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobs( + request?: protos.google.cloud.scheduler.v1.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.scheduler.v1.IListJobsRequest, + protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1.IJob>, + callback?: PaginationCallback< + protos.google.cloud.scheduler.v1.IListJobsRequest, + protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1.IJob>): + Promise<[ + protos.google.cloud.scheduler.v1.IJob[], + protos.google.cloud.scheduler.v1.IListJobsRequest|null, + protos.google.cloud.scheduler.v1.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {number} request.pageSize + * Requested page size. + * + * The maximum page size is 500. If unspecified, the page size will + * be the maximum. Fewer jobs than requested might be returned, + * even if more jobs exist; use next_page_token to determine if more + * jobs exist. + * @param {string} request.pageToken + * A token identifying a page of results the server will return. To + * request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Job]{@link google.cloud.scheduler.v1.Job} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobsStream( + request?: protos.google.cloud.scheduler.v1.IListJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {number} request.pageSize + * Requested page size. + * + * The maximum page size is 500. If unspecified, the page size will + * be the maximum. Fewer jobs than requested might be returned, + * even if more jobs exist; use next_page_token to determine if more + * jobs exist. + * @param {string} request.pageToken + * A token identifying a page of results the server will return. To + * request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Job]{@link google.cloud.scheduler.v1.Job}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listJobsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listJobsAsync( + request?: protos.google.cloud.scheduler.v1.IListJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,location:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + location: location, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the location from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the location. + */ + matchLocationFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).location; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.cloudSchedulerStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json b/owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json new file mode 100644 index 00000000..edb34789 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.scheduler.v1.CloudScheduler": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListJobs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteJob": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PauseJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResumeJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RunJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json b/owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json new file mode 100644 index 00000000..2762a016 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/scheduler/v1/cloudscheduler.proto", + "../../protos/google/cloud/scheduler/v1/job.proto", + "../../protos/google/cloud/scheduler/v1/target.proto" +] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000..122c43fb --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.scheduler.v1", + "libraryPackage": "@google-cloud/scheduler", + "services": { + "CloudScheduler": { + "clients": { + "grpc": { + "libraryClient": "CloudSchedulerClient", + "rpcs": { + "GetJob": { + "methods": [ + "getJob" + ] + }, + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "PauseJob": { + "methods": [ + "pauseJob" + ] + }, + "ResumeJob": { + "methods": [ + "resumeJob" + ] + }, + "RunJob": { + "methods": [ + "runJob" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudSchedulerClient", + "rpcs": { + "GetJob": { + "methods": [ + "getJob" + ] + }, + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "PauseJob": { + "methods": [ + "pauseJob" + ] + }, + "ResumeJob": { + "methods": [ + "resumeJob" + ] + }, + "RunJob": { + "methods": [ + "runJob" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 00000000..8805934c --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CloudSchedulerClient} from './cloud_scheduler_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..733beea6 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const scheduler = require('@google-cloud/scheduler'); + +function main() { + const cloudSchedulerClient = new scheduler.CloudSchedulerClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..7ceaecb2 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {CloudSchedulerClient} from '@google-cloud/scheduler'; + +// check that the client class type name can be used +function doStuffWithCloudSchedulerClient(client: CloudSchedulerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudSchedulerClient = new CloudSchedulerClient(); + doStuffWithCloudSchedulerClient(cloudSchedulerClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts b/owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts new file mode 100644 index 00000000..e5ad3b2e --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts @@ -0,0 +1,1097 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as cloudschedulerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CloudSchedulerClient', () => { + it('has servicePath', () => { + const servicePath = cloudschedulerModule.v1.CloudSchedulerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudschedulerModule.v1.CloudSchedulerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudschedulerModule.v1.CloudSchedulerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudSchedulerStub, undefined); + await client.initialize(); + assert(client.cloudSchedulerStub); + }); + + it('has close method', () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createJob', () => { + it('invokes createJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); + const [response] = await client.createJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJob(request), expectedError); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateJob', () => { + it('invokes updateJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJob(request), expectedError); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteJob', () => { + it('invokes deleteJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJob(request), expectedError); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('pauseJob', () => { + it('invokes pauseJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.PauseJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.pauseJob = stubSimpleCall(expectedResponse); + const [response] = await client.pauseJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pauseJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pauseJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.PauseJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.pauseJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pauseJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pauseJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.PauseJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pauseJob(request), expectedError); + assert((client.innerApiCalls.pauseJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('resumeJob', () => { + it('invokes resumeJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ResumeJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.resumeJob = stubSimpleCall(expectedResponse); + const [response] = await client.resumeJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resumeJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resumeJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ResumeJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.resumeJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resumeJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes resumeJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ResumeJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resumeJob(request), expectedError); + assert((client.innerApiCalls.resumeJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('runJob', () => { + it('invokes runJob without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.RunJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.runJob = stubSimpleCall(expectedResponse); + const [response] = await client.runJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runJob without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.RunJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); + client.innerApiCalls.runJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runJob with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.RunJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.runJob(request), expectedError); + assert((client.innerApiCalls.runJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listJobs with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.scheduler.v1.Job[] = []; + stream.on('data', (response: protos.google.cloud.scheduler.v1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.scheduler.v1.Job[] = []; + stream.on('data', (response: protos.google.cloud.scheduler.v1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.scheduler.v1.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.scheduler.v1.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + job: "jobValue", + }; + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "locationValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromJobName', () => { + const result = client.matchLocationFromJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new cloudschedulerModule.v1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 00000000..d4565464 --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'scheduler', + filename: './scheduler.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore new file mode 100644 index 00000000..521dc25a --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js new file mode 100644 index 00000000..a3c17684 --- /dev/null +++ b/owl-bot-staging/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/scheduler', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md new file mode 100644 index 00000000..90fa2a2d --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Scheduler: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json new file mode 100644 index 00000000..29a223b6 --- /dev/null +++ b/owl-bot-staging/v1beta1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 00000000..0d466273 --- /dev/null +++ b/owl-bot-staging/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/scheduler", + "version": "0.1.0", + "description": "Scheduler client for Node.js", + "repository": "googleapis/nodejs-scheduler", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google scheduler", + "scheduler", + "cloud scheduler" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.15.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^8.4.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto new file mode 100644 index 00000000..4f86b7a5 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto @@ -0,0 +1,267 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.scheduler.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/scheduler/v1beta1/job.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1;scheduler"; +option java_multiple_files = true; +option java_outer_classname = "SchedulerProto"; +option java_package = "com.google.cloud.scheduler.v1beta1"; +option objc_class_prefix = "SCHEDULER"; + +// The Cloud Scheduler API allows external entities to reliably +// schedule asynchronous jobs. +service CloudScheduler { + option (google.api.default_host) = "cloudscheduler.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists jobs. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=projects/*/locations/*}/jobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a job. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v1beta1/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a job. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/jobs" + body: "job" + }; + option (google.api.method_signature) = "parent,job"; + } + + // Updates a job. + // + // If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does + // not exist, `NOT_FOUND` is returned. + // + // If UpdateJob does not successfully return, it is possible for the + // job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may + // not be executed. If this happens, retry the UpdateJob request + // until a successful response is received. + rpc UpdateJob(UpdateJobRequest) returns (Job) { + option (google.api.http) = { + patch: "/v1beta1/{job.name=projects/*/locations/*/jobs/*}" + body: "job" + }; + option (google.api.method_signature) = "job,update_mask"; + } + + // Deletes a job. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta1/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Pauses a job. + // + // If a job is paused then the system will stop executing the job + // until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The + // state of the job is stored in [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it + // will be set to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] + // to be paused. + rpc PauseJob(PauseJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:pause" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Resume a job. + // + // This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The + // state of a job is stored in [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this method it + // will be set to [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A job must be in + // [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed. + rpc ResumeJob(ResumeJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:resume" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Forces a job to run now. + // + // When this method is called, Cloud Scheduler will dispatch the job, even + // if the job is already running. + rpc RunJob(RunJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:run" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for listing jobs using [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. +message ListJobsRequest { + // Required. The location name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudscheduler.googleapis.com/Job" + } + ]; + + // Requested page size. + // + // The maximum page size is 500. If unspecified, the page size will + // be the maximum. Fewer jobs than requested might be returned, + // even if more jobs exist; use next_page_token to determine if more + // jobs exist. + int32 page_size = 5; + + // A token identifying a page of results the server will return. To + // request the first page results, page_token must be empty. To + // request the next page of results, page_token must be the value of + // [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token] returned from + // the previous call to [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is an error to + // switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or + // [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages. + string page_token = 6; +} + +// Response message for listing jobs using [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. +message ListJobsResponse { + // The list of jobs. + repeated Job jobs = 1; + + // A token to retrieve next page of results. Pass this value in the + // [page_token][google.cloud.scheduler.v1beta1.ListJobsRequest.page_token] field in the subsequent call to + // [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs] to retrieve the next page of results. + // If this is empty it indicates that there are no more results + // through which to paginate. + // + // The page token is valid for only 2 hours. + string next_page_token = 2; +} + +// Request message for [GetJob][google.cloud.scheduler.v1beta1.CloudScheduler.GetJob]. +message GetJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob]. +message CreateJobRequest { + // Required. The location name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudscheduler.googleapis.com/Job" + } + ]; + + // Required. The job to add. The user can optionally specify a name for the + // job in [name][google.cloud.scheduler.v1beta1.Job.name]. [name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an + // existing job. If a name is not specified then the system will + // generate a random unique name that will be returned + // ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob]. +message UpdateJobRequest { + // Required. The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified. + // + // Output only fields cannot be modified using UpdateJob. + // Any value specified for an output only field will be ignored. + Job job = 1 [(google.api.field_behavior) = REQUIRED]; + + // A mask used to specify which fields of the job are being updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for deleting a job using +// [DeleteJob][google.cloud.scheduler.v1beta1.CloudScheduler.DeleteJob]. +message DeleteJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for [PauseJob][google.cloud.scheduler.v1beta1.CloudScheduler.PauseJob]. +message PauseJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. +message ResumeJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} + +// Request message for forcing a job to run now using +// [RunJob][google.cloud.scheduler.v1beta1.CloudScheduler.RunJob]. +message RunJobRequest { + // Required. The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudscheduler.googleapis.com/Job" + } + ]; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto new file mode 100644 index 00000000..ddfda31e --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto @@ -0,0 +1,239 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.scheduler.v1beta1; + +import "google/api/resource.proto"; +import "google/cloud/scheduler/v1beta1/target.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1;scheduler"; +option java_multiple_files = true; +option java_outer_classname = "JobProto"; +option java_package = "com.google.cloud.scheduler.v1beta1"; + +// Configuration for a job. +// The maximum allowed size for a job is 100KB. +message Job { + option (google.api.resource) = { + type: "cloudscheduler.googleapis.com/Job" + pattern: "projects/{project}/locations/{location}/jobs/{job}" + }; + + // State of the job. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The job is executing normally. + ENABLED = 1; + + // The job is paused by the user. It will not execute. A user can + // intentionally pause the job using + // [PauseJobRequest][google.cloud.scheduler.v1beta1.PauseJobRequest]. + PAUSED = 2; + + // The job is disabled by the system due to error. The user + // cannot directly set a job to be disabled. + DISABLED = 3; + + // The job state resulting from a failed [CloudScheduler.UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob] + // operation. To recover a job from this state, retry + // [CloudScheduler.UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob] until a successful response is received. + UPDATE_FAILED = 4; + } + + // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob], after + // which it becomes output only. + // + // The job name. For example: + // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + // + // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + // hyphens (-), colons (:), or periods (.). + // For more information, see + // [Identifying + // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + // * `LOCATION_ID` is the canonical ID for the job's location. + // The list of available locations can be obtained by calling + // [ListLocations][google.cloud.location.Locations.ListLocations]. + // For more information, see https://cloud.google.com/about/locations/. + // * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + // hyphens (-), or underscores (_). The maximum length is 500 characters. + string name = 1; + + // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob] or + // [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob]. + // + // A human-readable description for the job. This string must not contain + // more than 500 characters. + string description = 2; + + // Required. + // + // Delivery settings containing destination and parameters. + oneof target { + // Pub/Sub target. + PubsubTarget pubsub_target = 4; + + // App Engine HTTP target. + AppEngineHttpTarget app_engine_http_target = 5; + + // HTTP target. + HttpTarget http_target = 6; + } + + // Required, except when used with [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob]. + // + // Describes the schedule on which the job will be executed. + // + // The schedule can be either of the following types: + // + // * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview) + // * English-like + // [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) + // + // As a general rule, execution `n + 1` of a job will not begin + // until execution `n` has finished. Cloud Scheduler will never + // allow two simultaneously outstanding executions. For example, + // this implies that if the `n+1`th execution is scheduled to run at + // 16:00 but the `n`th execution takes until 16:15, the `n+1`th + // execution will not start until `16:15`. + // A scheduled start time will be delayed if the previous + // execution has not ended when its scheduled time occurs. + // + // If [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] > 0 and a job attempt fails, + // the job will be tried a total of [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] + // times, with exponential backoff, until the next scheduled start + // time. + string schedule = 20; + + // Specifies the time zone to be used in interpreting + // [schedule][google.cloud.scheduler.v1beta1.Job.schedule]. The value of this field must be a time + // zone name from the [tz database](http://en.wikipedia.org/wiki/Tz_database). + // + // Note that some time zones include a provision for + // daylight savings time. The rules for daylight saving time are + // determined by the chosen tz. For UTC use the string "utc". If a + // time zone is not specified, the default will be in UTC (also known + // as GMT). + string time_zone = 21; + + // Output only. The creation time of the job. + google.protobuf.Timestamp user_update_time = 9; + + // Output only. State of the job. + State state = 10; + + // Output only. The response from the target for the last attempted execution. + google.rpc.Status status = 11; + + // Output only. The next time the job is scheduled. Note that this may be a + // retry of a previously failed attempt or the next execution time + // according to the schedule. + google.protobuf.Timestamp schedule_time = 17; + + // Output only. The time the last job attempt started. + google.protobuf.Timestamp last_attempt_time = 18; + + // Settings that determine the retry behavior. + RetryConfig retry_config = 19; + + // The deadline for job attempts. If the request handler does not respond by + // this deadline then the request is cancelled and the attempt is marked as a + // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in + // execution logs. Cloud Scheduler will retry the job according + // to the [RetryConfig][google.cloud.scheduler.v1beta1.RetryConfig]. + // + // The allowed duration for this deadline is: + // + // * For [HTTP targets][google.cloud.scheduler.v1beta1.Job.http_target], between 15 seconds and 30 minutes. + // * For [App Engine HTTP targets][google.cloud.scheduler.v1beta1.Job.app_engine_http_target], between 15 + // seconds and 24 hours. + // * For [PubSub targets][google.cloud.scheduler.v1beta1.Job.pubsub_target], this field is ignored. + google.protobuf.Duration attempt_deadline = 22; +} + +// Settings that determine the retry behavior. +// +// By default, if a job does not complete successfully (meaning that +// an acknowledgement is not received from the handler, then it will be retried +// with exponential backoff according to the settings in [RetryConfig][google.cloud.scheduler.v1beta1.RetryConfig]. +message RetryConfig { + // The number of attempts that the system will make to run a job using the + // exponential backoff procedure described by + // [max_doublings][google.cloud.scheduler.v1beta1.RetryConfig.max_doublings]. + // + // The default value of retry_count is zero. + // + // If retry_count is zero, a job attempt will *not* be retried if + // it fails. Instead the Cloud Scheduler system will wait for the + // next scheduled execution time. + // + // If retry_count is set to a non-zero number then Cloud Scheduler + // will retry failed attempts, using exponential backoff, + // retry_count times, or until the next scheduled execution time, + // whichever comes first. + // + // Values greater than 5 and negative values are not allowed. + int32 retry_count = 1; + + // The time limit for retrying a failed job, measured from time when an + // execution was first attempted. If specified with + // [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count], the job will be retried until both + // limits are reached. + // + // The default value for max_retry_duration is zero, which means retry + // duration is unlimited. + google.protobuf.Duration max_retry_duration = 2; + + // The minimum amount of time to wait before retrying a job after + // it fails. + // + // The default value of this field is 5 seconds. + google.protobuf.Duration min_backoff_duration = 3; + + // The maximum amount of time to wait before retrying a job after + // it fails. + // + // The default value of this field is 1 hour. + google.protobuf.Duration max_backoff_duration = 4; + + // The time between retries will double `max_doublings` times. + // + // A job's retry interval starts at + // [min_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.min_backoff_duration], then doubles + // `max_doublings` times, then increases linearly, and finally + // retries retries at intervals of + // [max_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.max_backoff_duration] up to + // [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] times. + // + // For example, if [min_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.min_backoff_duration] is + // 10s, [max_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.max_backoff_duration] is 300s, and + // `max_doublings` is 3, then the a job will first be retried in 10s. The + // retry interval will double three times, and then increase linearly by + // 2^3 * 10s. Finally, the job will retry at intervals of + // [max_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.max_backoff_duration] until the job has + // been attempted [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] times. Thus, the + // requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... + // + // The default value of this field is 5. + int32 max_doublings = 5; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto new file mode 100644 index 00000000..4b47e356 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto @@ -0,0 +1,356 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.scheduler.v1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1;scheduler"; +option java_multiple_files = true; +option java_outer_classname = "TargetProto"; +option java_package = "com.google.cloud.scheduler.v1beta1"; + +// Http target. The job will be pushed to the job handler by means of +// an HTTP request via an [http_method][google.cloud.scheduler.v1beta1.HttpTarget.http_method] such as HTTP +// POST, HTTP GET, etc. The job is acknowledged by means of an HTTP +// response code in the range [200 - 299]. A failure to receive a response +// constitutes a failed execution. For a redirected request, the response +// returned by the redirected request is considered. +message HttpTarget { + // Required. The full URI path that the request will be sent to. This string + // must begin with either "http://" or "https://". Some examples of + // valid values for [uri][google.cloud.scheduler.v1beta1.HttpTarget.uri] are: + // `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will + // encode some characters for safety and compatibility. The maximum allowed + // URL length is 2083 characters after encoding. + string uri = 1; + + // Which HTTP method to use for the request. + HttpMethod http_method = 2; + + // The user can specify HTTP request headers to send with the job's + // HTTP request. This map contains the header field names and + // values. Repeated headers are not supported, but a header value can + // contain commas. These headers represent a subset of the headers + // that will accompany the job's HTTP request. Some HTTP request + // headers will be ignored or replaced. A partial list of headers that + // will be ignored or replaced is below: + // - Host: This will be computed by Cloud Scheduler and derived from + // [uri][google.cloud.scheduler.v1beta1.HttpTarget.uri]. + // * `Content-Length`: This will be computed by Cloud Scheduler. + // * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`. + // * `X-Google-*`: Google internal use only. + // * `X-AppEngine-*`: Google internal use only. + // + // The total size of headers must be less than 80KB. + map headers = 3; + + // HTTP request body. A request body is allowed only if the HTTP + // method is POST, PUT, or PATCH. It is an error to set body on a job with an + // incompatible [HttpMethod][google.cloud.scheduler.v1beta1.HttpMethod]. + bytes body = 4; + + // The mode for generating an `Authorization` header for HTTP requests. + // + // If specified, all `Authorization` headers in the [HttpTarget.headers][google.cloud.scheduler.v1beta1.HttpTarget.headers] + // field will be overridden. + oneof authorization_header { + // If specified, an + // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) + // will be generated and attached as an `Authorization` header in the HTTP + // request. + // + // This type of authorization should generally only be used when calling + // Google APIs hosted on *.googleapis.com. + OAuthToken oauth_token = 5; + + // If specified, an + // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) + // token will be generated and attached as an `Authorization` header in the + // HTTP request. + // + // This type of authorization can be used for many scenarios, including + // calling Cloud Run, or endpoints where you intend to validate the token + // yourself. + OidcToken oidc_token = 6; + } +} + +// App Engine target. The job will be pushed to a job handler by means +// of an HTTP request via an [http_method][google.cloud.scheduler.v1beta1.AppEngineHttpTarget.http_method] such +// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an +// HTTP response code in the range [200 - 299]. Error 503 is +// considered an App Engine system error instead of an application +// error. Requests returning error 503 will be retried regardless of +// retry configuration and not counted against retry counts. Any other +// response code, or a failure to receive a response before the +// deadline, constitutes a failed attempt. +message AppEngineHttpTarget { + // The HTTP method to use for the request. PATCH and OPTIONS are not + // permitted. + HttpMethod http_method = 1; + + // App Engine Routing setting for the job. + AppEngineRouting app_engine_routing = 2; + + // The relative URI. + // + // The relative URL must begin with "/" and must be a valid HTTP relative URL. + // It can contain a path, query string arguments, and `#` fragments. + // If the relative URL is empty, then the root path "/" will be used. + // No spaces are allowed, and the maximum length allowed is 2083 characters. + string relative_uri = 3; + + // HTTP request headers. + // + // This map contains the header field names and values. Headers can be set + // when the job is created. + // + // Cloud Scheduler sets some headers to default values: + // + // * `User-Agent`: By default, this header is + // `"AppEngine-Google; (+http://code.google.com/appengine)"`. + // This header can be modified, but Cloud Scheduler will append + // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the + // modified `User-Agent`. + // * `X-CloudScheduler`: This header will be set to true. + // + // If the job has an [body][google.cloud.scheduler.v1beta1.AppEngineHttpTarget.body], Cloud Scheduler sets + // the following headers: + // + // * `Content-Type`: By default, the `Content-Type` header is set to + // `"application/octet-stream"`. The default can be overridden by explictly + // setting `Content-Type` to a particular media type when the job is + // created. + // For example, `Content-Type` can be set to `"application/json"`. + // * `Content-Length`: This is computed by Cloud Scheduler. This value is + // output only. It cannot be changed. + // + // The headers below are output only. They cannot be set or overridden: + // + // * `X-Google-*`: For Google internal use only. + // * `X-AppEngine-*`: For Google internal use only. + // + // In addition, some App Engine headers, which contain + // job-specific information, are also be sent to the job handler. + map headers = 4; + + // Body. + // + // HTTP request body. A request body is allowed only if the HTTP method is + // POST or PUT. It will result in invalid argument error to set a body on a + // job with an incompatible [HttpMethod][google.cloud.scheduler.v1beta1.HttpMethod]. + bytes body = 5; +} + +// Pub/Sub target. The job will be delivered by publishing a message to +// the given Pub/Sub topic. +message PubsubTarget { + // Required. The name of the Cloud Pub/Sub topic to which messages will + // be published when a job is delivered. The topic name must be in the + // same format as required by PubSub's + // [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), + // for example `projects/PROJECT_ID/topics/TOPIC_ID`. + // + // The topic must be in the same project as the Cloud Scheduler job. + string topic_name = 1 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + + // The message payload for PubsubMessage. + // + // Pubsub message must contain either non-empty data, or at least one + // attribute. + bytes data = 3; + + // Attributes for PubsubMessage. + // + // Pubsub message must contain either non-empty data, or at least one + // attribute. + map attributes = 4; +} + +// App Engine Routing. +// +// For more information about services, versions, and instances see +// [An Overview of App +// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), +// [Microservices Architecture on Google App +// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), +// [App Engine Standard request +// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), +// and [App Engine Flex request +// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). +message AppEngineRouting { + // App service. + // + // By default, the job is sent to the service which is the default + // service when the job is attempted. + string service = 1; + + // App version. + // + // By default, the job is sent to the version which is the default + // version when the job is attempted. + string version = 2; + + // App instance. + // + // By default, the job is sent to an instance which is available when + // the job is attempted. + // + // Requests can only be sent to a specific instance if + // [manual scaling is used in App Engine + // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + // App Engine Flex does not support instances. For more information, see + // [App Engine Standard request + // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + // and [App Engine Flex request + // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + string instance = 3; + + // Output only. The host that the job is sent to. + // + // For more information about how App Engine requests are routed, see + // [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). + // + // The host is constructed as: + // + // + // * `host = [application_domain_name]`
+ // `| [service] + '.' + [application_domain_name]`
+ // `| [version] + '.' + [application_domain_name]`
+ // `| [version_dot_service]+ '.' + [application_domain_name]`
+ // `| [instance] + '.' + [application_domain_name]`
+ // `| [instance_dot_service] + '.' + [application_domain_name]`
+ // `| [instance_dot_version] + '.' + [application_domain_name]`
+ // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` + // + // * `application_domain_name` = The domain name of the app, for + // example .appspot.com, which is associated with the + // job's project ID. + // + // * `service =` [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] + // + // * `version =` [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] + // + // * `version_dot_service =` + // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] `+ '.' +` + // [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] + // + // * `instance =` [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] + // + // * `instance_dot_service =` + // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] `+ '.' +` + // [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] + // + // * `instance_dot_version =` + // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] `+ '.' +` + // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] + // + // * `instance_dot_version_dot_service =` + // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] `+ '.' +` + // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] `+ '.' +` + // [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] + // + // + // If [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] is empty, then the job will be sent + // to the service which is the default service when the job is attempted. + // + // If [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] is empty, then the job will be sent + // to the version which is the default version when the job is attempted. + // + // If [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] is empty, then the job will be + // sent to an instance which is available when the job is attempted. + // + // If [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service], + // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version], or + // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] is invalid, then the job will be sent + // to the default version of the default service when the job is attempted. + string host = 4; +} + +// The HTTP method used to execute the job. +enum HttpMethod { + // HTTP method unspecified. Defaults to POST. + HTTP_METHOD_UNSPECIFIED = 0; + + // HTTP POST + POST = 1; + + // HTTP GET + GET = 2; + + // HTTP HEAD + HEAD = 3; + + // HTTP PUT + PUT = 4; + + // HTTP DELETE + DELETE = 5; + + // HTTP PATCH + PATCH = 6; + + // HTTP OPTIONS + OPTIONS = 7; +} + +// Contains information needed for generating an +// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). +// This type of authorization should generally only be used when calling Google +// APIs hosted on *.googleapis.com. +message OAuthToken { + // [Service account email](https://cloud.google.com/iam/docs/service-accounts) + // to be used for generating OAuth token. + // The service account must be within the same project as the job. The caller + // must have iam.serviceAccounts.actAs permission for the service account. + string service_account_email = 1; + + // OAuth scope to be used for generating OAuth access token. + // If not specified, "https://www.googleapis.com/auth/cloud-platform" + // will be used. + string scope = 2; +} + +// Contains information needed for generating an +// [OpenID Connect +// token](https://developers.google.com/identity/protocols/OpenIDConnect). +// This type of authorization can be used for many scenarios, including +// calling Cloud Run, or endpoints where you intend to validate the token +// yourself. +message OidcToken { + // [Service account email](https://cloud.google.com/iam/docs/service-accounts) + // to be used for generating OIDC token. + // The service account must be within the same project as the job. The caller + // must have iam.serviceAccounts.actAs permission for the service account. + string service_account_email = 1; + + // Audience to be used when generating OIDC token. If not specified, the URI + // specified in target will be used. + string audience = 2; +} + +// The Pub/Sub Topic resource definition is in google/cloud/pubsub/v1/, +// but we do not import that proto directly; therefore, we redefine the +// pattern here. +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 00000000..8c3963ad --- /dev/null +++ b/owl-bot-staging/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1beta1 from './v1beta1'; +const CloudSchedulerClient = v1beta1.CloudSchedulerClient; +type CloudSchedulerClient = v1beta1.CloudSchedulerClient; +export {v1beta1, CloudSchedulerClient}; +export default {v1beta1, CloudSchedulerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts new file mode 100644 index 00000000..268b2c28 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts @@ -0,0 +1,1168 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/cloud_scheduler_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_scheduler_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The Cloud Scheduler API allows external entities to reliably + * schedule asynchronous jobs. + * @class + * @memberof v1beta1 + */ +export class CloudSchedulerClient { + 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; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + cloudSchedulerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudSchedulerClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * 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 {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudSchedulerClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + 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 = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + 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/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/jobs/{job}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.scheduler.v1beta1.CloudScheduler', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudSchedulerStub) { + return this.cloudSchedulerStub; + } + + // Put together the "service stub" for + // google.cloud.scheduler.v1beta1.CloudScheduler. + this.cloudSchedulerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.scheduler.v1beta1.CloudScheduler') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.scheduler.v1beta1.CloudScheduler, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudSchedulerStubMethods = + ['listJobs', 'getJob', 'createJob', 'updateJob', 'deleteJob', 'pauseJob', 'resumeJob', 'runJob']; + for (const methodName of cloudSchedulerStubMethods) { + const callPromise = this.cloudSchedulerStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudSchedulerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudscheduler.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudscheduler.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getJob( + request?: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getJob(request); + */ + getJob( + request?: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } + createJob( + request?: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|undefined, {}|undefined + ]>; + createJob( + request: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {google.cloud.scheduler.v1beta1.Job} request.job + * Required. The job to add. The user can optionally specify a name for the + * job in {@link google.cloud.scheduler.v1beta1.Job.name|name}. {@link google.cloud.scheduler.v1beta1.Job.name|name} cannot be the same as an + * existing job. If a name is not specified then the system will + * generate a random unique name that will be returned + * ({@link google.cloud.scheduler.v1beta1.Job.name|name}) in the response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createJob(request); + */ + createJob( + request?: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createJob(request, options, callback); + } + updateJob( + request?: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|undefined, {}|undefined + ]>; + updateJob( + request: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a job. + * + * If successful, the updated {@link google.cloud.scheduler.v1beta1.Job|Job} is returned. If the job does + * not exist, `NOT_FOUND` is returned. + * + * If UpdateJob does not successfully return, it is possible for the + * job to be in an {@link google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED|Job.State.UPDATE_FAILED} state. A job in this state may + * not be executed. If this happens, retry the UpdateJob request + * until a successful response is received. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.scheduler.v1beta1.Job} request.job + * Required. The new job properties. {@link google.cloud.scheduler.v1beta1.Job.name|name} must be specified. + * + * Output only fields cannot be modified using UpdateJob. + * Any value specified for an output only field will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * A mask used to specify which fields of the job are being updated. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateJob(request); + */ + updateJob( + request?: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'job.name': request.job!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateJob(request, options, callback); + } + deleteJob( + request?: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|undefined, {}|undefined + ]>; + deleteJob( + request: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteJob(request); + */ + deleteJob( + request?: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteJob(request, options, callback); + } + pauseJob( + request?: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|undefined, {}|undefined + ]>; + pauseJob( + request: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, + {}|null|undefined>): void; + pauseJob( + request: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Pauses a job. + * + * If a job is paused then the system will stop executing the job + * until it is re-enabled via {@link google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob|ResumeJob}. The + * state of the job is stored in {@link google.cloud.scheduler.v1beta1.Job.state|state}; if paused it + * will be set to {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED}. A job must be in {@link google.cloud.scheduler.v1beta1.Job.State.ENABLED|Job.State.ENABLED} + * to be paused. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.pauseJob(request); + */ + pauseJob( + request?: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.pauseJob(request, options, callback); + } + resumeJob( + request?: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|undefined, {}|undefined + ]>; + resumeJob( + request: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, + {}|null|undefined>): void; + resumeJob( + request: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Resume a job. + * + * This method reenables a job after it has been {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED}. The + * state of a job is stored in {@link google.cloud.scheduler.v1beta1.Job.state|Job.state}; after calling this method it + * will be set to {@link google.cloud.scheduler.v1beta1.Job.State.ENABLED|Job.State.ENABLED}. A job must be in + * {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED} to be resumed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.resumeJob(request); + */ + resumeJob( + request?: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.resumeJob(request, options, callback); + } + runJob( + request?: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IRunJobRequest|undefined, {}|undefined + ]>; + runJob( + request: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, + {}|null|undefined>): void; + runJob( + request: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, + callback: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Forces a job to run now. + * + * When this method is called, Cloud Scheduler will dispatch the job, even + * if the job is already running. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The job name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + * @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. + * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.runJob(request); + */ + runJob( + request?: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob, + protos.google.cloud.scheduler.v1beta1.IRunJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.runJob(request, options, callback); + } + + listJobs( + request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob[], + protos.google.cloud.scheduler.v1beta1.IListJobsRequest|null, + protos.google.cloud.scheduler.v1beta1.IListJobsResponse + ]>; + listJobs( + request: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1beta1.IJob>): void; + listJobs( + request: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + callback: PaginationCallback< + protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1beta1.IJob>): void; +/** + * Lists jobs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {number} request.pageSize + * Requested page size. + * + * The maximum page size is 500. If unspecified, the page size will + * be the maximum. Fewer jobs than requested might be returned, + * even if more jobs exist; use next_page_token to determine if more + * jobs exist. + * @param {string} request.pageToken + * A token identifying a page of results the server will return. To + * request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Job]{@link google.cloud.scheduler.v1beta1.Job}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobs( + request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1beta1.IJob>, + callback?: PaginationCallback< + protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, + protos.google.cloud.scheduler.v1beta1.IJob>): + Promise<[ + protos.google.cloud.scheduler.v1beta1.IJob[], + protos.google.cloud.scheduler.v1beta1.IListJobsRequest|null, + protos.google.cloud.scheduler.v1beta1.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {number} request.pageSize + * Requested page size. + * + * The maximum page size is 500. If unspecified, the page size will + * be the maximum. Fewer jobs than requested might be returned, + * even if more jobs exist; use next_page_token to determine if more + * jobs exist. + * @param {string} request.pageToken + * A token identifying a page of results the server will return. To + * request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobsStream( + request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID`. + * @param {number} request.pageSize + * Requested page size. + * + * The maximum page size is 500. If unspecified, the page size will + * be the maximum. Fewer jobs than requested might be returned, + * even if more jobs exist; use next_page_token to determine if more + * jobs exist. + * @param {string} request.pageToken + * A token identifying a page of results the server will return. To + * request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from + * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to + * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or + * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Job]{@link google.cloud.scheduler.v1beta1.Job}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listJobsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listJobsAsync( + request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,location:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + location: location, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the location from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the location. + */ + matchLocationFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).location; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.cloudSchedulerStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json new file mode 100644 index 00000000..6ded8fff --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.scheduler.v1beta1.CloudScheduler": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListJobs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteJob": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PauseJob": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ResumeJob": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunJob": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json new file mode 100644 index 00000000..a911aaeb --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto", + "../../protos/google/cloud/scheduler/v1beta1/job.proto", + "../../protos/google/cloud/scheduler/v1beta1/target.proto" +] diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000..c097889c --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.scheduler.v1beta1", + "libraryPackage": "@google-cloud/scheduler", + "services": { + "CloudScheduler": { + "clients": { + "grpc": { + "libraryClient": "CloudSchedulerClient", + "rpcs": { + "GetJob": { + "methods": [ + "getJob" + ] + }, + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "PauseJob": { + "methods": [ + "pauseJob" + ] + }, + "ResumeJob": { + "methods": [ + "resumeJob" + ] + }, + "RunJob": { + "methods": [ + "runJob" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudSchedulerClient", + "rpcs": { + "GetJob": { + "methods": [ + "getJob" + ] + }, + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "PauseJob": { + "methods": [ + "pauseJob" + ] + }, + "ResumeJob": { + "methods": [ + "resumeJob" + ] + }, + "RunJob": { + "methods": [ + "runJob" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000..8805934c --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CloudSchedulerClient} from './cloud_scheduler_client'; diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..733beea6 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const scheduler = require('@google-cloud/scheduler'); + +function main() { + const cloudSchedulerClient = new scheduler.CloudSchedulerClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..7ceaecb2 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {CloudSchedulerClient} from '@google-cloud/scheduler'; + +// check that the client class type name can be used +function doStuffWithCloudSchedulerClient(client: CloudSchedulerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudSchedulerClient = new CloudSchedulerClient(); + doStuffWithCloudSchedulerClient(cloudSchedulerClient); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts new file mode 100644 index 00000000..1710ef79 --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts @@ -0,0 +1,1097 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as cloudschedulerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.CloudSchedulerClient', () => { + it('has servicePath', () => { + const servicePath = cloudschedulerModule.v1beta1.CloudSchedulerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudschedulerModule.v1beta1.CloudSchedulerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudschedulerModule.v1beta1.CloudSchedulerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudSchedulerStub, undefined); + await client.initialize(); + assert(client.cloudSchedulerStub); + }); + + it('has close method', () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createJob', () => { + it('invokes createJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); + const [response] = await client.createJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJob(request), expectedError); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateJob', () => { + it('invokes updateJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJob(request), expectedError); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteJob', () => { + it('invokes deleteJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJob(request), expectedError); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('pauseJob', () => { + it('invokes pauseJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.PauseJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.pauseJob = stubSimpleCall(expectedResponse); + const [response] = await client.pauseJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pauseJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pauseJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.PauseJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.pauseJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pauseJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pauseJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.PauseJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pauseJob(request), expectedError); + assert((client.innerApiCalls.pauseJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('resumeJob', () => { + it('invokes resumeJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ResumeJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.resumeJob = stubSimpleCall(expectedResponse); + const [response] = await client.resumeJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resumeJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes resumeJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ResumeJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.resumeJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.resumeJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes resumeJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ResumeJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.resumeJob(request), expectedError); + assert((client.innerApiCalls.resumeJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('runJob', () => { + it('invokes runJob without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.RunJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.runJob = stubSimpleCall(expectedResponse); + const [response] = await client.runJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runJob without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.RunJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); + client.innerApiCalls.runJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runJob( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runJob with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.RunJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.runJob(request), expectedError); + assert((client.innerApiCalls.runJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listJobs with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.scheduler.v1beta1.Job[] = []; + stream.on('data', (response: protos.google.cloud.scheduler.v1beta1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.scheduler.v1beta1.Job[] = []; + stream.on('data', (response: protos.google.cloud.scheduler.v1beta1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.scheduler.v1beta1.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.scheduler.v1beta1.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + job: "jobValue", + }; + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "locationValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromJobName', () => { + const result = client.matchLocationFromJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js new file mode 100644 index 00000000..d4565464 --- /dev/null +++ b/owl-bot-staging/v1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'scheduler', + filename: './scheduler.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 37ba1aed2a17684aa27e4dad24bcb04515695c24 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 22 Jun 2021 00:52:42 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 6 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 10 - owl-bot-staging/v1/package.json | 64 - .../cloud/scheduler/v1/cloudscheduler.proto | 268 ---- .../google/cloud/scheduler/v1/job.proto | 237 ---- .../google/cloud/scheduler/v1/target.proto | 356 ----- owl-bot-staging/v1/src/index.ts | 25 - .../v1/src/v1/cloud_scheduler_client.ts | 1168 ----------------- .../src/v1/cloud_scheduler_client_config.json | 66 - .../v1/src/v1/cloud_scheduler_proto_list.json | 5 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 107 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_cloud_scheduler_v1.ts | 1097 ---------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1beta1/.eslintignore | 6 - owl-bot-staging/v1beta1/.eslintrc.json | 3 - owl-bot-staging/v1beta1/.gitignore | 14 - owl-bot-staging/v1beta1/.jsdoc.js | 55 - owl-bot-staging/v1beta1/.mocharc.js | 33 - owl-bot-staging/v1beta1/.prettierrc.js | 22 - owl-bot-staging/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 10 - owl-bot-staging/v1beta1/package.json | 64 - .../scheduler/v1beta1/cloudscheduler.proto | 267 ---- .../google/cloud/scheduler/v1beta1/job.proto | 239 ---- .../cloud/scheduler/v1beta1/target.proto | 356 ----- owl-bot-staging/v1beta1/src/index.ts | 25 - .../src/v1beta1/cloud_scheduler_client.ts | 1168 ----------------- .../cloud_scheduler_client_config.json | 66 - .../v1beta1/cloud_scheduler_proto_list.json | 5 - .../v1beta1/src/v1beta1/gapic_metadata.json | 107 -- owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - .../test/gapic_cloud_scheduler_v1beta1.ts | 1097 ---------------- owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 - src/v1/cloud_scheduler_client.ts | 32 +- src/v1beta1/cloud_scheduler_client.ts | 32 +- 50 files changed, 32 insertions(+), 7527 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta1/.gitignore delete mode 100644 owl-bot-staging/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta1/README.md delete mode 100644 owl-bot-staging/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta1/package.json delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts delete mode 100644 owl-bot-staging/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index 521dc25a..00000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index a3c17684..00000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/scheduler', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 50bc7f79..00000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 84f4713a..00000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 90fa2a2d..00000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Scheduler: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index 29a223b6..00000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 0d466273..00000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/scheduler", - "version": "0.1.0", - "description": "Scheduler client for Node.js", - "repository": "googleapis/nodejs-scheduler", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google scheduler", - "scheduler", - "cloud scheduler" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.15.0" - }, - "devDependencies": { - "@types/mocha": "^8.2.2", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^8.4.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto deleted file mode 100644 index 89ce8cbd..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/cloudscheduler.proto +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.scheduler.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/scheduler/v1/job.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler"; -option java_multiple_files = true; -option java_outer_classname = "SchedulerProto"; -option java_package = "com.google.cloud.scheduler.v1"; -option objc_class_prefix = "SCHEDULER"; - -// The Cloud Scheduler API allows external entities to reliably -// schedule asynchronous jobs. -service CloudScheduler { - option (google.api.default_host) = "cloudscheduler.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists jobs. - rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/jobs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a job. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/jobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a job. - rpc CreateJob(CreateJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/jobs" - body: "job" - }; - option (google.api.method_signature) = "parent,job"; - } - - // Updates a job. - // - // If successful, the updated [Job][google.cloud.scheduler.v1.Job] is returned. If the job does - // not exist, `NOT_FOUND` is returned. - // - // If UpdateJob does not successfully return, it is possible for the - // job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1.Job.State.UPDATE_FAILED] state. A job in this state may - // not be executed. If this happens, retry the UpdateJob request - // until a successful response is received. - rpc UpdateJob(UpdateJobRequest) returns (Job) { - option (google.api.http) = { - patch: "/v1/{job.name=projects/*/locations/*/jobs/*}" - body: "job" - }; - option (google.api.method_signature) = "job,update_mask"; - } - - // Deletes a job. - rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/jobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Pauses a job. - // - // If a job is paused then the system will stop executing the job - // until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob]. The - // state of the job is stored in [state][google.cloud.scheduler.v1.Job.state]; if paused it - // will be set to [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] - // to be paused. - rpc PauseJob(PauseJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/jobs/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Resume a job. - // - // This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. The - // state of a job is stored in [Job.state][google.cloud.scheduler.v1.Job.state]; after calling this method it - // will be set to [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in - // [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. - rpc ResumeJob(ResumeJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/jobs/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Forces a job to run now. - // - // When this method is called, Cloud Scheduler will dispatch the job, even - // if the job is already running. - rpc RunJob(RunJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/jobs/*}:run" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. -message ListJobsRequest { - // Required. The location name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudscheduler.googleapis.com/Job" - } - ]; - - // Requested page size. - // - // The maximum page size is 500. If unspecified, the page size will - // be the maximum. Fewer jobs than requested might be returned, - // even if more jobs exist; use next_page_token to determine if more - // jobs exist. - int32 page_size = 5; - - // A token identifying a page of results the server will return. To - // request the first page results, page_token must be empty. To - // request the next page of results, page_token must be the value of - // [next_page_token][google.cloud.scheduler.v1.ListJobsResponse.next_page_token] returned from - // the previous call to [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. It is an error to - // switch the value of [filter][google.cloud.scheduler.v1.ListJobsRequest.filter] or - // [order_by][google.cloud.scheduler.v1.ListJobsRequest.order_by] while iterating through pages. - string page_token = 6; -} - -// Response message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs]. -message ListJobsResponse { - // The list of jobs. - repeated Job jobs = 1; - - // A token to retrieve next page of results. Pass this value in the - // [page_token][google.cloud.scheduler.v1.ListJobsRequest.page_token] field in the subsequent call to - // [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs] to retrieve the next page of results. - // If this is empty it indicates that there are no more results - // through which to paginate. - // - // The page token is valid for only 2 hours. - string next_page_token = 2; -} - -// Request message for [GetJob][google.cloud.scheduler.v1.CloudScheduler.GetJob]. -message GetJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob]. -message CreateJobRequest { - // Required. The location name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudscheduler.googleapis.com/Job" - } - ]; - - // Required. The job to add. The user can optionally specify a name for the - // job in [name][google.cloud.scheduler.v1.Job.name]. [name][google.cloud.scheduler.v1.Job.name] cannot be the same as an - // existing job. If a name is not specified then the system will - // generate a random unique name that will be returned - // ([name][google.cloud.scheduler.v1.Job.name]) in the response. - Job job = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]. -message UpdateJobRequest { - // Required. The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be specified. - // - // Output only fields cannot be modified using UpdateJob. - // Any value specified for an output only field will be ignored. - Job job = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask used to specify which fields of the job are being updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for deleting a job using -// [DeleteJob][google.cloud.scheduler.v1.CloudScheduler.DeleteJob]. -message DeleteJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for [PauseJob][google.cloud.scheduler.v1.CloudScheduler.PauseJob]. -message PauseJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob]. -message ResumeJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for forcing a job to run now using -// [RunJob][google.cloud.scheduler.v1.CloudScheduler.RunJob]. -message RunJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto deleted file mode 100644 index d2607026..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/job.proto +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.scheduler.v1; - -import "google/api/resource.proto"; -import "google/cloud/scheduler/v1/target.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler"; -option java_multiple_files = true; -option java_outer_classname = "JobProto"; -option java_package = "com.google.cloud.scheduler.v1"; - -// Configuration for a job. -// The maximum allowed size for a job is 100KB. -message Job { - option (google.api.resource) = { - type: "cloudscheduler.googleapis.com/Job" - pattern: "projects/{project}/locations/{location}/jobs/{job}" - }; - - // State of the job. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The job is executing normally. - ENABLED = 1; - - // The job is paused by the user. It will not execute. A user can - // intentionally pause the job using - // [PauseJobRequest][google.cloud.scheduler.v1.PauseJobRequest]. - PAUSED = 2; - - // The job is disabled by the system due to error. The user - // cannot directly set a job to be disabled. - DISABLED = 3; - - // The job state resulting from a failed [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob] - // operation. To recover a job from this state, retry - // [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob] until a successful response is received. - UPDATE_FAILED = 4; - } - - // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob], after - // which it becomes output only. - // - // The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - // - // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), colons (:), or periods (.). - // For more information, see - // [Identifying - // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - // * `LOCATION_ID` is the canonical ID for the job's location. - // The list of available locations can be obtained by calling - // [ListLocations][google.cloud.location.Locations.ListLocations]. - // For more information, see https://cloud.google.com/about/locations/. - // * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), or underscores (_). The maximum length is 500 characters. - string name = 1; - - // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob] or - // [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]. - // - // A human-readable description for the job. This string must not contain - // more than 500 characters. - string description = 2; - - // Required. - // - // Delivery settings containing destination and parameters. - oneof target { - // Pub/Sub target. - PubsubTarget pubsub_target = 4; - - // App Engine HTTP target. - AppEngineHttpTarget app_engine_http_target = 5; - - // HTTP target. - HttpTarget http_target = 6; - } - - // Required, except when used with [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]. - // - // Describes the schedule on which the job will be executed. - // - // The schedule can be either of the following types: - // - // * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview) - // * English-like - // [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) - // - // As a general rule, execution `n + 1` of a job will not begin - // until execution `n` has finished. Cloud Scheduler will never - // allow two simultaneously outstanding executions. For example, - // this implies that if the `n+1`th execution is scheduled to run at - // 16:00 but the `n`th execution takes until 16:15, the `n+1`th - // execution will not start until `16:15`. - // A scheduled start time will be delayed if the previous - // execution has not ended when its scheduled time occurs. - // - // If [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] > 0 and a job attempt fails, - // the job will be tried a total of [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] - // times, with exponential backoff, until the next scheduled start - // time. - string schedule = 20; - - // Specifies the time zone to be used in interpreting - // [schedule][google.cloud.scheduler.v1.Job.schedule]. The value of this field must be a time - // zone name from the [tz database](http://en.wikipedia.org/wiki/Tz_database). - // - // Note that some time zones include a provision for - // daylight savings time. The rules for daylight saving time are - // determined by the chosen tz. For UTC use the string "utc". If a - // time zone is not specified, the default will be in UTC (also known - // as GMT). - string time_zone = 21; - - // Output only. The creation time of the job. - google.protobuf.Timestamp user_update_time = 9; - - // Output only. State of the job. - State state = 10; - - // Output only. The response from the target for the last attempted execution. - google.rpc.Status status = 11; - - // Output only. The next time the job is scheduled. Note that this may be a - // retry of a previously failed attempt or the next execution time - // according to the schedule. - google.protobuf.Timestamp schedule_time = 17; - - // Output only. The time the last job attempt started. - google.protobuf.Timestamp last_attempt_time = 18; - - // Settings that determine the retry behavior. - RetryConfig retry_config = 19; - - // The deadline for job attempts. If the request handler does not respond by - // this deadline then the request is cancelled and the attempt is marked as a - // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in - // execution logs. Cloud Scheduler will retry the job according - // to the [RetryConfig][google.cloud.scheduler.v1.RetryConfig]. - // - // The allowed duration for this deadline is: - // * For [HTTP targets][google.cloud.scheduler.v1.Job.http_target], between 15 seconds and 30 minutes. - // * For [App Engine HTTP targets][google.cloud.scheduler.v1.Job.app_engine_http_target], between 15 - // seconds and 24 hours. - google.protobuf.Duration attempt_deadline = 22; -} - -// Settings that determine the retry behavior. -// -// By default, if a job does not complete successfully (meaning that -// an acknowledgement is not received from the handler, then it will be retried -// with exponential backoff according to the settings in [RetryConfig][google.cloud.scheduler.v1.RetryConfig]. -message RetryConfig { - // The number of attempts that the system will make to run a job using the - // exponential backoff procedure described by - // [max_doublings][google.cloud.scheduler.v1.RetryConfig.max_doublings]. - // - // The default value of retry_count is zero. - // - // If retry_count is zero, a job attempt will *not* be retried if - // it fails. Instead the Cloud Scheduler system will wait for the - // next scheduled execution time. - // - // If retry_count is set to a non-zero number then Cloud Scheduler - // will retry failed attempts, using exponential backoff, - // retry_count times, or until the next scheduled execution time, - // whichever comes first. - // - // Values greater than 5 and negative values are not allowed. - int32 retry_count = 1; - - // The time limit for retrying a failed job, measured from time when an - // execution was first attempted. If specified with - // [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count], the job will be retried until both - // limits are reached. - // - // The default value for max_retry_duration is zero, which means retry - // duration is unlimited. - google.protobuf.Duration max_retry_duration = 2; - - // The minimum amount of time to wait before retrying a job after - // it fails. - // - // The default value of this field is 5 seconds. - google.protobuf.Duration min_backoff_duration = 3; - - // The maximum amount of time to wait before retrying a job after - // it fails. - // - // The default value of this field is 1 hour. - google.protobuf.Duration max_backoff_duration = 4; - - // The time between retries will double `max_doublings` times. - // - // A job's retry interval starts at - // [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration], then doubles - // `max_doublings` times, then increases linearly, and finally - // retries retries at intervals of - // [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] up to - // [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times. - // - // For example, if [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration] is - // 10s, [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] is 300s, and - // `max_doublings` is 3, then the a job will first be retried in 10s. The - // retry interval will double three times, and then increase linearly by - // 2^3 * 10s. Finally, the job will retry at intervals of - // [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration] until the job has - // been attempted [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times. Thus, the - // requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... - // - // The default value of this field is 5. - int32 max_doublings = 5; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto b/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto deleted file mode 100644 index 9a8f32f7..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/scheduler/v1/target.proto +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.scheduler.v1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler"; -option java_multiple_files = true; -option java_outer_classname = "TargetProto"; -option java_package = "com.google.cloud.scheduler.v1"; - -// Http target. The job will be pushed to the job handler by means of -// an HTTP request via an [http_method][google.cloud.scheduler.v1.HttpTarget.http_method] such as HTTP -// POST, HTTP GET, etc. The job is acknowledged by means of an HTTP -// response code in the range [200 - 299]. A failure to receive a response -// constitutes a failed execution. For a redirected request, the response -// returned by the redirected request is considered. -message HttpTarget { - // Required. The full URI path that the request will be sent to. This string - // must begin with either "http://" or "https://". Some examples of - // valid values for [uri][google.cloud.scheduler.v1.HttpTarget.uri] are: - // `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will - // encode some characters for safety and compatibility. The maximum allowed - // URL length is 2083 characters after encoding. - string uri = 1; - - // Which HTTP method to use for the request. - HttpMethod http_method = 2; - - // The user can specify HTTP request headers to send with the job's - // HTTP request. This map contains the header field names and - // values. Repeated headers are not supported, but a header value can - // contain commas. These headers represent a subset of the headers - // that will accompany the job's HTTP request. Some HTTP request - // headers will be ignored or replaced. A partial list of headers that - // will be ignored or replaced is below: - // - Host: This will be computed by Cloud Scheduler and derived from - // [uri][google.cloud.scheduler.v1.HttpTarget.uri]. - // * `Content-Length`: This will be computed by Cloud Scheduler. - // * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`. - // * `X-Google-*`: Google internal use only. - // * `X-AppEngine-*`: Google internal use only. - // - // The total size of headers must be less than 80KB. - map headers = 3; - - // HTTP request body. A request body is allowed only if the HTTP - // method is POST, PUT, or PATCH. It is an error to set body on a job with an - // incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod]. - bytes body = 4; - - // The mode for generating an `Authorization` header for HTTP requests. - // - // If specified, all `Authorization` headers in the [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.headers] - // field will be overridden. - oneof authorization_header { - // If specified, an - // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) - // will be generated and attached as an `Authorization` header in the HTTP - // request. - // - // This type of authorization should generally only be used when calling - // Google APIs hosted on *.googleapis.com. - OAuthToken oauth_token = 5; - - // If specified, an - // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) - // token will be generated and attached as an `Authorization` header in the - // HTTP request. - // - // This type of authorization can be used for many scenarios, including - // calling Cloud Run, or endpoints where you intend to validate the token - // yourself. - OidcToken oidc_token = 6; - } -} - -// App Engine target. The job will be pushed to a job handler by means -// of an HTTP request via an [http_method][google.cloud.scheduler.v1.AppEngineHttpTarget.http_method] such -// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an -// HTTP response code in the range [200 - 299]. Error 503 is -// considered an App Engine system error instead of an application -// error. Requests returning error 503 will be retried regardless of -// retry configuration and not counted against retry counts. Any other -// response code, or a failure to receive a response before the -// deadline, constitutes a failed attempt. -message AppEngineHttpTarget { - // The HTTP method to use for the request. PATCH and OPTIONS are not - // permitted. - HttpMethod http_method = 1; - - // App Engine Routing setting for the job. - AppEngineRouting app_engine_routing = 2; - - // The relative URI. - // - // The relative URL must begin with "/" and must be a valid HTTP relative URL. - // It can contain a path, query string arguments, and `#` fragments. - // If the relative URL is empty, then the root path "/" will be used. - // No spaces are allowed, and the maximum length allowed is 2083 characters. - string relative_uri = 3; - - // HTTP request headers. - // - // This map contains the header field names and values. Headers can be set - // when the job is created. - // - // Cloud Scheduler sets some headers to default values: - // - // * `User-Agent`: By default, this header is - // `"AppEngine-Google; (+http://code.google.com/appengine)"`. - // This header can be modified, but Cloud Scheduler will append - // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the - // modified `User-Agent`. - // * `X-CloudScheduler`: This header will be set to true. - // - // If the job has an [body][google.cloud.scheduler.v1.AppEngineHttpTarget.body], Cloud Scheduler sets - // the following headers: - // - // * `Content-Type`: By default, the `Content-Type` header is set to - // `"application/octet-stream"`. The default can be overridden by explictly - // setting `Content-Type` to a particular media type when the job is - // created. - // For example, `Content-Type` can be set to `"application/json"`. - // * `Content-Length`: This is computed by Cloud Scheduler. This value is - // output only. It cannot be changed. - // - // The headers below are output only. They cannot be set or overridden: - // - // * `X-Google-*`: For Google internal use only. - // * `X-AppEngine-*`: For Google internal use only. - // - // In addition, some App Engine headers, which contain - // job-specific information, are also be sent to the job handler. - map headers = 4; - - // Body. - // - // HTTP request body. A request body is allowed only if the HTTP method is - // POST or PUT. It will result in invalid argument error to set a body on a - // job with an incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod]. - bytes body = 5; -} - -// Pub/Sub target. The job will be delivered by publishing a message to -// the given Pub/Sub topic. -message PubsubTarget { - // Required. The name of the Cloud Pub/Sub topic to which messages will - // be published when a job is delivered. The topic name must be in the - // same format as required by PubSub's - // [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), - // for example `projects/PROJECT_ID/topics/TOPIC_ID`. - // - // The topic must be in the same project as the Cloud Scheduler job. - string topic_name = 1 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - - // The message payload for PubsubMessage. - // - // Pubsub message must contain either non-empty data, or at least one - // attribute. - bytes data = 3; - - // Attributes for PubsubMessage. - // - // Pubsub message must contain either non-empty data, or at least one - // attribute. - map attributes = 4; -} - -// App Engine Routing. -// -// For more information about services, versions, and instances see -// [An Overview of App -// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), -// [Microservices Architecture on Google App -// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), -// [App Engine Standard request -// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), -// and [App Engine Flex request -// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). -message AppEngineRouting { - // App service. - // - // By default, the job is sent to the service which is the default - // service when the job is attempted. - string service = 1; - - // App version. - // - // By default, the job is sent to the version which is the default - // version when the job is attempted. - string version = 2; - - // App instance. - // - // By default, the job is sent to an instance which is available when - // the job is attempted. - // - // Requests can only be sent to a specific instance if - // [manual scaling is used in App Engine - // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). - // App Engine Flex does not support instances. For more information, see - // [App Engine Standard request - // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) - // and [App Engine Flex request - // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). - string instance = 3; - - // Output only. The host that the job is sent to. - // - // For more information about how App Engine requests are routed, see - // [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). - // - // The host is constructed as: - // - // - // * `host = [application_domain_name]`
- // `| [service] + '.' + [application_domain_name]`
- // `| [version] + '.' + [application_domain_name]`
- // `| [version_dot_service]+ '.' + [application_domain_name]`
- // `| [instance] + '.' + [application_domain_name]`
- // `| [instance_dot_service] + '.' + [application_domain_name]`
- // `| [instance_dot_version] + '.' + [application_domain_name]`
- // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` - // - // * `application_domain_name` = The domain name of the app, for - // example .appspot.com, which is associated with the - // job's project ID. - // - // * `service =` [service][google.cloud.scheduler.v1.AppEngineRouting.service] - // - // * `version =` [version][google.cloud.scheduler.v1.AppEngineRouting.version] - // - // * `version_dot_service =` - // [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +` - // [service][google.cloud.scheduler.v1.AppEngineRouting.service] - // - // * `instance =` [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] - // - // * `instance_dot_service =` - // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +` - // [service][google.cloud.scheduler.v1.AppEngineRouting.service] - // - // * `instance_dot_version =` - // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +` - // [version][google.cloud.scheduler.v1.AppEngineRouting.version] - // - // * `instance_dot_version_dot_service =` - // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +` - // [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +` - // [service][google.cloud.scheduler.v1.AppEngineRouting.service] - // - // - // If [service][google.cloud.scheduler.v1.AppEngineRouting.service] is empty, then the job will be sent - // to the service which is the default service when the job is attempted. - // - // If [version][google.cloud.scheduler.v1.AppEngineRouting.version] is empty, then the job will be sent - // to the version which is the default version when the job is attempted. - // - // If [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is empty, then the job will be - // sent to an instance which is available when the job is attempted. - // - // If [service][google.cloud.scheduler.v1.AppEngineRouting.service], - // [version][google.cloud.scheduler.v1.AppEngineRouting.version], or - // [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is invalid, then the job will be sent - // to the default version of the default service when the job is attempted. - string host = 4; -} - -// The HTTP method used to execute the job. -enum HttpMethod { - // HTTP method unspecified. Defaults to POST. - HTTP_METHOD_UNSPECIFIED = 0; - - // HTTP POST - POST = 1; - - // HTTP GET - GET = 2; - - // HTTP HEAD - HEAD = 3; - - // HTTP PUT - PUT = 4; - - // HTTP DELETE - DELETE = 5; - - // HTTP PATCH - PATCH = 6; - - // HTTP OPTIONS - OPTIONS = 7; -} - -// Contains information needed for generating an -// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). -// This type of authorization should generally only be used when calling Google -// APIs hosted on *.googleapis.com. -message OAuthToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OAuth token. - // The service account must be within the same project as the job. The caller - // must have iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // OAuth scope to be used for generating OAuth access token. - // If not specified, "https://www.googleapis.com/auth/cloud-platform" - // will be used. - string scope = 2; -} - -// Contains information needed for generating an -// [OpenID Connect -// token](https://developers.google.com/identity/protocols/OpenIDConnect). -// This type of authorization can be used for many scenarios, including -// calling Cloud Run, or endpoints where you intend to validate the token -// yourself. -message OidcToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OIDC token. - // The service account must be within the same project as the job. The caller - // must have iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. If not specified, the URI - // specified in target will be used. - string audience = 2; -} - -// The Pub/Sub Topic resource definition is in google/cloud/pubsub/v1/, -// but we do not import that proto directly; therefore, we redefine the -// pattern here. -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 22cac7b5..00000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const CloudSchedulerClient = v1.CloudSchedulerClient; -type CloudSchedulerClient = v1.CloudSchedulerClient; -export {v1, CloudSchedulerClient}; -export default {v1, CloudSchedulerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts b/owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts deleted file mode 100644 index 92fecf17..00000000 --- a/owl-bot-staging/v1/src/v1/cloud_scheduler_client.ts +++ /dev/null @@ -1,1168 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/cloud_scheduler_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_scheduler_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * The Cloud Scheduler API allows external entities to reliably - * schedule asynchronous jobs. - * @class - * @memberof v1 - */ -export class CloudSchedulerClient { - 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; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - cloudSchedulerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudSchedulerClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * 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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudSchedulerClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - 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 = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - 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/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - jobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.scheduler.v1.CloudScheduler', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.cloudSchedulerStub) { - return this.cloudSchedulerStub; - } - - // Put together the "service stub" for - // google.cloud.scheduler.v1.CloudScheduler. - this.cloudSchedulerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.scheduler.v1.CloudScheduler') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.scheduler.v1.CloudScheduler, - this._opts) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudSchedulerStubMethods = - ['listJobs', 'getJob', 'createJob', 'updateJob', 'deleteJob', 'pauseJob', 'resumeJob', 'runJob']; - for (const methodName of cloudSchedulerStubMethods) { - const callPromise = this.cloudSchedulerStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudSchedulerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudscheduler.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudscheduler.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getJob( - request?: protos.google.cloud.scheduler.v1.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.cloud.scheduler.v1.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.cloud.scheduler.v1.IGetJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getJob(request); - */ - getJob( - request?: protos.google.cloud.scheduler.v1.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getJob(request, options, callback); - } - createJob( - request?: protos.google.cloud.scheduler.v1.ICreateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.ICreateJobRequest|undefined, {}|undefined - ]>; - createJob( - request: protos.google.cloud.scheduler.v1.ICreateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; - createJob( - request: protos.google.cloud.scheduler.v1.ICreateJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {google.cloud.scheduler.v1.Job} request.job - * Required. The job to add. The user can optionally specify a name for the - * job in {@link google.cloud.scheduler.v1.Job.name|name}. {@link google.cloud.scheduler.v1.Job.name|name} cannot be the same as an - * existing job. If a name is not specified then the system will - * generate a random unique name that will be returned - * ({@link google.cloud.scheduler.v1.Job.name|name}) in the response. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createJob(request); - */ - createJob( - request?: protos.google.cloud.scheduler.v1.ICreateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.ICreateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createJob(request, options, callback); - } - updateJob( - request?: protos.google.cloud.scheduler.v1.IUpdateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IUpdateJobRequest|undefined, {}|undefined - ]>; - updateJob( - request: protos.google.cloud.scheduler.v1.IUpdateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; - updateJob( - request: protos.google.cloud.scheduler.v1.IUpdateJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates a job. - * - * If successful, the updated {@link google.cloud.scheduler.v1.Job|Job} is returned. If the job does - * not exist, `NOT_FOUND` is returned. - * - * If UpdateJob does not successfully return, it is possible for the - * job to be in an {@link google.cloud.scheduler.v1.Job.State.UPDATE_FAILED|Job.State.UPDATE_FAILED} state. A job in this state may - * not be executed. If this happens, retry the UpdateJob request - * until a successful response is received. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.scheduler.v1.Job} request.job - * Required. The new job properties. {@link google.cloud.scheduler.v1.Job.name|name} must be specified. - * - * Output only fields cannot be modified using UpdateJob. - * Any value specified for an output only field will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * A mask used to specify which fields of the job are being updated. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateJob(request); - */ - updateJob( - request?: protos.google.cloud.scheduler.v1.IUpdateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IUpdateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'job.name': request.job!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateJob(request, options, callback); - } - deleteJob( - request?: protos.google.cloud.scheduler.v1.IDeleteJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1.IDeleteJobRequest|undefined, {}|undefined - ]>; - deleteJob( - request: protos.google.cloud.scheduler.v1.IDeleteJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request: protos.google.cloud.scheduler.v1.IDeleteJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteJob(request); - */ - deleteJob( - request?: protos.google.cloud.scheduler.v1.IDeleteJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1.IDeleteJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteJob(request, options, callback); - } - pauseJob( - request?: protos.google.cloud.scheduler.v1.IPauseJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IPauseJobRequest|undefined, {}|undefined - ]>; - pauseJob( - request: protos.google.cloud.scheduler.v1.IPauseJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, - {}|null|undefined>): void; - pauseJob( - request: protos.google.cloud.scheduler.v1.IPauseJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Pauses a job. - * - * If a job is paused then the system will stop executing the job - * until it is re-enabled via {@link google.cloud.scheduler.v1.CloudScheduler.ResumeJob|ResumeJob}. The - * state of the job is stored in {@link google.cloud.scheduler.v1.Job.state|state}; if paused it - * will be set to {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED}. A job must be in {@link google.cloud.scheduler.v1.Job.State.ENABLED|Job.State.ENABLED} - * to be paused. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.pauseJob(request); - */ - pauseJob( - request?: protos.google.cloud.scheduler.v1.IPauseJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IPauseJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IPauseJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.pauseJob(request, options, callback); - } - resumeJob( - request?: protos.google.cloud.scheduler.v1.IResumeJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IResumeJobRequest|undefined, {}|undefined - ]>; - resumeJob( - request: protos.google.cloud.scheduler.v1.IResumeJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, - {}|null|undefined>): void; - resumeJob( - request: protos.google.cloud.scheduler.v1.IResumeJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Resume a job. - * - * This method reenables a job after it has been {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED}. The - * state of a job is stored in {@link google.cloud.scheduler.v1.Job.state|Job.state}; after calling this method it - * will be set to {@link google.cloud.scheduler.v1.Job.State.ENABLED|Job.State.ENABLED}. A job must be in - * {@link google.cloud.scheduler.v1.Job.State.PAUSED|Job.State.PAUSED} to be resumed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.resumeJob(request); - */ - resumeJob( - request?: protos.google.cloud.scheduler.v1.IResumeJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IResumeJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IResumeJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.resumeJob(request, options, callback); - } - runJob( - request?: protos.google.cloud.scheduler.v1.IRunJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IRunJobRequest|undefined, {}|undefined - ]>; - runJob( - request: protos.google.cloud.scheduler.v1.IRunJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, - {}|null|undefined>): void; - runJob( - request: protos.google.cloud.scheduler.v1.IRunJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Forces a job to run now. - * - * When this method is called, Cloud Scheduler will dispatch the job, even - * if the job is already running. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.runJob(request); - */ - runJob( - request?: protos.google.cloud.scheduler.v1.IRunJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IRunJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob, - protos.google.cloud.scheduler.v1.IRunJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.runJob(request, options, callback); - } - - listJobs( - request?: protos.google.cloud.scheduler.v1.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1.IJob[], - protos.google.cloud.scheduler.v1.IListJobsRequest|null, - protos.google.cloud.scheduler.v1.IListJobsResponse - ]>; - listJobs( - request: protos.google.cloud.scheduler.v1.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.scheduler.v1.IListJobsRequest, - protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1.IJob>): void; - listJobs( - request: protos.google.cloud.scheduler.v1.IListJobsRequest, - callback: PaginationCallback< - protos.google.cloud.scheduler.v1.IListJobsRequest, - protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1.IJob>): void; -/** - * Lists jobs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 500. If unspecified, the page size will - * be the maximum. Fewer jobs than requested might be returned, - * even if more jobs exist; use next_page_token to determine if more - * jobs exist. - * @param {string} request.pageToken - * A token identifying a page of results the server will return. To - * request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from - * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to - * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or - * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Job]{@link google.cloud.scheduler.v1.Job}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listJobs( - request?: protos.google.cloud.scheduler.v1.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.scheduler.v1.IListJobsRequest, - protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1.IJob>, - callback?: PaginationCallback< - protos.google.cloud.scheduler.v1.IListJobsRequest, - protos.google.cloud.scheduler.v1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1.IJob>): - Promise<[ - protos.google.cloud.scheduler.v1.IJob[], - protos.google.cloud.scheduler.v1.IListJobsRequest|null, - protos.google.cloud.scheduler.v1.IListJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listJobs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 500. If unspecified, the page size will - * be the maximum. Fewer jobs than requested might be returned, - * even if more jobs exist; use next_page_token to determine if more - * jobs exist. - * @param {string} request.pageToken - * A token identifying a page of results the server will return. To - * request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from - * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to - * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or - * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Job]{@link google.cloud.scheduler.v1.Job} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listJobsStream( - request?: protos.google.cloud.scheduler.v1.IListJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 500. If unspecified, the page size will - * be the maximum. Fewer jobs than requested might be returned, - * even if more jobs exist; use next_page_token to determine if more - * jobs exist. - * @param {string} request.pageToken - * A token identifying a page of results the server will return. To - * request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link google.cloud.scheduler.v1.ListJobsResponse.next_page_token|next_page_token} returned from - * the previous call to {@link google.cloud.scheduler.v1.CloudScheduler.ListJobs|ListJobs}. It is an error to - * switch the value of {@link google.cloud.scheduler.v1.ListJobsRequest.filter|filter} or - * {@link google.cloud.scheduler.v1.ListJobsRequest.order_by|order_by} while iterating through pages. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Job]{@link google.cloud.scheduler.v1.Job}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listJobsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listJobsAsync( - request?: protos.google.cloud.scheduler.v1.IListJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified job resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} job - * @returns {string} Resource name string. - */ - jobPath(project:string,location:string,job:string) { - return this.pathTemplates.jobPathTemplate.render({ - project: project, - location: location, - job: job, - }); - } - - /** - * Parse the project from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the project. - */ - matchProjectFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).project; - } - - /** - * Parse the location from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the location. - */ - matchLocationFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).location; - } - - /** - * Parse the job from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the job. - */ - matchJobFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).job; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.cloudSchedulerStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json b/owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json deleted file mode 100644 index edb34789..00000000 --- a/owl-bot-staging/v1/src/v1/cloud_scheduler_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.scheduler.v1.CloudScheduler": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListJobs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetJob": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJob": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "PauseJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResumeJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RunJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json b/owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json deleted file mode 100644 index 2762a016..00000000 --- a/owl-bot-staging/v1/src/v1/cloud_scheduler_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/scheduler/v1/cloudscheduler.proto", - "../../protos/google/cloud/scheduler/v1/job.proto", - "../../protos/google/cloud/scheduler/v1/target.proto" -] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 122c43fb..00000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.scheduler.v1", - "libraryPackage": "@google-cloud/scheduler", - "services": { - "CloudScheduler": { - "clients": { - "grpc": { - "libraryClient": "CloudSchedulerClient", - "rpcs": { - "GetJob": { - "methods": [ - "getJob" - ] - }, - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "PauseJob": { - "methods": [ - "pauseJob" - ] - }, - "ResumeJob": { - "methods": [ - "resumeJob" - ] - }, - "RunJob": { - "methods": [ - "runJob" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudSchedulerClient", - "rpcs": { - "GetJob": { - "methods": [ - "getJob" - ] - }, - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "PauseJob": { - "methods": [ - "pauseJob" - ] - }, - "ResumeJob": { - "methods": [ - "resumeJob" - ] - }, - "RunJob": { - "methods": [ - "runJob" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 8805934c..00000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {CloudSchedulerClient} from './cloud_scheduler_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 733beea6..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const scheduler = require('@google-cloud/scheduler'); - -function main() { - const cloudSchedulerClient = new scheduler.CloudSchedulerClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 7ceaecb2..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {CloudSchedulerClient} from '@google-cloud/scheduler'; - -// check that the client class type name can be used -function doStuffWithCloudSchedulerClient(client: CloudSchedulerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudSchedulerClient = new CloudSchedulerClient(); - doStuffWithCloudSchedulerClient(cloudSchedulerClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 1f850b52..00000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts b/owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts deleted file mode 100644 index e5ad3b2e..00000000 --- a/owl-bot-staging/v1/test/gapic_cloud_scheduler_v1.ts +++ /dev/null @@ -1,1097 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as cloudschedulerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.CloudSchedulerClient', () => { - it('has servicePath', () => { - const servicePath = cloudschedulerModule.v1.CloudSchedulerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudschedulerModule.v1.CloudSchedulerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudschedulerModule.v1.CloudSchedulerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudSchedulerStub, undefined); - await client.initialize(); - assert(client.cloudSchedulerStub); - }); - - it('has close method', () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createJob', () => { - it('invokes createJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); - const [response] = await client.createJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJob(request), expectedError); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateJob', () => { - it('invokes updateJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.UpdateJobRequest()); - request.job = {}; - request.job.name = ''; - const expectedHeaderRequestParams = "job.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); - const [response] = await client.updateJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.UpdateJobRequest()); - request.job = {}; - request.job.name = ''; - const expectedHeaderRequestParams = "job.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.UpdateJobRequest()); - request.job = {}; - request.job.name = ''; - const expectedHeaderRequestParams = "job.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJob(request), expectedError); - assert((client.innerApiCalls.updateJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteJob', () => { - it('invokes deleteJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJob(request), expectedError); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('pauseJob', () => { - it('invokes pauseJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.PauseJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.pauseJob = stubSimpleCall(expectedResponse); - const [response] = await client.pauseJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pauseJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes pauseJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.PauseJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.pauseJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pauseJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes pauseJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.PauseJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseJob(request), expectedError); - assert((client.innerApiCalls.pauseJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('resumeJob', () => { - it('invokes resumeJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ResumeJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.resumeJob = stubSimpleCall(expectedResponse); - const [response] = await client.resumeJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resumeJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resumeJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ResumeJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.resumeJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resumeJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes resumeJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ResumeJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeJob(request), expectedError); - assert((client.innerApiCalls.resumeJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('runJob', () => { - it('invokes runJob without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.RunJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.runJob = stubSimpleCall(expectedResponse); - const [response] = await client.runJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runJob without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.RunJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()); - client.innerApiCalls.runJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runJob with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.RunJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.runJob(request), expectedError); - assert((client.innerApiCalls.runJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1.IJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listJobs with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.scheduler.v1.Job[] = []; - stream.on('data', (response: protos.google.cloud.scheduler.v1.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert.strictEqual( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.scheduler.v1.Job[] = []; - stream.on('data', (response: protos.google.cloud.scheduler.v1.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert.strictEqual( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1.Job()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.scheduler.v1.IJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.scheduler.v1.IJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('job', () => { - const fakePath = "/rendered/path/job"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job: "jobValue", - }; - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.jobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.jobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('jobPath', () => { - const result = client.jobPath("projectValue", "locationValue", "jobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.jobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromJobName', () => { - const result = client.matchProjectFromJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromJobName', () => { - const result = client.matchLocationFromJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobFromJobName', () => { - const result = client.matchJobFromJobName(fakePath); - assert.strictEqual(result, "jobValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new cloudschedulerModule.v1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index d4565464..00000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'scheduler', - filename: './scheduler.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore deleted file mode 100644 index 521dc25a..00000000 --- a/owl-bot-staging/v1beta1/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js deleted file mode 100644 index a3c17684..00000000 --- a/owl-bot-staging/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/scheduler', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js deleted file mode 100644 index 50bc7f79..00000000 --- a/owl-bot-staging/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 84f4713a..00000000 --- a/owl-bot-staging/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md deleted file mode 100644 index 90fa2a2d..00000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Scheduler: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json deleted file mode 100644 index 29a223b6..00000000 --- a/owl-bot-staging/v1beta1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index 0d466273..00000000 --- a/owl-bot-staging/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/scheduler", - "version": "0.1.0", - "description": "Scheduler client for Node.js", - "repository": "googleapis/nodejs-scheduler", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google scheduler", - "scheduler", - "cloud scheduler" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.15.0" - }, - "devDependencies": { - "@types/mocha": "^8.2.2", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^8.4.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto deleted file mode 100644 index 4f86b7a5..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.scheduler.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/scheduler/v1beta1/job.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1;scheduler"; -option java_multiple_files = true; -option java_outer_classname = "SchedulerProto"; -option java_package = "com.google.cloud.scheduler.v1beta1"; -option objc_class_prefix = "SCHEDULER"; - -// The Cloud Scheduler API allows external entities to reliably -// schedule asynchronous jobs. -service CloudScheduler { - option (google.api.default_host) = "cloudscheduler.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists jobs. - rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/jobs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a job. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/jobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a job. - rpc CreateJob(CreateJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/jobs" - body: "job" - }; - option (google.api.method_signature) = "parent,job"; - } - - // Updates a job. - // - // If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does - // not exist, `NOT_FOUND` is returned. - // - // If UpdateJob does not successfully return, it is possible for the - // job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may - // not be executed. If this happens, retry the UpdateJob request - // until a successful response is received. - rpc UpdateJob(UpdateJobRequest) returns (Job) { - option (google.api.http) = { - patch: "/v1beta1/{job.name=projects/*/locations/*/jobs/*}" - body: "job" - }; - option (google.api.method_signature) = "job,update_mask"; - } - - // Deletes a job. - rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/jobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Pauses a job. - // - // If a job is paused then the system will stop executing the job - // until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The - // state of the job is stored in [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it - // will be set to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] - // to be paused. - rpc PauseJob(PauseJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Resume a job. - // - // This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The - // state of a job is stored in [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this method it - // will be set to [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A job must be in - // [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed. - rpc ResumeJob(ResumeJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Forces a job to run now. - // - // When this method is called, Cloud Scheduler will dispatch the job, even - // if the job is already running. - rpc RunJob(RunJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/jobs/*}:run" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for listing jobs using [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. -message ListJobsRequest { - // Required. The location name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudscheduler.googleapis.com/Job" - } - ]; - - // Requested page size. - // - // The maximum page size is 500. If unspecified, the page size will - // be the maximum. Fewer jobs than requested might be returned, - // even if more jobs exist; use next_page_token to determine if more - // jobs exist. - int32 page_size = 5; - - // A token identifying a page of results the server will return. To - // request the first page results, page_token must be empty. To - // request the next page of results, page_token must be the value of - // [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token] returned from - // the previous call to [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is an error to - // switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or - // [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages. - string page_token = 6; -} - -// Response message for listing jobs using [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. -message ListJobsResponse { - // The list of jobs. - repeated Job jobs = 1; - - // A token to retrieve next page of results. Pass this value in the - // [page_token][google.cloud.scheduler.v1beta1.ListJobsRequest.page_token] field in the subsequent call to - // [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs] to retrieve the next page of results. - // If this is empty it indicates that there are no more results - // through which to paginate. - // - // The page token is valid for only 2 hours. - string next_page_token = 2; -} - -// Request message for [GetJob][google.cloud.scheduler.v1beta1.CloudScheduler.GetJob]. -message GetJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob]. -message CreateJobRequest { - // Required. The location name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudscheduler.googleapis.com/Job" - } - ]; - - // Required. The job to add. The user can optionally specify a name for the - // job in [name][google.cloud.scheduler.v1beta1.Job.name]. [name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an - // existing job. If a name is not specified then the system will - // generate a random unique name that will be returned - // ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response. - Job job = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob]. -message UpdateJobRequest { - // Required. The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified. - // - // Output only fields cannot be modified using UpdateJob. - // Any value specified for an output only field will be ignored. - Job job = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask used to specify which fields of the job are being updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for deleting a job using -// [DeleteJob][google.cloud.scheduler.v1beta1.CloudScheduler.DeleteJob]. -message DeleteJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for [PauseJob][google.cloud.scheduler.v1beta1.CloudScheduler.PauseJob]. -message PauseJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. -message ResumeJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} - -// Request message for forcing a job to run now using -// [RunJob][google.cloud.scheduler.v1beta1.CloudScheduler.RunJob]. -message RunJobRequest { - // Required. The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudscheduler.googleapis.com/Job" - } - ]; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto deleted file mode 100644 index ddfda31e..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/job.proto +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.scheduler.v1beta1; - -import "google/api/resource.proto"; -import "google/cloud/scheduler/v1beta1/target.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1;scheduler"; -option java_multiple_files = true; -option java_outer_classname = "JobProto"; -option java_package = "com.google.cloud.scheduler.v1beta1"; - -// Configuration for a job. -// The maximum allowed size for a job is 100KB. -message Job { - option (google.api.resource) = { - type: "cloudscheduler.googleapis.com/Job" - pattern: "projects/{project}/locations/{location}/jobs/{job}" - }; - - // State of the job. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The job is executing normally. - ENABLED = 1; - - // The job is paused by the user. It will not execute. A user can - // intentionally pause the job using - // [PauseJobRequest][google.cloud.scheduler.v1beta1.PauseJobRequest]. - PAUSED = 2; - - // The job is disabled by the system due to error. The user - // cannot directly set a job to be disabled. - DISABLED = 3; - - // The job state resulting from a failed [CloudScheduler.UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob] - // operation. To recover a job from this state, retry - // [CloudScheduler.UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob] until a successful response is received. - UPDATE_FAILED = 4; - } - - // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob], after - // which it becomes output only. - // - // The job name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - // - // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), colons (:), or periods (.). - // For more information, see - // [Identifying - // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - // * `LOCATION_ID` is the canonical ID for the job's location. - // The list of available locations can be obtained by calling - // [ListLocations][google.cloud.location.Locations.ListLocations]. - // For more information, see https://cloud.google.com/about/locations/. - // * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), or underscores (_). The maximum length is 500 characters. - string name = 1; - - // Optionally caller-specified in [CreateJob][google.cloud.scheduler.v1beta1.CloudScheduler.CreateJob] or - // [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob]. - // - // A human-readable description for the job. This string must not contain - // more than 500 characters. - string description = 2; - - // Required. - // - // Delivery settings containing destination and parameters. - oneof target { - // Pub/Sub target. - PubsubTarget pubsub_target = 4; - - // App Engine HTTP target. - AppEngineHttpTarget app_engine_http_target = 5; - - // HTTP target. - HttpTarget http_target = 6; - } - - // Required, except when used with [UpdateJob][google.cloud.scheduler.v1beta1.CloudScheduler.UpdateJob]. - // - // Describes the schedule on which the job will be executed. - // - // The schedule can be either of the following types: - // - // * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview) - // * English-like - // [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) - // - // As a general rule, execution `n + 1` of a job will not begin - // until execution `n` has finished. Cloud Scheduler will never - // allow two simultaneously outstanding executions. For example, - // this implies that if the `n+1`th execution is scheduled to run at - // 16:00 but the `n`th execution takes until 16:15, the `n+1`th - // execution will not start until `16:15`. - // A scheduled start time will be delayed if the previous - // execution has not ended when its scheduled time occurs. - // - // If [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] > 0 and a job attempt fails, - // the job will be tried a total of [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] - // times, with exponential backoff, until the next scheduled start - // time. - string schedule = 20; - - // Specifies the time zone to be used in interpreting - // [schedule][google.cloud.scheduler.v1beta1.Job.schedule]. The value of this field must be a time - // zone name from the [tz database](http://en.wikipedia.org/wiki/Tz_database). - // - // Note that some time zones include a provision for - // daylight savings time. The rules for daylight saving time are - // determined by the chosen tz. For UTC use the string "utc". If a - // time zone is not specified, the default will be in UTC (also known - // as GMT). - string time_zone = 21; - - // Output only. The creation time of the job. - google.protobuf.Timestamp user_update_time = 9; - - // Output only. State of the job. - State state = 10; - - // Output only. The response from the target for the last attempted execution. - google.rpc.Status status = 11; - - // Output only. The next time the job is scheduled. Note that this may be a - // retry of a previously failed attempt or the next execution time - // according to the schedule. - google.protobuf.Timestamp schedule_time = 17; - - // Output only. The time the last job attempt started. - google.protobuf.Timestamp last_attempt_time = 18; - - // Settings that determine the retry behavior. - RetryConfig retry_config = 19; - - // The deadline for job attempts. If the request handler does not respond by - // this deadline then the request is cancelled and the attempt is marked as a - // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in - // execution logs. Cloud Scheduler will retry the job according - // to the [RetryConfig][google.cloud.scheduler.v1beta1.RetryConfig]. - // - // The allowed duration for this deadline is: - // - // * For [HTTP targets][google.cloud.scheduler.v1beta1.Job.http_target], between 15 seconds and 30 minutes. - // * For [App Engine HTTP targets][google.cloud.scheduler.v1beta1.Job.app_engine_http_target], between 15 - // seconds and 24 hours. - // * For [PubSub targets][google.cloud.scheduler.v1beta1.Job.pubsub_target], this field is ignored. - google.protobuf.Duration attempt_deadline = 22; -} - -// Settings that determine the retry behavior. -// -// By default, if a job does not complete successfully (meaning that -// an acknowledgement is not received from the handler, then it will be retried -// with exponential backoff according to the settings in [RetryConfig][google.cloud.scheduler.v1beta1.RetryConfig]. -message RetryConfig { - // The number of attempts that the system will make to run a job using the - // exponential backoff procedure described by - // [max_doublings][google.cloud.scheduler.v1beta1.RetryConfig.max_doublings]. - // - // The default value of retry_count is zero. - // - // If retry_count is zero, a job attempt will *not* be retried if - // it fails. Instead the Cloud Scheduler system will wait for the - // next scheduled execution time. - // - // If retry_count is set to a non-zero number then Cloud Scheduler - // will retry failed attempts, using exponential backoff, - // retry_count times, or until the next scheduled execution time, - // whichever comes first. - // - // Values greater than 5 and negative values are not allowed. - int32 retry_count = 1; - - // The time limit for retrying a failed job, measured from time when an - // execution was first attempted. If specified with - // [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count], the job will be retried until both - // limits are reached. - // - // The default value for max_retry_duration is zero, which means retry - // duration is unlimited. - google.protobuf.Duration max_retry_duration = 2; - - // The minimum amount of time to wait before retrying a job after - // it fails. - // - // The default value of this field is 5 seconds. - google.protobuf.Duration min_backoff_duration = 3; - - // The maximum amount of time to wait before retrying a job after - // it fails. - // - // The default value of this field is 1 hour. - google.protobuf.Duration max_backoff_duration = 4; - - // The time between retries will double `max_doublings` times. - // - // A job's retry interval starts at - // [min_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.min_backoff_duration], then doubles - // `max_doublings` times, then increases linearly, and finally - // retries retries at intervals of - // [max_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.max_backoff_duration] up to - // [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] times. - // - // For example, if [min_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.min_backoff_duration] is - // 10s, [max_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.max_backoff_duration] is 300s, and - // `max_doublings` is 3, then the a job will first be retried in 10s. The - // retry interval will double three times, and then increase linearly by - // 2^3 * 10s. Finally, the job will retry at intervals of - // [max_backoff_duration][google.cloud.scheduler.v1beta1.RetryConfig.max_backoff_duration] until the job has - // been attempted [retry_count][google.cloud.scheduler.v1beta1.RetryConfig.retry_count] times. Thus, the - // requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... - // - // The default value of this field is 5. - int32 max_doublings = 5; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto b/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto deleted file mode 100644 index 4b47e356..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/scheduler/v1beta1/target.proto +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.scheduler.v1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1;scheduler"; -option java_multiple_files = true; -option java_outer_classname = "TargetProto"; -option java_package = "com.google.cloud.scheduler.v1beta1"; - -// Http target. The job will be pushed to the job handler by means of -// an HTTP request via an [http_method][google.cloud.scheduler.v1beta1.HttpTarget.http_method] such as HTTP -// POST, HTTP GET, etc. The job is acknowledged by means of an HTTP -// response code in the range [200 - 299]. A failure to receive a response -// constitutes a failed execution. For a redirected request, the response -// returned by the redirected request is considered. -message HttpTarget { - // Required. The full URI path that the request will be sent to. This string - // must begin with either "http://" or "https://". Some examples of - // valid values for [uri][google.cloud.scheduler.v1beta1.HttpTarget.uri] are: - // `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will - // encode some characters for safety and compatibility. The maximum allowed - // URL length is 2083 characters after encoding. - string uri = 1; - - // Which HTTP method to use for the request. - HttpMethod http_method = 2; - - // The user can specify HTTP request headers to send with the job's - // HTTP request. This map contains the header field names and - // values. Repeated headers are not supported, but a header value can - // contain commas. These headers represent a subset of the headers - // that will accompany the job's HTTP request. Some HTTP request - // headers will be ignored or replaced. A partial list of headers that - // will be ignored or replaced is below: - // - Host: This will be computed by Cloud Scheduler and derived from - // [uri][google.cloud.scheduler.v1beta1.HttpTarget.uri]. - // * `Content-Length`: This will be computed by Cloud Scheduler. - // * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`. - // * `X-Google-*`: Google internal use only. - // * `X-AppEngine-*`: Google internal use only. - // - // The total size of headers must be less than 80KB. - map headers = 3; - - // HTTP request body. A request body is allowed only if the HTTP - // method is POST, PUT, or PATCH. It is an error to set body on a job with an - // incompatible [HttpMethod][google.cloud.scheduler.v1beta1.HttpMethod]. - bytes body = 4; - - // The mode for generating an `Authorization` header for HTTP requests. - // - // If specified, all `Authorization` headers in the [HttpTarget.headers][google.cloud.scheduler.v1beta1.HttpTarget.headers] - // field will be overridden. - oneof authorization_header { - // If specified, an - // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) - // will be generated and attached as an `Authorization` header in the HTTP - // request. - // - // This type of authorization should generally only be used when calling - // Google APIs hosted on *.googleapis.com. - OAuthToken oauth_token = 5; - - // If specified, an - // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) - // token will be generated and attached as an `Authorization` header in the - // HTTP request. - // - // This type of authorization can be used for many scenarios, including - // calling Cloud Run, or endpoints where you intend to validate the token - // yourself. - OidcToken oidc_token = 6; - } -} - -// App Engine target. The job will be pushed to a job handler by means -// of an HTTP request via an [http_method][google.cloud.scheduler.v1beta1.AppEngineHttpTarget.http_method] such -// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an -// HTTP response code in the range [200 - 299]. Error 503 is -// considered an App Engine system error instead of an application -// error. Requests returning error 503 will be retried regardless of -// retry configuration and not counted against retry counts. Any other -// response code, or a failure to receive a response before the -// deadline, constitutes a failed attempt. -message AppEngineHttpTarget { - // The HTTP method to use for the request. PATCH and OPTIONS are not - // permitted. - HttpMethod http_method = 1; - - // App Engine Routing setting for the job. - AppEngineRouting app_engine_routing = 2; - - // The relative URI. - // - // The relative URL must begin with "/" and must be a valid HTTP relative URL. - // It can contain a path, query string arguments, and `#` fragments. - // If the relative URL is empty, then the root path "/" will be used. - // No spaces are allowed, and the maximum length allowed is 2083 characters. - string relative_uri = 3; - - // HTTP request headers. - // - // This map contains the header field names and values. Headers can be set - // when the job is created. - // - // Cloud Scheduler sets some headers to default values: - // - // * `User-Agent`: By default, this header is - // `"AppEngine-Google; (+http://code.google.com/appengine)"`. - // This header can be modified, but Cloud Scheduler will append - // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the - // modified `User-Agent`. - // * `X-CloudScheduler`: This header will be set to true. - // - // If the job has an [body][google.cloud.scheduler.v1beta1.AppEngineHttpTarget.body], Cloud Scheduler sets - // the following headers: - // - // * `Content-Type`: By default, the `Content-Type` header is set to - // `"application/octet-stream"`. The default can be overridden by explictly - // setting `Content-Type` to a particular media type when the job is - // created. - // For example, `Content-Type` can be set to `"application/json"`. - // * `Content-Length`: This is computed by Cloud Scheduler. This value is - // output only. It cannot be changed. - // - // The headers below are output only. They cannot be set or overridden: - // - // * `X-Google-*`: For Google internal use only. - // * `X-AppEngine-*`: For Google internal use only. - // - // In addition, some App Engine headers, which contain - // job-specific information, are also be sent to the job handler. - map headers = 4; - - // Body. - // - // HTTP request body. A request body is allowed only if the HTTP method is - // POST or PUT. It will result in invalid argument error to set a body on a - // job with an incompatible [HttpMethod][google.cloud.scheduler.v1beta1.HttpMethod]. - bytes body = 5; -} - -// Pub/Sub target. The job will be delivered by publishing a message to -// the given Pub/Sub topic. -message PubsubTarget { - // Required. The name of the Cloud Pub/Sub topic to which messages will - // be published when a job is delivered. The topic name must be in the - // same format as required by PubSub's - // [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), - // for example `projects/PROJECT_ID/topics/TOPIC_ID`. - // - // The topic must be in the same project as the Cloud Scheduler job. - string topic_name = 1 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - - // The message payload for PubsubMessage. - // - // Pubsub message must contain either non-empty data, or at least one - // attribute. - bytes data = 3; - - // Attributes for PubsubMessage. - // - // Pubsub message must contain either non-empty data, or at least one - // attribute. - map attributes = 4; -} - -// App Engine Routing. -// -// For more information about services, versions, and instances see -// [An Overview of App -// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), -// [Microservices Architecture on Google App -// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), -// [App Engine Standard request -// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), -// and [App Engine Flex request -// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). -message AppEngineRouting { - // App service. - // - // By default, the job is sent to the service which is the default - // service when the job is attempted. - string service = 1; - - // App version. - // - // By default, the job is sent to the version which is the default - // version when the job is attempted. - string version = 2; - - // App instance. - // - // By default, the job is sent to an instance which is available when - // the job is attempted. - // - // Requests can only be sent to a specific instance if - // [manual scaling is used in App Engine - // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). - // App Engine Flex does not support instances. For more information, see - // [App Engine Standard request - // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) - // and [App Engine Flex request - // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). - string instance = 3; - - // Output only. The host that the job is sent to. - // - // For more information about how App Engine requests are routed, see - // [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). - // - // The host is constructed as: - // - // - // * `host = [application_domain_name]`
- // `| [service] + '.' + [application_domain_name]`
- // `| [version] + '.' + [application_domain_name]`
- // `| [version_dot_service]+ '.' + [application_domain_name]`
- // `| [instance] + '.' + [application_domain_name]`
- // `| [instance_dot_service] + '.' + [application_domain_name]`
- // `| [instance_dot_version] + '.' + [application_domain_name]`
- // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` - // - // * `application_domain_name` = The domain name of the app, for - // example .appspot.com, which is associated with the - // job's project ID. - // - // * `service =` [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] - // - // * `version =` [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] - // - // * `version_dot_service =` - // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] `+ '.' +` - // [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] - // - // * `instance =` [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] - // - // * `instance_dot_service =` - // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] `+ '.' +` - // [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] - // - // * `instance_dot_version =` - // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] `+ '.' +` - // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] - // - // * `instance_dot_version_dot_service =` - // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] `+ '.' +` - // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] `+ '.' +` - // [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] - // - // - // If [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service] is empty, then the job will be sent - // to the service which is the default service when the job is attempted. - // - // If [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version] is empty, then the job will be sent - // to the version which is the default version when the job is attempted. - // - // If [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] is empty, then the job will be - // sent to an instance which is available when the job is attempted. - // - // If [service][google.cloud.scheduler.v1beta1.AppEngineRouting.service], - // [version][google.cloud.scheduler.v1beta1.AppEngineRouting.version], or - // [instance][google.cloud.scheduler.v1beta1.AppEngineRouting.instance] is invalid, then the job will be sent - // to the default version of the default service when the job is attempted. - string host = 4; -} - -// The HTTP method used to execute the job. -enum HttpMethod { - // HTTP method unspecified. Defaults to POST. - HTTP_METHOD_UNSPECIFIED = 0; - - // HTTP POST - POST = 1; - - // HTTP GET - GET = 2; - - // HTTP HEAD - HEAD = 3; - - // HTTP PUT - PUT = 4; - - // HTTP DELETE - DELETE = 5; - - // HTTP PATCH - PATCH = 6; - - // HTTP OPTIONS - OPTIONS = 7; -} - -// Contains information needed for generating an -// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). -// This type of authorization should generally only be used when calling Google -// APIs hosted on *.googleapis.com. -message OAuthToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OAuth token. - // The service account must be within the same project as the job. The caller - // must have iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // OAuth scope to be used for generating OAuth access token. - // If not specified, "https://www.googleapis.com/auth/cloud-platform" - // will be used. - string scope = 2; -} - -// Contains information needed for generating an -// [OpenID Connect -// token](https://developers.google.com/identity/protocols/OpenIDConnect). -// This type of authorization can be used for many scenarios, including -// calling Cloud Run, or endpoints where you intend to validate the token -// yourself. -message OidcToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OIDC token. - // The service account must be within the same project as the job. The caller - // must have iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. If not specified, the URI - // specified in target will be used. - string audience = 2; -} - -// The Pub/Sub Topic resource definition is in google/cloud/pubsub/v1/, -// but we do not import that proto directly; therefore, we redefine the -// pattern here. -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 8c3963ad..00000000 --- a/owl-bot-staging/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1beta1 from './v1beta1'; -const CloudSchedulerClient = v1beta1.CloudSchedulerClient; -type CloudSchedulerClient = v1beta1.CloudSchedulerClient; -export {v1beta1, CloudSchedulerClient}; -export default {v1beta1, CloudSchedulerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts deleted file mode 100644 index 268b2c28..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client.ts +++ /dev/null @@ -1,1168 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/cloud_scheduler_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_scheduler_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * The Cloud Scheduler API allows external entities to reliably - * schedule asynchronous jobs. - * @class - * @memberof v1beta1 - */ -export class CloudSchedulerClient { - 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; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - cloudSchedulerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudSchedulerClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * 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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudSchedulerClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - 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 = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - 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/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - jobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.scheduler.v1beta1.CloudScheduler', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.cloudSchedulerStub) { - return this.cloudSchedulerStub; - } - - // Put together the "service stub" for - // google.cloud.scheduler.v1beta1.CloudScheduler. - this.cloudSchedulerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.scheduler.v1beta1.CloudScheduler') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.scheduler.v1beta1.CloudScheduler, - this._opts) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudSchedulerStubMethods = - ['listJobs', 'getJob', 'createJob', 'updateJob', 'deleteJob', 'pauseJob', 'resumeJob', 'runJob']; - for (const methodName of cloudSchedulerStubMethods) { - const callPromise = this.cloudSchedulerStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudSchedulerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudscheduler.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudscheduler.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - getJob( - request?: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getJob(request); - */ - getJob( - request?: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getJob(request, options, callback); - } - createJob( - request?: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|undefined, {}|undefined - ]>; - createJob( - request: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; - createJob( - request: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {google.cloud.scheduler.v1beta1.Job} request.job - * Required. The job to add. The user can optionally specify a name for the - * job in {@link google.cloud.scheduler.v1beta1.Job.name|name}. {@link google.cloud.scheduler.v1beta1.Job.name|name} cannot be the same as an - * existing job. If a name is not specified then the system will - * generate a random unique name that will be returned - * ({@link google.cloud.scheduler.v1beta1.Job.name|name}) in the response. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createJob(request); - */ - createJob( - request?: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.ICreateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createJob(request, options, callback); - } - updateJob( - request?: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|undefined, {}|undefined - ]>; - updateJob( - request: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; - updateJob( - request: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates a job. - * - * If successful, the updated {@link google.cloud.scheduler.v1beta1.Job|Job} is returned. If the job does - * not exist, `NOT_FOUND` is returned. - * - * If UpdateJob does not successfully return, it is possible for the - * job to be in an {@link google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED|Job.State.UPDATE_FAILED} state. A job in this state may - * not be executed. If this happens, retry the UpdateJob request - * until a successful response is received. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.scheduler.v1beta1.Job} request.job - * Required. The new job properties. {@link google.cloud.scheduler.v1beta1.Job.name|name} must be specified. - * - * Output only fields cannot be modified using UpdateJob. - * Any value specified for an output only field will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * A mask used to specify which fields of the job are being updated. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateJob(request); - */ - updateJob( - request?: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'job.name': request.job!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateJob(request, options, callback); - } - deleteJob( - request?: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|undefined, {}|undefined - ]>; - deleteJob( - request: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Deletes a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteJob(request); - */ - deleteJob( - request?: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteJob(request, options, callback); - } - pauseJob( - request?: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|undefined, {}|undefined - ]>; - pauseJob( - request: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, - {}|null|undefined>): void; - pauseJob( - request: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Pauses a job. - * - * If a job is paused then the system will stop executing the job - * until it is re-enabled via {@link google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob|ResumeJob}. The - * state of the job is stored in {@link google.cloud.scheduler.v1beta1.Job.state|state}; if paused it - * will be set to {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED}. A job must be in {@link google.cloud.scheduler.v1beta1.Job.State.ENABLED|Job.State.ENABLED} - * to be paused. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.pauseJob(request); - */ - pauseJob( - request?: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IPauseJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.pauseJob(request, options, callback); - } - resumeJob( - request?: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|undefined, {}|undefined - ]>; - resumeJob( - request: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, - {}|null|undefined>): void; - resumeJob( - request: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Resume a job. - * - * This method reenables a job after it has been {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED}. The - * state of a job is stored in {@link google.cloud.scheduler.v1beta1.Job.state|Job.state}; after calling this method it - * will be set to {@link google.cloud.scheduler.v1beta1.Job.State.ENABLED|Job.State.ENABLED}. A job must be in - * {@link google.cloud.scheduler.v1beta1.Job.State.PAUSED|Job.State.PAUSED} to be resumed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.resumeJob(request); - */ - resumeJob( - request?: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IResumeJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.resumeJob(request, options, callback); - } - runJob( - request?: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IRunJobRequest|undefined, {}|undefined - ]>; - runJob( - request: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, - {}|null|undefined>): void; - runJob( - request: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, - callback: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, - {}|null|undefined>): void; -/** - * Forces a job to run now. - * - * When this method is called, Cloud Scheduler will dispatch the job, even - * if the job is already running. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The job name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. - * @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. - * The first element of the array is an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.runJob(request); - */ - runJob( - request?: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IRunJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob, - protos.google.cloud.scheduler.v1beta1.IRunJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.runJob(request, options, callback); - } - - listJobs( - request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob[], - protos.google.cloud.scheduler.v1beta1.IListJobsRequest|null, - protos.google.cloud.scheduler.v1beta1.IListJobsResponse - ]>; - listJobs( - request: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1beta1.IJob>): void; - listJobs( - request: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - callback: PaginationCallback< - protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1beta1.IJob>): void; -/** - * Lists jobs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 500. If unspecified, the page size will - * be the maximum. Fewer jobs than requested might be returned, - * even if more jobs exist; use next_page_token to determine if more - * jobs exist. - * @param {string} request.pageToken - * A token identifying a page of results the server will return. To - * request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from - * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to - * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or - * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Job]{@link google.cloud.scheduler.v1beta1.Job}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listJobs( - request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1beta1.IJob>, - callback?: PaginationCallback< - protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - protos.google.cloud.scheduler.v1beta1.IListJobsResponse|null|undefined, - protos.google.cloud.scheduler.v1beta1.IJob>): - Promise<[ - protos.google.cloud.scheduler.v1beta1.IJob[], - protos.google.cloud.scheduler.v1beta1.IListJobsRequest|null, - protos.google.cloud.scheduler.v1beta1.IListJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listJobs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 500. If unspecified, the page size will - * be the maximum. Fewer jobs than requested might be returned, - * even if more jobs exist; use next_page_token to determine if more - * jobs exist. - * @param {string} request.pageToken - * A token identifying a page of results the server will return. To - * request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from - * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to - * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or - * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Job]{@link google.cloud.scheduler.v1beta1.Job} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listJobsStream( - request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID`. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 500. If unspecified, the page size will - * be the maximum. Fewer jobs than requested might be returned, - * even if more jobs exist; use next_page_token to determine if more - * jobs exist. - * @param {string} request.pageToken - * A token identifying a page of results the server will return. To - * request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token|next_page_token} returned from - * the previous call to {@link google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs|ListJobs}. It is an error to - * switch the value of {@link google.cloud.scheduler.v1beta1.ListJobsRequest.filter|filter} or - * {@link google.cloud.scheduler.v1beta1.ListJobsRequest.order_by|order_by} while iterating through pages. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Job]{@link google.cloud.scheduler.v1beta1.Job}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listJobsAsync(request); - * for await (const response of iterable) { - * // process response - * } - */ - listJobsAsync( - request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - options = options || {}; - const callSettings = new gax.CallSettings(options); - this.initialize(); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified job resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} job - * @returns {string} Resource name string. - */ - jobPath(project:string,location:string,job:string) { - return this.pathTemplates.jobPathTemplate.render({ - project: project, - location: location, - job: job, - }); - } - - /** - * Parse the project from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the project. - */ - matchProjectFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).project; - } - - /** - * Parse the location from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the location. - */ - matchLocationFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).location; - } - - /** - * Parse the job from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the job. - */ - matchJobFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).job; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.cloudSchedulerStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json deleted file mode 100644 index 6ded8fff..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.scheduler.v1beta1.CloudScheduler": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListJobs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetJob": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJob": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "PauseJob": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ResumeJob": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunJob": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json deleted file mode 100644 index a911aaeb..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/cloud_scheduler_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/scheduler/v1beta1/cloudscheduler.proto", - "../../protos/google/cloud/scheduler/v1beta1/job.proto", - "../../protos/google/cloud/scheduler/v1beta1/target.proto" -] diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index c097889c..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.scheduler.v1beta1", - "libraryPackage": "@google-cloud/scheduler", - "services": { - "CloudScheduler": { - "clients": { - "grpc": { - "libraryClient": "CloudSchedulerClient", - "rpcs": { - "GetJob": { - "methods": [ - "getJob" - ] - }, - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "PauseJob": { - "methods": [ - "pauseJob" - ] - }, - "ResumeJob": { - "methods": [ - "resumeJob" - ] - }, - "RunJob": { - "methods": [ - "runJob" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudSchedulerClient", - "rpcs": { - "GetJob": { - "methods": [ - "getJob" - ] - }, - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "UpdateJob": { - "methods": [ - "updateJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "PauseJob": { - "methods": [ - "pauseJob" - ] - }, - "ResumeJob": { - "methods": [ - "resumeJob" - ] - }, - "RunJob": { - "methods": [ - "runJob" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 8805934c..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {CloudSchedulerClient} from './cloud_scheduler_client'; diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 733beea6..00000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const scheduler = require('@google-cloud/scheduler'); - -function main() { - const cloudSchedulerClient = new scheduler.CloudSchedulerClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 7ceaecb2..00000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {CloudSchedulerClient} from '@google-cloud/scheduler'; - -// check that the client class type name can be used -function doStuffWithCloudSchedulerClient(client: CloudSchedulerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudSchedulerClient = new CloudSchedulerClient(); - doStuffWithCloudSchedulerClient(cloudSchedulerClient); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts deleted file mode 100644 index 1f850b52..00000000 --- a/owl-bot-staging/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts deleted file mode 100644 index 1710ef79..00000000 --- a/owl-bot-staging/v1beta1/test/gapic_cloud_scheduler_v1beta1.ts +++ /dev/null @@ -1,1097 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as cloudschedulerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.CloudSchedulerClient', () => { - it('has servicePath', () => { - const servicePath = cloudschedulerModule.v1beta1.CloudSchedulerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudschedulerModule.v1beta1.CloudSchedulerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudschedulerModule.v1beta1.CloudSchedulerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudSchedulerStub, undefined); - await client.initialize(); - assert(client.cloudSchedulerStub); - }); - - it('has close method', () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createJob', () => { - it('invokes createJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); - const [response] = await client.createJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJob(request), expectedError); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateJob', () => { - it('invokes updateJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.UpdateJobRequest()); - request.job = {}; - request.job.name = ''; - const expectedHeaderRequestParams = "job.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); - const [response] = await client.updateJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.UpdateJobRequest()); - request.job = {}; - request.job.name = ''; - const expectedHeaderRequestParams = "job.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.UpdateJobRequest()); - request.job = {}; - request.job.name = ''; - const expectedHeaderRequestParams = "job.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJob(request), expectedError); - assert((client.innerApiCalls.updateJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteJob', () => { - it('invokes deleteJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJob(request), expectedError); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('pauseJob', () => { - it('invokes pauseJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.PauseJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.pauseJob = stubSimpleCall(expectedResponse); - const [response] = await client.pauseJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pauseJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes pauseJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.PauseJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.pauseJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.pauseJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes pauseJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.PauseJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseJob(request), expectedError); - assert((client.innerApiCalls.pauseJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('resumeJob', () => { - it('invokes resumeJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ResumeJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.resumeJob = stubSimpleCall(expectedResponse); - const [response] = await client.resumeJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resumeJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes resumeJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ResumeJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.resumeJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.resumeJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes resumeJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ResumeJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeJob(request), expectedError); - assert((client.innerApiCalls.resumeJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('runJob', () => { - it('invokes runJob without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.RunJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.runJob = stubSimpleCall(expectedResponse); - const [response] = await client.runJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runJob without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.RunJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()); - client.innerApiCalls.runJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runJob( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runJob with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.RunJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.runJob(request), expectedError); - assert((client.innerApiCalls.runJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.cloud.scheduler.v1beta1.IJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listJobs with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.scheduler.v1beta1.Job[] = []; - stream.on('data', (response: protos.google.cloud.scheduler.v1beta1.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert.strictEqual( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.scheduler.v1beta1.Job[] = []; - stream.on('data', (response: protos.google.cloud.scheduler.v1beta1.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert.strictEqual( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.Job()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.scheduler.v1beta1.IJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.scheduler.v1beta1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.scheduler.v1beta1.IJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('job', () => { - const fakePath = "/rendered/path/job"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job: "jobValue", - }; - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.jobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.jobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('jobPath', () => { - const result = client.jobPath("projectValue", "locationValue", "jobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.jobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromJobName', () => { - const result = client.matchProjectFromJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromJobName', () => { - const result = client.matchLocationFromJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobFromJobName', () => { - const result = client.matchJobFromJobName(fakePath); - assert.strictEqual(result, "jobValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new cloudschedulerModule.v1beta1.CloudSchedulerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js deleted file mode 100644 index d4565464..00000000 --- a/owl-bot-staging/v1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'scheduler', - filename: './scheduler.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1/cloud_scheduler_client.ts b/src/v1/cloud_scheduler_client.ts index 1248ca37..95ab0b28 100644 --- a/src/v1/cloud_scheduler_client.ts +++ b/src/v1/cloud_scheduler_client.ts @@ -313,7 +313,7 @@ export class CloudSchedulerClient { // -- Service calls -- // ------------------- getJob( - request: protos.google.cloud.scheduler.v1.IGetJobRequest, + request?: protos.google.cloud.scheduler.v1.IGetJobRequest, options?: CallOptions ): Promise< [ @@ -358,7 +358,7 @@ export class CloudSchedulerClient { * const [response] = await client.getJob(request); */ getJob( - request: protos.google.cloud.scheduler.v1.IGetJobRequest, + request?: protos.google.cloud.scheduler.v1.IGetJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -397,7 +397,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.getJob(request, options, callback); } createJob( - request: protos.google.cloud.scheduler.v1.ICreateJobRequest, + request?: protos.google.cloud.scheduler.v1.ICreateJobRequest, options?: CallOptions ): Promise< [ @@ -448,7 +448,7 @@ export class CloudSchedulerClient { * const [response] = await client.createJob(request); */ createJob( - request: protos.google.cloud.scheduler.v1.ICreateJobRequest, + request?: protos.google.cloud.scheduler.v1.ICreateJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -487,7 +487,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.createJob(request, options, callback); } updateJob( - request: protos.google.cloud.scheduler.v1.IUpdateJobRequest, + request?: protos.google.cloud.scheduler.v1.IUpdateJobRequest, options?: CallOptions ): Promise< [ @@ -544,7 +544,7 @@ export class CloudSchedulerClient { * const [response] = await client.updateJob(request); */ updateJob( - request: protos.google.cloud.scheduler.v1.IUpdateJobRequest, + request?: protos.google.cloud.scheduler.v1.IUpdateJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -583,7 +583,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.updateJob(request, options, callback); } deleteJob( - request: protos.google.cloud.scheduler.v1.IDeleteJobRequest, + request?: protos.google.cloud.scheduler.v1.IDeleteJobRequest, options?: CallOptions ): Promise< [ @@ -628,7 +628,7 @@ export class CloudSchedulerClient { * const [response] = await client.deleteJob(request); */ deleteJob( - request: protos.google.cloud.scheduler.v1.IDeleteJobRequest, + request?: protos.google.cloud.scheduler.v1.IDeleteJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -667,7 +667,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.deleteJob(request, options, callback); } pauseJob( - request: protos.google.cloud.scheduler.v1.IPauseJobRequest, + request?: protos.google.cloud.scheduler.v1.IPauseJobRequest, options?: CallOptions ): Promise< [ @@ -718,7 +718,7 @@ export class CloudSchedulerClient { * const [response] = await client.pauseJob(request); */ pauseJob( - request: protos.google.cloud.scheduler.v1.IPauseJobRequest, + request?: protos.google.cloud.scheduler.v1.IPauseJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -757,7 +757,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.pauseJob(request, options, callback); } resumeJob( - request: protos.google.cloud.scheduler.v1.IResumeJobRequest, + request?: protos.google.cloud.scheduler.v1.IResumeJobRequest, options?: CallOptions ): Promise< [ @@ -807,7 +807,7 @@ export class CloudSchedulerClient { * const [response] = await client.resumeJob(request); */ resumeJob( - request: protos.google.cloud.scheduler.v1.IResumeJobRequest, + request?: protos.google.cloud.scheduler.v1.IResumeJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -846,7 +846,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.resumeJob(request, options, callback); } runJob( - request: protos.google.cloud.scheduler.v1.IRunJobRequest, + request?: protos.google.cloud.scheduler.v1.IRunJobRequest, options?: CallOptions ): Promise< [ @@ -894,7 +894,7 @@ export class CloudSchedulerClient { * const [response] = await client.runJob(request); */ runJob( - request: protos.google.cloud.scheduler.v1.IRunJobRequest, + request?: protos.google.cloud.scheduler.v1.IRunJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -934,7 +934,7 @@ export class CloudSchedulerClient { } listJobs( - request: protos.google.cloud.scheduler.v1.IListJobsRequest, + request?: protos.google.cloud.scheduler.v1.IListJobsRequest, options?: CallOptions ): Promise< [ @@ -997,7 +997,7 @@ export class CloudSchedulerClient { * for more details and examples. */ listJobs( - request: protos.google.cloud.scheduler.v1.IListJobsRequest, + request?: protos.google.cloud.scheduler.v1.IListJobsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< diff --git a/src/v1beta1/cloud_scheduler_client.ts b/src/v1beta1/cloud_scheduler_client.ts index 2706deea..1d5a7e7e 100644 --- a/src/v1beta1/cloud_scheduler_client.ts +++ b/src/v1beta1/cloud_scheduler_client.ts @@ -313,7 +313,7 @@ export class CloudSchedulerClient { // -- Service calls -- // ------------------- getJob( - request: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, options?: CallOptions ): Promise< [ @@ -358,7 +358,7 @@ export class CloudSchedulerClient { * const [response] = await client.getJob(request); */ getJob( - request: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IGetJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -399,7 +399,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.getJob(request, options, callback); } createJob( - request: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, options?: CallOptions ): Promise< [ @@ -454,7 +454,7 @@ export class CloudSchedulerClient { * const [response] = await client.createJob(request); */ createJob( - request: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.ICreateJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -497,7 +497,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.createJob(request, options, callback); } updateJob( - request: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, options?: CallOptions ): Promise< [ @@ -558,7 +558,7 @@ export class CloudSchedulerClient { * const [response] = await client.updateJob(request); */ updateJob( - request: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IUpdateJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -601,7 +601,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.updateJob(request, options, callback); } deleteJob( - request: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, options?: CallOptions ): Promise< [ @@ -650,7 +650,7 @@ export class CloudSchedulerClient { * const [response] = await client.deleteJob(request); */ deleteJob( - request: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IDeleteJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -693,7 +693,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.deleteJob(request, options, callback); } pauseJob( - request: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, options?: CallOptions ): Promise< [ @@ -744,7 +744,7 @@ export class CloudSchedulerClient { * const [response] = await client.pauseJob(request); */ pauseJob( - request: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IPauseJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -785,7 +785,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.pauseJob(request, options, callback); } resumeJob( - request: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, options?: CallOptions ): Promise< [ @@ -839,7 +839,7 @@ export class CloudSchedulerClient { * const [response] = await client.resumeJob(request); */ resumeJob( - request: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IResumeJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -882,7 +882,7 @@ export class CloudSchedulerClient { return this.innerApiCalls.resumeJob(request, options, callback); } runJob( - request: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, options?: CallOptions ): Promise< [ @@ -930,7 +930,7 @@ export class CloudSchedulerClient { * const [response] = await client.runJob(request); */ runJob( - request: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, + request?: protos.google.cloud.scheduler.v1beta1.IRunJobRequest, optionsOrCallback?: | CallOptions | Callback< @@ -972,7 +972,7 @@ export class CloudSchedulerClient { } listJobs( - request: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, options?: CallOptions ): Promise< [ @@ -1039,7 +1039,7 @@ export class CloudSchedulerClient { * for more details and examples. */ listJobs( - request: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, + request?: protos.google.cloud.scheduler.v1beta1.IListJobsRequest, optionsOrCallback?: | CallOptions | PaginationCallback<