From 0306112027cbb29754e0049c18d3fac807cb9d28 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 15 Nov 2022 00:01:25 +0000 Subject: [PATCH 1/3] feat: add Pipeline.secret_environment, Action.secret_environment, VirtualMachine.reservation PiperOrigin-RevId: 488460572 Source-Link: https://github.com/googleapis/googleapis/commit/c2f6dac411677a57ddce5c8a232c764e6640d968 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2b4b17aeaa09c61bf86c702502bdf2d1644afb79 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWxpZmVzY2llbmNlcy8uT3dsQm90LnlhbWwiLCJoIjoiMmI0YjE3YWVhYTA5YzYxYmY4NmM3MDI1MDJiZGYyZDE2NDRhZmI3OSJ9 --- .../v2beta/.eslintignore | 7 + .../v2beta/.eslintrc.json | 3 + .../v2beta/.gitignore | 14 + .../v2beta/.jsdoc.js | 55 ++ .../v2beta/.mocharc.js | 33 + .../v2beta/.prettierrc.js | 22 + .../v2beta/README.md | 1 + .../v2beta/linkinator.config.json | 16 + .../v2beta/package.json | 64 ++ .../cloud/lifesciences/v2beta/workflows.proto | 772 ++++++++++++++++++ ...data.google.cloud.lifesciences.v2beta.json | 67 ++ .../workflows_service_v2_beta.run_pipeline.js | 81 ++ .../v2beta/src/index.ts | 25 + .../v2beta/src/v2beta/gapic_metadata.json | 33 + .../v2beta/src/v2beta/index.ts | 19 + .../workflows_service_v2_beta_client.ts | 718 ++++++++++++++++ ...rkflows_service_v2_beta_client_config.json | 31 + .../workflows_service_v2_beta_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2beta/system-test/install.ts | 49 ++ .../gapic_workflows_service_v2_beta_v2beta.ts | 757 +++++++++++++++++ .../v2beta/tsconfig.json | 19 + .../v2beta/webpack.config.js | 64 ++ 24 files changed, 2912 insertions(+) create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/README.md create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/package.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.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/google-cloud-lifesciences/v2beta/.jsdoc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js new file mode 100644 index 00000000000..0b5fe4d688b --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 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 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/life-sciences', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 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/google-cloud-lifesciences/v2beta/.prettierrc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 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/google-cloud-lifesciences/v2beta/README.md b/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md new file mode 100644 index 00000000000..d2c6675dd1e --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md @@ -0,0 +1 @@ +Lifesciences: Nodejs Client diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json new file mode 100644 index 00000000000..cbbe6047f02 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/life-sciences", + "version": "0.1.0", + "description": "Lifesciences client for Node.js", + "repository": "googleapis/nodejs-lifesciences", + "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 lifesciences", + "lifesciences", + "workflows service v2 beta" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "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": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto b/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto new file mode 100644 index 00000000000..2e9c576c63f --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto @@ -0,0 +1,772 @@ +// Copyright 2022 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.lifesciences.v2beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; + +option csharp_namespace = "Google.Cloud.LifeSciences.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta;lifesciences"; +option java_multiple_files = true; +option java_outer_classname = "WorkflowsProto"; +option java_package = "com.google.cloud.lifesciences.v2beta"; +option objc_class_prefix = "CLSW"; +option php_namespace = "Google\\Cloud\\LifeSciences\\V2beta"; +option ruby_package = "Google::Cloud::LifeSciences::V2beta"; + +// A service for running workflows, such as pipelines consisting of Docker +// containers. +service WorkflowsServiceV2Beta { + option (google.api.default_host) = "lifesciences.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Runs a pipeline. The returned Operation's [metadata] + // [google.longrunning.Operation.metadata] field will contain a + // [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] object describing the status + // of the pipeline execution. The + // [response][google.longrunning.Operation.response] field will contain a + // [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] object if the + // pipeline completes successfully. + // + // **Note:** Before you can use this method, the *Life Sciences Service Agent* + // must have access to your project. This is done automatically when the + // Cloud Life Sciences API is first enabled, but if you delete this permission + // you must disable and re-enable the API to grant the Life Sciences + // Service Agent the required permissions. + // Authorization requires the following [Google + // IAM](https://cloud.google.com/iam/) permission: + // + // * `lifesciences.workflows.run` + rpc RunPipeline(RunPipelineRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*}/pipelines:run" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "RunPipelineResponse" + metadata_type: "Metadata" + }; + } +} + +// The arguments to the `RunPipeline` method. The requesting user must have +// the `iam.serviceAccounts.actAs` permission for the Cloud Life Sciences +// service account or the request will fail. +message RunPipelineRequest { + // The project and location that this request should be executed against. + string parent = 4; + + // Required. The description of the pipeline to run. + Pipeline pipeline = 1 [(google.api.field_behavior) = REQUIRED]; + + // User-defined labels to associate with the returned operation. These + // labels are not propagated to any Google Cloud Platform resources used by + // the operation, and can be modified at any time. + // + // To associate labels with resources created while executing the operation, + // see the appropriate resource message (for example, `VirtualMachine`). + map labels = 2; + + // The name of an existing Pub/Sub topic. The server will publish + // messages to this topic whenever the status of the operation changes. + // The Life Sciences Service Agent account must have publisher permissions to + // the specified topic or notifications will not be sent. + string pub_sub_topic = 3; +} + +// The response to the RunPipeline method, returned in the operation's result +// field on success. +message RunPipelineResponse { + +} + +// Specifies a series of actions to execute, expressed as Docker containers. +message Pipeline { + // The list of actions to execute, in the order they are specified. + repeated Action actions = 1; + + // The resources required for execution. + Resources resources = 2; + + // The environment to pass into every action. Each action can also specify + // additional environment variables but cannot delete an entry from this map + // (though they can overwrite it with a different value). + map environment = 3; + + // The encrypted environment to pass into every action. Each action can also + // specify its own encrypted environment. + // + // The secret must decrypt to a JSON-encoded dictionary where key-value pairs + // serve as environment variable names and their values. The decoded + // environment variables can overwrite the values specified by the + // `environment` field. + Secret encrypted_environment = 5; + + // The maximum amount of time to give the pipeline to complete. This includes + // the time spent waiting for a worker to be allocated. If the pipeline fails + // to complete before the timeout, it will be cancelled and the error code + // will be set to DEADLINE_EXCEEDED. + // + // If unspecified, it will default to 7 days. + google.protobuf.Duration timeout = 4; +} + +// Specifies a single action that runs a Docker container. +message Action { + // An optional name for the container. The container hostname will be set to + // this name, making it useful for inter-container communication. The name + // must contain only upper and lowercase alphanumeric characters and hyphens + // and cannot start with a hyphen. + string container_name = 1; + + // Required. The URI to pull the container image from. Note that all images referenced + // by actions in the pipeline are pulled before the first action runs. If + // multiple actions reference the same image, it is only pulled once, + // ensuring that the same image is used for all actions in a single pipeline. + // + // The image URI can be either a complete host and image specification (e.g., + // quay.io/biocontainers/samtools), a library and image name (e.g., + // google/cloud-sdk) or a bare image name ('bash') to pull from the default + // library. No schema is required in any of these cases. + // + // If the specified image is not public, the service account specified for + // the Virtual Machine must have access to pull the images from GCR, or + // appropriate credentials must be specified in the + // [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] field. + string image_uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // If specified, overrides the `CMD` specified in the container. If the + // container also has an `ENTRYPOINT` the values are used as entrypoint + // arguments. Otherwise, they are used as a command and arguments to run + // inside the container. + repeated string commands = 3; + + // If specified, overrides the `ENTRYPOINT` specified in the container. + string entrypoint = 4; + + // The environment to pass into the container. This environment is merged + // with values specified in the [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] + // message, overwriting any duplicate values. + // + // In addition to the values passed here, a few other values are + // automatically injected into the environment. These cannot be hidden or + // overwritten. + // + // `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed + // because an action has exited with a non-zero status (and did not have the + // `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional + // debug or logging actions should execute. + // + // `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last + // non-background action that executed. This can be used by workflow engine + // authors to determine whether an individual action has succeeded or failed. + map environment = 5; + + // The encrypted environment to pass into the container. This environment is + // merged with values specified in the + // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] message, overwriting any + // duplicate values. + // + // The secret must decrypt to a JSON-encoded dictionary where key-value pairs + // serve as environment variable names and their values. The decoded + // environment variables can overwrite the values specified by the + // `environment` field. + Secret encrypted_environment = 21; + + // An optional identifier for a PID namespace to run the action inside. + // Multiple actions should use the same string to share a namespace. If + // unspecified, a separate isolated namespace is used. + string pid_namespace = 6; + + // A map of containers to host port mappings for this container. If the + // container already specifies exposed ports, use the + // `PUBLISH_EXPOSED_PORTS` flag instead. + // + // The host port number must be less than 65536. If it is zero, an unused + // random port is assigned. To determine the resulting port number, consult + // the `ContainerStartedEvent` in the operation metadata. + map port_mappings = 8; + + // A list of mounts to make available to the action. + // + // In addition to the values specified here, every action has a special + // virtual disk mounted under `/google` that contains log files and other + // operational components. + // + //
    + //
  • /google/logs All logs written during the pipeline + // execution.
  • + //
  • /google/logs/output The combined standard output and + // standard error of all actions run as part of the pipeline + // execution.
  • + //
  • /google/logs/action/*/stdout The complete contents of + // each individual action's standard output.
  • + //
  • /google/logs/action/*/stderr The complete contents of + // each individual action's standard error output.
  • + //
+ repeated Mount mounts = 9; + + // Labels to associate with the action. This field is provided to assist + // workflow engine authors in identifying actions (for example, to indicate + // what sort of action they perform, such as localization or debugging). + // They are returned in the operation metadata, but are otherwise ignored. + map labels = 10; + + // If the specified image is hosted on a private registry other than Google + // Container Registry, the credentials required to pull the image must be + // specified here as an encrypted secret. + // + // The secret must decrypt to a JSON-encoded dictionary containing both + // `username` and `password` keys. + Secret credentials = 11; + + // The maximum amount of time to give the action to complete. If the action + // fails to complete before the timeout, it will be terminated and the exit + // status will be non-zero. The pipeline will continue or terminate based + // on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. + google.protobuf.Duration timeout = 12; + + // Normally, a non-zero exit status causes the pipeline to fail. This flag + // allows execution of other actions to continue instead. + bool ignore_exit_status = 13; + + // This flag allows an action to continue running in the background while + // executing subsequent actions. This is useful to provide services to + // other actions (or to provide debugging support tools like SSH servers). + bool run_in_background = 14; + + // By default, after an action fails, no further actions are run. This flag + // indicates that this action must be run even if the pipeline has already + // failed. This is useful for actions that copy output files off of the VM + // or for debugging. Note that no actions will be run if image prefetching + // fails. + bool always_run = 15; + + // Enable access to the FUSE device for this action. Filesystems can then + // be mounted into disks shared with other actions. The other actions do + // not need the `enable_fuse` flag to access the mounted filesystem. + // + // This has the effect of causing the container to be executed with + // `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only + // for containers you trust. + bool enable_fuse = 16; + + // Exposes all ports specified by `EXPOSE` statements in the container. To + // discover the host side port numbers, consult the `ACTION_STARTED` event + // in the operation metadata. + bool publish_exposed_ports = 17; + + // All container images are typically downloaded before any actions are + // executed. This helps prevent typos in URIs or issues like lack of disk + // space from wasting large amounts of compute resources. + // + // If set, this flag prevents the worker from downloading the image until + // just before the action is executed. + bool disable_image_prefetch = 18; + + // A small portion of the container's standard error stream is typically + // captured and returned inside the `ContainerStoppedEvent`. Setting this + // flag disables this functionality. + bool disable_standard_error_capture = 19; + + // Prevents the container from accessing the external network. + bool block_external_network = 20; +} + +// Holds encrypted information that is only decrypted and stored in RAM +// by the worker VM when running the pipeline. +message Secret { + // The name of the Cloud KMS key that will be used to decrypt the secret + // value. The VM service account must have the required permissions and + // authentication scopes to invoke the `decrypt` method on the specified key. + string key_name = 1; + + // The value of the cipherText response from the `encrypt` method. This field + // is intentionally unaudited. + string cipher_text = 2; +} + +// Carries information about a particular disk mount inside a container. +message Mount { + // The name of the disk to mount, as specified in the resources section. + string disk = 1; + + // The path to mount the disk inside the container. + string path = 2; + + // If true, the disk is mounted read-only inside the container. + bool read_only = 3; +} + +// The system resources for the pipeline run. +// +// At least one zone or region must be specified or the pipeline run will fail. +message Resources { + // The list of regions allowed for VM allocation. If set, the `zones` field + // must not be set. + repeated string regions = 2; + + // The list of zones allowed for VM allocation. If set, the `regions` field + // must not be set. + repeated string zones = 3; + + // The virtual machine specification. + VirtualMachine virtual_machine = 4; +} + +// Carries information about a Compute Engine VM resource. +message VirtualMachine { + // Required. The machine type of the virtual machine to create. Must be the short name + // of a standard machine type (such as "n1-standard-1") or a custom machine + // type (such as "custom-1-4096", where "1" indicates the number of vCPUs and + // "4096" indicates the memory in MB). See + // [Creating an instance with a custom machine + // type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) + // for more specifications on creating a custom machine type. + string machine_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // If true, allocate a preemptible VM. + bool preemptible = 2; + + // Optional set of labels to apply to the VM and any attached disk resources. + // These labels must adhere to the [name and value + // restrictions](https://cloud.google.com/compute/docs/labeling-resources) on + // VM labels imposed by Compute Engine. + // + // Labels keys with the prefix 'google-' are reserved for use by Google. + // + // Labels applied at creation time to the VM. Applied on a best-effort basis + // to attached disk resources shortly after VM creation. + map labels = 3; + + // The list of disks to create and attach to the VM. + // + // Specify either the `volumes[]` field or the `disks[]` field, but not both. + repeated Disk disks = 4; + + // The VM network configuration. + Network network = 5; + + // The list of accelerators to attach to the VM. + repeated Accelerator accelerators = 6; + + // The service account to install on the VM. This account does not need + // any permissions other than those required by the pipeline. + ServiceAccount service_account = 7; + + // The size of the boot disk, in GB. The boot disk must be large + // enough to accommodate all of the Docker images from each action in the + // pipeline at the same time. If not specified, a small but reasonable + // default value is used. + int32 boot_disk_size_gb = 8; + + // The CPU platform to request. An instance based on a newer platform can be + // allocated, but never one with fewer capabilities. The value of this + // parameter must be a valid Compute Engine CPU platform name (such as "Intel + // Skylake"). This parameter is only useful for carefully optimized work + // loads where the CPU platform has a significant impact. + // + // For more information about the effect of this parameter, see + // https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. + string cpu_platform = 9; + + // The host operating system image to use. + // + // Currently, only Container-Optimized OS images can be used. + // + // The default value is `projects/cos-cloud/global/images/family/cos-stable`, + // which selects the latest stable release of Container-Optimized OS. + // + // This option is provided to allow testing against the beta release of the + // operating system to ensure that the new version does not interact + // negatively with production pipelines. + // + // To test a pipeline against the beta release of Container-Optimized OS, + // use the value `projects/cos-cloud/global/images/family/cos-beta`. + string boot_image = 10; + + // The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. + // The version specified here must be compatible with the GPU libraries + // contained in the container being executed, and must be one of the drivers + // hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. + string nvidia_driver_version = 11 [deprecated = true]; + + // Whether Stackdriver monitoring should be enabled on the VM. + bool enable_stackdriver_monitoring = 12; + + // The Compute Engine Disk Images to use as a Docker cache. The disks will be + // mounted into the Docker folder in a way that the images present in the + // cache will not need to be pulled. The digests of the cached images must + // match those of the tags used or the latest version will still be pulled. + // The root directory of the ext4 image must contain `image` and `overlay2` + // directories copied from the Docker directory of a VM where the desired + // Docker images have already been pulled. Any images pulled that are not + // cached will be stored on the first cache disk instead of the boot disk. + // Only a single image is supported. + repeated string docker_cache_images = 13; + + // The list of disks and other storage to create or attach to the VM. + // + // Specify either the `volumes[]` field or the `disks[]` field, but not both. + repeated Volume volumes = 14; + + // If specified, the VM will only be allocated inside the matching + // reservation. It will fail if the VM parameters don't match the reservation. + string reservation = 15; +} + +// Carries information about a Google Cloud service account. +message ServiceAccount { + // Email address of the service account. If not specified, the default + // Compute Engine service account for the project will be used. + string email = 1; + + // List of scopes to be enabled for this service account on the VM, in + // addition to the cloud-platform API scope that will be added by default. + repeated string scopes = 2; +} + +// Carries information about an accelerator that can be attached to a VM. +message Accelerator { + // The accelerator type string (for example, "nvidia-tesla-k80"). + // + // Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is + // attached, the required runtime libraries will be made available to all + // containers under `/usr/local/nvidia`. The driver version to install must + // be specified using the NVIDIA driver version parameter on the virtual + // machine specification. Note that attaching a GPU increases the worker VM + // startup time by a few minutes. + string type = 1; + + // How many accelerators of this type to attach. + int64 count = 2; +} + +// VM networking options. +message Network { + // The network name to attach the VM's network interface to. The value will + // be prefixed with `global/networks/` unless it contains a `/`, in which + // case it is assumed to be a fully specified network resource URL. + // + // If unspecified, the global default network is used. + string network = 1; + + // If set to true, do not attach a public IP address to the VM. Note that + // without a public IP address, additional configuration is required to + // allow the VM to access Google services. + // + // See https://cloud.google.com/vpc/docs/configure-private-google-access + // for more information. + bool use_private_address = 2; + + // If the specified network is configured for custom subnet creation, the + // name of the subnetwork to attach the instance to must be specified here. + // + // The value is prefixed with `regions/*/subnetworks/` unless it contains a + // `/`, in which case it is assumed to be a fully specified subnetwork + // resource URL. + // + // If the `*` character appears in the value, it is replaced with the region + // that the virtual machine has been allocated in. + string subnetwork = 3; +} + +// Carries information about a disk that can be attached to a VM. +// +// See https://cloud.google.com/compute/docs/disks/performance for more +// information about disk type, size, and performance considerations. +// +// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or +// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. +message Disk { + // A user-supplied name for the disk. Used when mounting the disk into + // actions. The name must contain only upper and lowercase alphanumeric + // characters and hyphens and cannot start with a hyphen. + string name = 1; + + // The size, in GB, of the disk to attach. If the size is not + // specified, a default is chosen to ensure reasonable I/O performance. + // + // If the disk type is specified as `local-ssd`, multiple local drives are + // automatically combined to provide the requested size. Note, however, that + // each physical SSD is 375GB in size, and no more than 8 drives can be + // attached to a single instance. + int32 size_gb = 2; + + // The Compute Engine disk type. If unspecified, `pd-standard` is used. + string type = 3; + + // An optional image to put on the disk before attaching it to the VM. + string source_image = 4; +} + +// Carries information about storage that can be attached to a VM. +// +// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or +// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. +message Volume { + // A user-supplied name for the volume. Used when mounting the volume into + // [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain + // only upper and lowercase alphanumeric characters and hyphens and cannot + // start with a hyphen. + string volume = 1; + + oneof storage { + // Configuration for a persistent disk. + PersistentDisk persistent_disk = 2; + + // Configuration for a existing disk. + ExistingDisk existing_disk = 3; + + // Configuration for an NFS mount. + NFSMount nfs_mount = 4; + } +} + +// Configuration for a persistent disk to be attached to the VM. +// +// See https://cloud.google.com/compute/docs/disks/performance for more +// information about disk type, size, and performance considerations. +message PersistentDisk { + // The size, in GB, of the disk to attach. If the size is not + // specified, a default is chosen to ensure reasonable I/O performance. + // + // If the disk type is specified as `local-ssd`, multiple local drives are + // automatically combined to provide the requested size. Note, however, that + // each physical SSD is 375GB in size, and no more than 8 drives can be + // attached to a single instance. + int32 size_gb = 1; + + // The Compute Engine disk type. If unspecified, `pd-standard` is used. + string type = 2; + + // An image to put on the disk before attaching it to the VM. + string source_image = 3; +} + +// Configuration for an existing disk to be attached to the VM. +message ExistingDisk { + // If `disk` contains slashes, the Cloud Life Sciences API assumes that it is + // a complete URL for the disk. If `disk` does not contain slashes, the Cloud + // Life Sciences API assumes that the disk is a zonal disk and a URL will be + // generated of the form `zones//disks/`, where `` is the + // zone in which the instance is allocated. The disk must be ext4 formatted. + // + // If all `Mount` references to this disk have the `read_only` flag set to + // true, the disk will be attached in `read-only` mode and can be shared with + // other instances. Otherwise, the disk will be available for writing but + // cannot be shared. + string disk = 1; +} + +// Configuration for an `NFSMount` to be attached to the VM. +message NFSMount { + // A target NFS mount. The target must be specified as `address:/mount". + string target = 1; +} + +// Carries information about the pipeline execution that is returned +// in the long running operation's metadata field. +message Metadata { + // The pipeline this operation represents. + Pipeline pipeline = 1; + + // The user-defined labels associated with this operation. + map labels = 2; + + // The list of events that have happened so far during the execution of this + // operation. + repeated Event events = 3; + + // The time at which the operation was created by the API. + google.protobuf.Timestamp create_time = 4; + + // The first time at which resources were allocated to execute the pipeline. + google.protobuf.Timestamp start_time = 5; + + // The time at which execution was completed and resources were cleaned up. + google.protobuf.Timestamp end_time = 6; + + // The name of the Cloud Pub/Sub topic where notifications of operation status + // changes are sent. + string pub_sub_topic = 7; +} + +// Carries information about events that occur during pipeline execution. +message Event { + // The time at which the event occurred. + google.protobuf.Timestamp timestamp = 1; + + // A human-readable description of the event. Note that these strings can + // change at any time without notice. Any application logic must use the + // information in the `details` field. + string description = 2; + + // Machine-readable details about the event. + oneof details { + // See [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. + DelayedEvent delayed = 17; + + // See [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. + WorkerAssignedEvent worker_assigned = 18; + + // See [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. + WorkerReleasedEvent worker_released = 19; + + // See [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. + PullStartedEvent pull_started = 20; + + // See [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. + PullStoppedEvent pull_stopped = 21; + + // See [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. + ContainerStartedEvent container_started = 22; + + // See [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. + ContainerStoppedEvent container_stopped = 23; + + // See [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. + ContainerKilledEvent container_killed = 24; + + // See [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. + UnexpectedExitStatusEvent unexpected_exit_status = 25; + + // See [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. + FailedEvent failed = 26; + } +} + +// An event generated whenever a resource limitation or transient error +// delays execution of a pipeline that was otherwise ready to run. +message DelayedEvent { + // A textual description of the cause of the delay. The string can change + // without notice because it is often generated by another service (such as + // Compute Engine). + string cause = 1; + + // If the delay was caused by a resource shortage, this field lists the + // Compute Engine metrics that are preventing this operation from running + // (for example, `CPUS` or `INSTANCES`). If the particular metric is not + // known, a single `UNKNOWN` metric will be present. + repeated string metrics = 2; +} + +// An event generated after a worker VM has been assigned to run the +// pipeline. +message WorkerAssignedEvent { + // The zone the worker is running in. + string zone = 1; + + // The worker's instance name. + string instance = 2; + + // The machine type that was assigned for the worker. + string machine_type = 3; +} + +// An event generated when the worker VM that was assigned to the pipeline +// has been released (deleted). +message WorkerReleasedEvent { + // The zone the worker was running in. + string zone = 1; + + // The worker's instance name. + string instance = 2; +} + +// An event generated when the worker starts pulling an image. +message PullStartedEvent { + // The URI of the image that was pulled. + string image_uri = 1; +} + +// An event generated when the worker stops pulling an image. +message PullStoppedEvent { + // The URI of the image that was pulled. + string image_uri = 1; +} + +// An event generated when a container starts. +message ContainerStartedEvent { + // The numeric ID of the action that started this container. + int32 action_id = 1; + + // The container-to-host port mappings installed for this container. This + // set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag + // as well as any specified in the `Action` definition. + map port_mappings = 2; + + // The public IP address that can be used to connect to the container. This + // field is only populated when at least one port mapping is present. If the + // instance was created with a private address, this field will be empty even + // if port mappings exist. + string ip_address = 3; +} + +// An event generated when a container exits. +message ContainerStoppedEvent { + // The numeric ID of the action that started this container. + int32 action_id = 1; + + // The exit status of the container. + int32 exit_status = 2; + + // The tail end of any content written to standard error by the container. + // If the content emits large amounts of debugging noise or contains + // sensitive information, you can prevent the content from being printed by + // setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. + // + // Note that only a small amount of the end of the stream is captured here. + // The entire stream is stored in the `/google/logs` directory mounted into + // each action, and can be copied off the machine as described elsewhere. + string stderr = 3; +} + +// An event generated when the execution of a container results in a +// non-zero exit status that was not otherwise ignored. Execution will +// continue, but only actions that are flagged as `ALWAYS_RUN` will be +// executed. Other actions will be skipped. +message UnexpectedExitStatusEvent { + // The numeric ID of the action that started the container. + int32 action_id = 1; + + // The exit status of the container. + int32 exit_status = 2; +} + +// An event generated when a container is forcibly terminated by the +// worker. Currently, this only occurs when the container outlives the +// timeout specified by the user. +message ContainerKilledEvent { + // The numeric ID of the action that started the container. + int32 action_id = 1; +} + +// An event generated when the execution of a pipeline has failed. Note +// that other events can continue to occur after this event. +message FailedEvent { + // The Google standard error code that best describes this failure. + google.rpc.Code code = 1; + + // The human-readable description of the cause of the failure. + string cause = 2; +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json new file mode 100644 index 00000000000..3785dc98d68 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json @@ -0,0 +1,67 @@ +{ + "clientLibrary": { + "name": "nodejs-lifesciences", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.lifesciences.v2beta", + "version": "v2beta" + } + ] + }, + "snippets": [ + { + "regionTag": "lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async", + "title": "WorkflowsServiceV2Beta runPipeline Sample", + "origin": "API_DEFINITION", + "description": " Runs a pipeline. The returned Operation's [metadata] [google.longrunning.Operation.metadata] field will contain a [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] object describing the status of the pipeline execution. The [response][google.longrunning.Operation.response] field will contain a [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] object if the pipeline completes successfully. **Note:** Before you can use this method, the *Life Sciences Service Agent* must have access to your project. This is done automatically when the Cloud Life Sciences API is first enabled, but if you delete this permission you must disable and re-enable the API to grant the Life Sciences Service Agent the required permissions. Authorization requires the following [Google IAM](https://cloud.google.com/iam/) permission: * `lifesciences.workflows.run`", + "canonical": true, + "file": "workflows_service_v2_beta.run_pipeline.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunPipeline", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "pipeline", + "type": ".google.cloud.lifesciences.v2beta.Pipeline" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "pub_sub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsServiceV2BetaClient", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient" + }, + "method": { + "shortName": "RunPipeline", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", + "service": { + "shortName": "WorkflowsServiceV2Beta", + "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js new file mode 100644 index 00000000000..196d0e6fffe --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js @@ -0,0 +1,81 @@ +// Copyright 2022 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'; + +function main(pipeline) { + // [START lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project and location that this request should be executed against. + */ + // const parent = 'abc123' + /** + * Required. The description of the pipeline to run. + */ + // const pipeline = {} + /** + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + */ + // const labels = 1234 + /** + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + */ + // const pubSubTopic = 'abc123' + + // Imports the Lifesciences library + const {WorkflowsServiceV2BetaClient} = require('@google-cloud/life-sciences').v2beta; + + // Instantiates a client + const lifesciencesClient = new WorkflowsServiceV2BetaClient(); + + async function callRunPipeline() { + // Construct request + const request = { + pipeline, + }; + + // Run request + const [operation] = await lifesciencesClient.runPipeline(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunPipeline(); + // [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts new file mode 100644 index 00000000000..30f6153527d --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 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 v2beta from './v2beta'; +const WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; +type WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; +export {v2beta, WorkflowsServiceV2BetaClient}; +export default {v2beta, WorkflowsServiceV2BetaClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json new file mode 100644 index 00000000000..443e9dc9c80 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json @@ -0,0 +1,33 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.lifesciences.v2beta", + "libraryPackage": "@google-cloud/life-sciences", + "services": { + "WorkflowsServiceV2Beta": { + "clients": { + "grpc": { + "libraryClient": "WorkflowsServiceV2BetaClient", + "rpcs": { + "RunPipeline": { + "methods": [ + "runPipeline" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WorkflowsServiceV2BetaClient", + "rpcs": { + "RunPipeline": { + "methods": [ + "runPipeline" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts new file mode 100644 index 00000000000..5e123284d2b --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 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 {WorkflowsServiceV2BetaClient} from './workflows_service_v2_beta_client'; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts new file mode 100644 index 00000000000..d41e1477829 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts @@ -0,0 +1,718 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, LocationsClient, LocationProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/workflows_service_v2_beta_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflows_service_v2_beta_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service for running workflows, such as pipelines consisting of Docker + * containers. + * @class + * @memberof v2beta + */ +export class WorkflowsServiceV2BetaClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + 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: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + operationsClient: gax.OperationsClient; + workflowsServiceV2BetaStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WorkflowsServiceV2BetaClient. + * + * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new WorkflowsServiceV2BetaClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WorkflowsServiceV2BetaClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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); + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const runPipelineResponse = protoFilesRoot.lookup( + '.google.cloud.lifesciences.v2beta.RunPipelineResponse') as gax.protobuf.Type; + const runPipelineMetadata = protoFilesRoot.lookup( + '.google.cloud.lifesciences.v2beta.Metadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runPipeline: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runPipelineResponse.decode.bind(runPipelineResponse), + runPipelineMetadata.decode.bind(runPipelineMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta', 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 = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * 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.workflowsServiceV2BetaStub) { + return this.workflowsServiceV2BetaStub; + } + + // Put together the "service stub" for + // google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta. + this.workflowsServiceV2BetaStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const workflowsServiceV2BetaStubMethods = + ['runPipeline']; + for (const methodName of workflowsServiceV2BetaStubMethods) { + const callPromise = this.workflowsServiceV2BetaStub.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.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.workflowsServiceV2BetaStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'lifesciences.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 'lifesciences.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 -- + // ------------------- + +/** + * Runs a pipeline. The returned Operation's [metadata] + * [google.longrunning.Operation.metadata] field will contain a + * {@link google.cloud.lifesciences.v2beta.Metadata|google.cloud.lifesciences.v2beta.Metadata} object describing the status + * of the pipeline execution. The + * {@link google.longrunning.Operation.response|response} field will contain a + * {@link google.cloud.lifesciences.v2beta.RunPipelineResponse|google.cloud.lifesciences.v2beta.RunPipelineResponse} object if the + * pipeline completes successfully. + * + * **Note:** Before you can use this method, the *Life Sciences Service Agent* + * must have access to your project. This is done automatically when the + * Cloud Life Sciences API is first enabled, but if you delete this permission + * you must disable and re-enable the API to grant the Life Sciences + * Service Agent the required permissions. + * Authorization requires the following [Google + * IAM](https://cloud.google.com/iam/) permission: + * + * * `lifesciences.workflows.run` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location that this request should be executed against. + * @param {google.cloud.lifesciences.v2beta.Pipeline} request.pipeline + * Required. The description of the pipeline to run. + * @param {number[]} request.labels + * User-defined labels to associate with the returned operation. These + * labels are not propagated to any Google Cloud Platform resources used by + * the operation, and can be modified at any time. + * + * To associate labels with resources created while executing the operation, + * see the appropriate resource message (for example, `VirtualMachine`). + * @param {string} request.pubSubTopic + * The name of an existing Pub/Sub topic. The server will publish + * messages to this topic whenever the status of the operation changes. + * The Life Sciences Service Agent account must have publisher permissions to + * the specified topic or notifications will not be sent. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js + * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async + */ + runPipeline( + request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runPipeline( + request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runPipeline( + request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runPipeline( + request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.runPipeline(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runPipeline()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js + * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async + */ + async checkRunPipelineProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runPipeline, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + + /** + * 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 { + if (this.workflowsServiceV2BetaStub && !this._terminated) { + return this.workflowsServiceV2BetaStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json new file mode 100644 index 00000000000..9c8434c1b8d --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta": { + "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": { + "RunPipeline": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json new file mode 100644 index 00000000000..b8302b0ea69 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/lifesciences/v2beta/workflows.proto" +] diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..ae7f5d6d93c --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 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 lifesciences = require('@google-cloud/life-sciences'); + +function main() { + const workflowsServiceV2BetaClient = new lifesciences.WorkflowsServiceV2BetaClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b6981b5c986 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 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 {WorkflowsServiceV2BetaClient} from '@google-cloud/life-sciences'; + +// check that the client class type name can be used +function doStuffWithWorkflowsServiceV2BetaClient(client: WorkflowsServiceV2BetaClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); + doStuffWithWorkflowsServiceV2BetaClient(workflowsServiceV2BetaClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 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/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts new file mode 100644 index 00000000000..5578f6f1a37 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts @@ -0,0 +1,757 @@ +// Copyright 2022 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 workflowsservicev2betaModule from '../src'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +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('v2beta.WorkflowsServiceV2BetaClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); + await client.initialize(); + assert(client.workflowsServiceV2BetaStub); + }); + + it('has close method for the initialized client', done => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.workflowsServiceV2BetaStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + 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 workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + 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('runPipeline', () => { + it('invokes runPipeline without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runPipeline = stubLongRunningCall(expectedResponse); + const [operation] = await client.runPipeline(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runPipeline without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.runPipeline = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runPipeline( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runPipeline with call error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runPipeline(request), expectedError); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes runPipeline with LRO error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runPipeline(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRunPipelineProgress without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunPipelineProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunPipelineProgress with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunPipelineProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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/google-cloud-lifesciences/v2beta/webpack.config.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js new file mode 100644 index 00000000000..e7f6079e4d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/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: 'WorkflowsServiceV2Beta', + filename: './workflows-service-v2-beta.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 aa47bf7c4b26a80e27e0249cbf0e77c4e25638e0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 6 Dec 2022 03:53:31 +0000 Subject: [PATCH 2/3] chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java) PiperOrigin-RevId: 493113566 Source-Link: https://github.com/googleapis/googleapis/commit/758f0d1217d9c7fe398aa5efb1057ce4b6409e55 Source-Link: https://github.com/googleapis/googleapis-gen/commit/78bd8f05e1276363eb14eae70e91fe4bc20703ab Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWxpZmVzY2llbmNlcy8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9 --- .../v2beta/src/v2beta/workflows_service_v2_beta_client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts index d41e1477829..434d47547e1 100644 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts +++ b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts @@ -107,6 +107,9 @@ export class WorkflowsServiceV2BetaClient { const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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; From c522605fefb9140ee0b0011992fef44d326c3e7c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 7 Dec 2022 19:23:47 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../v2beta/.eslintignore | 7 - .../v2beta/.eslintrc.json | 3 - .../v2beta/.gitignore | 14 - .../v2beta/.jsdoc.js | 55 -- .../v2beta/.mocharc.js | 33 - .../v2beta/.prettierrc.js | 22 - .../v2beta/README.md | 1 - .../v2beta/linkinator.config.json | 16 - .../v2beta/package.json | 64 -- .../cloud/lifesciences/v2beta/workflows.proto | 772 ------------------ ...data.google.cloud.lifesciences.v2beta.json | 67 -- .../workflows_service_v2_beta.run_pipeline.js | 81 -- .../v2beta/src/index.ts | 25 - .../v2beta/src/v2beta/gapic_metadata.json | 33 - .../v2beta/src/v2beta/index.ts | 19 - .../workflows_service_v2_beta_client.ts | 721 ---------------- ...rkflows_service_v2_beta_client_config.json | 31 - .../workflows_service_v2_beta_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2beta/system-test/install.ts | 49 -- .../gapic_workflows_service_v2_beta_v2beta.ts | 757 ----------------- .../v2beta/tsconfig.json | 19 - .../v2beta/webpack.config.js | 64 -- .../cloud/lifesciences/v2beta/workflows.proto | 28 +- .../protos/protos.d.ts | 18 + .../protos/protos.js | 79 ++ .../protos/protos.json | 46 +- .../workflows_service_v2_beta_client.ts | 267 ++++++ .../gapic_workflows_service_v2_beta_v2beta.ts | 549 ++++++++++++- 30 files changed, 967 insertions(+), 2935 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/README.md delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/package.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore b/owl-bot-staging/google-cloud-lifesciences/v2beta/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.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/google-cloud-lifesciences/v2beta/.jsdoc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js deleted file mode 100644 index 0b5fe4d688b..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/life-sciences', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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/google-cloud-lifesciences/v2beta/.prettierrc.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 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/google-cloud-lifesciences/v2beta/README.md b/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md deleted file mode 100644 index d2c6675dd1e..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Lifesciences: Nodejs Client diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json deleted file mode 100644 index cbbe6047f02..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/life-sciences", - "version": "0.1.0", - "description": "Lifesciences client for Node.js", - "repository": "googleapis/nodejs-lifesciences", - "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 lifesciences", - "lifesciences", - "workflows service v2 beta" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "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": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto b/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto deleted file mode 100644 index 2e9c576c63f..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/protos/google/cloud/lifesciences/v2beta/workflows.proto +++ /dev/null @@ -1,772 +0,0 @@ -// Copyright 2022 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.lifesciences.v2beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/code.proto"; - -option csharp_namespace = "Google.Cloud.LifeSciences.V2Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta;lifesciences"; -option java_multiple_files = true; -option java_outer_classname = "WorkflowsProto"; -option java_package = "com.google.cloud.lifesciences.v2beta"; -option objc_class_prefix = "CLSW"; -option php_namespace = "Google\\Cloud\\LifeSciences\\V2beta"; -option ruby_package = "Google::Cloud::LifeSciences::V2beta"; - -// A service for running workflows, such as pipelines consisting of Docker -// containers. -service WorkflowsServiceV2Beta { - option (google.api.default_host) = "lifesciences.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Runs a pipeline. The returned Operation's [metadata] - // [google.longrunning.Operation.metadata] field will contain a - // [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] object describing the status - // of the pipeline execution. The - // [response][google.longrunning.Operation.response] field will contain a - // [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] object if the - // pipeline completes successfully. - // - // **Note:** Before you can use this method, the *Life Sciences Service Agent* - // must have access to your project. This is done automatically when the - // Cloud Life Sciences API is first enabled, but if you delete this permission - // you must disable and re-enable the API to grant the Life Sciences - // Service Agent the required permissions. - // Authorization requires the following [Google - // IAM](https://cloud.google.com/iam/) permission: - // - // * `lifesciences.workflows.run` - rpc RunPipeline(RunPipelineRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta/{parent=projects/*/locations/*}/pipelines:run" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "RunPipelineResponse" - metadata_type: "Metadata" - }; - } -} - -// The arguments to the `RunPipeline` method. The requesting user must have -// the `iam.serviceAccounts.actAs` permission for the Cloud Life Sciences -// service account or the request will fail. -message RunPipelineRequest { - // The project and location that this request should be executed against. - string parent = 4; - - // Required. The description of the pipeline to run. - Pipeline pipeline = 1 [(google.api.field_behavior) = REQUIRED]; - - // User-defined labels to associate with the returned operation. These - // labels are not propagated to any Google Cloud Platform resources used by - // the operation, and can be modified at any time. - // - // To associate labels with resources created while executing the operation, - // see the appropriate resource message (for example, `VirtualMachine`). - map labels = 2; - - // The name of an existing Pub/Sub topic. The server will publish - // messages to this topic whenever the status of the operation changes. - // The Life Sciences Service Agent account must have publisher permissions to - // the specified topic or notifications will not be sent. - string pub_sub_topic = 3; -} - -// The response to the RunPipeline method, returned in the operation's result -// field on success. -message RunPipelineResponse { - -} - -// Specifies a series of actions to execute, expressed as Docker containers. -message Pipeline { - // The list of actions to execute, in the order they are specified. - repeated Action actions = 1; - - // The resources required for execution. - Resources resources = 2; - - // The environment to pass into every action. Each action can also specify - // additional environment variables but cannot delete an entry from this map - // (though they can overwrite it with a different value). - map environment = 3; - - // The encrypted environment to pass into every action. Each action can also - // specify its own encrypted environment. - // - // The secret must decrypt to a JSON-encoded dictionary where key-value pairs - // serve as environment variable names and their values. The decoded - // environment variables can overwrite the values specified by the - // `environment` field. - Secret encrypted_environment = 5; - - // The maximum amount of time to give the pipeline to complete. This includes - // the time spent waiting for a worker to be allocated. If the pipeline fails - // to complete before the timeout, it will be cancelled and the error code - // will be set to DEADLINE_EXCEEDED. - // - // If unspecified, it will default to 7 days. - google.protobuf.Duration timeout = 4; -} - -// Specifies a single action that runs a Docker container. -message Action { - // An optional name for the container. The container hostname will be set to - // this name, making it useful for inter-container communication. The name - // must contain only upper and lowercase alphanumeric characters and hyphens - // and cannot start with a hyphen. - string container_name = 1; - - // Required. The URI to pull the container image from. Note that all images referenced - // by actions in the pipeline are pulled before the first action runs. If - // multiple actions reference the same image, it is only pulled once, - // ensuring that the same image is used for all actions in a single pipeline. - // - // The image URI can be either a complete host and image specification (e.g., - // quay.io/biocontainers/samtools), a library and image name (e.g., - // google/cloud-sdk) or a bare image name ('bash') to pull from the default - // library. No schema is required in any of these cases. - // - // If the specified image is not public, the service account specified for - // the Virtual Machine must have access to pull the images from GCR, or - // appropriate credentials must be specified in the - // [google.cloud.lifesciences.v2beta.Action.credentials][google.cloud.lifesciences.v2beta.Action.credentials] field. - string image_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // If specified, overrides the `CMD` specified in the container. If the - // container also has an `ENTRYPOINT` the values are used as entrypoint - // arguments. Otherwise, they are used as a command and arguments to run - // inside the container. - repeated string commands = 3; - - // If specified, overrides the `ENTRYPOINT` specified in the container. - string entrypoint = 4; - - // The environment to pass into the container. This environment is merged - // with values specified in the [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] - // message, overwriting any duplicate values. - // - // In addition to the values passed here, a few other values are - // automatically injected into the environment. These cannot be hidden or - // overwritten. - // - // `GOOGLE_PIPELINE_FAILED` will be set to "1" if the pipeline failed - // because an action has exited with a non-zero status (and did not have the - // `IGNORE_EXIT_STATUS` flag set). This can be used to determine if additional - // debug or logging actions should execute. - // - // `GOOGLE_LAST_EXIT_STATUS` will be set to the exit status of the last - // non-background action that executed. This can be used by workflow engine - // authors to determine whether an individual action has succeeded or failed. - map environment = 5; - - // The encrypted environment to pass into the container. This environment is - // merged with values specified in the - // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] message, overwriting any - // duplicate values. - // - // The secret must decrypt to a JSON-encoded dictionary where key-value pairs - // serve as environment variable names and their values. The decoded - // environment variables can overwrite the values specified by the - // `environment` field. - Secret encrypted_environment = 21; - - // An optional identifier for a PID namespace to run the action inside. - // Multiple actions should use the same string to share a namespace. If - // unspecified, a separate isolated namespace is used. - string pid_namespace = 6; - - // A map of containers to host port mappings for this container. If the - // container already specifies exposed ports, use the - // `PUBLISH_EXPOSED_PORTS` flag instead. - // - // The host port number must be less than 65536. If it is zero, an unused - // random port is assigned. To determine the resulting port number, consult - // the `ContainerStartedEvent` in the operation metadata. - map port_mappings = 8; - - // A list of mounts to make available to the action. - // - // In addition to the values specified here, every action has a special - // virtual disk mounted under `/google` that contains log files and other - // operational components. - // - //
    - //
  • /google/logs All logs written during the pipeline - // execution.
  • - //
  • /google/logs/output The combined standard output and - // standard error of all actions run as part of the pipeline - // execution.
  • - //
  • /google/logs/action/*/stdout The complete contents of - // each individual action's standard output.
  • - //
  • /google/logs/action/*/stderr The complete contents of - // each individual action's standard error output.
  • - //
- repeated Mount mounts = 9; - - // Labels to associate with the action. This field is provided to assist - // workflow engine authors in identifying actions (for example, to indicate - // what sort of action they perform, such as localization or debugging). - // They are returned in the operation metadata, but are otherwise ignored. - map labels = 10; - - // If the specified image is hosted on a private registry other than Google - // Container Registry, the credentials required to pull the image must be - // specified here as an encrypted secret. - // - // The secret must decrypt to a JSON-encoded dictionary containing both - // `username` and `password` keys. - Secret credentials = 11; - - // The maximum amount of time to give the action to complete. If the action - // fails to complete before the timeout, it will be terminated and the exit - // status will be non-zero. The pipeline will continue or terminate based - // on the rules defined by the `ALWAYS_RUN` and `IGNORE_EXIT_STATUS` flags. - google.protobuf.Duration timeout = 12; - - // Normally, a non-zero exit status causes the pipeline to fail. This flag - // allows execution of other actions to continue instead. - bool ignore_exit_status = 13; - - // This flag allows an action to continue running in the background while - // executing subsequent actions. This is useful to provide services to - // other actions (or to provide debugging support tools like SSH servers). - bool run_in_background = 14; - - // By default, after an action fails, no further actions are run. This flag - // indicates that this action must be run even if the pipeline has already - // failed. This is useful for actions that copy output files off of the VM - // or for debugging. Note that no actions will be run if image prefetching - // fails. - bool always_run = 15; - - // Enable access to the FUSE device for this action. Filesystems can then - // be mounted into disks shared with other actions. The other actions do - // not need the `enable_fuse` flag to access the mounted filesystem. - // - // This has the effect of causing the container to be executed with - // `CAP_SYS_ADMIN` and exposes `/dev/fuse` to the container, so use it only - // for containers you trust. - bool enable_fuse = 16; - - // Exposes all ports specified by `EXPOSE` statements in the container. To - // discover the host side port numbers, consult the `ACTION_STARTED` event - // in the operation metadata. - bool publish_exposed_ports = 17; - - // All container images are typically downloaded before any actions are - // executed. This helps prevent typos in URIs or issues like lack of disk - // space from wasting large amounts of compute resources. - // - // If set, this flag prevents the worker from downloading the image until - // just before the action is executed. - bool disable_image_prefetch = 18; - - // A small portion of the container's standard error stream is typically - // captured and returned inside the `ContainerStoppedEvent`. Setting this - // flag disables this functionality. - bool disable_standard_error_capture = 19; - - // Prevents the container from accessing the external network. - bool block_external_network = 20; -} - -// Holds encrypted information that is only decrypted and stored in RAM -// by the worker VM when running the pipeline. -message Secret { - // The name of the Cloud KMS key that will be used to decrypt the secret - // value. The VM service account must have the required permissions and - // authentication scopes to invoke the `decrypt` method on the specified key. - string key_name = 1; - - // The value of the cipherText response from the `encrypt` method. This field - // is intentionally unaudited. - string cipher_text = 2; -} - -// Carries information about a particular disk mount inside a container. -message Mount { - // The name of the disk to mount, as specified in the resources section. - string disk = 1; - - // The path to mount the disk inside the container. - string path = 2; - - // If true, the disk is mounted read-only inside the container. - bool read_only = 3; -} - -// The system resources for the pipeline run. -// -// At least one zone or region must be specified or the pipeline run will fail. -message Resources { - // The list of regions allowed for VM allocation. If set, the `zones` field - // must not be set. - repeated string regions = 2; - - // The list of zones allowed for VM allocation. If set, the `regions` field - // must not be set. - repeated string zones = 3; - - // The virtual machine specification. - VirtualMachine virtual_machine = 4; -} - -// Carries information about a Compute Engine VM resource. -message VirtualMachine { - // Required. The machine type of the virtual machine to create. Must be the short name - // of a standard machine type (such as "n1-standard-1") or a custom machine - // type (such as "custom-1-4096", where "1" indicates the number of vCPUs and - // "4096" indicates the memory in MB). See - // [Creating an instance with a custom machine - // type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) - // for more specifications on creating a custom machine type. - string machine_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // If true, allocate a preemptible VM. - bool preemptible = 2; - - // Optional set of labels to apply to the VM and any attached disk resources. - // These labels must adhere to the [name and value - // restrictions](https://cloud.google.com/compute/docs/labeling-resources) on - // VM labels imposed by Compute Engine. - // - // Labels keys with the prefix 'google-' are reserved for use by Google. - // - // Labels applied at creation time to the VM. Applied on a best-effort basis - // to attached disk resources shortly after VM creation. - map labels = 3; - - // The list of disks to create and attach to the VM. - // - // Specify either the `volumes[]` field or the `disks[]` field, but not both. - repeated Disk disks = 4; - - // The VM network configuration. - Network network = 5; - - // The list of accelerators to attach to the VM. - repeated Accelerator accelerators = 6; - - // The service account to install on the VM. This account does not need - // any permissions other than those required by the pipeline. - ServiceAccount service_account = 7; - - // The size of the boot disk, in GB. The boot disk must be large - // enough to accommodate all of the Docker images from each action in the - // pipeline at the same time. If not specified, a small but reasonable - // default value is used. - int32 boot_disk_size_gb = 8; - - // The CPU platform to request. An instance based on a newer platform can be - // allocated, but never one with fewer capabilities. The value of this - // parameter must be a valid Compute Engine CPU platform name (such as "Intel - // Skylake"). This parameter is only useful for carefully optimized work - // loads where the CPU platform has a significant impact. - // - // For more information about the effect of this parameter, see - // https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. - string cpu_platform = 9; - - // The host operating system image to use. - // - // Currently, only Container-Optimized OS images can be used. - // - // The default value is `projects/cos-cloud/global/images/family/cos-stable`, - // which selects the latest stable release of Container-Optimized OS. - // - // This option is provided to allow testing against the beta release of the - // operating system to ensure that the new version does not interact - // negatively with production pipelines. - // - // To test a pipeline against the beta release of Container-Optimized OS, - // use the value `projects/cos-cloud/global/images/family/cos-beta`. - string boot_image = 10; - - // The NVIDIA driver version to use when attaching an NVIDIA GPU accelerator. - // The version specified here must be compatible with the GPU libraries - // contained in the container being executed, and must be one of the drivers - // hosted in the `nvidia-drivers-us-public` bucket on Google Cloud Storage. - string nvidia_driver_version = 11 [deprecated = true]; - - // Whether Stackdriver monitoring should be enabled on the VM. - bool enable_stackdriver_monitoring = 12; - - // The Compute Engine Disk Images to use as a Docker cache. The disks will be - // mounted into the Docker folder in a way that the images present in the - // cache will not need to be pulled. The digests of the cached images must - // match those of the tags used or the latest version will still be pulled. - // The root directory of the ext4 image must contain `image` and `overlay2` - // directories copied from the Docker directory of a VM where the desired - // Docker images have already been pulled. Any images pulled that are not - // cached will be stored on the first cache disk instead of the boot disk. - // Only a single image is supported. - repeated string docker_cache_images = 13; - - // The list of disks and other storage to create or attach to the VM. - // - // Specify either the `volumes[]` field or the `disks[]` field, but not both. - repeated Volume volumes = 14; - - // If specified, the VM will only be allocated inside the matching - // reservation. It will fail if the VM parameters don't match the reservation. - string reservation = 15; -} - -// Carries information about a Google Cloud service account. -message ServiceAccount { - // Email address of the service account. If not specified, the default - // Compute Engine service account for the project will be used. - string email = 1; - - // List of scopes to be enabled for this service account on the VM, in - // addition to the cloud-platform API scope that will be added by default. - repeated string scopes = 2; -} - -// Carries information about an accelerator that can be attached to a VM. -message Accelerator { - // The accelerator type string (for example, "nvidia-tesla-k80"). - // - // Only NVIDIA GPU accelerators are currently supported. If an NVIDIA GPU is - // attached, the required runtime libraries will be made available to all - // containers under `/usr/local/nvidia`. The driver version to install must - // be specified using the NVIDIA driver version parameter on the virtual - // machine specification. Note that attaching a GPU increases the worker VM - // startup time by a few minutes. - string type = 1; - - // How many accelerators of this type to attach. - int64 count = 2; -} - -// VM networking options. -message Network { - // The network name to attach the VM's network interface to. The value will - // be prefixed with `global/networks/` unless it contains a `/`, in which - // case it is assumed to be a fully specified network resource URL. - // - // If unspecified, the global default network is used. - string network = 1; - - // If set to true, do not attach a public IP address to the VM. Note that - // without a public IP address, additional configuration is required to - // allow the VM to access Google services. - // - // See https://cloud.google.com/vpc/docs/configure-private-google-access - // for more information. - bool use_private_address = 2; - - // If the specified network is configured for custom subnet creation, the - // name of the subnetwork to attach the instance to must be specified here. - // - // The value is prefixed with `regions/*/subnetworks/` unless it contains a - // `/`, in which case it is assumed to be a fully specified subnetwork - // resource URL. - // - // If the `*` character appears in the value, it is replaced with the region - // that the virtual machine has been allocated in. - string subnetwork = 3; -} - -// Carries information about a disk that can be attached to a VM. -// -// See https://cloud.google.com/compute/docs/disks/performance for more -// information about disk type, size, and performance considerations. -// -// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or -// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. -message Disk { - // A user-supplied name for the disk. Used when mounting the disk into - // actions. The name must contain only upper and lowercase alphanumeric - // characters and hyphens and cannot start with a hyphen. - string name = 1; - - // The size, in GB, of the disk to attach. If the size is not - // specified, a default is chosen to ensure reasonable I/O performance. - // - // If the disk type is specified as `local-ssd`, multiple local drives are - // automatically combined to provide the requested size. Note, however, that - // each physical SSD is 375GB in size, and no more than 8 drives can be - // attached to a single instance. - int32 size_gb = 2; - - // The Compute Engine disk type. If unspecified, `pd-standard` is used. - string type = 3; - - // An optional image to put on the disk before attaching it to the VM. - string source_image = 4; -} - -// Carries information about storage that can be attached to a VM. -// -// Specify either [`Volume`][google.cloud.lifesciences.v2beta.Volume] or -// [`Disk`][google.cloud.lifesciences.v2beta.Disk], but not both. -message Volume { - // A user-supplied name for the volume. Used when mounting the volume into - // [`Actions`][google.cloud.lifesciences.v2beta.Action]. The name must contain - // only upper and lowercase alphanumeric characters and hyphens and cannot - // start with a hyphen. - string volume = 1; - - oneof storage { - // Configuration for a persistent disk. - PersistentDisk persistent_disk = 2; - - // Configuration for a existing disk. - ExistingDisk existing_disk = 3; - - // Configuration for an NFS mount. - NFSMount nfs_mount = 4; - } -} - -// Configuration for a persistent disk to be attached to the VM. -// -// See https://cloud.google.com/compute/docs/disks/performance for more -// information about disk type, size, and performance considerations. -message PersistentDisk { - // The size, in GB, of the disk to attach. If the size is not - // specified, a default is chosen to ensure reasonable I/O performance. - // - // If the disk type is specified as `local-ssd`, multiple local drives are - // automatically combined to provide the requested size. Note, however, that - // each physical SSD is 375GB in size, and no more than 8 drives can be - // attached to a single instance. - int32 size_gb = 1; - - // The Compute Engine disk type. If unspecified, `pd-standard` is used. - string type = 2; - - // An image to put on the disk before attaching it to the VM. - string source_image = 3; -} - -// Configuration for an existing disk to be attached to the VM. -message ExistingDisk { - // If `disk` contains slashes, the Cloud Life Sciences API assumes that it is - // a complete URL for the disk. If `disk` does not contain slashes, the Cloud - // Life Sciences API assumes that the disk is a zonal disk and a URL will be - // generated of the form `zones//disks/`, where `` is the - // zone in which the instance is allocated. The disk must be ext4 formatted. - // - // If all `Mount` references to this disk have the `read_only` flag set to - // true, the disk will be attached in `read-only` mode and can be shared with - // other instances. Otherwise, the disk will be available for writing but - // cannot be shared. - string disk = 1; -} - -// Configuration for an `NFSMount` to be attached to the VM. -message NFSMount { - // A target NFS mount. The target must be specified as `address:/mount". - string target = 1; -} - -// Carries information about the pipeline execution that is returned -// in the long running operation's metadata field. -message Metadata { - // The pipeline this operation represents. - Pipeline pipeline = 1; - - // The user-defined labels associated with this operation. - map labels = 2; - - // The list of events that have happened so far during the execution of this - // operation. - repeated Event events = 3; - - // The time at which the operation was created by the API. - google.protobuf.Timestamp create_time = 4; - - // The first time at which resources were allocated to execute the pipeline. - google.protobuf.Timestamp start_time = 5; - - // The time at which execution was completed and resources were cleaned up. - google.protobuf.Timestamp end_time = 6; - - // The name of the Cloud Pub/Sub topic where notifications of operation status - // changes are sent. - string pub_sub_topic = 7; -} - -// Carries information about events that occur during pipeline execution. -message Event { - // The time at which the event occurred. - google.protobuf.Timestamp timestamp = 1; - - // A human-readable description of the event. Note that these strings can - // change at any time without notice. Any application logic must use the - // information in the `details` field. - string description = 2; - - // Machine-readable details about the event. - oneof details { - // See [google.cloud.lifesciences.v2beta.DelayedEvent][google.cloud.lifesciences.v2beta.DelayedEvent]. - DelayedEvent delayed = 17; - - // See [google.cloud.lifesciences.v2beta.WorkerAssignedEvent][google.cloud.lifesciences.v2beta.WorkerAssignedEvent]. - WorkerAssignedEvent worker_assigned = 18; - - // See [google.cloud.lifesciences.v2beta.WorkerReleasedEvent][google.cloud.lifesciences.v2beta.WorkerReleasedEvent]. - WorkerReleasedEvent worker_released = 19; - - // See [google.cloud.lifesciences.v2beta.PullStartedEvent][google.cloud.lifesciences.v2beta.PullStartedEvent]. - PullStartedEvent pull_started = 20; - - // See [google.cloud.lifesciences.v2beta.PullStoppedEvent][google.cloud.lifesciences.v2beta.PullStoppedEvent]. - PullStoppedEvent pull_stopped = 21; - - // See [google.cloud.lifesciences.v2beta.ContainerStartedEvent][google.cloud.lifesciences.v2beta.ContainerStartedEvent]. - ContainerStartedEvent container_started = 22; - - // See [google.cloud.lifesciences.v2beta.ContainerStoppedEvent][google.cloud.lifesciences.v2beta.ContainerStoppedEvent]. - ContainerStoppedEvent container_stopped = 23; - - // See [google.cloud.lifesciences.v2beta.ContainerKilledEvent][google.cloud.lifesciences.v2beta.ContainerKilledEvent]. - ContainerKilledEvent container_killed = 24; - - // See [google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent][google.cloud.lifesciences.v2beta.UnexpectedExitStatusEvent]. - UnexpectedExitStatusEvent unexpected_exit_status = 25; - - // See [google.cloud.lifesciences.v2beta.FailedEvent][google.cloud.lifesciences.v2beta.FailedEvent]. - FailedEvent failed = 26; - } -} - -// An event generated whenever a resource limitation or transient error -// delays execution of a pipeline that was otherwise ready to run. -message DelayedEvent { - // A textual description of the cause of the delay. The string can change - // without notice because it is often generated by another service (such as - // Compute Engine). - string cause = 1; - - // If the delay was caused by a resource shortage, this field lists the - // Compute Engine metrics that are preventing this operation from running - // (for example, `CPUS` or `INSTANCES`). If the particular metric is not - // known, a single `UNKNOWN` metric will be present. - repeated string metrics = 2; -} - -// An event generated after a worker VM has been assigned to run the -// pipeline. -message WorkerAssignedEvent { - // The zone the worker is running in. - string zone = 1; - - // The worker's instance name. - string instance = 2; - - // The machine type that was assigned for the worker. - string machine_type = 3; -} - -// An event generated when the worker VM that was assigned to the pipeline -// has been released (deleted). -message WorkerReleasedEvent { - // The zone the worker was running in. - string zone = 1; - - // The worker's instance name. - string instance = 2; -} - -// An event generated when the worker starts pulling an image. -message PullStartedEvent { - // The URI of the image that was pulled. - string image_uri = 1; -} - -// An event generated when the worker stops pulling an image. -message PullStoppedEvent { - // The URI of the image that was pulled. - string image_uri = 1; -} - -// An event generated when a container starts. -message ContainerStartedEvent { - // The numeric ID of the action that started this container. - int32 action_id = 1; - - // The container-to-host port mappings installed for this container. This - // set will contain any ports exposed using the `PUBLISH_EXPOSED_PORTS` flag - // as well as any specified in the `Action` definition. - map port_mappings = 2; - - // The public IP address that can be used to connect to the container. This - // field is only populated when at least one port mapping is present. If the - // instance was created with a private address, this field will be empty even - // if port mappings exist. - string ip_address = 3; -} - -// An event generated when a container exits. -message ContainerStoppedEvent { - // The numeric ID of the action that started this container. - int32 action_id = 1; - - // The exit status of the container. - int32 exit_status = 2; - - // The tail end of any content written to standard error by the container. - // If the content emits large amounts of debugging noise or contains - // sensitive information, you can prevent the content from being printed by - // setting the `DISABLE_STANDARD_ERROR_CAPTURE` flag. - // - // Note that only a small amount of the end of the stream is captured here. - // The entire stream is stored in the `/google/logs` directory mounted into - // each action, and can be copied off the machine as described elsewhere. - string stderr = 3; -} - -// An event generated when the execution of a container results in a -// non-zero exit status that was not otherwise ignored. Execution will -// continue, but only actions that are flagged as `ALWAYS_RUN` will be -// executed. Other actions will be skipped. -message UnexpectedExitStatusEvent { - // The numeric ID of the action that started the container. - int32 action_id = 1; - - // The exit status of the container. - int32 exit_status = 2; -} - -// An event generated when a container is forcibly terminated by the -// worker. Currently, this only occurs when the container outlives the -// timeout specified by the user. -message ContainerKilledEvent { - // The numeric ID of the action that started the container. - int32 action_id = 1; -} - -// An event generated when the execution of a pipeline has failed. Note -// that other events can continue to occur after this event. -message FailedEvent { - // The Google standard error code that best describes this failure. - google.rpc.Code code = 1; - - // The human-readable description of the cause of the failure. - string cause = 2; -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json deleted file mode 100644 index 3785dc98d68..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/snippet_metadata.google.cloud.lifesciences.v2beta.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-lifesciences", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.lifesciences.v2beta", - "version": "v2beta" - } - ] - }, - "snippets": [ - { - "regionTag": "lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async", - "title": "WorkflowsServiceV2Beta runPipeline Sample", - "origin": "API_DEFINITION", - "description": " Runs a pipeline. The returned Operation's [metadata] [google.longrunning.Operation.metadata] field will contain a [google.cloud.lifesciences.v2beta.Metadata][google.cloud.lifesciences.v2beta.Metadata] object describing the status of the pipeline execution. The [response][google.longrunning.Operation.response] field will contain a [google.cloud.lifesciences.v2beta.RunPipelineResponse][google.cloud.lifesciences.v2beta.RunPipelineResponse] object if the pipeline completes successfully. **Note:** Before you can use this method, the *Life Sciences Service Agent* must have access to your project. This is done automatically when the Cloud Life Sciences API is first enabled, but if you delete this permission you must disable and re-enable the API to grant the Life Sciences Service Agent the required permissions. Authorization requires the following [Google IAM](https://cloud.google.com/iam/) permission: * `lifesciences.workflows.run`", - "canonical": true, - "file": "workflows_service_v2_beta.run_pipeline.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunPipeline", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "pipeline", - "type": ".google.cloud.lifesciences.v2beta.Pipeline" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "pub_sub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsServiceV2BetaClient", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient" - }, - "method": { - "shortName": "RunPipeline", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta.RunPipeline", - "service": { - "shortName": "WorkflowsServiceV2Beta", - "fullName": "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js deleted file mode 100644 index 196d0e6fffe..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 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'; - -function main(pipeline) { - // [START lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The project and location that this request should be executed against. - */ - // const parent = 'abc123' - /** - * Required. The description of the pipeline to run. - */ - // const pipeline = {} - /** - * User-defined labels to associate with the returned operation. These - * labels are not propagated to any Google Cloud Platform resources used by - * the operation, and can be modified at any time. - * To associate labels with resources created while executing the operation, - * see the appropriate resource message (for example, `VirtualMachine`). - */ - // const labels = 1234 - /** - * The name of an existing Pub/Sub topic. The server will publish - * messages to this topic whenever the status of the operation changes. - * The Life Sciences Service Agent account must have publisher permissions to - * the specified topic or notifications will not be sent. - */ - // const pubSubTopic = 'abc123' - - // Imports the Lifesciences library - const {WorkflowsServiceV2BetaClient} = require('@google-cloud/life-sciences').v2beta; - - // Instantiates a client - const lifesciencesClient = new WorkflowsServiceV2BetaClient(); - - async function callRunPipeline() { - // Construct request - const request = { - pipeline, - }; - - // Run request - const [operation] = await lifesciencesClient.runPipeline(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunPipeline(); - // [END lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts deleted file mode 100644 index 30f6153527d..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 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 v2beta from './v2beta'; -const WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; -type WorkflowsServiceV2BetaClient = v2beta.WorkflowsServiceV2BetaClient; -export {v2beta, WorkflowsServiceV2BetaClient}; -export default {v2beta, WorkflowsServiceV2BetaClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json deleted file mode 100644 index 443e9dc9c80..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/gapic_metadata.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.lifesciences.v2beta", - "libraryPackage": "@google-cloud/life-sciences", - "services": { - "WorkflowsServiceV2Beta": { - "clients": { - "grpc": { - "libraryClient": "WorkflowsServiceV2BetaClient", - "rpcs": { - "RunPipeline": { - "methods": [ - "runPipeline" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WorkflowsServiceV2BetaClient", - "rpcs": { - "RunPipeline": { - "methods": [ - "runPipeline" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts deleted file mode 100644 index 5e123284d2b..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 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 {WorkflowsServiceV2BetaClient} from './workflows_service_v2_beta_client'; diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts deleted file mode 100644 index 434d47547e1..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client.ts +++ /dev/null @@ -1,721 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, LocationsClient, LocationProtos} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2beta/workflows_service_v2_beta_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './workflows_service_v2_beta_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service for running workflows, such as pipelines consisting of Docker - * containers. - * @class - * @memberof v2beta - */ -export class WorkflowsServiceV2BetaClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - 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: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - locationsClient: LocationsClient; - operationsClient: gax.OperationsClient; - workflowsServiceV2BetaStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WorkflowsServiceV2BetaClient. - * - * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new WorkflowsServiceV2BetaClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WorkflowsServiceV2BetaClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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); - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const runPipelineResponse = protoFilesRoot.lookup( - '.google.cloud.lifesciences.v2beta.RunPipelineResponse') as gax.protobuf.Type; - const runPipelineMetadata = protoFilesRoot.lookup( - '.google.cloud.lifesciences.v2beta.Metadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runPipeline: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runPipelineResponse.decode.bind(runPipelineResponse), - runPipelineMetadata.decode.bind(runPipelineMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta', 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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * 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.workflowsServiceV2BetaStub) { - return this.workflowsServiceV2BetaStub; - } - - // Put together the "service stub" for - // google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta. - this.workflowsServiceV2BetaStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const workflowsServiceV2BetaStubMethods = - ['runPipeline']; - for (const methodName of workflowsServiceV2BetaStubMethods) { - const callPromise = this.workflowsServiceV2BetaStub.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.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.workflowsServiceV2BetaStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'lifesciences.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 'lifesciences.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 -- - // ------------------- - -/** - * Runs a pipeline. The returned Operation's [metadata] - * [google.longrunning.Operation.metadata] field will contain a - * {@link google.cloud.lifesciences.v2beta.Metadata|google.cloud.lifesciences.v2beta.Metadata} object describing the status - * of the pipeline execution. The - * {@link google.longrunning.Operation.response|response} field will contain a - * {@link google.cloud.lifesciences.v2beta.RunPipelineResponse|google.cloud.lifesciences.v2beta.RunPipelineResponse} object if the - * pipeline completes successfully. - * - * **Note:** Before you can use this method, the *Life Sciences Service Agent* - * must have access to your project. This is done automatically when the - * Cloud Life Sciences API is first enabled, but if you delete this permission - * you must disable and re-enable the API to grant the Life Sciences - * Service Agent the required permissions. - * Authorization requires the following [Google - * IAM](https://cloud.google.com/iam/) permission: - * - * * `lifesciences.workflows.run` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location that this request should be executed against. - * @param {google.cloud.lifesciences.v2beta.Pipeline} request.pipeline - * Required. The description of the pipeline to run. - * @param {number[]} request.labels - * User-defined labels to associate with the returned operation. These - * labels are not propagated to any Google Cloud Platform resources used by - * the operation, and can be modified at any time. - * - * To associate labels with resources created while executing the operation, - * see the appropriate resource message (for example, `VirtualMachine`). - * @param {string} request.pubSubTopic - * The name of an existing Pub/Sub topic. The server will publish - * messages to this topic whenever the status of the operation changes. - * The Life Sciences Service Agent account must have publisher permissions to - * the specified topic or notifications will not be sent. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js - * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async - */ - runPipeline( - request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runPipeline( - request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runPipeline( - request: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runPipeline( - request?: protos.google.cloud.lifesciences.v2beta.IRunPipelineRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.runPipeline(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runPipeline()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v2beta/workflows_service_v2_beta.run_pipeline.js - * region_tag:lifesciences_v2beta_generated_WorkflowsServiceV2Beta_RunPipeline_async - */ - async checkRunPipelineProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runPipeline, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @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 [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - - /** - * 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 { - if (this.workflowsServiceV2BetaStub && !this._terminated) { - return this.workflowsServiceV2BetaStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json deleted file mode 100644 index 9c8434c1b8d..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta": { - "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": { - "RunPipeline": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json deleted file mode 100644 index b8302b0ea69..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/src/v2beta/workflows_service_v2_beta_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/lifesciences/v2beta/workflows.proto" -] diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index ae7f5d6d93c..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 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 lifesciences = require('@google-cloud/life-sciences'); - -function main() { - const workflowsServiceV2BetaClient = new lifesciences.WorkflowsServiceV2BetaClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b6981b5c986..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 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 {WorkflowsServiceV2BetaClient} from '@google-cloud/life-sciences'; - -// check that the client class type name can be used -function doStuffWithWorkflowsServiceV2BetaClient(client: WorkflowsServiceV2BetaClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const workflowsServiceV2BetaClient = new WorkflowsServiceV2BetaClient(); - doStuffWithWorkflowsServiceV2BetaClient(workflowsServiceV2BetaClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts b/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts deleted file mode 100644 index 5578f6f1a37..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/test/gapic_workflows_service_v2_beta_v2beta.ts +++ /dev/null @@ -1,757 +0,0 @@ -// Copyright 2022 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 workflowsservicev2betaModule from '../src'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -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('v2beta.WorkflowsServiceV2BetaClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); - await client.initialize(); - assert(client.workflowsServiceV2BetaStub); - }); - - it('has close method for the initialized client', done => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.workflowsServiceV2BetaStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workflowsServiceV2BetaStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - 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 workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - 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('runPipeline', () => { - it('invokes runPipeline without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runPipeline = stubLongRunningCall(expectedResponse); - const [operation] = await client.runPipeline(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runPipeline without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runPipeline = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runPipeline( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runPipeline with call error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runPipeline(request), expectedError); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runPipeline with LRO error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.lifesciences.v2beta.RunPipelineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.lifesciences.v2beta.RunPipelineRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.runPipeline = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runPipeline(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runPipeline as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunPipelineProgress without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunPipelineProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunPipelineProgress with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunPipelineProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json b/owl-bot-staging/google-cloud-lifesciences/v2beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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/google-cloud-lifesciences/v2beta/webpack.config.js b/owl-bot-staging/google-cloud-lifesciences/v2beta/webpack.config.js deleted file mode 100644 index e7f6079e4d2..00000000000 --- a/owl-bot-staging/google-cloud-lifesciences/v2beta/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: 'WorkflowsServiceV2Beta', - filename: './workflows-service-v2-beta.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/packages/google-cloud-lifesciences/protos/google/cloud/lifesciences/v2beta/workflows.proto b/packages/google-cloud-lifesciences/protos/google/cloud/lifesciences/v2beta/workflows.proto index b69928ffa8f..2e9c576c63f 100644 --- a/packages/google-cloud-lifesciences/protos/google/cloud/lifesciences/v2beta/workflows.proto +++ b/packages/google-cloud-lifesciences/protos/google/cloud/lifesciences/v2beta/workflows.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,12 +17,12 @@ syntax = "proto3"; package google.cloud.lifesciences.v2beta; import "google/api/annotations.proto"; +import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/code.proto"; -import "google/api/client.proto"; option csharp_namespace = "Google.Cloud.LifeSciences.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta;lifesciences"; @@ -112,6 +112,15 @@ message Pipeline { // (though they can overwrite it with a different value). map environment = 3; + // The encrypted environment to pass into every action. Each action can also + // specify its own encrypted environment. + // + // The secret must decrypt to a JSON-encoded dictionary where key-value pairs + // serve as environment variable names and their values. The decoded + // environment variables can overwrite the values specified by the + // `environment` field. + Secret encrypted_environment = 5; + // The maximum amount of time to give the pipeline to complete. This includes // the time spent waiting for a worker to be allocated. If the pipeline fails // to complete before the timeout, it will be cancelled and the error code @@ -172,6 +181,17 @@ message Action { // authors to determine whether an individual action has succeeded or failed. map environment = 5; + // The encrypted environment to pass into the container. This environment is + // merged with values specified in the + // [google.cloud.lifesciences.v2beta.Pipeline][google.cloud.lifesciences.v2beta.Pipeline] message, overwriting any + // duplicate values. + // + // The secret must decrypt to a JSON-encoded dictionary where key-value pairs + // serve as environment variable names and their values. The decoded + // environment variables can overwrite the values specified by the + // `environment` field. + Secret encrypted_environment = 21; + // An optional identifier for a PID namespace to run the action inside. // Multiple actions should use the same string to share a namespace. If // unspecified, a separate isolated namespace is used. @@ -408,6 +428,10 @@ message VirtualMachine { // // Specify either the `volumes[]` field or the `disks[]` field, but not both. repeated Volume volumes = 14; + + // If specified, the VM will only be allocated inside the matching + // reservation. It will fail if the VM parameters don't match the reservation. + string reservation = 15; } // Carries information about a Google Cloud service account. diff --git a/packages/google-cloud-lifesciences/protos/protos.d.ts b/packages/google-cloud-lifesciences/protos/protos.d.ts index 60d1bce2e15..797ed218a8f 100644 --- a/packages/google-cloud-lifesciences/protos/protos.d.ts +++ b/packages/google-cloud-lifesciences/protos/protos.d.ts @@ -289,6 +289,9 @@ export namespace google { /** Pipeline environment */ environment?: ({ [k: string]: string }|null); + /** Pipeline encryptedEnvironment */ + encryptedEnvironment?: (google.cloud.lifesciences.v2beta.ISecret|null); + /** Pipeline timeout */ timeout?: (google.protobuf.IDuration|null); } @@ -311,6 +314,9 @@ export namespace google { /** Pipeline environment. */ public environment: { [k: string]: string }; + /** Pipeline encryptedEnvironment. */ + public encryptedEnvironment?: (google.cloud.lifesciences.v2beta.ISecret|null); + /** Pipeline timeout. */ public timeout?: (google.protobuf.IDuration|null); @@ -410,6 +416,9 @@ export namespace google { /** Action environment */ environment?: ({ [k: string]: string }|null); + /** Action encryptedEnvironment */ + encryptedEnvironment?: (google.cloud.lifesciences.v2beta.ISecret|null); + /** Action pidNamespace */ pidNamespace?: (string|null); @@ -477,6 +486,9 @@ export namespace google { /** Action environment. */ public environment: { [k: string]: string }; + /** Action encryptedEnvironment. */ + public encryptedEnvironment?: (google.cloud.lifesciences.v2beta.ISecret|null); + /** Action pidNamespace. */ public pidNamespace: string; @@ -962,6 +974,9 @@ export namespace google { /** VirtualMachine volumes */ volumes?: (google.cloud.lifesciences.v2beta.IVolume[]|null); + + /** VirtualMachine reservation */ + reservation?: (string|null); } /** Represents a VirtualMachine. */ @@ -1015,6 +1030,9 @@ export namespace google { /** VirtualMachine volumes. */ public volumes: google.cloud.lifesciences.v2beta.IVolume[]; + /** VirtualMachine reservation. */ + public reservation: string; + /** * Creates a new VirtualMachine instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-lifesciences/protos/protos.js b/packages/google-cloud-lifesciences/protos/protos.js index ecbff4d199e..27bcba8cb40 100644 --- a/packages/google-cloud-lifesciences/protos/protos.js +++ b/packages/google-cloud-lifesciences/protos/protos.js @@ -632,6 +632,7 @@ * @property {Array.|null} [actions] Pipeline actions * @property {google.cloud.lifesciences.v2beta.IResources|null} [resources] Pipeline resources * @property {Object.|null} [environment] Pipeline environment + * @property {google.cloud.lifesciences.v2beta.ISecret|null} [encryptedEnvironment] Pipeline encryptedEnvironment * @property {google.protobuf.IDuration|null} [timeout] Pipeline timeout */ @@ -676,6 +677,14 @@ */ Pipeline.prototype.environment = $util.emptyObject; + /** + * Pipeline encryptedEnvironment. + * @member {google.cloud.lifesciences.v2beta.ISecret|null|undefined} encryptedEnvironment + * @memberof google.cloud.lifesciences.v2beta.Pipeline + * @instance + */ + Pipeline.prototype.encryptedEnvironment = null; + /** * Pipeline timeout. * @member {google.protobuf.IDuration|null|undefined} timeout @@ -718,6 +727,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environment[keys[i]]).ldelim(); if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.encryptedEnvironment != null && Object.hasOwnProperty.call(message, "encryptedEnvironment")) + $root.google.cloud.lifesciences.v2beta.Secret.encode(message.encryptedEnvironment, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -785,6 +796,10 @@ message.environment[key] = value; break; } + case 5: { + message.encryptedEnvironment = $root.google.cloud.lifesciences.v2beta.Secret.decode(reader, reader.uint32()); + break; + } case 4: { message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); break; @@ -846,6 +861,11 @@ if (!$util.isString(message.environment[key[i]])) return "environment: string{k:string} expected"; } + if (message.encryptedEnvironment != null && message.hasOwnProperty("encryptedEnvironment")) { + var error = $root.google.cloud.lifesciences.v2beta.Secret.verify(message.encryptedEnvironment); + if (error) + return "encryptedEnvironment." + error; + } if (message.timeout != null && message.hasOwnProperty("timeout")) { var error = $root.google.protobuf.Duration.verify(message.timeout); if (error) @@ -888,6 +908,11 @@ for (var keys = Object.keys(object.environment), i = 0; i < keys.length; ++i) message.environment[keys[i]] = String(object.environment[keys[i]]); } + if (object.encryptedEnvironment != null) { + if (typeof object.encryptedEnvironment !== "object") + throw TypeError(".google.cloud.lifesciences.v2beta.Pipeline.encryptedEnvironment: object expected"); + message.encryptedEnvironment = $root.google.cloud.lifesciences.v2beta.Secret.fromObject(object.encryptedEnvironment); + } if (object.timeout != null) { if (typeof object.timeout !== "object") throw TypeError(".google.cloud.lifesciences.v2beta.Pipeline.timeout: object expected"); @@ -916,6 +941,7 @@ if (options.defaults) { object.resources = null; object.timeout = null; + object.encryptedEnvironment = null; } if (message.actions && message.actions.length) { object.actions = []; @@ -932,6 +958,8 @@ } if (message.timeout != null && message.hasOwnProperty("timeout")) object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + if (message.encryptedEnvironment != null && message.hasOwnProperty("encryptedEnvironment")) + object.encryptedEnvironment = $root.google.cloud.lifesciences.v2beta.Secret.toObject(message.encryptedEnvironment, options); return object; }; @@ -975,6 +1003,7 @@ * @property {Array.|null} [commands] Action commands * @property {string|null} [entrypoint] Action entrypoint * @property {Object.|null} [environment] Action environment + * @property {google.cloud.lifesciences.v2beta.ISecret|null} [encryptedEnvironment] Action encryptedEnvironment * @property {string|null} [pidNamespace] Action pidNamespace * @property {Object.|null} [portMappings] Action portMappings * @property {Array.|null} [mounts] Action mounts @@ -1051,6 +1080,14 @@ */ Action.prototype.environment = $util.emptyObject; + /** + * Action encryptedEnvironment. + * @member {google.cloud.lifesciences.v2beta.ISecret|null|undefined} encryptedEnvironment + * @memberof google.cloud.lifesciences.v2beta.Action + * @instance + */ + Action.prototype.encryptedEnvironment = null; + /** * Action pidNamespace. * @member {string} pidNamespace @@ -1230,6 +1267,8 @@ writer.uint32(/* id 19, wireType 0 =*/152).bool(message.disableStandardErrorCapture); if (message.blockExternalNetwork != null && Object.hasOwnProperty.call(message, "blockExternalNetwork")) writer.uint32(/* id 20, wireType 0 =*/160).bool(message.blockExternalNetwork); + if (message.encryptedEnvironment != null && Object.hasOwnProperty.call(message, "encryptedEnvironment")) + $root.google.cloud.lifesciences.v2beta.Secret.encode(message.encryptedEnvironment, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); return writer; }; @@ -1305,6 +1344,10 @@ message.environment[key] = value; break; } + case 21: { + message.encryptedEnvironment = $root.google.cloud.lifesciences.v2beta.Secret.decode(reader, reader.uint32()); + break; + } case 6: { message.pidNamespace = reader.string(); break; @@ -1460,6 +1503,11 @@ if (!$util.isString(message.environment[key[i]])) return "environment: string{k:string} expected"; } + if (message.encryptedEnvironment != null && message.hasOwnProperty("encryptedEnvironment")) { + var error = $root.google.cloud.lifesciences.v2beta.Secret.verify(message.encryptedEnvironment); + if (error) + return "encryptedEnvironment." + error; + } if (message.pidNamespace != null && message.hasOwnProperty("pidNamespace")) if (!$util.isString(message.pidNamespace)) return "pidNamespace: string expected"; @@ -1560,6 +1608,11 @@ for (var keys = Object.keys(object.environment), i = 0; i < keys.length; ++i) message.environment[keys[i]] = String(object.environment[keys[i]]); } + if (object.encryptedEnvironment != null) { + if (typeof object.encryptedEnvironment !== "object") + throw TypeError(".google.cloud.lifesciences.v2beta.Action.encryptedEnvironment: object expected"); + message.encryptedEnvironment = $root.google.cloud.lifesciences.v2beta.Secret.fromObject(object.encryptedEnvironment); + } if (object.pidNamespace != null) message.pidNamespace = String(object.pidNamespace); if (object.portMappings) { @@ -1652,6 +1705,7 @@ object.disableImagePrefetch = false; object.disableStandardErrorCapture = false; object.blockExternalNetwork = false; + object.encryptedEnvironment = null; } if (message.containerName != null && message.hasOwnProperty("containerName")) object.containerName = message.containerName; @@ -1707,6 +1761,8 @@ object.disableStandardErrorCapture = message.disableStandardErrorCapture; if (message.blockExternalNetwork != null && message.hasOwnProperty("blockExternalNetwork")) object.blockExternalNetwork = message.blockExternalNetwork; + if (message.encryptedEnvironment != null && message.hasOwnProperty("encryptedEnvironment")) + object.encryptedEnvironment = $root.google.cloud.lifesciences.v2beta.Secret.toObject(message.encryptedEnvironment, options); return object; }; @@ -2524,6 +2580,7 @@ * @property {boolean|null} [enableStackdriverMonitoring] VirtualMachine enableStackdriverMonitoring * @property {Array.|null} [dockerCacheImages] VirtualMachine dockerCacheImages * @property {Array.|null} [volumes] VirtualMachine volumes + * @property {string|null} [reservation] VirtualMachine reservation */ /** @@ -2658,6 +2715,14 @@ */ VirtualMachine.prototype.volumes = $util.emptyArray; + /** + * VirtualMachine reservation. + * @member {string} reservation + * @memberof google.cloud.lifesciences.v2beta.VirtualMachine + * @instance + */ + VirtualMachine.prototype.reservation = ""; + /** * Creates a new VirtualMachine instance using the specified properties. * @function create @@ -2715,6 +2780,8 @@ if (message.volumes != null && message.volumes.length) for (var i = 0; i < message.volumes.length; ++i) $root.google.cloud.lifesciences.v2beta.Volume.encode(message.volumes[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.reservation != null && Object.hasOwnProperty.call(message, "reservation")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.reservation); return writer; }; @@ -2832,6 +2899,10 @@ message.volumes.push($root.google.cloud.lifesciences.v2beta.Volume.decode(reader, reader.uint32())); break; } + case 15: { + message.reservation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2940,6 +3011,9 @@ return "volumes." + error; } } + if (message.reservation != null && message.hasOwnProperty("reservation")) + if (!$util.isString(message.reservation)) + return "reservation: string expected"; return null; }; @@ -3023,6 +3097,8 @@ message.volumes[i] = $root.google.cloud.lifesciences.v2beta.Volume.fromObject(object.volumes[i]); } } + if (object.reservation != null) + message.reservation = String(object.reservation); return message; }; @@ -3057,6 +3133,7 @@ object.bootImage = ""; object.nvidiaDriverVersion = ""; object.enableStackdriverMonitoring = false; + object.reservation = ""; } if (message.machineType != null && message.hasOwnProperty("machineType")) object.machineType = message.machineType; @@ -3102,6 +3179,8 @@ for (var j = 0; j < message.volumes.length; ++j) object.volumes[j] = $root.google.cloud.lifesciences.v2beta.Volume.toObject(message.volumes[j], options); } + if (message.reservation != null && message.hasOwnProperty("reservation")) + object.reservation = message.reservation; return object; }; diff --git a/packages/google-cloud-lifesciences/protos/protos.json b/packages/google-cloud-lifesciences/protos/protos.json index 0555dbe7747..5a3e377c671 100644 --- a/packages/google-cloud-lifesciences/protos/protos.json +++ b/packages/google-cloud-lifesciences/protos/protos.json @@ -93,6 +93,10 @@ "type": "string", "id": 3 }, + "encryptedEnvironment": { + "type": "Secret", + "id": 5 + }, "timeout": { "type": "google.protobuf.Duration", "id": 4 @@ -126,6 +130,10 @@ "type": "string", "id": 5 }, + "encryptedEnvironment": { + "type": "Secret", + "id": 21 + }, "pidNamespace": { "type": "string", "id": 6 @@ -301,6 +309,10 @@ "rule": "repeated", "type": "Volume", "id": 14 + }, + "reservation": { + "type": "string", + "id": 15 } } }, @@ -660,7 +672,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ClientProto", + "java_outer_classname": "FieldBehaviorProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -753,6 +765,22 @@ } } }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, "fieldBehavior": { "rule": "repeated", "type": "google.api.FieldBehavior", @@ -770,22 +798,6 @@ "UNORDERED_LIST": 6, "NON_EMPTY_DEFAULT": 7 } - }, - "methodSignature": { - "rule": "repeated", - "type": "string", - "id": 1051, - "extend": "google.protobuf.MethodOptions" - }, - "defaultHost": { - "type": "string", - "id": 1049, - "extend": "google.protobuf.ServiceOptions" - }, - "oauthScopes": { - "type": "string", - "id": 1050, - "extend": "google.protobuf.ServiceOptions" } } }, diff --git a/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts b/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts index 7de1f486f04..3ef49e76f81 100644 --- a/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts +++ b/packages/google-cloud-lifesciences/src/v2beta/workflows_service_v2_beta_client.ts @@ -25,6 +25,8 @@ import type { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -60,6 +62,7 @@ export class WorkflowsServiceV2BetaClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; operationsClient: gax.OperationsClient; workflowsServiceV2BetaStub?: Promise<{[name: string]: Function}>; @@ -122,6 +125,9 @@ export class WorkflowsServiceV2BetaClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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; @@ -154,6 +160,10 @@ export class WorkflowsServiceV2BetaClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -527,6 +537,262 @@ export class WorkflowsServiceV2BetaClient { protos.google.cloud.lifesciences.v2beta.Metadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } /** * Terminate the gRPC channel and close the client. @@ -539,6 +805,7 @@ export class WorkflowsServiceV2BetaClient { return this.workflowsServiceV2BetaStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-lifesciences/test/gapic_workflows_service_v2_beta_v2beta.ts b/packages/google-cloud-lifesciences/test/gapic_workflows_service_v2_beta_v2beta.ts index 1aa037d758b..4fea0c4993e 100644 --- a/packages/google-cloud-lifesciences/test/gapic_workflows_service_v2_beta_v2beta.ts +++ b/packages/google-cloud-lifesciences/test/gapic_workflows_service_v2_beta_v2beta.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as workflowsservicev2betaModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects @@ -87,6 +92,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +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('v2beta.WorkflowsServiceV2BetaClient', () => { describe('Common methods', () => { it('has servicePath', () => { @@ -392,4 +420,523 @@ describe('v2beta.WorkflowsServiceV2BetaClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new workflowsservicev2betaModule.v2beta.WorkflowsServiceV2BetaClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); });