From 0f3a7f06a82bd6c6cc0597821289a3c5429bb14a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 15 Nov 2022 00:26:24 +0000 Subject: [PATCH 1/3] feat: added CreateSshPublicKey RPC PiperOrigin-RevId: 488460648 Source-Link: https://github.com/googleapis/googleapis/commit/236055995b64ba17e1441fe12908ca6e0f1953b9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/59576752785e41d49590c1ed00042827611f3438 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9zbG9naW4vLk93bEJvdC55YW1sIiwiaCI6IjU5NTc2NzUyNzg1ZTQxZDQ5NTkwYzFlZDAwMDQyODI3NjExZjM0MzgifQ== --- .../google-cloud-oslogin/v1/.eslintignore | 7 + .../google-cloud-oslogin/v1/.eslintrc.json | 3 + .../google-cloud-oslogin/v1/.gitignore | 14 + .../google-cloud-oslogin/v1/.jsdoc.js | 55 + .../google-cloud-oslogin/v1/.mocharc.js | 33 + .../google-cloud-oslogin/v1/.prettierrc.js | 22 + .../google-cloud-oslogin/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../google-cloud-oslogin/v1/package.json | 64 ++ .../google/cloud/oslogin/common/common.proto | 108 ++ .../google/cloud/oslogin/v1/oslogin.proto | 239 ++++ .../os_login_service.create_ssh_public_key.js | 66 ++ .../os_login_service.delete_posix_account.js | 63 + .../os_login_service.delete_ssh_public_key.js | 63 + .../v1/os_login_service.get_login_profile.js | 69 ++ .../v1/os_login_service.get_ssh_public_key.js | 63 + .../os_login_service.import_ssh_public_key.js | 69 ++ .../os_login_service.update_ssh_public_key.js | 72 ++ ...ppet_metadata.google.cloud.oslogin.v1.json | 323 ++++++ .../google-cloud-oslogin/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 93 ++ .../google-cloud-oslogin/v1/src/v1/index.ts | 19 + .../v1/src/v1/os_login_service_client.ts | 947 +++++++++++++++ .../v1/os_login_service_client_config.json | 60 + .../src/v1/os_login_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_os_login_service_v1.ts | 1015 +++++++++++++++++ .../google-cloud-oslogin/v1/tsconfig.json | 19 + .../google-cloud-oslogin/v1/webpack.config.js | 64 ++ .../google-cloud-oslogin/v1beta/.eslintignore | 7 + .../v1beta/.eslintrc.json | 3 + .../google-cloud-oslogin/v1beta/.gitignore | 14 + .../google-cloud-oslogin/v1beta/.jsdoc.js | 55 + .../google-cloud-oslogin/v1beta/.mocharc.js | 33 + .../v1beta/.prettierrc.js | 22 + .../google-cloud-oslogin/v1beta/README.md | 1 + .../v1beta/linkinator.config.json | 16 + .../google-cloud-oslogin/v1beta/package.json | 64 ++ .../google/cloud/oslogin/common/common.proto | 108 ++ .../google/cloud/oslogin/v1beta/oslogin.proto | 288 +++++ .../os_login_service.create_ssh_public_key.js | 66 ++ .../os_login_service.delete_posix_account.js | 63 + .../os_login_service.delete_ssh_public_key.js | 63 + .../os_login_service.get_login_profile.js | 73 ++ .../os_login_service.get_ssh_public_key.js | 63 + .../os_login_service.import_ssh_public_key.js | 73 ++ .../os_login_service.update_ssh_public_key.js | 72 ++ ..._metadata.google.cloud.oslogin.v1beta.json | 331 ++++++ .../google-cloud-oslogin/v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/gapic_metadata.json | 93 ++ .../v1beta/src/v1beta/index.ts | 19 + .../src/v1beta/os_login_service_client.ts | 951 +++++++++++++++ .../os_login_service_client_config.json | 60 + .../v1beta/os_login_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta/system-test/install.ts | 49 + .../test/gapic_os_login_service_v1beta.ts | 1015 +++++++++++++++++ .../google-cloud-oslogin/v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 ++ 62 files changed, 7477 insertions(+) create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/README.md create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/package.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/common/common.proto create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.create_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/test/gapic_os_login_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.create_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/webpack.config.js diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.eslintignore b/owl-bot-staging/google-cloud-oslogin/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json b/owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.gitignore b/owl-bot-staging/google-cloud-oslogin/v1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.jsdoc.js b/owl-bot-staging/google-cloud-oslogin/v1/.jsdoc.js new file mode 100644 index 00000000000..83fc87c6ceb --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/.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/os-login', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.mocharc.js b/owl-bot-staging/google-cloud-oslogin/v1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/.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-oslogin/v1/.prettierrc.js b/owl-bot-staging/google-cloud-oslogin/v1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/.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-oslogin/v1/README.md b/owl-bot-staging/google-cloud-oslogin/v1/README.md new file mode 100644 index 00000000000..f7acdc89a3a --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/README.md @@ -0,0 +1 @@ +Oslogin: Nodejs Client diff --git a/owl-bot-staging/google-cloud-oslogin/v1/linkinator.config.json b/owl-bot-staging/google-cloud-oslogin/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/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-oslogin/v1/package.json b/owl-bot-staging/google-cloud-oslogin/v1/package.json new file mode 100644 index 00000000000..c968d347d8f --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/os-login", + "version": "0.1.0", + "description": "Oslogin client for Node.js", + "repository": "googleapis/nodejs-oslogin", + "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 oslogin", + "oslogin", + "os login service" + ], + "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-oslogin/v1/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/common/common.proto new file mode 100644 index 00000000000..6eeaf8908d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/common/common.proto @@ -0,0 +1,108 @@ +// 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.oslogin.common; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.OsLogin.Common"; +option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/common;common"; +option java_outer_classname = "OsLoginProto"; +option java_package = "com.google.cloud.oslogin.common"; +option php_namespace = "Google\\Cloud\\OsLogin\\Common"; +option ruby_package = "Google::Cloud::OsLogin::Common"; +option (google.api.resource_definition) = { + type: "oslogin.googleapis.com/User" + pattern: "users/{user}" +}; + +// The operating system options for account entries. +enum OperatingSystemType { + // The operating system type associated with the user account information is + // unspecified. + OPERATING_SYSTEM_TYPE_UNSPECIFIED = 0; + + // Linux user account information. + LINUX = 1; + + // Windows user account information. + WINDOWS = 2; +} + +// The POSIX account information associated with a Google account. +message PosixAccount { + option (google.api.resource) = { + type: "oslogin.googleapis.com/PosixAccount" + pattern: "users/{user}/projects/{project}" + }; + + // Only one POSIX account can be marked as primary. + bool primary = 1; + + // The username of the POSIX account. + string username = 2; + + // The user ID. + int64 uid = 3; + + // The default group ID. + int64 gid = 4; + + // The path to the home directory for this account. + string home_directory = 5; + + // The path to the logic shell for this account. + string shell = 6; + + // The GECOS (user information) entry for this account. + string gecos = 7; + + // System identifier for which account the username or uid applies to. + // By default, the empty value is used. + string system_id = 8; + + // Output only. A POSIX account identifier. + string account_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The operating system type where this account applies. + OperatingSystemType operating_system_type = 10; + + // Output only. The canonical resource name. + string name = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The SSH public key information associated with a Google account. +message SshPublicKey { + option (google.api.resource) = { + type: "oslogin.googleapis.com/SshPublicKey" + pattern: "users/{user}/sshPublicKeys/{fingerprint}" + }; + + // Public key text in SSH format, defined by + // RFC4253 + // section 6.6. + string key = 1; + + // An expiration time in microseconds since epoch. + int64 expiration_time_usec = 2; + + // Output only. The SHA-256 fingerprint of the SSH public key. + string fingerprint = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The canonical resource name. + string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto b/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto new file mode 100644 index 00000000000..fb3575600c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto @@ -0,0 +1,239 @@ +// 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.oslogin.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/oslogin/common/common.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.OsLogin.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin"; +option java_multiple_files = true; +option java_outer_classname = "OsLoginProto"; +option java_package = "com.google.cloud.oslogin.v1"; +option php_namespace = "Google\\Cloud\\OsLogin\\V1"; +option ruby_package = "Google::Cloud::OsLogin::V1"; + +// Cloud OS Login API +// +// The Cloud OS Login API allows you to manage users and their associated SSH +// public keys for logging into virtual machines on Google Cloud Platform. +service OsLoginService { + option (google.api.default_host) = "oslogin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly"; + + // Create an SSH public key + rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + post: "/v1/{parent=users/*}/sshPublicKeys" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + } + + // Deletes a POSIX account. + rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=users/*/projects/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an SSH public key. + rpc DeleteSshPublicKey(DeleteSshPublicKeyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=users/*/sshPublicKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves the profile information used for logging in to a virtual machine + // on Google Compute Engine. + rpc GetLoginProfile(GetLoginProfileRequest) returns (LoginProfile) { + option (google.api.http) = { + get: "/v1/{name=users/*}/loginProfile" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves an SSH public key. + rpc GetSshPublicKey(GetSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + get: "/v1/{name=users/*/sshPublicKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds an SSH public key and returns the profile information. Default POSIX + // account information is set when no username and UID exist as part of the + // login profile. + rpc ImportSshPublicKey(ImportSshPublicKeyRequest) returns (ImportSshPublicKeyResponse) { + option (google.api.http) = { + post: "/v1/{parent=users/*}:importSshPublicKey" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + option (google.api.method_signature) = "parent,ssh_public_key,project_id"; + } + + // Updates an SSH public key and returns the profile information. This method + // supports patch semantics. + rpc UpdateSshPublicKey(UpdateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + patch: "/v1/{name=users/*/sshPublicKeys/*}" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "name,ssh_public_key"; + option (google.api.method_signature) = "name,ssh_public_key,update_mask"; + } +} + +// The user profile information used for logging in to a virtual machine on +// Google Compute Engine. +message LoginProfile { + // Required. A unique user ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of POSIX accounts associated with the user. + repeated google.cloud.oslogin.common.PosixAccount posix_accounts = 2; + + // A map from SSH public key fingerprint to the associated key object. + map ssh_public_keys = 3; +} + +// A request message for creating an SSH public key. +message CreateSshPublicKeyRequest { + // Required. The unique ID for the user in format `users/{user}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request message for deleting a POSIX account entry. +message DeletePosixAccountRequest { + // Required. A reference to the POSIX account to update. POSIX accounts are identified + // by the project ID they are associated with. A reference to the POSIX + // account is in format `users/{user}/projects/{project}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/PosixAccount" + } + ]; +} + +// A request message for deleting an SSH public key. +message DeleteSshPublicKeyRequest { + // Required. The fingerprint of the public key to update. Public keys are identified by + // their SHA-256 fingerprint. The fingerprint of the public key is in format + // `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; +} + +// A request message for retrieving the login profile information for a user. +message GetLoginProfileRequest { + // Required. The unique ID for the user in format `users/{user}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/PosixAccount" + } + ]; + + // The project ID of the Google Cloud Platform project. + string project_id = 2; + + // A system ID for filtering the results of the request. + string system_id = 3; +} + +// A request message for retrieving an SSH public key. +message GetSshPublicKeyRequest { + // Required. The fingerprint of the public key to retrieve. Public keys are identified + // by their SHA-256 fingerprint. The fingerprint of the public key is in + // format `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; +} + +// A request message for importing an SSH public key. +message ImportSshPublicKeyRequest { + // Required. The unique ID for the user in format `users/{user}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Optional. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The project ID of the Google Cloud Platform project. + string project_id = 3; +} + +// A response message for importing an SSH public key. +message ImportSshPublicKeyResponse { + // The login profile information for the user. + LoginProfile login_profile = 1; + + // Detailed information about import results. + string details = 2; +} + +// A request message for updating an SSH public key. +message UpdateSshPublicKeyRequest { + // Required. The fingerprint of the public key to update. Public keys are identified by + // their SHA-256 fingerprint. The fingerprint of the public key is in format + // `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Mask to control which fields get updated. Updates all if not present. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.create_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.create_ssh_public_key.js new file mode 100644 index 00000000000..1ad7dcb2467 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.create_ssh_public_key.js @@ -0,0 +1,66 @@ +// 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(parent, sshPublicKey) { + // [START oslogin_v1_generated_OsLoginService_CreateSshPublicKey_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. + */ + /** + * Required. The unique ID for the user in format `users/{user}`. + */ + // const parent = 'abc123' + /** + * Required. The SSH public key and expiration time. + */ + // const sshPublicKey = {} + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callCreateSshPublicKey() { + // Construct request + const request = { + parent, + sshPublicKey, + }; + + // Run request + const response = await osloginClient.createSshPublicKey(request); + console.log(response); + } + + callCreateSshPublicKey(); + // [END oslogin_v1_generated_OsLoginService_CreateSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js new file mode 100644 index 00000000000..9ffef6406c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js @@ -0,0 +1,63 @@ +// 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(name) { + // [START oslogin_v1_generated_OsLoginService_DeletePosixAccount_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. + */ + /** + * Required. A reference to the POSIX account to update. POSIX accounts are identified + * by the project ID they are associated with. A reference to the POSIX + * account is in format `users/{user}/projects/{project}`. + */ + // const name = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callDeletePosixAccount() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.deletePosixAccount(request); + console.log(response); + } + + callDeletePosixAccount(); + // [END oslogin_v1_generated_OsLoginService_DeletePosixAccount_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-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js new file mode 100644 index 00000000000..cf03e46e16d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js @@ -0,0 +1,63 @@ +// 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(name) { + // [START oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_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. + */ + /** + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + */ + // const name = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callDeleteSshPublicKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.deleteSshPublicKey(request); + console.log(response); + } + + callDeleteSshPublicKey(); + // [END oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js new file mode 100644 index 00000000000..bfe9398c903 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js @@ -0,0 +1,69 @@ +// 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(name) { + // [START oslogin_v1_generated_OsLoginService_GetLoginProfile_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. + */ + /** + * Required. The unique ID for the user in format `users/{user}`. + */ + // const name = 'abc123' + /** + * The project ID of the Google Cloud Platform project. + */ + // const projectId = 'abc123' + /** + * A system ID for filtering the results of the request. + */ + // const systemId = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callGetLoginProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.getLoginProfile(request); + console.log(response); + } + + callGetLoginProfile(); + // [END oslogin_v1_generated_OsLoginService_GetLoginProfile_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-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js new file mode 100644 index 00000000000..d95414b4f9c --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js @@ -0,0 +1,63 @@ +// 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(name) { + // [START oslogin_v1_generated_OsLoginService_GetSshPublicKey_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. + */ + /** + * Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in + * format `users/{user}/sshPublicKeys/{fingerprint}`. + */ + // const name = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callGetSshPublicKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.getSshPublicKey(request); + console.log(response); + } + + callGetSshPublicKey(); + // [END oslogin_v1_generated_OsLoginService_GetSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js new file mode 100644 index 00000000000..c6d826aa785 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js @@ -0,0 +1,69 @@ +// 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(parent) { + // [START oslogin_v1_generated_OsLoginService_ImportSshPublicKey_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. + */ + /** + * Required. The unique ID for the user in format `users/{user}`. + */ + // const parent = 'abc123' + /** + * Optional. The SSH public key and expiration time. + */ + // const sshPublicKey = {} + /** + * The project ID of the Google Cloud Platform project. + */ + // const projectId = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callImportSshPublicKey() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await osloginClient.importSshPublicKey(request); + console.log(response); + } + + callImportSshPublicKey(); + // [END oslogin_v1_generated_OsLoginService_ImportSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js new file mode 100644 index 00000000000..a9d5dc708c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js @@ -0,0 +1,72 @@ +// 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(name, sshPublicKey) { + // [START oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_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. + */ + /** + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + */ + // const name = 'abc123' + /** + * Required. The SSH public key and expiration time. + */ + // const sshPublicKey = {} + /** + * Mask to control which fields get updated. Updates all if not present. + */ + // const updateMask = {} + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callUpdateSshPublicKey() { + // Construct request + const request = { + name, + sshPublicKey, + }; + + // Run request + const response = await osloginClient.updateSshPublicKey(request); + console.log(response); + } + + callUpdateSshPublicKey(); + // [END oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_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-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json new file mode 100644 index 00000000000..2c35446f956 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json @@ -0,0 +1,323 @@ +{ + "clientLibrary": { + "name": "nodejs-oslogin", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.oslogin.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "oslogin_v1_generated_OsLoginService_CreateSshPublicKey_async", + "title": "OsLoginService createSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Create an SSH public key", + "canonical": true, + "file": "os_login_service.create_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_DeletePosixAccount_async", + "title": "OsLoginService deletePosixAccount Sample", + "origin": "API_DEFINITION", + "description": " Deletes a POSIX account.", + "canonical": true, + "file": "os_login_service.delete_posix_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_async", + "title": "OsLoginService deleteSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Deletes an SSH public key.", + "canonical": true, + "file": "os_login_service.delete_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_GetLoginProfile_async", + "title": "OsLoginService getLoginProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.", + "canonical": true, + "file": "os_login_service.get_login_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetLoginProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "system_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.v1.LoginProfile", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetLoginProfile", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_GetSshPublicKey_async", + "title": "OsLoginService getSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an SSH public key.", + "canonical": true, + "file": "os_login_service.get_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_ImportSshPublicKey_async", + "title": "OsLoginService importSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.", + "canonical": true, + "file": "os_login_service.import_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.v1.ImportSshPublicKeyResponse", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_async", + "title": "OsLoginService updateSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Updates an SSH public key and returns the profile information. This method supports patch semantics.", + "canonical": true, + "file": "os_login_service.update_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/index.ts new file mode 100644 index 00000000000..03a3c4cea2d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/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 v1 from './v1'; +const OsLoginServiceClient = v1.OsLoginServiceClient; +type OsLoginServiceClient = v1.OsLoginServiceClient; +export {v1, OsLoginServiceClient}; +export default {v1, OsLoginServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..fc08cf26063 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json @@ -0,0 +1,93 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.oslogin.v1", + "libraryPackage": "@google-cloud/os-login", + "services": { + "OsLoginService": { + "clients": { + "grpc": { + "libraryClient": "OsLoginServiceClient", + "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "OsLoginServiceClient", + "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/index.ts new file mode 100644 index 00000000000..d3f167933f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/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 {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts new file mode 100644 index 00000000000..9751d8dbac0 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts @@ -0,0 +1,947 @@ +// 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} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/os_login_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './os_login_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud OS Login API + * + * The Cloud OS Login API allows you to manage users and their associated SSH + * public keys for logging into virtual machines on Google Cloud Platform. + * @class + * @memberof v1 + */ +export class OsLoginServiceClient { + 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}; + pathTemplates: {[name: string]: gax.PathTemplate}; + osLoginServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of OsLoginServiceClient. + * + * @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 OsLoginServiceClient({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 OsLoginServiceClient; + 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; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + posixAccountPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/projects/{project}' + ), + sshPublicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/sshPublicKeys/{fingerprint}' + ), + userPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.oslogin.v1.OsLoginService', 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.osLoginServiceStub) { + return this.osLoginServiceStub; + } + + // Put together the "service stub" for + // google.cloud.oslogin.v1.OsLoginService. + this.osLoginServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.oslogin.v1.OsLoginService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.oslogin.v1.OsLoginService, + 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 osLoginServiceStubMethods = + ['createSshPublicKey', 'deletePosixAccount', 'deleteSshPublicKey', 'getLoginProfile', 'getSshPublicKey', 'importSshPublicKey', 'updateSshPublicKey']; + for (const methodName of osLoginServiceStubMethods) { + const callPromise = this.osLoginServiceStub.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 = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.osLoginServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'oslogin.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 'oslogin.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', + 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/compute', + 'https://www.googleapis.com/auth/compute.readonly' + ]; + } + + 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 -- + // ------------------- +/** + * Create an SSH public key + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.create_ssh_public_key.js + * region_tag:oslogin_v1_generated_OsLoginService_CreateSshPublicKey_async + */ + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|undefined, {}|undefined + ]>; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|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.createSshPublicKey(request, options, callback); + } +/** + * Deletes a POSIX account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A reference to the POSIX account to update. POSIX accounts are identified + * by the project ID they are associated with. A reference to the POSIX + * account is in format `users/{user}/projects/{project}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.delete_posix_account.js + * region_tag:oslogin_v1_generated_OsLoginService_DeletePosixAccount_async + */ + deletePosixAccount( + request?: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|undefined, {}|undefined + ]>; + deletePosixAccount( + request: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>): void; + deletePosixAccount( + request: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>): void; + deletePosixAccount( + request?: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePosixAccount(request, options, callback); + } +/** + * Deletes an SSH public key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.delete_ssh_public_key.js + * region_tag:oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_async + */ + deleteSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|undefined, {}|undefined + ]>; + deleteSshPublicKey( + request: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + deleteSshPublicKey( + request: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + deleteSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSshPublicKey(request, options, callback); + } +/** + * Retrieves the profile information used for logging in to a virtual machine + * on Google Compute Engine. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique ID for the user in format `users/{user}`. + * @param {string} request.projectId + * The project ID of the Google Cloud Platform project. + * @param {string} request.systemId + * A system ID for filtering the results of the request. + * @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 [LoginProfile]{@link google.cloud.oslogin.v1.LoginProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.get_login_profile.js + * region_tag:oslogin_v1_generated_OsLoginService_GetLoginProfile_async + */ + getLoginProfile( + request?: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.v1.ILoginProfile, + protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|undefined, {}|undefined + ]>; + getLoginProfile( + request: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.v1.ILoginProfile, + protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>): void; + getLoginProfile( + request: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, + callback: Callback< + protos.google.cloud.oslogin.v1.ILoginProfile, + protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>): void; + getLoginProfile( + request?: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.v1.ILoginProfile, + protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.v1.ILoginProfile, + protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.v1.ILoginProfile, + protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getLoginProfile(request, options, callback); + } +/** + * Retrieves an SSH public key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in + * format `users/{user}/sshPublicKeys/{fingerprint}`. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.get_ssh_public_key.js + * region_tag:oslogin_v1_generated_OsLoginService_GetSshPublicKey_async + */ + getSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|undefined, {}|undefined + ]>; + getSshPublicKey( + request: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + getSshPublicKey( + request: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + getSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSshPublicKey(request, options, callback); + } +/** + * Adds an SSH public key and returns the profile information. Default POSIX + * account information is set when no username and UID exist as part of the + * login profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} [request.sshPublicKey] + * Optional. The SSH public key and expiration time. + * @param {string} request.projectId + * The project ID of the Google Cloud Platform project. + * @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 [ImportSshPublicKeyResponse]{@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.import_ssh_public_key.js + * region_tag:oslogin_v1_generated_OsLoginService_ImportSshPublicKey_async + */ + importSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|undefined, {}|undefined + ]>; + importSshPublicKey( + request: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + importSshPublicKey( + request: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + importSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|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.importSshPublicKey(request, options, callback); + } +/** + * Updates an SSH public key and returns the profile information. This method + * supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get updated. Updates all if not present. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.update_ssh_public_key.js + * region_tag:oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_async + */ + updateSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|undefined, {}|undefined + ]>; + updateSshPublicKey( + request: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + updateSshPublicKey( + request: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + updateSshPublicKey( + request?: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSshPublicKey(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified posixAccount resource name string. + * + * @param {string} user + * @param {string} project + * @returns {string} Resource name string. + */ + posixAccountPath(user:string,project:string) { + return this.pathTemplates.posixAccountPathTemplate.render({ + user: user, + project: project, + }); + } + + /** + * Parse the user from PosixAccount resource. + * + * @param {string} posixAccountName + * A fully-qualified path representing PosixAccount resource. + * @returns {string} A string representing the user. + */ + matchUserFromPosixAccountName(posixAccountName: string) { + return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).user; + } + + /** + * Parse the project from PosixAccount resource. + * + * @param {string} posixAccountName + * A fully-qualified path representing PosixAccount resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPosixAccountName(posixAccountName: string) { + return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).project; + } + + /** + * Return a fully-qualified sshPublicKey resource name string. + * + * @param {string} user + * @param {string} fingerprint + * @returns {string} Resource name string. + */ + sshPublicKeyPath(user:string,fingerprint:string) { + return this.pathTemplates.sshPublicKeyPathTemplate.render({ + user: user, + fingerprint: fingerprint, + }); + } + + /** + * Parse the user from SshPublicKey resource. + * + * @param {string} sshPublicKeyName + * A fully-qualified path representing SshPublicKey resource. + * @returns {string} A string representing the user. + */ + matchUserFromSshPublicKeyName(sshPublicKeyName: string) { + return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).user; + } + + /** + * Parse the fingerprint from SshPublicKey resource. + * + * @param {string} sshPublicKeyName + * A fully-qualified path representing SshPublicKey resource. + * @returns {string} A string representing the fingerprint. + */ + matchFingerprintFromSshPublicKeyName(sshPublicKeyName: string) { + return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).fingerprint; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user:string) { + return this.pathTemplates.userPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * 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.osLoginServiceStub && !this._terminated) { + return this.osLoginServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json new file mode 100644 index 00000000000..afdd4ec0a35 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json @@ -0,0 +1,60 @@ +{ + "interfaces": { + "google.cloud.oslogin.v1.OsLoginService": { + "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": { + "CreateSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeletePosixAccount": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetLoginProfile": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json new file mode 100644 index 00000000000..46f125ed586 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/oslogin/common/common.proto", + "../../protos/google/cloud/oslogin/v1/oslogin.proto" +] diff --git a/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..dbe35025422 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/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 oslogin = require('@google-cloud/os-login'); + +function main() { + const osLoginServiceClient = new oslogin.OsLoginServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b5eb626ee88 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/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 {OsLoginServiceClient} from '@google-cloud/os-login'; + +// check that the client class type name can be used +function doStuffWithOsLoginServiceClient(client: OsLoginServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const osLoginServiceClient = new OsLoginServiceClient(); + doStuffWithOsLoginServiceClient(osLoginServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1/system-test/install.ts b/owl-bot-staging/google-cloud-oslogin/v1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/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-oslogin/v1/test/gapic_os_login_service_v1.ts b/owl-bot-staging/google-cloud-oslogin/v1/test/gapic_os_login_service_v1.ts new file mode 100644 index 00000000000..853768f0cc4 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/test/gapic_os_login_service_v1.ts @@ -0,0 +1,1015 @@ +// 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 osloginserviceModule from '../src'; + +import {protobuf} 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 stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1.OsLoginServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = osloginserviceModule.v1.OsLoginServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = osloginserviceModule.v1.OsLoginServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = osloginserviceModule.v1.OsLoginServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.osLoginServiceStub, undefined); + await client.initialize(); + assert(client.osLoginServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.osLoginServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.osLoginServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + 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 osloginserviceModule.v1.OsLoginServiceClient({ + 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('createSshPublicKey', () => { + it('invokes createSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.createSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSshPublicKey(request), expectedError); + }); + }); + + describe('deletePosixAccount', () => { + it('invokes deletePosixAccount without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); + const [response] = await client.deletePosixAccount(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePosixAccount without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deletePosixAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePosixAccount( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePosixAccount with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deletePosixAccount(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePosixAccount with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deletePosixAccount(request), expectedError); + }); + }); + + describe('deleteSshPublicKey', () => { + it('invokes deleteSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSshPublicKey( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + }); + }); + + describe('getLoginProfile', () => { + it('invokes getLoginProfile without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1.LoginProfile() + ); + client.innerApiCalls.getLoginProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getLoginProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLoginProfile without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1.LoginProfile() + ); + client.innerApiCalls.getLoginProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLoginProfile( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.v1.ILoginProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLoginProfile with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLoginProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLoginProfile with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLoginProfile(request), expectedError); + }); + }); + + describe('getSshPublicKey', () => { + it('invokes getSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.getSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.getSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.getSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSshPublicKey(request), expectedError); + }); + }); + + describe('importSshPublicKey', () => { + it('invokes importSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyResponse() + ); + client.innerApiCalls.importSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.importSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyResponse() + ); + client.innerApiCalls.importSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.importSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.importSshPublicKey(request), expectedError); + }); + }); + + describe('updateSshPublicKey', () => { + it('invokes updateSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.updateSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.updateSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.updateSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + }); + }); + + describe('Path templates', () => { + + describe('posixAccount', () => { + const fakePath = "/rendered/path/posixAccount"; + const expectedParameters = { + user: "userValue", + project: "projectValue", + }; + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.posixAccountPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.posixAccountPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('posixAccountPath', () => { + const result = client.posixAccountPath("userValue", "projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.posixAccountPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromPosixAccountName', () => { + const result = client.matchUserFromPosixAccountName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProjectFromPosixAccountName', () => { + const result = client.matchProjectFromPosixAccountName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sshPublicKey', () => { + const fakePath = "/rendered/path/sshPublicKey"; + const expectedParameters = { + user: "userValue", + fingerprint: "fingerprintValue", + }; + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sshPublicKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sshPublicKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sshPublicKeyPath', () => { + const result = client.sshPublicKeyPath("userValue", "fingerprintValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sshPublicKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromSshPublicKeyName', () => { + const result = client.matchUserFromSshPublicKeyName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFingerprintFromSshPublicKeyName', () => { + const result = client.matchFingerprintFromSshPublicKeyName(fakePath); + assert.strictEqual(result, "fingerprintValue"); + assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('user', () => { + const fakePath = "/rendered/path/user"; + const expectedParameters = { + user: "userValue", + }; + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userPath', () => { + const result = client.userPath("userValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json b/owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js b/owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js new file mode 100644 index 00000000000..67fc391472d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'OsLoginService', + filename: './os-login-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore b/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.gitignore b/owl-bot-staging/google-cloud-oslogin/v1beta/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-oslogin/v1beta/.jsdoc.js new file mode 100644 index 00000000000..83fc87c6ceb --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/.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/os-login', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-oslogin/v1beta/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-oslogin/v1beta/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/README.md b/owl-bot-staging/google-cloud-oslogin/v1beta/README.md new file mode 100644 index 00000000000..f7acdc89a3a --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/README.md @@ -0,0 +1 @@ +Oslogin: Nodejs Client diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/linkinator.config.json b/owl-bot-staging/google-cloud-oslogin/v1beta/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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-oslogin/v1beta/package.json b/owl-bot-staging/google-cloud-oslogin/v1beta/package.json new file mode 100644 index 00000000000..c968d347d8f --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/os-login", + "version": "0.1.0", + "description": "Oslogin client for Node.js", + "repository": "googleapis/nodejs-oslogin", + "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 oslogin", + "oslogin", + "os login service" + ], + "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-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto new file mode 100644 index 00000000000..6eeaf8908d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto @@ -0,0 +1,108 @@ +// 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.oslogin.common; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.OsLogin.Common"; +option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/common;common"; +option java_outer_classname = "OsLoginProto"; +option java_package = "com.google.cloud.oslogin.common"; +option php_namespace = "Google\\Cloud\\OsLogin\\Common"; +option ruby_package = "Google::Cloud::OsLogin::Common"; +option (google.api.resource_definition) = { + type: "oslogin.googleapis.com/User" + pattern: "users/{user}" +}; + +// The operating system options for account entries. +enum OperatingSystemType { + // The operating system type associated with the user account information is + // unspecified. + OPERATING_SYSTEM_TYPE_UNSPECIFIED = 0; + + // Linux user account information. + LINUX = 1; + + // Windows user account information. + WINDOWS = 2; +} + +// The POSIX account information associated with a Google account. +message PosixAccount { + option (google.api.resource) = { + type: "oslogin.googleapis.com/PosixAccount" + pattern: "users/{user}/projects/{project}" + }; + + // Only one POSIX account can be marked as primary. + bool primary = 1; + + // The username of the POSIX account. + string username = 2; + + // The user ID. + int64 uid = 3; + + // The default group ID. + int64 gid = 4; + + // The path to the home directory for this account. + string home_directory = 5; + + // The path to the logic shell for this account. + string shell = 6; + + // The GECOS (user information) entry for this account. + string gecos = 7; + + // System identifier for which account the username or uid applies to. + // By default, the empty value is used. + string system_id = 8; + + // Output only. A POSIX account identifier. + string account_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The operating system type where this account applies. + OperatingSystemType operating_system_type = 10; + + // Output only. The canonical resource name. + string name = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The SSH public key information associated with a Google account. +message SshPublicKey { + option (google.api.resource) = { + type: "oslogin.googleapis.com/SshPublicKey" + pattern: "users/{user}/sshPublicKeys/{fingerprint}" + }; + + // Public key text in SSH format, defined by + // RFC4253 + // section 6.6. + string key = 1; + + // An expiration time in microseconds since epoch. + int64 expiration_time_usec = 2; + + // Output only. The SHA-256 fingerprint of the SSH public key. + string fingerprint = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The canonical resource name. + string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto b/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto new file mode 100644 index 00000000000..9a7a06b4a03 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto @@ -0,0 +1,288 @@ +// 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.oslogin.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/oslogin/common/common.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.OsLogin.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta;oslogin"; +option java_multiple_files = true; +option java_outer_classname = "OsLoginProto"; +option java_package = "com.google.cloud.oslogin.v1beta"; +option php_namespace = "Google\\Cloud\\OsLogin\\V1beta"; +option ruby_package = "Google::Cloud::OsLogin::V1beta"; + +// Cloud OS Login API +// +// The Cloud OS Login API allows you to manage users and their associated SSH +// public keys for logging into virtual machines on Google Cloud Platform. +service OsLoginService { + option (google.api.default_host) = "oslogin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly"; + + // Create an SSH public key + rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + post: "/v1beta/{parent=users/*}/sshPublicKeys" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + } + + // Deletes a POSIX account. + rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta/{name=users/*/projects/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an SSH public key. + rpc DeleteSshPublicKey(DeleteSshPublicKeyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta/{name=users/*/sshPublicKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves the profile information used for logging in to a virtual machine + // on Google Compute Engine. + rpc GetLoginProfile(GetLoginProfileRequest) returns (LoginProfile) { + option (google.api.http) = { + get: "/v1beta/{name=users/*}/loginProfile" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves an SSH public key. + rpc GetSshPublicKey(GetSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + get: "/v1beta/{name=users/*/sshPublicKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds an SSH public key and returns the profile information. Default POSIX + // account information is set when no username and UID exist as part of the + // login profile. + rpc ImportSshPublicKey(ImportSshPublicKeyRequest) returns (ImportSshPublicKeyResponse) { + option (google.api.http) = { + post: "/v1beta/{parent=users/*}:importSshPublicKey" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + option (google.api.method_signature) = "parent,ssh_public_key,project_id"; + } + + // Updates an SSH public key and returns the profile information. This method + // supports patch semantics. + rpc UpdateSshPublicKey(UpdateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + patch: "/v1beta/{name=users/*/sshPublicKeys/*}" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "name,ssh_public_key"; + option (google.api.method_signature) = "name,ssh_public_key,update_mask"; + } +} + +// The user profile information used for logging in to a virtual machine on +// Google Compute Engine. +message LoginProfile { + // Required. A unique user ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of POSIX accounts associated with the user. + repeated google.cloud.oslogin.common.PosixAccount posix_accounts = 2; + + // A map from SSH public key fingerprint to the associated key object. + map ssh_public_keys = 3; + + // The registered security key credentials for a user. + repeated SecurityKey security_keys = 5; +} + +// A request message for creating an SSH public key. +message CreateSshPublicKeyRequest { + // Required. The unique ID for the user in format `users/{user}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A request message for deleting a POSIX account entry. +message DeletePosixAccountRequest { + // Required. A reference to the POSIX account to update. POSIX accounts are identified + // by the project ID they are associated with. A reference to the POSIX + // account is in format `users/{user}/projects/{project}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/PosixAccount" + } + ]; +} + +// A request message for deleting an SSH public key. +message DeleteSshPublicKeyRequest { + // Required. The fingerprint of the public key to update. Public keys are identified by + // their SHA-256 fingerprint. The fingerprint of the public key is in format + // `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; +} + +// A request message for retrieving the login profile information for a user. +message GetLoginProfileRequest { + // Required. The unique ID for the user in format `users/{user}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/User" + } + ]; + + // The project ID of the Google Cloud Platform project. + string project_id = 2; + + // A system ID for filtering the results of the request. + string system_id = 3; + + // The view configures whether to retrieve security keys information. + LoginProfileView view = 4; +} + +// A request message for retrieving an SSH public key. +message GetSshPublicKeyRequest { + // Required. The fingerprint of the public key to retrieve. Public keys are identified + // by their SHA-256 fingerprint. The fingerprint of the public key is in + // format `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; +} + +// A request message for importing an SSH public key. +message ImportSshPublicKeyRequest { + // The unique ID for the user in format `users/{user}`. + string parent = 1 [(google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + }]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // The project ID of the Google Cloud Platform project. + string project_id = 3; + + // The view configures whether to retrieve security keys information. + LoginProfileView view = 4; +} + +// A response message for importing an SSH public key. +message ImportSshPublicKeyResponse { + // The login profile information for the user. + LoginProfile login_profile = 1; + + // Detailed information about import results. + string details = 2; +} + +// A request message for updating an SSH public key. +message UpdateSshPublicKeyRequest { + // Required. The fingerprint of the public key to update. Public keys are identified by + // their SHA-256 fingerprint. The fingerprint of the public key is in format + // `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Mask to control which fields get updated. Updates all if not present. + google.protobuf.FieldMask update_mask = 3; +} + +// The credential information for a Google registered security key. +message SecurityKey { + // Public key text in SSH format, defined by + // [RFC4253]("https://www.ietf.org/rfc/rfc4253.txt") section 6.6. + string public_key = 1; + + // Hardware-backed private key text in SSH format. + string private_key = 2; + + // The FIDO protocol type used to register this credential. + oneof protocol_type { + // The U2F protocol type. + UniversalTwoFactor universal_two_factor = 3; + + // The Web Authentication protocol type. + WebAuthn web_authn = 4; + } +} + +// Security key information specific to the U2F protocol. +message UniversalTwoFactor { + // Application ID for the U2F protocol. + string app_id = 1; +} + +// Security key information specific to the Web Authentication protocol. +message WebAuthn { + // Relying party ID for Web Authentication. + string rp_id = 1; +} + +// The login profile view limits the user content retrieved. +enum LoginProfileView { + // The default login profile view. The API defaults to the BASIC view. + LOGIN_PROFILE_VIEW_UNSPECIFIED = 0; + + // Includes POSIX and SSH key information. + BASIC = 1; + + // Include security key information for the user. + SECURITY_KEY = 2; +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.create_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.create_ssh_public_key.js new file mode 100644 index 00000000000..ec94480c743 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.create_ssh_public_key.js @@ -0,0 +1,66 @@ +// 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(parent, sshPublicKey) { + // [START oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_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. + */ + /** + * Required. The unique ID for the user in format `users/{user}`. + */ + // const parent = 'abc123' + /** + * Required. The SSH public key and expiration time. + */ + // const sshPublicKey = {} + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callCreateSshPublicKey() { + // Construct request + const request = { + parent, + sshPublicKey, + }; + + // Run request + const response = await osloginClient.createSshPublicKey(request); + console.log(response); + } + + callCreateSshPublicKey(); + // [END oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js new file mode 100644 index 00000000000..8833aa395b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js @@ -0,0 +1,63 @@ +// 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(name) { + // [START oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_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. + */ + /** + * Required. A reference to the POSIX account to update. POSIX accounts are identified + * by the project ID they are associated with. A reference to the POSIX + * account is in format `users/{user}/projects/{project}`. + */ + // const name = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callDeletePosixAccount() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.deletePosixAccount(request); + console.log(response); + } + + callDeletePosixAccount(); + // [END oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js new file mode 100644 index 00000000000..2dc7fdc4fa1 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js @@ -0,0 +1,63 @@ +// 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(name) { + // [START oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_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. + */ + /** + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + */ + // const name = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callDeleteSshPublicKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.deleteSshPublicKey(request); + console.log(response); + } + + callDeleteSshPublicKey(); + // [END oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js new file mode 100644 index 00000000000..ed9ae4af370 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js @@ -0,0 +1,73 @@ +// 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(name) { + // [START oslogin_v1beta_generated_OsLoginService_GetLoginProfile_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. + */ + /** + * Required. The unique ID for the user in format `users/{user}`. + */ + // const name = 'abc123' + /** + * The project ID of the Google Cloud Platform project. + */ + // const projectId = 'abc123' + /** + * A system ID for filtering the results of the request. + */ + // const systemId = 'abc123' + /** + * The view configures whether to retrieve security keys information. + */ + // const view = {} + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callGetLoginProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.getLoginProfile(request); + console.log(response); + } + + callGetLoginProfile(); + // [END oslogin_v1beta_generated_OsLoginService_GetLoginProfile_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js new file mode 100644 index 00000000000..7e901702ea9 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js @@ -0,0 +1,63 @@ +// 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(name) { + // [START oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_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. + */ + /** + * Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in + * format `users/{user}/sshPublicKeys/{fingerprint}`. + */ + // const name = 'abc123' + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callGetSshPublicKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await osloginClient.getSshPublicKey(request); + console.log(response); + } + + callGetSshPublicKey(); + // [END oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js new file mode 100644 index 00000000000..d3bb62a2ab4 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js @@ -0,0 +1,73 @@ +// 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(sshPublicKey) { + // [START oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_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 unique ID for the user in format `users/{user}`. + */ + // const parent = 'abc123' + /** + * Required. The SSH public key and expiration time. + */ + // const sshPublicKey = {} + /** + * The project ID of the Google Cloud Platform project. + */ + // const projectId = 'abc123' + /** + * The view configures whether to retrieve security keys information. + */ + // const view = {} + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callImportSshPublicKey() { + // Construct request + const request = { + sshPublicKey, + }; + + // Run request + const response = await osloginClient.importSshPublicKey(request); + console.log(response); + } + + callImportSshPublicKey(); + // [END oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js new file mode 100644 index 00000000000..ce67375a1b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js @@ -0,0 +1,72 @@ +// 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(name, sshPublicKey) { + // [START oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_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. + */ + /** + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + */ + // const name = 'abc123' + /** + * Required. The SSH public key and expiration time. + */ + // const sshPublicKey = {} + /** + * Mask to control which fields get updated. Updates all if not present. + */ + // const updateMask = {} + + // Imports the Oslogin library + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; + + // Instantiates a client + const osloginClient = new OsLoginServiceClient(); + + async function callUpdateSshPublicKey() { + // Construct request + const request = { + name, + sshPublicKey, + }; + + // Run request + const response = await osloginClient.updateSshPublicKey(request); + console.log(response); + } + + callUpdateSshPublicKey(); + // [END oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json new file mode 100644 index 00000000000..f67eb12166b --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json @@ -0,0 +1,331 @@ +{ + "clientLibrary": { + "name": "nodejs-oslogin", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.oslogin.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_async", + "title": "OsLoginService createSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Create an SSH public key", + "canonical": true, + "file": "os_login_service.create_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_async", + "title": "OsLoginService deletePosixAccount Sample", + "origin": "API_DEFINITION", + "description": " Deletes a POSIX account.", + "canonical": true, + "file": "os_login_service.delete_posix_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_async", + "title": "OsLoginService deleteSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Deletes an SSH public key.", + "canonical": true, + "file": "os_login_service.delete_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_GetLoginProfile_async", + "title": "OsLoginService getLoginProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.", + "canonical": true, + "file": "os_login_service.get_login_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "system_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.oslogin.v1beta.LoginProfileView" + } + ], + "resultType": ".google.cloud.oslogin.v1beta.LoginProfile", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_async", + "title": "OsLoginService getSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an SSH public key.", + "canonical": true, + "file": "os_login_service.get_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_async", + "title": "OsLoginService importSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.", + "canonical": true, + "file": "os_login_service.import_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.oslogin.v1beta.LoginProfileView" + } + ], + "resultType": ".google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_async", + "title": "OsLoginService updateSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Updates an SSH public key and returns the profile information. This method supports patch semantics.", + "canonical": true, + "file": "os_login_service.update_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/index.ts new file mode 100644 index 00000000000..d782422d4b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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 v1beta from './v1beta'; +const OsLoginServiceClient = v1beta.OsLoginServiceClient; +type OsLoginServiceClient = v1beta.OsLoginServiceClient; +export {v1beta, OsLoginServiceClient}; +export default {v1beta, OsLoginServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..ad42910537d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,93 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.oslogin.v1beta", + "libraryPackage": "@google-cloud/os-login", + "services": { + "OsLoginService": { + "clients": { + "grpc": { + "libraryClient": "OsLoginServiceClient", + "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "OsLoginServiceClient", + "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..d3f167933f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/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 {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts new file mode 100644 index 00000000000..e7b577eb4b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts @@ -0,0 +1,951 @@ +// 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} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta/os_login_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './os_login_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud OS Login API + * + * The Cloud OS Login API allows you to manage users and their associated SSH + * public keys for logging into virtual machines on Google Cloud Platform. + * @class + * @memberof v1beta + */ +export class OsLoginServiceClient { + 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}; + pathTemplates: {[name: string]: gax.PathTemplate}; + osLoginServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of OsLoginServiceClient. + * + * @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 OsLoginServiceClient({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 OsLoginServiceClient; + 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; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + posixAccountPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/projects/{project}' + ), + sshPublicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/sshPublicKeys/{fingerprint}' + ), + userPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.oslogin.v1beta.OsLoginService', 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.osLoginServiceStub) { + return this.osLoginServiceStub; + } + + // Put together the "service stub" for + // google.cloud.oslogin.v1beta.OsLoginService. + this.osLoginServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.oslogin.v1beta.OsLoginService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.oslogin.v1beta.OsLoginService, + 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 osLoginServiceStubMethods = + ['createSshPublicKey', 'deletePosixAccount', 'deleteSshPublicKey', 'getLoginProfile', 'getSshPublicKey', 'importSshPublicKey', 'updateSshPublicKey']; + for (const methodName of osLoginServiceStubMethods) { + const callPromise = this.osLoginServiceStub.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 = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.osLoginServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'oslogin.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 'oslogin.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', + 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/compute', + 'https://www.googleapis.com/auth/compute.readonly' + ]; + } + + 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 -- + // ------------------- +/** + * Create an SSH public key + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.create_ssh_public_key.js + * region_tag:oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_async + */ + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|undefined, {}|undefined + ]>; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|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.createSshPublicKey(request, options, callback); + } +/** + * Deletes a POSIX account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A reference to the POSIX account to update. POSIX accounts are identified + * by the project ID they are associated with. A reference to the POSIX + * account is in format `users/{user}/projects/{project}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.delete_posix_account.js + * region_tag:oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_async + */ + deletePosixAccount( + request?: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|undefined, {}|undefined + ]>; + deletePosixAccount( + request: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>): void; + deletePosixAccount( + request: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>): void; + deletePosixAccount( + request?: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePosixAccount(request, options, callback); + } +/** + * Deletes an SSH public key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.delete_ssh_public_key.js + * region_tag:oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_async + */ + deleteSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|undefined, {}|undefined + ]>; + deleteSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + deleteSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + deleteSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSshPublicKey(request, options, callback); + } +/** + * Retrieves the profile information used for logging in to a virtual machine + * on Google Compute Engine. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique ID for the user in format `users/{user}`. + * @param {string} request.projectId + * The project ID of the Google Cloud Platform project. + * @param {string} request.systemId + * A system ID for filtering the results of the request. + * @param {google.cloud.oslogin.v1beta.LoginProfileView} request.view + * The view configures whether to retrieve security keys information. + * @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 [LoginProfile]{@link google.cloud.oslogin.v1beta.LoginProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.get_login_profile.js + * region_tag:oslogin_v1beta_generated_OsLoginService_GetLoginProfile_async + */ + getLoginProfile( + request?: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.v1beta.ILoginProfile, + protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|undefined, {}|undefined + ]>; + getLoginProfile( + request: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.v1beta.ILoginProfile, + protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>): void; + getLoginProfile( + request: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, + callback: Callback< + protos.google.cloud.oslogin.v1beta.ILoginProfile, + protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>): void; + getLoginProfile( + request?: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.v1beta.ILoginProfile, + protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.v1beta.ILoginProfile, + protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.v1beta.ILoginProfile, + protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getLoginProfile(request, options, callback); + } +/** + * Retrieves an SSH public key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in + * format `users/{user}/sshPublicKeys/{fingerprint}`. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.get_ssh_public_key.js + * region_tag:oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_async + */ + getSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|undefined, {}|undefined + ]>; + getSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + getSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + getSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSshPublicKey(request, options, callback); + } +/** + * Adds an SSH public key and returns the profile information. Default POSIX + * account information is set when no username and UID exist as part of the + * login profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @param {string} request.projectId + * The project ID of the Google Cloud Platform project. + * @param {google.cloud.oslogin.v1beta.LoginProfileView} request.view + * The view configures whether to retrieve security keys information. + * @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 [ImportSshPublicKeyResponse]{@link google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.import_ssh_public_key.js + * region_tag:oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_async + */ + importSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|undefined, {}|undefined + ]>; + importSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + importSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + importSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, + protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|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.importSshPublicKey(request, options, callback); + } +/** + * Updates an SSH public key and returns the profile information. This method + * supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get updated. Updates all if not present. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.update_ssh_public_key.js + * region_tag:oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_async + */ + updateSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|undefined, {}|undefined + ]>; + updateSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + updateSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): void; + updateSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|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({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSshPublicKey(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified posixAccount resource name string. + * + * @param {string} user + * @param {string} project + * @returns {string} Resource name string. + */ + posixAccountPath(user:string,project:string) { + return this.pathTemplates.posixAccountPathTemplate.render({ + user: user, + project: project, + }); + } + + /** + * Parse the user from PosixAccount resource. + * + * @param {string} posixAccountName + * A fully-qualified path representing PosixAccount resource. + * @returns {string} A string representing the user. + */ + matchUserFromPosixAccountName(posixAccountName: string) { + return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).user; + } + + /** + * Parse the project from PosixAccount resource. + * + * @param {string} posixAccountName + * A fully-qualified path representing PosixAccount resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPosixAccountName(posixAccountName: string) { + return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).project; + } + + /** + * Return a fully-qualified sshPublicKey resource name string. + * + * @param {string} user + * @param {string} fingerprint + * @returns {string} Resource name string. + */ + sshPublicKeyPath(user:string,fingerprint:string) { + return this.pathTemplates.sshPublicKeyPathTemplate.render({ + user: user, + fingerprint: fingerprint, + }); + } + + /** + * Parse the user from SshPublicKey resource. + * + * @param {string} sshPublicKeyName + * A fully-qualified path representing SshPublicKey resource. + * @returns {string} A string representing the user. + */ + matchUserFromSshPublicKeyName(sshPublicKeyName: string) { + return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).user; + } + + /** + * Parse the fingerprint from SshPublicKey resource. + * + * @param {string} sshPublicKeyName + * A fully-qualified path representing SshPublicKey resource. + * @returns {string} A string representing the fingerprint. + */ + matchFingerprintFromSshPublicKeyName(sshPublicKeyName: string) { + return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).fingerprint; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user:string) { + return this.pathTemplates.userPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * 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.osLoginServiceStub && !this._terminated) { + return this.osLoginServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json new file mode 100644 index 00000000000..d45946b5241 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json @@ -0,0 +1,60 @@ +{ + "interfaces": { + "google.cloud.oslogin.v1beta.OsLoginService": { + "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": { + "CreateSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeletePosixAccount": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetLoginProfile": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateSshPublicKey": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json new file mode 100644 index 00000000000..078ed1d537d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/oslogin/common/common.proto", + "../../protos/google/cloud/oslogin/v1beta/oslogin.proto" +] diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..dbe35025422 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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 oslogin = require('@google-cloud/os-login'); + +function main() { + const osLoginServiceClient = new oslogin.OsLoginServiceClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..b5eb626ee88 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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 {OsLoginServiceClient} from '@google-cloud/os-login'; + +// check that the client class type name can be used +function doStuffWithOsLoginServiceClient(client: OsLoginServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const osLoginServiceClient = new OsLoginServiceClient(); + doStuffWithOsLoginServiceClient(osLoginServiceClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts new file mode 100644 index 00000000000..33fac17be8c --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts @@ -0,0 +1,1015 @@ +// 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 osloginserviceModule from '../src'; + +import {protobuf} 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 stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1beta.OsLoginServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = osloginserviceModule.v1beta.OsLoginServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = osloginserviceModule.v1beta.OsLoginServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = osloginserviceModule.v1beta.OsLoginServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.osLoginServiceStub, undefined); + await client.initialize(); + assert(client.osLoginServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.osLoginServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.osLoginServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + 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 osloginserviceModule.v1beta.OsLoginServiceClient({ + 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('createSshPublicKey', () => { + it('invokes createSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.createSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSshPublicKey(request), expectedError); + }); + }); + + describe('deletePosixAccount', () => { + it('invokes deletePosixAccount without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); + const [response] = await client.deletePosixAccount(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePosixAccount without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deletePosixAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePosixAccount( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePosixAccount with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deletePosixAccount(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePosixAccount with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deletePosixAccount(request), expectedError); + }); + }); + + describe('deleteSshPublicKey', () => { + it('invokes deleteSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSshPublicKey( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + }); + }); + + describe('getLoginProfile', () => { + it('invokes getLoginProfile without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.LoginProfile() + ); + client.innerApiCalls.getLoginProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getLoginProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLoginProfile without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.LoginProfile() + ); + client.innerApiCalls.getLoginProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLoginProfile( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.v1beta.ILoginProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLoginProfile with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLoginProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLoginProfile with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLoginProfile(request), expectedError); + }); + }); + + describe('getSshPublicKey', () => { + it('invokes getSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.getSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.getSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.getSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSshPublicKey(request), expectedError); + }); + }); + + describe('importSshPublicKey', () => { + it('invokes importSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse() + ); + client.innerApiCalls.importSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.importSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse() + ); + client.innerApiCalls.importSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.importSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.importSshPublicKey(request), expectedError); + }); + }); + + describe('updateSshPublicKey', () => { + it('invokes updateSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.updateSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.updateSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.updateSshPublicKey = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSshPublicKey( + request, + (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + }); + }); + + describe('Path templates', () => { + + describe('posixAccount', () => { + const fakePath = "/rendered/path/posixAccount"; + const expectedParameters = { + user: "userValue", + project: "projectValue", + }; + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.posixAccountPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.posixAccountPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('posixAccountPath', () => { + const result = client.posixAccountPath("userValue", "projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.posixAccountPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromPosixAccountName', () => { + const result = client.matchUserFromPosixAccountName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProjectFromPosixAccountName', () => { + const result = client.matchProjectFromPosixAccountName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sshPublicKey', () => { + const fakePath = "/rendered/path/sshPublicKey"; + const expectedParameters = { + user: "userValue", + fingerprint: "fingerprintValue", + }; + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sshPublicKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sshPublicKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sshPublicKeyPath', () => { + const result = client.sshPublicKeyPath("userValue", "fingerprintValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sshPublicKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromSshPublicKeyName', () => { + const result = client.matchUserFromSshPublicKeyName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFingerprintFromSshPublicKeyName', () => { + const result = client.matchFingerprintFromSshPublicKeyName(fakePath); + assert.strictEqual(result, "fingerprintValue"); + assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('user', () => { + const fakePath = "/rendered/path/user"; + const expectedParameters = { + user: "userValue", + }; + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userPath', () => { + const result = client.userPath("userValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-oslogin/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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-oslogin/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-oslogin/v1beta/webpack.config.js new file mode 100644 index 00000000000..67fc391472d --- /dev/null +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/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: 'OsLoginService', + filename: './os-login-service.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 22b41c885d9e371bb6e9db2b8e76eb6f4b736942 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 6 Dec 2022 03:55:21 +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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9zbG9naW4vLk93bEJvdC55YW1sIiwiaCI6Ijc4YmQ4ZjA1ZTEyNzYzNjNlYjE0ZWFlNzBlOTFmZTRiYzIwNzAzYWIifQ== --- .../google-cloud-oslogin/v1/src/v1/os_login_service_client.ts | 3 +++ .../v1beta/src/v1beta/os_login_service_client.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts index 9751d8dbac0..01df8b9bf97 100644 --- a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts +++ b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts @@ -108,6 +108,9 @@ export class OsLoginServiceClient { 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; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts index e7b577eb4b2..edb545a230d 100644 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts +++ b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts @@ -108,6 +108,9 @@ export class OsLoginServiceClient { 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 481ef8034909d5ae520566693008923ae929dba6 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 6 Dec 2022 04:38:57 +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 --- .../google-cloud-oslogin/v1/.eslintignore | 7 - .../google-cloud-oslogin/v1/.eslintrc.json | 3 - .../google-cloud-oslogin/v1/.gitignore | 14 - .../google-cloud-oslogin/v1/.jsdoc.js | 55 - .../google-cloud-oslogin/v1/.mocharc.js | 33 - .../google-cloud-oslogin/v1/.prettierrc.js | 22 - .../google-cloud-oslogin/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../google-cloud-oslogin/v1/package.json | 64 - .../google/cloud/oslogin/common/common.proto | 108 -- .../google/cloud/oslogin/v1/oslogin.proto | 239 --- .../os_login_service.delete_posix_account.js | 63 - .../os_login_service.delete_ssh_public_key.js | 63 - .../v1/os_login_service.get_login_profile.js | 69 - .../v1/os_login_service.get_ssh_public_key.js | 63 - .../os_login_service.import_ssh_public_key.js | 69 - .../os_login_service.update_ssh_public_key.js | 72 - ...ppet_metadata.google.cloud.oslogin.v1.json | 323 ---- .../google-cloud-oslogin/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 93 -- .../google-cloud-oslogin/v1/src/v1/index.ts | 19 - .../v1/src/v1/os_login_service_client.ts | 950 ----------- .../v1/os_login_service_client_config.json | 60 - .../src/v1/os_login_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_os_login_service_v1.ts | 1015 ----------- .../google-cloud-oslogin/v1/tsconfig.json | 19 - .../google-cloud-oslogin/v1/webpack.config.js | 64 - .../google-cloud-oslogin/v1beta/.eslintignore | 7 - .../v1beta/.eslintrc.json | 3 - .../google-cloud-oslogin/v1beta/.gitignore | 14 - .../google-cloud-oslogin/v1beta/.jsdoc.js | 55 - .../google-cloud-oslogin/v1beta/.mocharc.js | 33 - .../v1beta/.prettierrc.js | 22 - .../google-cloud-oslogin/v1beta/README.md | 1 - .../v1beta/linkinator.config.json | 16 - .../google-cloud-oslogin/v1beta/package.json | 64 - .../google/cloud/oslogin/common/common.proto | 108 -- .../google/cloud/oslogin/v1beta/oslogin.proto | 288 ---- .../os_login_service.delete_posix_account.js | 63 - .../os_login_service.delete_ssh_public_key.js | 63 - .../os_login_service.get_login_profile.js | 73 - .../os_login_service.get_ssh_public_key.js | 63 - .../os_login_service.import_ssh_public_key.js | 73 - .../os_login_service.update_ssh_public_key.js | 72 - ..._metadata.google.cloud.oslogin.v1beta.json | 331 ---- .../google-cloud-oslogin/v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/gapic_metadata.json | 93 -- .../v1beta/src/v1beta/index.ts | 19 - .../src/v1beta/os_login_service_client.ts | 954 ----------- .../os_login_service_client_config.json | 60 - .../v1beta/os_login_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta/system-test/install.ts | 49 - .../test/gapic_os_login_service_v1beta.ts | 1015 ----------- .../google-cloud-oslogin/v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - packages/google-cloud-oslogin/README.md | 2 + .../google/cloud/oslogin/common/common.proto | 5 +- .../google/cloud/oslogin/v1/oslogin.proto | 33 +- .../google/cloud/oslogin/v1beta/oslogin.proto | 86 +- .../google-cloud-oslogin/protos/protos.d.ts | 597 +++++++ .../google-cloud-oslogin/protos/protos.js | 1485 ++++++++++++++++- .../google-cloud-oslogin/protos/protos.json | 152 +- .../google-cloud-oslogin/samples/README.md | 36 + .../os_login_service.create_ssh_public_key.js | 0 ...ppet_metadata.google.cloud.oslogin.v1.json | 44 + .../os_login_service.create_ssh_public_key.js | 0 .../os_login_service.get_login_profile.js | 4 + .../os_login_service.import_ssh_public_key.js | 4 + ..._metadata.google.cloud.oslogin.v1beta.json | 56 +- .../src/v1/gapic_metadata.json | 10 + .../src/v1/os_login_service_client.ts | 99 ++ .../v1/os_login_service_client_config.json | 4 + .../src/v1beta/gapic_metadata.json | 10 + .../src/v1beta/os_login_service_client.ts | 101 ++ .../os_login_service_client_config.json | 4 + .../test/gapic_os_login_service_v1.ts | 131 ++ .../test/gapic_os_login_service_v1beta.ts | 131 ++ release-please-config.json | 1 - 83 files changed, 2963 insertions(+), 7383 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/common/common.proto delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/test/gapic_os_login_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-oslogin/v1beta/webpack.config.js rename {owl-bot-staging/google-cloud-oslogin/v1 => packages/google-cloud-oslogin}/samples/generated/v1/os_login_service.create_ssh_public_key.js (100%) rename {owl-bot-staging/google-cloud-oslogin/v1beta => packages/google-cloud-oslogin}/samples/generated/v1beta/os_login_service.create_ssh_public_key.js (100%) diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.eslintignore b/owl-bot-staging/google-cloud-oslogin/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/.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-oslogin/v1/.eslintrc.json b/owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.gitignore b/owl-bot-staging/google-cloud-oslogin/v1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.jsdoc.js b/owl-bot-staging/google-cloud-oslogin/v1/.jsdoc.js deleted file mode 100644 index 83fc87c6ceb..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/.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/os-login', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-oslogin/v1/.mocharc.js b/owl-bot-staging/google-cloud-oslogin/v1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/.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-oslogin/v1/.prettierrc.js b/owl-bot-staging/google-cloud-oslogin/v1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/.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-oslogin/v1/README.md b/owl-bot-staging/google-cloud-oslogin/v1/README.md deleted file mode 100644 index f7acdc89a3a..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Oslogin: Nodejs Client diff --git a/owl-bot-staging/google-cloud-oslogin/v1/linkinator.config.json b/owl-bot-staging/google-cloud-oslogin/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/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-oslogin/v1/package.json b/owl-bot-staging/google-cloud-oslogin/v1/package.json deleted file mode 100644 index c968d347d8f..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/os-login", - "version": "0.1.0", - "description": "Oslogin client for Node.js", - "repository": "googleapis/nodejs-oslogin", - "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 oslogin", - "oslogin", - "os login service" - ], - "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-oslogin/v1/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/common/common.proto deleted file mode 100644 index 6eeaf8908d8..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/common/common.proto +++ /dev/null @@ -1,108 +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.oslogin.common; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.OsLogin.Common"; -option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/common;common"; -option java_outer_classname = "OsLoginProto"; -option java_package = "com.google.cloud.oslogin.common"; -option php_namespace = "Google\\Cloud\\OsLogin\\Common"; -option ruby_package = "Google::Cloud::OsLogin::Common"; -option (google.api.resource_definition) = { - type: "oslogin.googleapis.com/User" - pattern: "users/{user}" -}; - -// The operating system options for account entries. -enum OperatingSystemType { - // The operating system type associated with the user account information is - // unspecified. - OPERATING_SYSTEM_TYPE_UNSPECIFIED = 0; - - // Linux user account information. - LINUX = 1; - - // Windows user account information. - WINDOWS = 2; -} - -// The POSIX account information associated with a Google account. -message PosixAccount { - option (google.api.resource) = { - type: "oslogin.googleapis.com/PosixAccount" - pattern: "users/{user}/projects/{project}" - }; - - // Only one POSIX account can be marked as primary. - bool primary = 1; - - // The username of the POSIX account. - string username = 2; - - // The user ID. - int64 uid = 3; - - // The default group ID. - int64 gid = 4; - - // The path to the home directory for this account. - string home_directory = 5; - - // The path to the logic shell for this account. - string shell = 6; - - // The GECOS (user information) entry for this account. - string gecos = 7; - - // System identifier for which account the username or uid applies to. - // By default, the empty value is used. - string system_id = 8; - - // Output only. A POSIX account identifier. - string account_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The operating system type where this account applies. - OperatingSystemType operating_system_type = 10; - - // Output only. The canonical resource name. - string name = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The SSH public key information associated with a Google account. -message SshPublicKey { - option (google.api.resource) = { - type: "oslogin.googleapis.com/SshPublicKey" - pattern: "users/{user}/sshPublicKeys/{fingerprint}" - }; - - // Public key text in SSH format, defined by - // RFC4253 - // section 6.6. - string key = 1; - - // An expiration time in microseconds since epoch. - int64 expiration_time_usec = 2; - - // Output only. The SHA-256 fingerprint of the SSH public key. - string fingerprint = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The canonical resource name. - string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto b/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto deleted file mode 100644 index fb3575600c4..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/protos/google/cloud/oslogin/v1/oslogin.proto +++ /dev/null @@ -1,239 +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.oslogin.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/oslogin/common/common.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.OsLogin.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin"; -option java_multiple_files = true; -option java_outer_classname = "OsLoginProto"; -option java_package = "com.google.cloud.oslogin.v1"; -option php_namespace = "Google\\Cloud\\OsLogin\\V1"; -option ruby_package = "Google::Cloud::OsLogin::V1"; - -// Cloud OS Login API -// -// The Cloud OS Login API allows you to manage users and their associated SSH -// public keys for logging into virtual machines on Google Cloud Platform. -service OsLoginService { - option (google.api.default_host) = "oslogin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly"; - - // Create an SSH public key - rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { - option (google.api.http) = { - post: "/v1/{parent=users/*}/sshPublicKeys" - body: "ssh_public_key" - }; - option (google.api.method_signature) = "parent,ssh_public_key"; - } - - // Deletes a POSIX account. - rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=users/*/projects/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes an SSH public key. - rpc DeleteSshPublicKey(DeleteSshPublicKeyRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=users/*/sshPublicKeys/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves the profile information used for logging in to a virtual machine - // on Google Compute Engine. - rpc GetLoginProfile(GetLoginProfileRequest) returns (LoginProfile) { - option (google.api.http) = { - get: "/v1/{name=users/*}/loginProfile" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves an SSH public key. - rpc GetSshPublicKey(GetSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { - option (google.api.http) = { - get: "/v1/{name=users/*/sshPublicKeys/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds an SSH public key and returns the profile information. Default POSIX - // account information is set when no username and UID exist as part of the - // login profile. - rpc ImportSshPublicKey(ImportSshPublicKeyRequest) returns (ImportSshPublicKeyResponse) { - option (google.api.http) = { - post: "/v1/{parent=users/*}:importSshPublicKey" - body: "ssh_public_key" - }; - option (google.api.method_signature) = "parent,ssh_public_key"; - option (google.api.method_signature) = "parent,ssh_public_key,project_id"; - } - - // Updates an SSH public key and returns the profile information. This method - // supports patch semantics. - rpc UpdateSshPublicKey(UpdateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { - option (google.api.http) = { - patch: "/v1/{name=users/*/sshPublicKeys/*}" - body: "ssh_public_key" - }; - option (google.api.method_signature) = "name,ssh_public_key"; - option (google.api.method_signature) = "name,ssh_public_key,update_mask"; - } -} - -// The user profile information used for logging in to a virtual machine on -// Google Compute Engine. -message LoginProfile { - // Required. A unique user ID. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of POSIX accounts associated with the user. - repeated google.cloud.oslogin.common.PosixAccount posix_accounts = 2; - - // A map from SSH public key fingerprint to the associated key object. - map ssh_public_keys = 3; -} - -// A request message for creating an SSH public key. -message CreateSshPublicKeyRequest { - // Required. The unique ID for the user in format `users/{user}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "oslogin.googleapis.com/SshPublicKey" - } - ]; - - // Required. The SSH public key and expiration time. - google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request message for deleting a POSIX account entry. -message DeletePosixAccountRequest { - // Required. A reference to the POSIX account to update. POSIX accounts are identified - // by the project ID they are associated with. A reference to the POSIX - // account is in format `users/{user}/projects/{project}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/PosixAccount" - } - ]; -} - -// A request message for deleting an SSH public key. -message DeleteSshPublicKeyRequest { - // Required. The fingerprint of the public key to update. Public keys are identified by - // their SHA-256 fingerprint. The fingerprint of the public key is in format - // `users/{user}/sshPublicKeys/{fingerprint}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/SshPublicKey" - } - ]; -} - -// A request message for retrieving the login profile information for a user. -message GetLoginProfileRequest { - // Required. The unique ID for the user in format `users/{user}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "oslogin.googleapis.com/PosixAccount" - } - ]; - - // The project ID of the Google Cloud Platform project. - string project_id = 2; - - // A system ID for filtering the results of the request. - string system_id = 3; -} - -// A request message for retrieving an SSH public key. -message GetSshPublicKeyRequest { - // Required. The fingerprint of the public key to retrieve. Public keys are identified - // by their SHA-256 fingerprint. The fingerprint of the public key is in - // format `users/{user}/sshPublicKeys/{fingerprint}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/SshPublicKey" - } - ]; -} - -// A request message for importing an SSH public key. -message ImportSshPublicKeyRequest { - // Required. The unique ID for the user in format `users/{user}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "oslogin.googleapis.com/SshPublicKey" - } - ]; - - // Optional. The SSH public key and expiration time. - google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = OPTIONAL]; - - // The project ID of the Google Cloud Platform project. - string project_id = 3; -} - -// A response message for importing an SSH public key. -message ImportSshPublicKeyResponse { - // The login profile information for the user. - LoginProfile login_profile = 1; - - // Detailed information about import results. - string details = 2; -} - -// A request message for updating an SSH public key. -message UpdateSshPublicKeyRequest { - // Required. The fingerprint of the public key to update. Public keys are identified by - // their SHA-256 fingerprint. The fingerprint of the public key is in format - // `users/{user}/sshPublicKeys/{fingerprint}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/SshPublicKey" - } - ]; - - // Required. The SSH public key and expiration time. - google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // Mask to control which fields get updated. Updates all if not present. - google.protobuf.FieldMask update_mask = 3; -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js deleted file mode 100644 index 9ffef6406c7..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_posix_account.js +++ /dev/null @@ -1,63 +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(name) { - // [START oslogin_v1_generated_OsLoginService_DeletePosixAccount_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. - */ - /** - * Required. A reference to the POSIX account to update. POSIX accounts are identified - * by the project ID they are associated with. A reference to the POSIX - * account is in format `users/{user}/projects/{project}`. - */ - // const name = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callDeletePosixAccount() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.deletePosixAccount(request); - console.log(response); - } - - callDeletePosixAccount(); - // [END oslogin_v1_generated_OsLoginService_DeletePosixAccount_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-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js deleted file mode 100644 index cf03e46e16d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.delete_ssh_public_key.js +++ /dev/null @@ -1,63 +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(name) { - // [START oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_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. - */ - /** - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - */ - // const name = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callDeleteSshPublicKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.deleteSshPublicKey(request); - console.log(response); - } - - callDeleteSshPublicKey(); - // [END oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js deleted file mode 100644 index bfe9398c903..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_login_profile.js +++ /dev/null @@ -1,69 +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(name) { - // [START oslogin_v1_generated_OsLoginService_GetLoginProfile_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. - */ - /** - * Required. The unique ID for the user in format `users/{user}`. - */ - // const name = 'abc123' - /** - * The project ID of the Google Cloud Platform project. - */ - // const projectId = 'abc123' - /** - * A system ID for filtering the results of the request. - */ - // const systemId = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callGetLoginProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.getLoginProfile(request); - console.log(response); - } - - callGetLoginProfile(); - // [END oslogin_v1_generated_OsLoginService_GetLoginProfile_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-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js deleted file mode 100644 index d95414b4f9c..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.get_ssh_public_key.js +++ /dev/null @@ -1,63 +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(name) { - // [START oslogin_v1_generated_OsLoginService_GetSshPublicKey_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. - */ - /** - * Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in - * format `users/{user}/sshPublicKeys/{fingerprint}`. - */ - // const name = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callGetSshPublicKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.getSshPublicKey(request); - console.log(response); - } - - callGetSshPublicKey(); - // [END oslogin_v1_generated_OsLoginService_GetSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js deleted file mode 100644 index c6d826aa785..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.import_ssh_public_key.js +++ /dev/null @@ -1,69 +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(parent) { - // [START oslogin_v1_generated_OsLoginService_ImportSshPublicKey_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. - */ - /** - * Required. The unique ID for the user in format `users/{user}`. - */ - // const parent = 'abc123' - /** - * Optional. The SSH public key and expiration time. - */ - // const sshPublicKey = {} - /** - * The project ID of the Google Cloud Platform project. - */ - // const projectId = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callImportSshPublicKey() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await osloginClient.importSshPublicKey(request); - console.log(response); - } - - callImportSshPublicKey(); - // [END oslogin_v1_generated_OsLoginService_ImportSshPublicKey_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-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js deleted file mode 100644 index a9d5dc708c6..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.update_ssh_public_key.js +++ /dev/null @@ -1,72 +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(name, sshPublicKey) { - // [START oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_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. - */ - /** - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - */ - // const name = 'abc123' - /** - * Required. The SSH public key and expiration time. - */ - // const sshPublicKey = {} - /** - * Mask to control which fields get updated. Updates all if not present. - */ - // const updateMask = {} - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callUpdateSshPublicKey() { - // Construct request - const request = { - name, - sshPublicKey, - }; - - // Run request - const response = await osloginClient.updateSshPublicKey(request); - console.log(response); - } - - callUpdateSshPublicKey(); - // [END oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_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-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json b/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json deleted file mode 100644 index 2c35446f956..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json +++ /dev/null @@ -1,323 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-oslogin", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.oslogin.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "oslogin_v1_generated_OsLoginService_CreateSshPublicKey_async", - "title": "OsLoginService createSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Create an SSH public key", - "canonical": true, - "file": "os_login_service.create_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "ssh_public_key", - "type": ".google.cloud.oslogin.common.SshPublicKey" - } - ], - "resultType": ".google.cloud.oslogin.common.SshPublicKey", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "CreateSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1_generated_OsLoginService_DeletePosixAccount_async", - "title": "OsLoginService deletePosixAccount Sample", - "origin": "API_DEFINITION", - "description": " Deletes a POSIX account.", - "canonical": true, - "file": "os_login_service.delete_posix_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePosixAccount", - "fullName": "google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "DeletePosixAccount", - "fullName": "google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_async", - "title": "OsLoginService deleteSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Deletes an SSH public key.", - "canonical": true, - "file": "os_login_service.delete_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "DeleteSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1_generated_OsLoginService_GetLoginProfile_async", - "title": "OsLoginService getLoginProfile Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.", - "canonical": true, - "file": "os_login_service.get_login_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLoginProfile", - "fullName": "google.cloud.oslogin.v1.OsLoginService.GetLoginProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "system_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.oslogin.v1.LoginProfile", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "GetLoginProfile", - "fullName": "google.cloud.oslogin.v1.OsLoginService.GetLoginProfile", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1_generated_OsLoginService_GetSshPublicKey_async", - "title": "OsLoginService getSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an SSH public key.", - "canonical": true, - "file": "os_login_service.get_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.oslogin.common.SshPublicKey", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "GetSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1_generated_OsLoginService_ImportSshPublicKey_async", - "title": "OsLoginService importSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.", - "canonical": true, - "file": "os_login_service.import_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "ssh_public_key", - "type": ".google.cloud.oslogin.common.SshPublicKey" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.oslogin.v1.ImportSshPublicKeyResponse", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "ImportSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_async", - "title": "OsLoginService updateSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Updates an SSH public key and returns the profile information. This method supports patch semantics.", - "canonical": true, - "file": "os_login_service.update_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ssh_public_key", - "type": ".google.cloud.oslogin.common.SshPublicKey" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.oslogin.common.SshPublicKey", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" - }, - "method": { - "shortName": "UpdateSshPublicKey", - "fullName": "google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1.OsLoginService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/index.ts deleted file mode 100644 index 03a3c4cea2d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/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 v1 from './v1'; -const OsLoginServiceClient = v1.OsLoginServiceClient; -type OsLoginServiceClient = v1.OsLoginServiceClient; -export {v1, OsLoginServiceClient}; -export default {v1, OsLoginServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json deleted file mode 100644 index fc08cf26063..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.oslogin.v1", - "libraryPackage": "@google-cloud/os-login", - "services": { - "OsLoginService": { - "clients": { - "grpc": { - "libraryClient": "OsLoginServiceClient", - "rpcs": { - "CreateSshPublicKey": { - "methods": [ - "createSshPublicKey" - ] - }, - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "OsLoginServiceClient", - "rpcs": { - "CreateSshPublicKey": { - "methods": [ - "createSshPublicKey" - ] - }, - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/index.ts deleted file mode 100644 index d3f167933f9..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/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 {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts deleted file mode 100644 index 01df8b9bf97..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client.ts +++ /dev/null @@ -1,950 +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} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/os_login_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './os_login_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud OS Login API - * - * The Cloud OS Login API allows you to manage users and their associated SSH - * public keys for logging into virtual machines on Google Cloud Platform. - * @class - * @memberof v1 - */ -export class OsLoginServiceClient { - 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}; - pathTemplates: {[name: string]: gax.PathTemplate}; - osLoginServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of OsLoginServiceClient. - * - * @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 OsLoginServiceClient({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 OsLoginServiceClient; - 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; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - posixAccountPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/projects/{project}' - ), - sshPublicKeyPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/sshPublicKeys/{fingerprint}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.oslogin.v1.OsLoginService', 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.osLoginServiceStub) { - return this.osLoginServiceStub; - } - - // Put together the "service stub" for - // google.cloud.oslogin.v1.OsLoginService. - this.osLoginServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.oslogin.v1.OsLoginService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.oslogin.v1.OsLoginService, - 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 osLoginServiceStubMethods = - ['createSshPublicKey', 'deletePosixAccount', 'deleteSshPublicKey', 'getLoginProfile', 'getSshPublicKey', 'importSshPublicKey', 'updateSshPublicKey']; - for (const methodName of osLoginServiceStubMethods) { - const callPromise = this.osLoginServiceStub.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 = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.osLoginServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'oslogin.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 'oslogin.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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/compute.readonly' - ]; - } - - 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 -- - // ------------------- -/** - * Create an SSH public key - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique ID for the user in format `users/{user}`. - * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey - * Required. The SSH public key and expiration time. - * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.create_ssh_public_key.js - * region_tag:oslogin_v1_generated_OsLoginService_CreateSshPublicKey_async - */ - createSshPublicKey( - request?: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|undefined, {}|undefined - ]>; - createSshPublicKey( - request: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - createSshPublicKey( - request: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - createSshPublicKey( - request?: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest|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.createSshPublicKey(request, options, callback); - } -/** - * Deletes a POSIX account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A reference to the POSIX account to update. POSIX accounts are identified - * by the project ID they are associated with. A reference to the POSIX - * account is in format `users/{user}/projects/{project}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.delete_posix_account.js - * region_tag:oslogin_v1_generated_OsLoginService_DeletePosixAccount_async - */ - deletePosixAccount( - request?: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|undefined, {}|undefined - ]>; - deletePosixAccount( - request: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>): void; - deletePosixAccount( - request: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>): void; - deletePosixAccount( - request?: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePosixAccount(request, options, callback); - } -/** - * Deletes an SSH public key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.delete_ssh_public_key.js - * region_tag:oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_async - */ - deleteSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|undefined, {}|undefined - ]>; - deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - deleteSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSshPublicKey(request, options, callback); - } -/** - * Retrieves the profile information used for logging in to a virtual machine - * on Google Compute Engine. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique ID for the user in format `users/{user}`. - * @param {string} request.projectId - * The project ID of the Google Cloud Platform project. - * @param {string} request.systemId - * A system ID for filtering the results of the request. - * @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 [LoginProfile]{@link google.cloud.oslogin.v1.LoginProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.get_login_profile.js - * region_tag:oslogin_v1_generated_OsLoginService_GetLoginProfile_async - */ - getLoginProfile( - request?: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.v1.ILoginProfile, - protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|undefined, {}|undefined - ]>; - getLoginProfile( - request: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.v1.ILoginProfile, - protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>): void; - getLoginProfile( - request: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, - callback: Callback< - protos.google.cloud.oslogin.v1.ILoginProfile, - protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>): void; - getLoginProfile( - request?: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.v1.ILoginProfile, - protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.v1.ILoginProfile, - protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.v1.ILoginProfile, - protos.google.cloud.oslogin.v1.IGetLoginProfileRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getLoginProfile(request, options, callback); - } -/** - * Retrieves an SSH public key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in - * format `users/{user}/sshPublicKeys/{fingerprint}`. - * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.get_ssh_public_key.js - * region_tag:oslogin_v1_generated_OsLoginService_GetSshPublicKey_async - */ - getSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|undefined, {}|undefined - ]>; - getSshPublicKey( - request: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getSshPublicKey( - request: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSshPublicKey(request, options, callback); - } -/** - * Adds an SSH public key and returns the profile information. Default POSIX - * account information is set when no username and UID exist as part of the - * login profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique ID for the user in format `users/{user}`. - * @param {google.cloud.oslogin.common.SshPublicKey} [request.sshPublicKey] - * Optional. The SSH public key and expiration time. - * @param {string} request.projectId - * The project ID of the Google Cloud Platform project. - * @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 [ImportSshPublicKeyResponse]{@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.import_ssh_public_key.js - * region_tag:oslogin_v1_generated_OsLoginService_ImportSshPublicKey_async - */ - importSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|undefined, {}|undefined - ]>; - importSshPublicKey( - request: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - importSshPublicKey( - request: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - importSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest|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.importSshPublicKey(request, options, callback); - } -/** - * Updates an SSH public key and returns the profile information. This method - * supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey - * Required. The SSH public key and expiration time. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get updated. Updates all if not present. - * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/os_login_service.update_ssh_public_key.js - * region_tag:oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_async - */ - updateSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|undefined, {}|undefined - ]>; - updateSshPublicKey( - request: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - updateSshPublicKey( - request: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - updateSshPublicKey( - request?: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSshPublicKey(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified posixAccount resource name string. - * - * @param {string} user - * @param {string} project - * @returns {string} Resource name string. - */ - posixAccountPath(user:string,project:string) { - return this.pathTemplates.posixAccountPathTemplate.render({ - user: user, - project: project, - }); - } - - /** - * Parse the user from PosixAccount resource. - * - * @param {string} posixAccountName - * A fully-qualified path representing PosixAccount resource. - * @returns {string} A string representing the user. - */ - matchUserFromPosixAccountName(posixAccountName: string) { - return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).user; - } - - /** - * Parse the project from PosixAccount resource. - * - * @param {string} posixAccountName - * A fully-qualified path representing PosixAccount resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPosixAccountName(posixAccountName: string) { - return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).project; - } - - /** - * Return a fully-qualified sshPublicKey resource name string. - * - * @param {string} user - * @param {string} fingerprint - * @returns {string} Resource name string. - */ - sshPublicKeyPath(user:string,fingerprint:string) { - return this.pathTemplates.sshPublicKeyPathTemplate.render({ - user: user, - fingerprint: fingerprint, - }); - } - - /** - * Parse the user from SshPublicKey resource. - * - * @param {string} sshPublicKeyName - * A fully-qualified path representing SshPublicKey resource. - * @returns {string} A string representing the user. - */ - matchUserFromSshPublicKeyName(sshPublicKeyName: string) { - return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).user; - } - - /** - * Parse the fingerprint from SshPublicKey resource. - * - * @param {string} sshPublicKeyName - * A fully-qualified path representing SshPublicKey resource. - * @returns {string} A string representing the fingerprint. - */ - matchFingerprintFromSshPublicKeyName(sshPublicKeyName: string) { - return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).fingerprint; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * 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.osLoginServiceStub && !this._terminated) { - return this.osLoginServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json deleted file mode 100644 index afdd4ec0a35..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_client_config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "interfaces": { - "google.cloud.oslogin.v1.OsLoginService": { - "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": { - "CreateSshPublicKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePosixAccount": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetLoginProfile": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ImportSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json b/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json deleted file mode 100644 index 46f125ed586..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/src/v1/os_login_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/oslogin/common/common.proto", - "../../protos/google/cloud/oslogin/v1/oslogin.proto" -] diff --git a/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index dbe35025422..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/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 oslogin = require('@google-cloud/os-login'); - -function main() { - const osLoginServiceClient = new oslogin.OsLoginServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b5eb626ee88..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/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 {OsLoginServiceClient} from '@google-cloud/os-login'; - -// check that the client class type name can be used -function doStuffWithOsLoginServiceClient(client: OsLoginServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const osLoginServiceClient = new OsLoginServiceClient(); - doStuffWithOsLoginServiceClient(osLoginServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1/system-test/install.ts b/owl-bot-staging/google-cloud-oslogin/v1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/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-oslogin/v1/test/gapic_os_login_service_v1.ts b/owl-bot-staging/google-cloud-oslogin/v1/test/gapic_os_login_service_v1.ts deleted file mode 100644 index 853768f0cc4..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/test/gapic_os_login_service_v1.ts +++ /dev/null @@ -1,1015 +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 osloginserviceModule from '../src'; - -import {protobuf} 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 stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.OsLoginServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = osloginserviceModule.v1.OsLoginServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = osloginserviceModule.v1.OsLoginServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = osloginserviceModule.v1.OsLoginServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.osLoginServiceStub, undefined); - await client.initialize(); - assert(client.osLoginServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.osLoginServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.osLoginServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - 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 osloginserviceModule.v1.OsLoginServiceClient({ - 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('createSshPublicKey', () => { - it('invokes createSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.createSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.createSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.createSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSshPublicKey(request), expectedError); - }); - }); - - describe('deletePosixAccount', () => { - it('invokes deletePosixAccount without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); - const [response] = await client.deletePosixAccount(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePosixAccount without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deletePosixAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePosixAccount( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePosixAccount with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deletePosixAccount(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePosixAccount with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deletePosixAccount(request), expectedError); - }); - }); - - describe('deleteSshPublicKey', () => { - it('invokes deleteSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSshPublicKey( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSshPublicKey(request), expectedError); - }); - }); - - describe('getLoginProfile', () => { - it('invokes getLoginProfile without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1.LoginProfile() - ); - client.innerApiCalls.getLoginProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getLoginProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoginProfile without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1.LoginProfile() - ); - client.innerApiCalls.getLoginProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLoginProfile( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.v1.ILoginProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoginProfile with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoginProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoginProfile with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getLoginProfile(request), expectedError); - }); - }); - - describe('getSshPublicKey', () => { - it('invokes getSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.getSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.getSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.getSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSshPublicKey(request), expectedError); - }); - }); - - describe('importSshPublicKey', () => { - it('invokes importSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1.ImportSshPublicKeyResponse() - ); - client.innerApiCalls.importSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.importSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1.ImportSshPublicKeyResponse() - ); - client.innerApiCalls.importSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.importSshPublicKey(request), expectedError); - }); - }); - - describe('updateSshPublicKey', () => { - it('invokes updateSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.updateSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.updateSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.updateSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSshPublicKey(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('posixAccount', () => { - const fakePath = "/rendered/path/posixAccount"; - const expectedParameters = { - user: "userValue", - project: "projectValue", - }; - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.posixAccountPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.posixAccountPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('posixAccountPath', () => { - const result = client.posixAccountPath("userValue", "projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.posixAccountPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromPosixAccountName', () => { - const result = client.matchUserFromPosixAccountName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProjectFromPosixAccountName', () => { - const result = client.matchProjectFromPosixAccountName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sshPublicKey', () => { - const fakePath = "/rendered/path/sshPublicKey"; - const expectedParameters = { - user: "userValue", - fingerprint: "fingerprintValue", - }; - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.sshPublicKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sshPublicKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sshPublicKeyPath', () => { - const result = client.sshPublicKeyPath("userValue", "fingerprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sshPublicKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromSshPublicKeyName', () => { - const result = client.matchUserFromSshPublicKeyName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFingerprintFromSshPublicKeyName', () => { - const result = client.matchFingerprintFromSshPublicKeyName(fakePath); - assert.strictEqual(result, "fingerprintValue"); - assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json b/owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js b/owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js deleted file mode 100644 index 67fc391472d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'OsLoginService', - filename: './os-login-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore b/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.gitignore b/owl-bot-staging/google-cloud-oslogin/v1beta/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-oslogin/v1beta/.jsdoc.js deleted file mode 100644 index 83fc87c6ceb..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/.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/os-login', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-oslogin/v1beta/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-oslogin/v1beta/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/.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-oslogin/v1beta/README.md b/owl-bot-staging/google-cloud-oslogin/v1beta/README.md deleted file mode 100644 index f7acdc89a3a..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Oslogin: Nodejs Client diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/linkinator.config.json b/owl-bot-staging/google-cloud-oslogin/v1beta/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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-oslogin/v1beta/package.json b/owl-bot-staging/google-cloud-oslogin/v1beta/package.json deleted file mode 100644 index c968d347d8f..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/os-login", - "version": "0.1.0", - "description": "Oslogin client for Node.js", - "repository": "googleapis/nodejs-oslogin", - "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 oslogin", - "oslogin", - "os login service" - ], - "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-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto deleted file mode 100644 index 6eeaf8908d8..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/common/common.proto +++ /dev/null @@ -1,108 +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.oslogin.common; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.OsLogin.Common"; -option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/common;common"; -option java_outer_classname = "OsLoginProto"; -option java_package = "com.google.cloud.oslogin.common"; -option php_namespace = "Google\\Cloud\\OsLogin\\Common"; -option ruby_package = "Google::Cloud::OsLogin::Common"; -option (google.api.resource_definition) = { - type: "oslogin.googleapis.com/User" - pattern: "users/{user}" -}; - -// The operating system options for account entries. -enum OperatingSystemType { - // The operating system type associated with the user account information is - // unspecified. - OPERATING_SYSTEM_TYPE_UNSPECIFIED = 0; - - // Linux user account information. - LINUX = 1; - - // Windows user account information. - WINDOWS = 2; -} - -// The POSIX account information associated with a Google account. -message PosixAccount { - option (google.api.resource) = { - type: "oslogin.googleapis.com/PosixAccount" - pattern: "users/{user}/projects/{project}" - }; - - // Only one POSIX account can be marked as primary. - bool primary = 1; - - // The username of the POSIX account. - string username = 2; - - // The user ID. - int64 uid = 3; - - // The default group ID. - int64 gid = 4; - - // The path to the home directory for this account. - string home_directory = 5; - - // The path to the logic shell for this account. - string shell = 6; - - // The GECOS (user information) entry for this account. - string gecos = 7; - - // System identifier for which account the username or uid applies to. - // By default, the empty value is used. - string system_id = 8; - - // Output only. A POSIX account identifier. - string account_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The operating system type where this account applies. - OperatingSystemType operating_system_type = 10; - - // Output only. The canonical resource name. - string name = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The SSH public key information associated with a Google account. -message SshPublicKey { - option (google.api.resource) = { - type: "oslogin.googleapis.com/SshPublicKey" - pattern: "users/{user}/sshPublicKeys/{fingerprint}" - }; - - // Public key text in SSH format, defined by - // RFC4253 - // section 6.6. - string key = 1; - - // An expiration time in microseconds since epoch. - int64 expiration_time_usec = 2; - - // Output only. The SHA-256 fingerprint of the SSH public key. - string fingerprint = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The canonical resource name. - string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto b/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto deleted file mode 100644 index 9a7a06b4a03..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto +++ /dev/null @@ -1,288 +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.oslogin.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/oslogin/common/common.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.OsLogin.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta;oslogin"; -option java_multiple_files = true; -option java_outer_classname = "OsLoginProto"; -option java_package = "com.google.cloud.oslogin.v1beta"; -option php_namespace = "Google\\Cloud\\OsLogin\\V1beta"; -option ruby_package = "Google::Cloud::OsLogin::V1beta"; - -// Cloud OS Login API -// -// The Cloud OS Login API allows you to manage users and their associated SSH -// public keys for logging into virtual machines on Google Cloud Platform. -service OsLoginService { - option (google.api.default_host) = "oslogin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/compute.readonly"; - - // Create an SSH public key - rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { - option (google.api.http) = { - post: "/v1beta/{parent=users/*}/sshPublicKeys" - body: "ssh_public_key" - }; - option (google.api.method_signature) = "parent,ssh_public_key"; - } - - // Deletes a POSIX account. - rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta/{name=users/*/projects/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes an SSH public key. - rpc DeleteSshPublicKey(DeleteSshPublicKeyRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta/{name=users/*/sshPublicKeys/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves the profile information used for logging in to a virtual machine - // on Google Compute Engine. - rpc GetLoginProfile(GetLoginProfileRequest) returns (LoginProfile) { - option (google.api.http) = { - get: "/v1beta/{name=users/*}/loginProfile" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves an SSH public key. - rpc GetSshPublicKey(GetSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { - option (google.api.http) = { - get: "/v1beta/{name=users/*/sshPublicKeys/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds an SSH public key and returns the profile information. Default POSIX - // account information is set when no username and UID exist as part of the - // login profile. - rpc ImportSshPublicKey(ImportSshPublicKeyRequest) returns (ImportSshPublicKeyResponse) { - option (google.api.http) = { - post: "/v1beta/{parent=users/*}:importSshPublicKey" - body: "ssh_public_key" - }; - option (google.api.method_signature) = "parent,ssh_public_key"; - option (google.api.method_signature) = "parent,ssh_public_key,project_id"; - } - - // Updates an SSH public key and returns the profile information. This method - // supports patch semantics. - rpc UpdateSshPublicKey(UpdateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { - option (google.api.http) = { - patch: "/v1beta/{name=users/*/sshPublicKeys/*}" - body: "ssh_public_key" - }; - option (google.api.method_signature) = "name,ssh_public_key"; - option (google.api.method_signature) = "name,ssh_public_key,update_mask"; - } -} - -// The user profile information used for logging in to a virtual machine on -// Google Compute Engine. -message LoginProfile { - // Required. A unique user ID. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of POSIX accounts associated with the user. - repeated google.cloud.oslogin.common.PosixAccount posix_accounts = 2; - - // A map from SSH public key fingerprint to the associated key object. - map ssh_public_keys = 3; - - // The registered security key credentials for a user. - repeated SecurityKey security_keys = 5; -} - -// A request message for creating an SSH public key. -message CreateSshPublicKeyRequest { - // Required. The unique ID for the user in format `users/{user}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "oslogin.googleapis.com/SshPublicKey" - } - ]; - - // Required. The SSH public key and expiration time. - google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A request message for deleting a POSIX account entry. -message DeletePosixAccountRequest { - // Required. A reference to the POSIX account to update. POSIX accounts are identified - // by the project ID they are associated with. A reference to the POSIX - // account is in format `users/{user}/projects/{project}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/PosixAccount" - } - ]; -} - -// A request message for deleting an SSH public key. -message DeleteSshPublicKeyRequest { - // Required. The fingerprint of the public key to update. Public keys are identified by - // their SHA-256 fingerprint. The fingerprint of the public key is in format - // `users/{user}/sshPublicKeys/{fingerprint}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/SshPublicKey" - } - ]; -} - -// A request message for retrieving the login profile information for a user. -message GetLoginProfileRequest { - // Required. The unique ID for the user in format `users/{user}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/User" - } - ]; - - // The project ID of the Google Cloud Platform project. - string project_id = 2; - - // A system ID for filtering the results of the request. - string system_id = 3; - - // The view configures whether to retrieve security keys information. - LoginProfileView view = 4; -} - -// A request message for retrieving an SSH public key. -message GetSshPublicKeyRequest { - // Required. The fingerprint of the public key to retrieve. Public keys are identified - // by their SHA-256 fingerprint. The fingerprint of the public key is in - // format `users/{user}/sshPublicKeys/{fingerprint}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/SshPublicKey" - } - ]; -} - -// A request message for importing an SSH public key. -message ImportSshPublicKeyRequest { - // The unique ID for the user in format `users/{user}`. - string parent = 1 [(google.api.resource_reference) = { - child_type: "oslogin.googleapis.com/SshPublicKey" - }]; - - // Required. The SSH public key and expiration time. - google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // The project ID of the Google Cloud Platform project. - string project_id = 3; - - // The view configures whether to retrieve security keys information. - LoginProfileView view = 4; -} - -// A response message for importing an SSH public key. -message ImportSshPublicKeyResponse { - // The login profile information for the user. - LoginProfile login_profile = 1; - - // Detailed information about import results. - string details = 2; -} - -// A request message for updating an SSH public key. -message UpdateSshPublicKeyRequest { - // Required. The fingerprint of the public key to update. Public keys are identified by - // their SHA-256 fingerprint. The fingerprint of the public key is in format - // `users/{user}/sshPublicKeys/{fingerprint}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "oslogin.googleapis.com/SshPublicKey" - } - ]; - - // Required. The SSH public key and expiration time. - google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // Mask to control which fields get updated. Updates all if not present. - google.protobuf.FieldMask update_mask = 3; -} - -// The credential information for a Google registered security key. -message SecurityKey { - // Public key text in SSH format, defined by - // [RFC4253]("https://www.ietf.org/rfc/rfc4253.txt") section 6.6. - string public_key = 1; - - // Hardware-backed private key text in SSH format. - string private_key = 2; - - // The FIDO protocol type used to register this credential. - oneof protocol_type { - // The U2F protocol type. - UniversalTwoFactor universal_two_factor = 3; - - // The Web Authentication protocol type. - WebAuthn web_authn = 4; - } -} - -// Security key information specific to the U2F protocol. -message UniversalTwoFactor { - // Application ID for the U2F protocol. - string app_id = 1; -} - -// Security key information specific to the Web Authentication protocol. -message WebAuthn { - // Relying party ID for Web Authentication. - string rp_id = 1; -} - -// The login profile view limits the user content retrieved. -enum LoginProfileView { - // The default login profile view. The API defaults to the BASIC view. - LOGIN_PROFILE_VIEW_UNSPECIFIED = 0; - - // Includes POSIX and SSH key information. - BASIC = 1; - - // Include security key information for the user. - SECURITY_KEY = 2; -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js deleted file mode 100644 index 8833aa395b4..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_posix_account.js +++ /dev/null @@ -1,63 +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(name) { - // [START oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_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. - */ - /** - * Required. A reference to the POSIX account to update. POSIX accounts are identified - * by the project ID they are associated with. A reference to the POSIX - * account is in format `users/{user}/projects/{project}`. - */ - // const name = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callDeletePosixAccount() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.deletePosixAccount(request); - console.log(response); - } - - callDeletePosixAccount(); - // [END oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js deleted file mode 100644 index 2dc7fdc4fa1..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js +++ /dev/null @@ -1,63 +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(name) { - // [START oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_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. - */ - /** - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - */ - // const name = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callDeleteSshPublicKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.deleteSshPublicKey(request); - console.log(response); - } - - callDeleteSshPublicKey(); - // [END oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js deleted file mode 100644 index ed9ae4af370..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_login_profile.js +++ /dev/null @@ -1,73 +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(name) { - // [START oslogin_v1beta_generated_OsLoginService_GetLoginProfile_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. - */ - /** - * Required. The unique ID for the user in format `users/{user}`. - */ - // const name = 'abc123' - /** - * The project ID of the Google Cloud Platform project. - */ - // const projectId = 'abc123' - /** - * A system ID for filtering the results of the request. - */ - // const systemId = 'abc123' - /** - * The view configures whether to retrieve security keys information. - */ - // const view = {} - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callGetLoginProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.getLoginProfile(request); - console.log(response); - } - - callGetLoginProfile(); - // [END oslogin_v1beta_generated_OsLoginService_GetLoginProfile_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js deleted file mode 100644 index 7e901702ea9..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.get_ssh_public_key.js +++ /dev/null @@ -1,63 +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(name) { - // [START oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_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. - */ - /** - * Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in - * format `users/{user}/sshPublicKeys/{fingerprint}`. - */ - // const name = 'abc123' - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callGetSshPublicKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await osloginClient.getSshPublicKey(request); - console.log(response); - } - - callGetSshPublicKey(); - // [END oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js deleted file mode 100644 index d3bb62a2ab4..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.import_ssh_public_key.js +++ /dev/null @@ -1,73 +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(sshPublicKey) { - // [START oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_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 unique ID for the user in format `users/{user}`. - */ - // const parent = 'abc123' - /** - * Required. The SSH public key and expiration time. - */ - // const sshPublicKey = {} - /** - * The project ID of the Google Cloud Platform project. - */ - // const projectId = 'abc123' - /** - * The view configures whether to retrieve security keys information. - */ - // const view = {} - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callImportSshPublicKey() { - // Construct request - const request = { - sshPublicKey, - }; - - // Run request - const response = await osloginClient.importSshPublicKey(request); - console.log(response); - } - - callImportSshPublicKey(); - // [END oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js deleted file mode 100644 index ce67375a1b9..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.update_ssh_public_key.js +++ /dev/null @@ -1,72 +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(name, sshPublicKey) { - // [START oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_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. - */ - /** - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - */ - // const name = 'abc123' - /** - * Required. The SSH public key and expiration time. - */ - // const sshPublicKey = {} - /** - * Mask to control which fields get updated. Updates all if not present. - */ - // const updateMask = {} - - // Imports the Oslogin library - const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; - - // Instantiates a client - const osloginClient = new OsLoginServiceClient(); - - async function callUpdateSshPublicKey() { - // Construct request - const request = { - name, - sshPublicKey, - }; - - // Run request - const response = await osloginClient.updateSshPublicKey(request); - console.log(response); - } - - callUpdateSshPublicKey(); - // [END oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_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-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json b/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json deleted file mode 100644 index f67eb12166b..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json +++ /dev/null @@ -1,331 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-oslogin", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.oslogin.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_async", - "title": "OsLoginService createSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Create an SSH public key", - "canonical": true, - "file": "os_login_service.create_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "ssh_public_key", - "type": ".google.cloud.oslogin.common.SshPublicKey" - } - ], - "resultType": ".google.cloud.oslogin.common.SshPublicKey", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "CreateSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_async", - "title": "OsLoginService deletePosixAccount Sample", - "origin": "API_DEFINITION", - "description": " Deletes a POSIX account.", - "canonical": true, - "file": "os_login_service.delete_posix_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePosixAccount", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "DeletePosixAccount", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_async", - "title": "OsLoginService deleteSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Deletes an SSH public key.", - "canonical": true, - "file": "os_login_service.delete_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "DeleteSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_GetLoginProfile_async", - "title": "OsLoginService getLoginProfile Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.", - "canonical": true, - "file": "os_login_service.get_login_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLoginProfile", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "system_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.oslogin.v1beta.LoginProfileView" - } - ], - "resultType": ".google.cloud.oslogin.v1beta.LoginProfile", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "GetLoginProfile", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_async", - "title": "OsLoginService getSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an SSH public key.", - "canonical": true, - "file": "os_login_service.get_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.oslogin.common.SshPublicKey", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "GetSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_async", - "title": "OsLoginService importSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.", - "canonical": true, - "file": "os_login_service.import_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "ssh_public_key", - "type": ".google.cloud.oslogin.common.SshPublicKey" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.oslogin.v1beta.LoginProfileView" - } - ], - "resultType": ".google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "ImportSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - }, - { - "regionTag": "oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_async", - "title": "OsLoginService updateSshPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Updates an SSH public key and returns the profile information. This method supports patch semantics.", - "canonical": true, - "file": "os_login_service.update_ssh_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ssh_public_key", - "type": ".google.cloud.oslogin.common.SshPublicKey" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.oslogin.common.SshPublicKey", - "client": { - "shortName": "OsLoginServiceClient", - "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" - }, - "method": { - "shortName": "UpdateSshPublicKey", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey", - "service": { - "shortName": "OsLoginService", - "fullName": "google.cloud.oslogin.v1beta.OsLoginService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/index.ts deleted file mode 100644 index d782422d4b1..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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 v1beta from './v1beta'; -const OsLoginServiceClient = v1beta.OsLoginServiceClient; -type OsLoginServiceClient = v1beta.OsLoginServiceClient; -export {v1beta, OsLoginServiceClient}; -export default {v1beta, OsLoginServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index ad42910537d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.oslogin.v1beta", - "libraryPackage": "@google-cloud/os-login", - "services": { - "OsLoginService": { - "clients": { - "grpc": { - "libraryClient": "OsLoginServiceClient", - "rpcs": { - "CreateSshPublicKey": { - "methods": [ - "createSshPublicKey" - ] - }, - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "OsLoginServiceClient", - "rpcs": { - "CreateSshPublicKey": { - "methods": [ - "createSshPublicKey" - ] - }, - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/index.ts deleted file mode 100644 index d3f167933f9..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/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 {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts deleted file mode 100644 index edb545a230d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client.ts +++ /dev/null @@ -1,954 +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} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta/os_login_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './os_login_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud OS Login API - * - * The Cloud OS Login API allows you to manage users and their associated SSH - * public keys for logging into virtual machines on Google Cloud Platform. - * @class - * @memberof v1beta - */ -export class OsLoginServiceClient { - 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}; - pathTemplates: {[name: string]: gax.PathTemplate}; - osLoginServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of OsLoginServiceClient. - * - * @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 OsLoginServiceClient({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 OsLoginServiceClient; - 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; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - posixAccountPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/projects/{project}' - ), - sshPublicKeyPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/sshPublicKeys/{fingerprint}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.oslogin.v1beta.OsLoginService', 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.osLoginServiceStub) { - return this.osLoginServiceStub; - } - - // Put together the "service stub" for - // google.cloud.oslogin.v1beta.OsLoginService. - this.osLoginServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.oslogin.v1beta.OsLoginService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.oslogin.v1beta.OsLoginService, - 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 osLoginServiceStubMethods = - ['createSshPublicKey', 'deletePosixAccount', 'deleteSshPublicKey', 'getLoginProfile', 'getSshPublicKey', 'importSshPublicKey', 'updateSshPublicKey']; - for (const methodName of osLoginServiceStubMethods) { - const callPromise = this.osLoginServiceStub.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 = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.osLoginServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'oslogin.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 'oslogin.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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/compute.readonly' - ]; - } - - 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 -- - // ------------------- -/** - * Create an SSH public key - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The unique ID for the user in format `users/{user}`. - * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey - * Required. The SSH public key and expiration time. - * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.create_ssh_public_key.js - * region_tag:oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_async - */ - createSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|undefined, {}|undefined - ]>; - createSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - createSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - createSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest|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.createSshPublicKey(request, options, callback); - } -/** - * Deletes a POSIX account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. A reference to the POSIX account to update. POSIX accounts are identified - * by the project ID they are associated with. A reference to the POSIX - * account is in format `users/{user}/projects/{project}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.delete_posix_account.js - * region_tag:oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_async - */ - deletePosixAccount( - request?: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|undefined, {}|undefined - ]>; - deletePosixAccount( - request: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>): void; - deletePosixAccount( - request: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>): void; - deletePosixAccount( - request?: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePosixAccount(request, options, callback); - } -/** - * Deletes an SSH public key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.delete_ssh_public_key.js - * region_tag:oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_async - */ - deleteSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|undefined, {}|undefined - ]>; - deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - deleteSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSshPublicKey(request, options, callback); - } -/** - * Retrieves the profile information used for logging in to a virtual machine - * on Google Compute Engine. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The unique ID for the user in format `users/{user}`. - * @param {string} request.projectId - * The project ID of the Google Cloud Platform project. - * @param {string} request.systemId - * A system ID for filtering the results of the request. - * @param {google.cloud.oslogin.v1beta.LoginProfileView} request.view - * The view configures whether to retrieve security keys information. - * @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 [LoginProfile]{@link google.cloud.oslogin.v1beta.LoginProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.get_login_profile.js - * region_tag:oslogin_v1beta_generated_OsLoginService_GetLoginProfile_async - */ - getLoginProfile( - request?: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.v1beta.ILoginProfile, - protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|undefined, {}|undefined - ]>; - getLoginProfile( - request: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.v1beta.ILoginProfile, - protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>): void; - getLoginProfile( - request: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, - callback: Callback< - protos.google.cloud.oslogin.v1beta.ILoginProfile, - protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>): void; - getLoginProfile( - request?: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.v1beta.ILoginProfile, - protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.v1beta.ILoginProfile, - protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.v1beta.ILoginProfile, - protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getLoginProfile(request, options, callback); - } -/** - * Retrieves an SSH public key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in - * format `users/{user}/sshPublicKeys/{fingerprint}`. - * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.get_ssh_public_key.js - * region_tag:oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_async - */ - getSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|undefined, {}|undefined - ]>; - getSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSshPublicKey(request, options, callback); - } -/** - * Adds an SSH public key and returns the profile information. Default POSIX - * account information is set when no username and UID exist as part of the - * login profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The unique ID for the user in format `users/{user}`. - * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey - * Required. The SSH public key and expiration time. - * @param {string} request.projectId - * The project ID of the Google Cloud Platform project. - * @param {google.cloud.oslogin.v1beta.LoginProfileView} request.view - * The view configures whether to retrieve security keys information. - * @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 [ImportSshPublicKeyResponse]{@link google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.import_ssh_public_key.js - * region_tag:oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_async - */ - importSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|undefined, {}|undefined - ]>; - importSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - importSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - importSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse, - protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest|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.importSshPublicKey(request, options, callback); - } -/** - * Updates an SSH public key and returns the profile information. This method - * supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey - * Required. The SSH public key and expiration time. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get updated. Updates all if not present. - * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/os_login_service.update_ssh_public_key.js - * region_tag:oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_async - */ - updateSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|undefined, {}|undefined - ]>; - updateSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - updateSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, - callback: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - updateSshPublicKey( - request?: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.oslogin.common.ISshPublicKey, - protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest|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({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSshPublicKey(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified posixAccount resource name string. - * - * @param {string} user - * @param {string} project - * @returns {string} Resource name string. - */ - posixAccountPath(user:string,project:string) { - return this.pathTemplates.posixAccountPathTemplate.render({ - user: user, - project: project, - }); - } - - /** - * Parse the user from PosixAccount resource. - * - * @param {string} posixAccountName - * A fully-qualified path representing PosixAccount resource. - * @returns {string} A string representing the user. - */ - matchUserFromPosixAccountName(posixAccountName: string) { - return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).user; - } - - /** - * Parse the project from PosixAccount resource. - * - * @param {string} posixAccountName - * A fully-qualified path representing PosixAccount resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPosixAccountName(posixAccountName: string) { - return this.pathTemplates.posixAccountPathTemplate.match(posixAccountName).project; - } - - /** - * Return a fully-qualified sshPublicKey resource name string. - * - * @param {string} user - * @param {string} fingerprint - * @returns {string} Resource name string. - */ - sshPublicKeyPath(user:string,fingerprint:string) { - return this.pathTemplates.sshPublicKeyPathTemplate.render({ - user: user, - fingerprint: fingerprint, - }); - } - - /** - * Parse the user from SshPublicKey resource. - * - * @param {string} sshPublicKeyName - * A fully-qualified path representing SshPublicKey resource. - * @returns {string} A string representing the user. - */ - matchUserFromSshPublicKeyName(sshPublicKeyName: string) { - return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).user; - } - - /** - * Parse the fingerprint from SshPublicKey resource. - * - * @param {string} sshPublicKeyName - * A fully-qualified path representing SshPublicKey resource. - * @returns {string} A string representing the fingerprint. - */ - matchFingerprintFromSshPublicKeyName(sshPublicKeyName: string) { - return this.pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName).fingerprint; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * 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.osLoginServiceStub && !this._terminated) { - return this.osLoginServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json deleted file mode 100644 index d45946b5241..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_client_config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "interfaces": { - "google.cloud.oslogin.v1beta.OsLoginService": { - "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": { - "CreateSshPublicKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeletePosixAccount": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetLoginProfile": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ImportSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateSshPublicKey": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json b/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json deleted file mode 100644 index 078ed1d537d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/src/v1beta/os_login_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/oslogin/common/common.proto", - "../../protos/google/cloud/oslogin/v1beta/oslogin.proto" -] diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index dbe35025422..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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 oslogin = require('@google-cloud/os-login'); - -function main() { - const osLoginServiceClient = new oslogin.OsLoginServiceClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b5eb626ee88..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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 {OsLoginServiceClient} from '@google-cloud/os-login'; - -// check that the client class type name can be used -function doStuffWithOsLoginServiceClient(client: OsLoginServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const osLoginServiceClient = new OsLoginServiceClient(); - doStuffWithOsLoginServiceClient(osLoginServiceClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts b/owl-bot-staging/google-cloud-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts deleted file mode 100644 index 33fac17be8c..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/test/gapic_os_login_service_v1beta.ts +++ /dev/null @@ -1,1015 +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 osloginserviceModule from '../src'; - -import {protobuf} 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 stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta.OsLoginServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = osloginserviceModule.v1beta.OsLoginServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = osloginserviceModule.v1beta.OsLoginServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = osloginserviceModule.v1beta.OsLoginServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.osLoginServiceStub, undefined); - await client.initialize(); - assert(client.osLoginServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.osLoginServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.osLoginServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - 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 osloginserviceModule.v1beta.OsLoginServiceClient({ - 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('createSshPublicKey', () => { - it('invokes createSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.createSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.createSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.createSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSshPublicKey(request), expectedError); - }); - }); - - describe('deletePosixAccount', () => { - it('invokes deletePosixAccount without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); - const [response] = await client.deletePosixAccount(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePosixAccount without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deletePosixAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePosixAccount( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePosixAccount with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deletePosixAccount(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePosixAccount with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeletePosixAccountRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deletePosixAccount(request), expectedError); - }); - }); - - describe('deleteSshPublicKey', () => { - it('invokes deleteSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSshPublicKey( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSshPublicKey(request), expectedError); - }); - }); - - describe('getLoginProfile', () => { - it('invokes getLoginProfile without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.LoginProfile() - ); - client.innerApiCalls.getLoginProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getLoginProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoginProfile without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.LoginProfile() - ); - client.innerApiCalls.getLoginProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLoginProfile( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.v1beta.ILoginProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoginProfile with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoginProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoginProfile with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetLoginProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getLoginProfile(request), expectedError); - }); - }); - - describe('getSshPublicKey', () => { - it('invokes getSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.getSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.getSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.getSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSshPublicKey(request), expectedError); - }); - }); - - describe('importSshPublicKey', () => { - it('invokes importSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse() - ); - client.innerApiCalls.importSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.importSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse() - ); - client.innerApiCalls.importSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.importSshPublicKey(request), expectedError); - }); - }); - - describe('updateSshPublicKey', () => { - it('invokes updateSshPublicKey without error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.updateSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.updateSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSshPublicKey without error using callback', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.oslogin.common.SshPublicKey() - ); - client.innerApiCalls.updateSshPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSshPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.oslogin.common.ISshPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSshPublicKey with error', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSshPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSshPublicKey with closed client', async () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSshPublicKey(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('posixAccount', () => { - const fakePath = "/rendered/path/posixAccount"; - const expectedParameters = { - user: "userValue", - project: "projectValue", - }; - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.posixAccountPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.posixAccountPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('posixAccountPath', () => { - const result = client.posixAccountPath("userValue", "projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.posixAccountPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromPosixAccountName', () => { - const result = client.matchUserFromPosixAccountName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProjectFromPosixAccountName', () => { - const result = client.matchProjectFromPosixAccountName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.posixAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sshPublicKey', () => { - const fakePath = "/rendered/path/sshPublicKey"; - const expectedParameters = { - user: "userValue", - fingerprint: "fingerprintValue", - }; - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.sshPublicKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sshPublicKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sshPublicKeyPath', () => { - const result = client.sshPublicKeyPath("userValue", "fingerprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sshPublicKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromSshPublicKeyName', () => { - const result = client.matchUserFromSshPublicKeyName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFingerprintFromSshPublicKeyName', () => { - const result = client.matchFingerprintFromSshPublicKeyName(fakePath); - assert.strictEqual(result, "fingerprintValue"); - assert((client.pathTemplates.sshPublicKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-oslogin/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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-oslogin/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-oslogin/v1beta/webpack.config.js deleted file mode 100644 index 67fc391472d..00000000000 --- a/owl-bot-staging/google-cloud-oslogin/v1beta/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: 'OsLoginService', - filename: './os-login-service.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-oslogin/README.md b/packages/google-cloud-oslogin/README.md index 5b80022bd0d..747c5bc8d37 100644 --- a/packages/google-cloud-oslogin/README.md +++ b/packages/google-cloud-oslogin/README.md @@ -102,12 +102,14 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Os_login_service.create_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js,samples/README.md) | | Os_login_service.delete_posix_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js,samples/README.md) | | Os_login_service.delete_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_ssh_public_key.js,samples/README.md) | | Os_login_service.get_login_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_login_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_login_profile.js,samples/README.md) | | Os_login_service.get_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_ssh_public_key.js,samples/README.md) | | Os_login_service.import_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.import_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.import_ssh_public_key.js,samples/README.md) | | Os_login_service.update_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.update_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.update_ssh_public_key.js,samples/README.md) | +| Os_login_service.create_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js,samples/README.md) | | Os_login_service.delete_posix_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js,samples/README.md) | | Os_login_service.delete_ssh_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js,samples/README.md) | | Os_login_service.get_login_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js,samples/README.md) | diff --git a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/common/common.proto b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/common/common.proto index 4d9755f0d20..6eeaf8908d8 100644 --- a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/common/common.proto +++ b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/common/common.proto @@ -1,4 +1,4 @@ -// Copyright 2019 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. @@ -11,7 +11,6 @@ // 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"; @@ -26,8 +25,6 @@ option java_outer_classname = "OsLoginProto"; option java_package = "com.google.cloud.oslogin.common"; option php_namespace = "Google\\Cloud\\OsLogin\\Common"; option ruby_package = "Google::Cloud::OsLogin::Common"; - -// Define a "User" resource owned by OS Login. option (google.api.resource_definition) = { type: "oslogin.googleapis.com/User" pattern: "users/{user}" diff --git a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto index 25e9be0a07e..fb3575600c4 100644 --- a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto +++ b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto @@ -1,4 +1,4 @@ -// Copyright 2019 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. @@ -11,7 +11,6 @@ // 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"; @@ -41,7 +40,18 @@ service OsLoginService { option (google.api.default_host) = "oslogin.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/compute"; + "https://www.googleapis.com/auth/cloud-platform.read-only," + "https://www.googleapis.com/auth/compute," + "https://www.googleapis.com/auth/compute.readonly"; + + // Create an SSH public key + rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + post: "/v1/{parent=users/*}/sshPublicKeys" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + } // Deletes a POSIX account. rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { @@ -113,6 +123,20 @@ message LoginProfile { map ssh_public_keys = 3; } +// A request message for creating an SSH public key. +message CreateSshPublicKeyRequest { + // Required. The unique ID for the user in format `users/{user}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; +} + // A request message for deleting a POSIX account entry. message DeletePosixAccountRequest { // Required. A reference to the POSIX account to update. POSIX accounts are identified @@ -190,6 +214,9 @@ message ImportSshPublicKeyRequest { message ImportSshPublicKeyResponse { // The login profile information for the user. LoginProfile login_profile = 1; + + // Detailed information about import results. + string details = 2; } // A request message for updating an SSH public key. diff --git a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1beta/oslogin.proto b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1beta/oslogin.proto index a5d7847466a..9a7a06b4a03 100644 --- a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1beta/oslogin.proto +++ b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1beta/oslogin.proto @@ -1,4 +1,4 @@ -// Copyright 2019 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. @@ -11,7 +11,6 @@ // 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"; @@ -45,6 +44,15 @@ service OsLoginService { "https://www.googleapis.com/auth/compute," "https://www.googleapis.com/auth/compute.readonly"; + // Create an SSH public key + rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + post: "/v1beta/{parent=users/*}/sshPublicKeys" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + } + // Deletes a POSIX account. rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -113,6 +121,23 @@ message LoginProfile { // A map from SSH public key fingerprint to the associated key object. map ssh_public_keys = 3; + + // The registered security key credentials for a user. + repeated SecurityKey security_keys = 5; +} + +// A request message for creating an SSH public key. +message CreateSshPublicKeyRequest { + // Required. The unique ID for the user in format `users/{user}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; } // A request message for deleting a POSIX account entry. @@ -146,13 +171,19 @@ message GetLoginProfileRequest { // Required. The unique ID for the user in format `users/{user}`. string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "oslogin.googleapis.com/User"]; + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/User" + } + ]; // The project ID of the Google Cloud Platform project. string project_id = 2; // A system ID for filtering the results of the request. string system_id = 3; + + // The view configures whether to retrieve security keys information. + LoginProfileView view = 4; } // A request message for retrieving an SSH public key. @@ -180,12 +211,18 @@ message ImportSshPublicKeyRequest { // The project ID of the Google Cloud Platform project. string project_id = 3; + + // The view configures whether to retrieve security keys information. + LoginProfileView view = 4; } // A response message for importing an SSH public key. message ImportSshPublicKeyResponse { // The login profile information for the user. LoginProfile login_profile = 1; + + // Detailed information about import results. + string details = 2; } // A request message for updating an SSH public key. @@ -206,3 +243,46 @@ message UpdateSshPublicKeyRequest { // Mask to control which fields get updated. Updates all if not present. google.protobuf.FieldMask update_mask = 3; } + +// The credential information for a Google registered security key. +message SecurityKey { + // Public key text in SSH format, defined by + // [RFC4253]("https://www.ietf.org/rfc/rfc4253.txt") section 6.6. + string public_key = 1; + + // Hardware-backed private key text in SSH format. + string private_key = 2; + + // The FIDO protocol type used to register this credential. + oneof protocol_type { + // The U2F protocol type. + UniversalTwoFactor universal_two_factor = 3; + + // The Web Authentication protocol type. + WebAuthn web_authn = 4; + } +} + +// Security key information specific to the U2F protocol. +message UniversalTwoFactor { + // Application ID for the U2F protocol. + string app_id = 1; +} + +// Security key information specific to the Web Authentication protocol. +message WebAuthn { + // Relying party ID for Web Authentication. + string rp_id = 1; +} + +// The login profile view limits the user content retrieved. +enum LoginProfileView { + // The default login profile view. The API defaults to the BASIC view. + LOGIN_PROFILE_VIEW_UNSPECIFIED = 0; + + // Includes POSIX and SSH key information. + BASIC = 1; + + // Include security key information for the user. + SECURITY_KEY = 2; +} diff --git a/packages/google-cloud-oslogin/protos/protos.d.ts b/packages/google-cloud-oslogin/protos/protos.d.ts index 16610929e8c..3f993ae2c58 100644 --- a/packages/google-cloud-oslogin/protos/protos.d.ts +++ b/packages/google-cloud-oslogin/protos/protos.d.ts @@ -329,6 +329,20 @@ export namespace google { */ public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): OsLoginService; + /** + * Calls CreateSshPublicKey. + * @param request CreateSshPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SshPublicKey + */ + public createSshPublicKey(request: google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, callback: google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKeyCallback): void; + + /** + * Calls CreateSshPublicKey. + * @param request CreateSshPublicKeyRequest message or plain object + * @returns Promise + */ + public createSshPublicKey(request: google.cloud.oslogin.v1.ICreateSshPublicKeyRequest): Promise; + /** * Calls DeletePosixAccount. * @param request DeletePosixAccountRequest message or plain object @@ -416,6 +430,13 @@ export namespace google { namespace OsLoginService { + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService|createSshPublicKey}. + * @param error Error, if any + * @param [response] SshPublicKey + */ + type CreateSshPublicKeyCallback = (error: (Error|null), response?: google.cloud.oslogin.common.SshPublicKey) => void; + /** * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService|deletePosixAccount}. * @param error Error, if any @@ -568,6 +589,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a CreateSshPublicKeyRequest. */ + interface ICreateSshPublicKeyRequest { + + /** CreateSshPublicKeyRequest parent */ + parent?: (string|null); + + /** CreateSshPublicKeyRequest sshPublicKey */ + sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + } + + /** Represents a CreateSshPublicKeyRequest. */ + class CreateSshPublicKeyRequest implements ICreateSshPublicKeyRequest { + + /** + * Constructs a new CreateSshPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.ICreateSshPublicKeyRequest); + + /** CreateSshPublicKeyRequest parent. */ + public parent: string; + + /** CreateSshPublicKeyRequest sshPublicKey. */ + public sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + + /** + * Creates a new CreateSshPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSshPublicKeyRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.ICreateSshPublicKeyRequest): google.cloud.oslogin.v1.CreateSshPublicKeyRequest; + + /** + * Encodes the specified CreateSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.CreateSshPublicKeyRequest.verify|verify} messages. + * @param message CreateSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.CreateSshPublicKeyRequest.verify|verify} messages. + * @param message CreateSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.CreateSshPublicKeyRequest; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.CreateSshPublicKeyRequest; + + /** + * Verifies a CreateSshPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSshPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.CreateSshPublicKeyRequest; + + /** + * Creates a plain object from a CreateSshPublicKeyRequest message. Also converts values to other types if specified. + * @param message CreateSshPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.CreateSshPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSshPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSshPublicKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a DeletePosixAccountRequest. */ interface IDeletePosixAccountRequest { @@ -1082,6 +1206,9 @@ export namespace google { /** ImportSshPublicKeyResponse loginProfile */ loginProfile?: (google.cloud.oslogin.v1.ILoginProfile|null); + + /** ImportSshPublicKeyResponse details */ + details?: (string|null); } /** Represents an ImportSshPublicKeyResponse. */ @@ -1096,6 +1223,9 @@ export namespace google { /** ImportSshPublicKeyResponse loginProfile. */ public loginProfile?: (google.cloud.oslogin.v1.ILoginProfile|null); + /** ImportSshPublicKeyResponse details. */ + public details: string; + /** * Creates a new ImportSshPublicKeyResponse instance using the specified properties. * @param [properties] Properties to set @@ -1307,6 +1437,20 @@ export namespace google { */ public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): OsLoginService; + /** + * Calls CreateSshPublicKey. + * @param request CreateSshPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SshPublicKey + */ + public createSshPublicKey(request: google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, callback: google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKeyCallback): void; + + /** + * Calls CreateSshPublicKey. + * @param request CreateSshPublicKeyRequest message or plain object + * @returns Promise + */ + public createSshPublicKey(request: google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest): Promise; + /** * Calls DeletePosixAccount. * @param request DeletePosixAccountRequest message or plain object @@ -1394,6 +1538,13 @@ export namespace google { namespace OsLoginService { + /** + * Callback as used by {@link google.cloud.oslogin.v1beta.OsLoginService|createSshPublicKey}. + * @param error Error, if any + * @param [response] SshPublicKey + */ + type CreateSshPublicKeyCallback = (error: (Error|null), response?: google.cloud.oslogin.common.SshPublicKey) => void; + /** * Callback as used by {@link google.cloud.oslogin.v1beta.OsLoginService|deletePosixAccount}. * @param error Error, if any @@ -1448,6 +1599,9 @@ export namespace google { /** LoginProfile sshPublicKeys */ sshPublicKeys?: ({ [k: string]: google.cloud.oslogin.common.ISshPublicKey }|null); + + /** LoginProfile securityKeys */ + securityKeys?: (google.cloud.oslogin.v1beta.ISecurityKey[]|null); } /** Represents a LoginProfile. */ @@ -1468,6 +1622,9 @@ export namespace google { /** LoginProfile sshPublicKeys. */ public sshPublicKeys: { [k: string]: google.cloud.oslogin.common.ISshPublicKey }; + /** LoginProfile securityKeys. */ + public securityKeys: google.cloud.oslogin.v1beta.ISecurityKey[]; + /** * Creates a new LoginProfile instance using the specified properties. * @param [properties] Properties to set @@ -1546,6 +1703,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a CreateSshPublicKeyRequest. */ + interface ICreateSshPublicKeyRequest { + + /** CreateSshPublicKeyRequest parent */ + parent?: (string|null); + + /** CreateSshPublicKeyRequest sshPublicKey */ + sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + } + + /** Represents a CreateSshPublicKeyRequest. */ + class CreateSshPublicKeyRequest implements ICreateSshPublicKeyRequest { + + /** + * Constructs a new CreateSshPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest); + + /** CreateSshPublicKeyRequest parent. */ + public parent: string; + + /** CreateSshPublicKeyRequest sshPublicKey. */ + public sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + + /** + * Creates a new CreateSshPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSshPublicKeyRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest): google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest; + + /** + * Encodes the specified CreateSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest.verify|verify} messages. + * @param message CreateSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest.verify|verify} messages. + * @param message CreateSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest; + + /** + * Verifies a CreateSshPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSshPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest; + + /** + * Creates a plain object from a CreateSshPublicKeyRequest message. Also converts values to other types if specified. + * @param message CreateSshPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSshPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSshPublicKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a DeletePosixAccountRequest. */ interface IDeletePosixAccountRequest { @@ -1751,6 +2011,9 @@ export namespace google { /** GetLoginProfileRequest systemId */ systemId?: (string|null); + + /** GetLoginProfileRequest view */ + view?: (google.cloud.oslogin.v1beta.LoginProfileView|keyof typeof google.cloud.oslogin.v1beta.LoginProfileView|null); } /** Represents a GetLoginProfileRequest. */ @@ -1771,6 +2034,9 @@ export namespace google { /** GetLoginProfileRequest systemId. */ public systemId: string; + /** GetLoginProfileRequest view. */ + public view: (google.cloud.oslogin.v1beta.LoginProfileView|keyof typeof google.cloud.oslogin.v1beta.LoginProfileView); + /** * Creates a new GetLoginProfileRequest instance using the specified properties. * @param [properties] Properties to set @@ -1957,6 +2223,9 @@ export namespace google { /** ImportSshPublicKeyRequest projectId */ projectId?: (string|null); + + /** ImportSshPublicKeyRequest view */ + view?: (google.cloud.oslogin.v1beta.LoginProfileView|keyof typeof google.cloud.oslogin.v1beta.LoginProfileView|null); } /** Represents an ImportSshPublicKeyRequest. */ @@ -1977,6 +2246,9 @@ export namespace google { /** ImportSshPublicKeyRequest projectId. */ public projectId: string; + /** ImportSshPublicKeyRequest view. */ + public view: (google.cloud.oslogin.v1beta.LoginProfileView|keyof typeof google.cloud.oslogin.v1beta.LoginProfileView); + /** * Creates a new ImportSshPublicKeyRequest instance using the specified properties. * @param [properties] Properties to set @@ -2060,6 +2332,9 @@ export namespace google { /** ImportSshPublicKeyResponse loginProfile */ loginProfile?: (google.cloud.oslogin.v1beta.ILoginProfile|null); + + /** ImportSshPublicKeyResponse details */ + details?: (string|null); } /** Represents an ImportSshPublicKeyResponse. */ @@ -2074,6 +2349,9 @@ export namespace google { /** ImportSshPublicKeyResponse loginProfile. */ public loginProfile?: (google.cloud.oslogin.v1beta.ILoginProfile|null); + /** ImportSshPublicKeyResponse details. */ + public details: string; + /** * Creates a new ImportSshPublicKeyResponse instance using the specified properties. * @param [properties] Properties to set @@ -2260,6 +2538,325 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a SecurityKey. */ + interface ISecurityKey { + + /** SecurityKey publicKey */ + publicKey?: (string|null); + + /** SecurityKey privateKey */ + privateKey?: (string|null); + + /** SecurityKey universalTwoFactor */ + universalTwoFactor?: (google.cloud.oslogin.v1beta.IUniversalTwoFactor|null); + + /** SecurityKey webAuthn */ + webAuthn?: (google.cloud.oslogin.v1beta.IWebAuthn|null); + } + + /** Represents a SecurityKey. */ + class SecurityKey implements ISecurityKey { + + /** + * Constructs a new SecurityKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1beta.ISecurityKey); + + /** SecurityKey publicKey. */ + public publicKey: string; + + /** SecurityKey privateKey. */ + public privateKey: string; + + /** SecurityKey universalTwoFactor. */ + public universalTwoFactor?: (google.cloud.oslogin.v1beta.IUniversalTwoFactor|null); + + /** SecurityKey webAuthn. */ + public webAuthn?: (google.cloud.oslogin.v1beta.IWebAuthn|null); + + /** SecurityKey protocolType. */ + public protocolType?: ("universalTwoFactor"|"webAuthn"); + + /** + * Creates a new SecurityKey instance using the specified properties. + * @param [properties] Properties to set + * @returns SecurityKey instance + */ + public static create(properties?: google.cloud.oslogin.v1beta.ISecurityKey): google.cloud.oslogin.v1beta.SecurityKey; + + /** + * Encodes the specified SecurityKey message. Does not implicitly {@link google.cloud.oslogin.v1beta.SecurityKey.verify|verify} messages. + * @param message SecurityKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1beta.ISecurityKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecurityKey message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.SecurityKey.verify|verify} messages. + * @param message SecurityKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1beta.ISecurityKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecurityKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecurityKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1beta.SecurityKey; + + /** + * Decodes a SecurityKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecurityKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1beta.SecurityKey; + + /** + * Verifies a SecurityKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecurityKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecurityKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1beta.SecurityKey; + + /** + * Creates a plain object from a SecurityKey message. Also converts values to other types if specified. + * @param message SecurityKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1beta.SecurityKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecurityKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecurityKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UniversalTwoFactor. */ + interface IUniversalTwoFactor { + + /** UniversalTwoFactor appId */ + appId?: (string|null); + } + + /** Represents an UniversalTwoFactor. */ + class UniversalTwoFactor implements IUniversalTwoFactor { + + /** + * Constructs a new UniversalTwoFactor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1beta.IUniversalTwoFactor); + + /** UniversalTwoFactor appId. */ + public appId: string; + + /** + * Creates a new UniversalTwoFactor instance using the specified properties. + * @param [properties] Properties to set + * @returns UniversalTwoFactor instance + */ + public static create(properties?: google.cloud.oslogin.v1beta.IUniversalTwoFactor): google.cloud.oslogin.v1beta.UniversalTwoFactor; + + /** + * Encodes the specified UniversalTwoFactor message. Does not implicitly {@link google.cloud.oslogin.v1beta.UniversalTwoFactor.verify|verify} messages. + * @param message UniversalTwoFactor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1beta.IUniversalTwoFactor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UniversalTwoFactor message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.UniversalTwoFactor.verify|verify} messages. + * @param message UniversalTwoFactor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1beta.IUniversalTwoFactor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UniversalTwoFactor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UniversalTwoFactor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1beta.UniversalTwoFactor; + + /** + * Decodes an UniversalTwoFactor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UniversalTwoFactor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1beta.UniversalTwoFactor; + + /** + * Verifies an UniversalTwoFactor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UniversalTwoFactor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UniversalTwoFactor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1beta.UniversalTwoFactor; + + /** + * Creates a plain object from an UniversalTwoFactor message. Also converts values to other types if specified. + * @param message UniversalTwoFactor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1beta.UniversalTwoFactor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UniversalTwoFactor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UniversalTwoFactor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WebAuthn. */ + interface IWebAuthn { + + /** WebAuthn rpId */ + rpId?: (string|null); + } + + /** Represents a WebAuthn. */ + class WebAuthn implements IWebAuthn { + + /** + * Constructs a new WebAuthn. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1beta.IWebAuthn); + + /** WebAuthn rpId. */ + public rpId: string; + + /** + * Creates a new WebAuthn instance using the specified properties. + * @param [properties] Properties to set + * @returns WebAuthn instance + */ + public static create(properties?: google.cloud.oslogin.v1beta.IWebAuthn): google.cloud.oslogin.v1beta.WebAuthn; + + /** + * Encodes the specified WebAuthn message. Does not implicitly {@link google.cloud.oslogin.v1beta.WebAuthn.verify|verify} messages. + * @param message WebAuthn message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1beta.IWebAuthn, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebAuthn message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.WebAuthn.verify|verify} messages. + * @param message WebAuthn message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1beta.IWebAuthn, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebAuthn message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebAuthn + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1beta.WebAuthn; + + /** + * Decodes a WebAuthn message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebAuthn + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1beta.WebAuthn; + + /** + * Verifies a WebAuthn message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebAuthn message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebAuthn + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1beta.WebAuthn; + + /** + * Creates a plain object from a WebAuthn message. Also converts values to other types if specified. + * @param message WebAuthn + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1beta.WebAuthn, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebAuthn to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WebAuthn + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** LoginProfileView enum. */ + enum LoginProfileView { + LOGIN_PROFILE_VIEW_UNSPECIFIED = 0, + BASIC = 1, + SECURITY_KEY = 2 + } } } } diff --git a/packages/google-cloud-oslogin/protos/protos.js b/packages/google-cloud-oslogin/protos/protos.js index fcbdf1da119..7fd62425e5b 100644 --- a/packages/google-cloud-oslogin/protos/protos.js +++ b/packages/google-cloud-oslogin/protos/protos.js @@ -899,6 +899,39 @@ return new this(rpcImpl, requestDelimited, responseDelimited); }; + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService|createSshPublicKey}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef CreateSshPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.oslogin.common.SshPublicKey} [response] SshPublicKey + */ + + /** + * Calls CreateSshPublicKey. + * @function createSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.ICreateSshPublicKeyRequest} request CreateSshPublicKeyRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKeyCallback} callback Node-style callback called with the error, if any, and SshPublicKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.createSshPublicKey = function createSshPublicKey(request, callback) { + return this.rpcCall(createSshPublicKey, $root.google.cloud.oslogin.v1.CreateSshPublicKeyRequest, $root.google.cloud.oslogin.common.SshPublicKey, request, callback); + }, "name", { value: "CreateSshPublicKey" }); + + /** + * Calls CreateSshPublicKey. + * @function createSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.ICreateSshPublicKeyRequest} request CreateSshPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService|deletePosixAccount}. * @memberof google.cloud.oslogin.v1.OsLoginService @@ -1414,6 +1447,238 @@ return LoginProfile; })(); + v1.CreateSshPublicKeyRequest = (function() { + + /** + * Properties of a CreateSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @interface ICreateSshPublicKeyRequest + * @property {string|null} [parent] CreateSshPublicKeyRequest parent + * @property {google.cloud.oslogin.common.ISshPublicKey|null} [sshPublicKey] CreateSshPublicKeyRequest sshPublicKey + */ + + /** + * Constructs a new CreateSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents a CreateSshPublicKeyRequest. + * @implements ICreateSshPublicKeyRequest + * @constructor + * @param {google.cloud.oslogin.v1.ICreateSshPublicKeyRequest=} [properties] Properties to set + */ + function CreateSshPublicKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateSshPublicKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @instance + */ + CreateSshPublicKeyRequest.prototype.parent = ""; + + /** + * CreateSshPublicKeyRequest sshPublicKey. + * @member {google.cloud.oslogin.common.ISshPublicKey|null|undefined} sshPublicKey + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @instance + */ + CreateSshPublicKeyRequest.prototype.sshPublicKey = null; + + /** + * Creates a new CreateSshPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.ICreateSshPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest instance + */ + CreateSshPublicKeyRequest.create = function create(properties) { + return new CreateSshPublicKeyRequest(properties); + }; + + /** + * Encodes the specified CreateSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.CreateSshPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.ICreateSshPublicKeyRequest} message CreateSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSshPublicKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.sshPublicKey != null && Object.hasOwnProperty.call(message, "sshPublicKey")) + $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.CreateSshPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.ICreateSshPublicKeyRequest} message CreateSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSshPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSshPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.CreateSshPublicKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSshPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSshPublicKeyRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSshPublicKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) { + var error = $root.google.cloud.oslogin.common.SshPublicKey.verify(message.sshPublicKey); + if (error) + return "sshPublicKey." + error; + } + return null; + }; + + /** + * Creates a CreateSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest + */ + CreateSshPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.CreateSshPublicKeyRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.CreateSshPublicKeyRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sshPublicKey != null) { + if (typeof object.sshPublicKey !== "object") + throw TypeError(".google.cloud.oslogin.v1.CreateSshPublicKeyRequest.sshPublicKey: object expected"); + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.fromObject(object.sshPublicKey); + } + return message; + }; + + /** + * Creates a plain object from a CreateSshPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.CreateSshPublicKeyRequest} message CreateSshPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSshPublicKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sshPublicKey = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) + object.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKey, options); + return object; + }; + + /** + * Converts this CreateSshPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSshPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSshPublicKeyRequest + * @function getTypeUrl + * @memberof google.cloud.oslogin.v1.CreateSshPublicKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSshPublicKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.oslogin.v1.CreateSshPublicKeyRequest"; + }; + + return CreateSshPublicKeyRequest; + })(); + v1.DeletePosixAccountRequest = (function() { /** @@ -2535,6 +2800,7 @@ * @memberof google.cloud.oslogin.v1 * @interface IImportSshPublicKeyResponse * @property {google.cloud.oslogin.v1.ILoginProfile|null} [loginProfile] ImportSshPublicKeyResponse loginProfile + * @property {string|null} [details] ImportSshPublicKeyResponse details */ /** @@ -2560,6 +2826,14 @@ */ ImportSshPublicKeyResponse.prototype.loginProfile = null; + /** + * ImportSshPublicKeyResponse details. + * @member {string} details + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @instance + */ + ImportSshPublicKeyResponse.prototype.details = ""; + /** * Creates a new ImportSshPublicKeyResponse instance using the specified properties. * @function create @@ -2586,6 +2860,8 @@ writer = $Writer.create(); if (message.loginProfile != null && Object.hasOwnProperty.call(message, "loginProfile")) $root.google.cloud.oslogin.v1.LoginProfile.encode(message.loginProfile, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.details); return writer; }; @@ -2624,6 +2900,10 @@ message.loginProfile = $root.google.cloud.oslogin.v1.LoginProfile.decode(reader, reader.uint32()); break; } + case 2: { + message.details = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2664,6 +2944,9 @@ if (error) return "loginProfile." + error; } + if (message.details != null && message.hasOwnProperty("details")) + if (!$util.isString(message.details)) + return "details: string expected"; return null; }; @@ -2684,6 +2967,8 @@ throw TypeError(".google.cloud.oslogin.v1.ImportSshPublicKeyResponse.loginProfile: object expected"); message.loginProfile = $root.google.cloud.oslogin.v1.LoginProfile.fromObject(object.loginProfile); } + if (object.details != null) + message.details = String(object.details); return message; }; @@ -2700,10 +2985,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.loginProfile = null; + object.details = ""; + } if (message.loginProfile != null && message.hasOwnProperty("loginProfile")) object.loginProfile = $root.google.cloud.oslogin.v1.LoginProfile.toObject(message.loginProfile, options); + if (message.details != null && message.hasOwnProperty("details")) + object.details = message.details; return object; }; @@ -3040,6 +3329,39 @@ return new this(rpcImpl, requestDelimited, responseDelimited); }; + /** + * Callback as used by {@link google.cloud.oslogin.v1beta.OsLoginService|createSshPublicKey}. + * @memberof google.cloud.oslogin.v1beta.OsLoginService + * @typedef CreateSshPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.oslogin.common.SshPublicKey} [response] SshPublicKey + */ + + /** + * Calls CreateSshPublicKey. + * @function createSshPublicKey + * @memberof google.cloud.oslogin.v1beta.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest} request CreateSshPublicKeyRequest message or plain object + * @param {google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKeyCallback} callback Node-style callback called with the error, if any, and SshPublicKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.createSshPublicKey = function createSshPublicKey(request, callback) { + return this.rpcCall(createSshPublicKey, $root.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest, $root.google.cloud.oslogin.common.SshPublicKey, request, callback); + }, "name", { value: "CreateSshPublicKey" }); + + /** + * Calls CreateSshPublicKey. + * @function createSshPublicKey + * @memberof google.cloud.oslogin.v1beta.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest} request CreateSshPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.oslogin.v1beta.OsLoginService|deletePosixAccount}. * @memberof google.cloud.oslogin.v1beta.OsLoginService @@ -3250,6 +3572,7 @@ * @property {string|null} [name] LoginProfile name * @property {Array.|null} [posixAccounts] LoginProfile posixAccounts * @property {Object.|null} [sshPublicKeys] LoginProfile sshPublicKeys + * @property {Array.|null} [securityKeys] LoginProfile securityKeys */ /** @@ -3263,6 +3586,7 @@ function LoginProfile(properties) { this.posixAccounts = []; this.sshPublicKeys = {}; + this.securityKeys = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3293,6 +3617,14 @@ */ LoginProfile.prototype.sshPublicKeys = $util.emptyObject; + /** + * LoginProfile securityKeys. + * @member {Array.} securityKeys + * @memberof google.cloud.oslogin.v1beta.LoginProfile + * @instance + */ + LoginProfile.prototype.securityKeys = $util.emptyArray; + /** * Creates a new LoginProfile instance using the specified properties. * @function create @@ -3327,6 +3659,9 @@ writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKeys[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } + if (message.securityKeys != null && message.securityKeys.length) + for (var i = 0; i < message.securityKeys.length; ++i) + $root.google.cloud.oslogin.v1beta.SecurityKey.encode(message.securityKeys[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -3394,6 +3729,12 @@ message.sshPublicKeys[key] = value; break; } + case 5: { + if (!(message.securityKeys && message.securityKeys.length)) + message.securityKeys = []; + message.securityKeys.push($root.google.cloud.oslogin.v1beta.SecurityKey.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -3451,6 +3792,15 @@ return "sshPublicKeys." + error; } } + if (message.securityKeys != null && message.hasOwnProperty("securityKeys")) { + if (!Array.isArray(message.securityKeys)) + return "securityKeys: array expected"; + for (var i = 0; i < message.securityKeys.length; ++i) { + var error = $root.google.cloud.oslogin.v1beta.SecurityKey.verify(message.securityKeys[i]); + if (error) + return "securityKeys." + error; + } + } return null; }; @@ -3488,6 +3838,16 @@ message.sshPublicKeys[keys[i]] = $root.google.cloud.oslogin.common.SshPublicKey.fromObject(object.sshPublicKeys[keys[i]]); } } + if (object.securityKeys) { + if (!Array.isArray(object.securityKeys)) + throw TypeError(".google.cloud.oslogin.v1beta.LoginProfile.securityKeys: array expected"); + message.securityKeys = []; + for (var i = 0; i < object.securityKeys.length; ++i) { + if (typeof object.securityKeys[i] !== "object") + throw TypeError(".google.cloud.oslogin.v1beta.LoginProfile.securityKeys: object expected"); + message.securityKeys[i] = $root.google.cloud.oslogin.v1beta.SecurityKey.fromObject(object.securityKeys[i]); + } + } return message; }; @@ -3504,8 +3864,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.posixAccounts = []; + object.securityKeys = []; + } if (options.objects || options.defaults) object.sshPublicKeys = {}; if (options.defaults) @@ -3523,6 +3885,11 @@ for (var j = 0; j < keys2.length; ++j) object.sshPublicKeys[keys2[j]] = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKeys[keys2[j]], options); } + if (message.securityKeys && message.securityKeys.length) { + object.securityKeys = []; + for (var j = 0; j < message.securityKeys.length; ++j) + object.securityKeys[j] = $root.google.cloud.oslogin.v1beta.SecurityKey.toObject(message.securityKeys[j], options); + } return object; }; @@ -3555,24 +3922,25 @@ return LoginProfile; })(); - v1beta.DeletePosixAccountRequest = (function() { + v1beta.CreateSshPublicKeyRequest = (function() { /** - * Properties of a DeletePosixAccountRequest. + * Properties of a CreateSshPublicKeyRequest. * @memberof google.cloud.oslogin.v1beta - * @interface IDeletePosixAccountRequest - * @property {string|null} [name] DeletePosixAccountRequest name + * @interface ICreateSshPublicKeyRequest + * @property {string|null} [parent] CreateSshPublicKeyRequest parent + * @property {google.cloud.oslogin.common.ISshPublicKey|null} [sshPublicKey] CreateSshPublicKeyRequest sshPublicKey */ /** - * Constructs a new DeletePosixAccountRequest. + * Constructs a new CreateSshPublicKeyRequest. * @memberof google.cloud.oslogin.v1beta - * @classdesc Represents a DeletePosixAccountRequest. - * @implements IDeletePosixAccountRequest + * @classdesc Represents a CreateSshPublicKeyRequest. + * @implements ICreateSshPublicKeyRequest * @constructor - * @param {google.cloud.oslogin.v1beta.IDeletePosixAccountRequest=} [properties] Properties to set + * @param {google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest=} [properties] Properties to set */ - function DeletePosixAccountRequest(properties) { + function CreateSshPublicKeyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3580,16 +3948,247 @@ } /** - * DeletePosixAccountRequest name. - * @member {string} name - * @memberof google.cloud.oslogin.v1beta.DeletePosixAccountRequest + * CreateSshPublicKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest * @instance */ - DeletePosixAccountRequest.prototype.name = ""; + CreateSshPublicKeyRequest.prototype.parent = ""; /** - * Creates a new DeletePosixAccountRequest instance using the specified properties. - * @function create + * CreateSshPublicKeyRequest sshPublicKey. + * @member {google.cloud.oslogin.common.ISshPublicKey|null|undefined} sshPublicKey + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @instance + */ + CreateSshPublicKeyRequest.prototype.sshPublicKey = null; + + /** + * Creates a new CreateSshPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest instance + */ + CreateSshPublicKeyRequest.create = function create(properties) { + return new CreateSshPublicKeyRequest(properties); + }; + + /** + * Encodes the specified CreateSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest} message CreateSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSshPublicKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.sshPublicKey != null && Object.hasOwnProperty.call(message, "sshPublicKey")) + $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest} message CreateSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSshPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSshPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSshPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSshPublicKeyRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSshPublicKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) { + var error = $root.google.cloud.oslogin.common.SshPublicKey.verify(message.sshPublicKey); + if (error) + return "sshPublicKey." + error; + } + return null; + }; + + /** + * Creates a CreateSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest} CreateSshPublicKeyRequest + */ + CreateSshPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest) + return object; + var message = new $root.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sshPublicKey != null) { + if (typeof object.sshPublicKey !== "object") + throw TypeError(".google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest.sshPublicKey: object expected"); + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.fromObject(object.sshPublicKey); + } + return message; + }; + + /** + * Creates a plain object from a CreateSshPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest} message CreateSshPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSshPublicKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sshPublicKey = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) + object.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKey, options); + return object; + }; + + /** + * Converts this CreateSshPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSshPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSshPublicKeyRequest + * @function getTypeUrl + * @memberof google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSshPublicKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest"; + }; + + return CreateSshPublicKeyRequest; + })(); + + v1beta.DeletePosixAccountRequest = (function() { + + /** + * Properties of a DeletePosixAccountRequest. + * @memberof google.cloud.oslogin.v1beta + * @interface IDeletePosixAccountRequest + * @property {string|null} [name] DeletePosixAccountRequest name + */ + + /** + * Constructs a new DeletePosixAccountRequest. + * @memberof google.cloud.oslogin.v1beta + * @classdesc Represents a DeletePosixAccountRequest. + * @implements IDeletePosixAccountRequest + * @constructor + * @param {google.cloud.oslogin.v1beta.IDeletePosixAccountRequest=} [properties] Properties to set + */ + function DeletePosixAccountRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeletePosixAccountRequest name. + * @member {string} name + * @memberof google.cloud.oslogin.v1beta.DeletePosixAccountRequest + * @instance + */ + DeletePosixAccountRequest.prototype.name = ""; + + /** + * Creates a new DeletePosixAccountRequest instance using the specified properties. + * @function create * @memberof google.cloud.oslogin.v1beta.DeletePosixAccountRequest * @static * @param {google.cloud.oslogin.v1beta.IDeletePosixAccountRequest=} [properties] Properties to set @@ -3970,6 +4569,7 @@ * @property {string|null} [name] GetLoginProfileRequest name * @property {string|null} [projectId] GetLoginProfileRequest projectId * @property {string|null} [systemId] GetLoginProfileRequest systemId + * @property {google.cloud.oslogin.v1beta.LoginProfileView|null} [view] GetLoginProfileRequest view */ /** @@ -4011,6 +4611,14 @@ */ GetLoginProfileRequest.prototype.systemId = ""; + /** + * GetLoginProfileRequest view. + * @member {google.cloud.oslogin.v1beta.LoginProfileView} view + * @memberof google.cloud.oslogin.v1beta.GetLoginProfileRequest + * @instance + */ + GetLoginProfileRequest.prototype.view = 0; + /** * Creates a new GetLoginProfileRequest instance using the specified properties. * @function create @@ -4041,6 +4649,8 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); if (message.systemId != null && Object.hasOwnProperty.call(message, "systemId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.systemId); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.view); return writer; }; @@ -4087,6 +4697,10 @@ message.systemId = reader.string(); break; } + case 4: { + message.view = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -4131,6 +4745,15 @@ if (message.systemId != null && message.hasOwnProperty("systemId")) if (!$util.isString(message.systemId)) return "systemId: string expected"; + if (message.view != null && message.hasOwnProperty("view")) + switch (message.view) { + default: + return "view: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -4152,6 +4775,26 @@ message.projectId = String(object.projectId); if (object.systemId != null) message.systemId = String(object.systemId); + switch (object.view) { + default: + if (typeof object.view === "number") { + message.view = object.view; + break; + } + break; + case "LOGIN_PROFILE_VIEW_UNSPECIFIED": + case 0: + message.view = 0; + break; + case "BASIC": + case 1: + message.view = 1; + break; + case "SECURITY_KEY": + case 2: + message.view = 2; + break; + } return message; }; @@ -4172,6 +4815,7 @@ object.name = ""; object.projectId = ""; object.systemId = ""; + object.view = options.enums === String ? "LOGIN_PROFILE_VIEW_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -4179,6 +4823,8 @@ object.projectId = message.projectId; if (message.systemId != null && message.hasOwnProperty("systemId")) object.systemId = message.systemId; + if (message.view != null && message.hasOwnProperty("view")) + object.view = options.enums === String ? $root.google.cloud.oslogin.v1beta.LoginProfileView[message.view] === undefined ? message.view : $root.google.cloud.oslogin.v1beta.LoginProfileView[message.view] : message.view; return object; }; @@ -4423,6 +5069,7 @@ * @property {string|null} [parent] ImportSshPublicKeyRequest parent * @property {google.cloud.oslogin.common.ISshPublicKey|null} [sshPublicKey] ImportSshPublicKeyRequest sshPublicKey * @property {string|null} [projectId] ImportSshPublicKeyRequest projectId + * @property {google.cloud.oslogin.v1beta.LoginProfileView|null} [view] ImportSshPublicKeyRequest view */ /** @@ -4464,6 +5111,14 @@ */ ImportSshPublicKeyRequest.prototype.projectId = ""; + /** + * ImportSshPublicKeyRequest view. + * @member {google.cloud.oslogin.v1beta.LoginProfileView} view + * @memberof google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest + * @instance + */ + ImportSshPublicKeyRequest.prototype.view = 0; + /** * Creates a new ImportSshPublicKeyRequest instance using the specified properties. * @function create @@ -4494,6 +5149,8 @@ $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.projectId); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.view); return writer; }; @@ -4540,6 +5197,10 @@ message.projectId = reader.string(); break; } + case 4: { + message.view = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -4586,6 +5247,15 @@ if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; + if (message.view != null && message.hasOwnProperty("view")) + switch (message.view) { + default: + return "view: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -4610,6 +5280,26 @@ } if (object.projectId != null) message.projectId = String(object.projectId); + switch (object.view) { + default: + if (typeof object.view === "number") { + message.view = object.view; + break; + } + break; + case "LOGIN_PROFILE_VIEW_UNSPECIFIED": + case 0: + message.view = 0; + break; + case "BASIC": + case 1: + message.view = 1; + break; + case "SECURITY_KEY": + case 2: + message.view = 2; + break; + } return message; }; @@ -4630,6 +5320,7 @@ object.parent = ""; object.sshPublicKey = null; object.projectId = ""; + object.view = options.enums === String ? "LOGIN_PROFILE_VIEW_UNSPECIFIED" : 0; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -4637,6 +5328,8 @@ object.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKey, options); if (message.projectId != null && message.hasOwnProperty("projectId")) object.projectId = message.projectId; + if (message.view != null && message.hasOwnProperty("view")) + object.view = options.enums === String ? $root.google.cloud.oslogin.v1beta.LoginProfileView[message.view] === undefined ? message.view : $root.google.cloud.oslogin.v1beta.LoginProfileView[message.view] : message.view; return object; }; @@ -4676,6 +5369,7 @@ * @memberof google.cloud.oslogin.v1beta * @interface IImportSshPublicKeyResponse * @property {google.cloud.oslogin.v1beta.ILoginProfile|null} [loginProfile] ImportSshPublicKeyResponse loginProfile + * @property {string|null} [details] ImportSshPublicKeyResponse details */ /** @@ -4701,6 +5395,14 @@ */ ImportSshPublicKeyResponse.prototype.loginProfile = null; + /** + * ImportSshPublicKeyResponse details. + * @member {string} details + * @memberof google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse + * @instance + */ + ImportSshPublicKeyResponse.prototype.details = ""; + /** * Creates a new ImportSshPublicKeyResponse instance using the specified properties. * @function create @@ -4727,6 +5429,8 @@ writer = $Writer.create(); if (message.loginProfile != null && Object.hasOwnProperty.call(message, "loginProfile")) $root.google.cloud.oslogin.v1beta.LoginProfile.encode(message.loginProfile, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.details); return writer; }; @@ -4765,6 +5469,10 @@ message.loginProfile = $root.google.cloud.oslogin.v1beta.LoginProfile.decode(reader, reader.uint32()); break; } + case 2: { + message.details = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -4805,6 +5513,9 @@ if (error) return "loginProfile." + error; } + if (message.details != null && message.hasOwnProperty("details")) + if (!$util.isString(message.details)) + return "details: string expected"; return null; }; @@ -4825,6 +5536,8 @@ throw TypeError(".google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse.loginProfile: object expected"); message.loginProfile = $root.google.cloud.oslogin.v1beta.LoginProfile.fromObject(object.loginProfile); } + if (object.details != null) + message.details = String(object.details); return message; }; @@ -4841,10 +5554,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.loginProfile = null; + object.details = ""; + } if (message.loginProfile != null && message.hasOwnProperty("loginProfile")) object.loginProfile = $root.google.cloud.oslogin.v1beta.LoginProfile.toObject(message.loginProfile, options); + if (message.details != null && message.hasOwnProperty("details")) + object.details = message.details; return object; }; @@ -5137,6 +5854,738 @@ return UpdateSshPublicKeyRequest; })(); + v1beta.SecurityKey = (function() { + + /** + * Properties of a SecurityKey. + * @memberof google.cloud.oslogin.v1beta + * @interface ISecurityKey + * @property {string|null} [publicKey] SecurityKey publicKey + * @property {string|null} [privateKey] SecurityKey privateKey + * @property {google.cloud.oslogin.v1beta.IUniversalTwoFactor|null} [universalTwoFactor] SecurityKey universalTwoFactor + * @property {google.cloud.oslogin.v1beta.IWebAuthn|null} [webAuthn] SecurityKey webAuthn + */ + + /** + * Constructs a new SecurityKey. + * @memberof google.cloud.oslogin.v1beta + * @classdesc Represents a SecurityKey. + * @implements ISecurityKey + * @constructor + * @param {google.cloud.oslogin.v1beta.ISecurityKey=} [properties] Properties to set + */ + function SecurityKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecurityKey publicKey. + * @member {string} publicKey + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @instance + */ + SecurityKey.prototype.publicKey = ""; + + /** + * SecurityKey privateKey. + * @member {string} privateKey + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @instance + */ + SecurityKey.prototype.privateKey = ""; + + /** + * SecurityKey universalTwoFactor. + * @member {google.cloud.oslogin.v1beta.IUniversalTwoFactor|null|undefined} universalTwoFactor + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @instance + */ + SecurityKey.prototype.universalTwoFactor = null; + + /** + * SecurityKey webAuthn. + * @member {google.cloud.oslogin.v1beta.IWebAuthn|null|undefined} webAuthn + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @instance + */ + SecurityKey.prototype.webAuthn = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SecurityKey protocolType. + * @member {"universalTwoFactor"|"webAuthn"|undefined} protocolType + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @instance + */ + Object.defineProperty(SecurityKey.prototype, "protocolType", { + get: $util.oneOfGetter($oneOfFields = ["universalTwoFactor", "webAuthn"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SecurityKey instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {google.cloud.oslogin.v1beta.ISecurityKey=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1beta.SecurityKey} SecurityKey instance + */ + SecurityKey.create = function create(properties) { + return new SecurityKey(properties); + }; + + /** + * Encodes the specified SecurityKey message. Does not implicitly {@link google.cloud.oslogin.v1beta.SecurityKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {google.cloud.oslogin.v1beta.ISecurityKey} message SecurityKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecurityKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.publicKey); + if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKey); + if (message.universalTwoFactor != null && Object.hasOwnProperty.call(message, "universalTwoFactor")) + $root.google.cloud.oslogin.v1beta.UniversalTwoFactor.encode(message.universalTwoFactor, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.webAuthn != null && Object.hasOwnProperty.call(message, "webAuthn")) + $root.google.cloud.oslogin.v1beta.WebAuthn.encode(message.webAuthn, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SecurityKey message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.SecurityKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {google.cloud.oslogin.v1beta.ISecurityKey} message SecurityKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecurityKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecurityKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1beta.SecurityKey} SecurityKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecurityKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1beta.SecurityKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.publicKey = reader.string(); + break; + } + case 2: { + message.privateKey = reader.string(); + break; + } + case 3: { + message.universalTwoFactor = $root.google.cloud.oslogin.v1beta.UniversalTwoFactor.decode(reader, reader.uint32()); + break; + } + case 4: { + message.webAuthn = $root.google.cloud.oslogin.v1beta.WebAuthn.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecurityKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1beta.SecurityKey} SecurityKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecurityKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecurityKey message. + * @function verify + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecurityKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!$util.isString(message.publicKey)) + return "publicKey: string expected"; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + if (!$util.isString(message.privateKey)) + return "privateKey: string expected"; + if (message.universalTwoFactor != null && message.hasOwnProperty("universalTwoFactor")) { + properties.protocolType = 1; + { + var error = $root.google.cloud.oslogin.v1beta.UniversalTwoFactor.verify(message.universalTwoFactor); + if (error) + return "universalTwoFactor." + error; + } + } + if (message.webAuthn != null && message.hasOwnProperty("webAuthn")) { + if (properties.protocolType === 1) + return "protocolType: multiple values"; + properties.protocolType = 1; + { + var error = $root.google.cloud.oslogin.v1beta.WebAuthn.verify(message.webAuthn); + if (error) + return "webAuthn." + error; + } + } + return null; + }; + + /** + * Creates a SecurityKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1beta.SecurityKey} SecurityKey + */ + SecurityKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1beta.SecurityKey) + return object; + var message = new $root.google.cloud.oslogin.v1beta.SecurityKey(); + if (object.publicKey != null) + message.publicKey = String(object.publicKey); + if (object.privateKey != null) + message.privateKey = String(object.privateKey); + if (object.universalTwoFactor != null) { + if (typeof object.universalTwoFactor !== "object") + throw TypeError(".google.cloud.oslogin.v1beta.SecurityKey.universalTwoFactor: object expected"); + message.universalTwoFactor = $root.google.cloud.oslogin.v1beta.UniversalTwoFactor.fromObject(object.universalTwoFactor); + } + if (object.webAuthn != null) { + if (typeof object.webAuthn !== "object") + throw TypeError(".google.cloud.oslogin.v1beta.SecurityKey.webAuthn: object expected"); + message.webAuthn = $root.google.cloud.oslogin.v1beta.WebAuthn.fromObject(object.webAuthn); + } + return message; + }; + + /** + * Creates a plain object from a SecurityKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {google.cloud.oslogin.v1beta.SecurityKey} message SecurityKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecurityKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.publicKey = ""; + object.privateKey = ""; + } + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = message.publicKey; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + object.privateKey = message.privateKey; + if (message.universalTwoFactor != null && message.hasOwnProperty("universalTwoFactor")) { + object.universalTwoFactor = $root.google.cloud.oslogin.v1beta.UniversalTwoFactor.toObject(message.universalTwoFactor, options); + if (options.oneofs) + object.protocolType = "universalTwoFactor"; + } + if (message.webAuthn != null && message.hasOwnProperty("webAuthn")) { + object.webAuthn = $root.google.cloud.oslogin.v1beta.WebAuthn.toObject(message.webAuthn, options); + if (options.oneofs) + object.protocolType = "webAuthn"; + } + return object; + }; + + /** + * Converts this SecurityKey to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @instance + * @returns {Object.} JSON object + */ + SecurityKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SecurityKey + * @function getTypeUrl + * @memberof google.cloud.oslogin.v1beta.SecurityKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecurityKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.oslogin.v1beta.SecurityKey"; + }; + + return SecurityKey; + })(); + + v1beta.UniversalTwoFactor = (function() { + + /** + * Properties of an UniversalTwoFactor. + * @memberof google.cloud.oslogin.v1beta + * @interface IUniversalTwoFactor + * @property {string|null} [appId] UniversalTwoFactor appId + */ + + /** + * Constructs a new UniversalTwoFactor. + * @memberof google.cloud.oslogin.v1beta + * @classdesc Represents an UniversalTwoFactor. + * @implements IUniversalTwoFactor + * @constructor + * @param {google.cloud.oslogin.v1beta.IUniversalTwoFactor=} [properties] Properties to set + */ + function UniversalTwoFactor(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UniversalTwoFactor appId. + * @member {string} appId + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @instance + */ + UniversalTwoFactor.prototype.appId = ""; + + /** + * Creates a new UniversalTwoFactor instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {google.cloud.oslogin.v1beta.IUniversalTwoFactor=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1beta.UniversalTwoFactor} UniversalTwoFactor instance + */ + UniversalTwoFactor.create = function create(properties) { + return new UniversalTwoFactor(properties); + }; + + /** + * Encodes the specified UniversalTwoFactor message. Does not implicitly {@link google.cloud.oslogin.v1beta.UniversalTwoFactor.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {google.cloud.oslogin.v1beta.IUniversalTwoFactor} message UniversalTwoFactor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UniversalTwoFactor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.appId != null && Object.hasOwnProperty.call(message, "appId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.appId); + return writer; + }; + + /** + * Encodes the specified UniversalTwoFactor message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.UniversalTwoFactor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {google.cloud.oslogin.v1beta.IUniversalTwoFactor} message UniversalTwoFactor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UniversalTwoFactor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UniversalTwoFactor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1beta.UniversalTwoFactor} UniversalTwoFactor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UniversalTwoFactor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1beta.UniversalTwoFactor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.appId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UniversalTwoFactor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1beta.UniversalTwoFactor} UniversalTwoFactor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UniversalTwoFactor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UniversalTwoFactor message. + * @function verify + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UniversalTwoFactor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.appId != null && message.hasOwnProperty("appId")) + if (!$util.isString(message.appId)) + return "appId: string expected"; + return null; + }; + + /** + * Creates an UniversalTwoFactor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1beta.UniversalTwoFactor} UniversalTwoFactor + */ + UniversalTwoFactor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1beta.UniversalTwoFactor) + return object; + var message = new $root.google.cloud.oslogin.v1beta.UniversalTwoFactor(); + if (object.appId != null) + message.appId = String(object.appId); + return message; + }; + + /** + * Creates a plain object from an UniversalTwoFactor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {google.cloud.oslogin.v1beta.UniversalTwoFactor} message UniversalTwoFactor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UniversalTwoFactor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.appId = ""; + if (message.appId != null && message.hasOwnProperty("appId")) + object.appId = message.appId; + return object; + }; + + /** + * Converts this UniversalTwoFactor to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @instance + * @returns {Object.} JSON object + */ + UniversalTwoFactor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UniversalTwoFactor + * @function getTypeUrl + * @memberof google.cloud.oslogin.v1beta.UniversalTwoFactor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UniversalTwoFactor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.oslogin.v1beta.UniversalTwoFactor"; + }; + + return UniversalTwoFactor; + })(); + + v1beta.WebAuthn = (function() { + + /** + * Properties of a WebAuthn. + * @memberof google.cloud.oslogin.v1beta + * @interface IWebAuthn + * @property {string|null} [rpId] WebAuthn rpId + */ + + /** + * Constructs a new WebAuthn. + * @memberof google.cloud.oslogin.v1beta + * @classdesc Represents a WebAuthn. + * @implements IWebAuthn + * @constructor + * @param {google.cloud.oslogin.v1beta.IWebAuthn=} [properties] Properties to set + */ + function WebAuthn(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebAuthn rpId. + * @member {string} rpId + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @instance + */ + WebAuthn.prototype.rpId = ""; + + /** + * Creates a new WebAuthn instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {google.cloud.oslogin.v1beta.IWebAuthn=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1beta.WebAuthn} WebAuthn instance + */ + WebAuthn.create = function create(properties) { + return new WebAuthn(properties); + }; + + /** + * Encodes the specified WebAuthn message. Does not implicitly {@link google.cloud.oslogin.v1beta.WebAuthn.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {google.cloud.oslogin.v1beta.IWebAuthn} message WebAuthn message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebAuthn.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rpId != null && Object.hasOwnProperty.call(message, "rpId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.rpId); + return writer; + }; + + /** + * Encodes the specified WebAuthn message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1beta.WebAuthn.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {google.cloud.oslogin.v1beta.IWebAuthn} message WebAuthn message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebAuthn.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebAuthn message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1beta.WebAuthn} WebAuthn + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebAuthn.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1beta.WebAuthn(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.rpId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebAuthn message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1beta.WebAuthn} WebAuthn + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebAuthn.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebAuthn message. + * @function verify + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebAuthn.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rpId != null && message.hasOwnProperty("rpId")) + if (!$util.isString(message.rpId)) + return "rpId: string expected"; + return null; + }; + + /** + * Creates a WebAuthn message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1beta.WebAuthn} WebAuthn + */ + WebAuthn.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1beta.WebAuthn) + return object; + var message = new $root.google.cloud.oslogin.v1beta.WebAuthn(); + if (object.rpId != null) + message.rpId = String(object.rpId); + return message; + }; + + /** + * Creates a plain object from a WebAuthn message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {google.cloud.oslogin.v1beta.WebAuthn} message WebAuthn + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebAuthn.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rpId = ""; + if (message.rpId != null && message.hasOwnProperty("rpId")) + object.rpId = message.rpId; + return object; + }; + + /** + * Converts this WebAuthn to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @instance + * @returns {Object.} JSON object + */ + WebAuthn.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WebAuthn + * @function getTypeUrl + * @memberof google.cloud.oslogin.v1beta.WebAuthn + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WebAuthn.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.oslogin.v1beta.WebAuthn"; + }; + + return WebAuthn; + })(); + + /** + * LoginProfileView enum. + * @name google.cloud.oslogin.v1beta.LoginProfileView + * @enum {number} + * @property {number} LOGIN_PROFILE_VIEW_UNSPECIFIED=0 LOGIN_PROFILE_VIEW_UNSPECIFIED value + * @property {number} BASIC=1 BASIC value + * @property {number} SECURITY_KEY=2 SECURITY_KEY value + */ + v1beta.LoginProfileView = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOGIN_PROFILE_VIEW_UNSPECIFIED"] = 0; + values[valuesById[1] = "BASIC"] = 1; + values[valuesById[2] = "SECURITY_KEY"] = 2; + return values; + })(); + return v1beta; })(); diff --git a/packages/google-cloud-oslogin/protos/protos.json b/packages/google-cloud-oslogin/protos/protos.json index a07b79a4f36..b3d32e35c8a 100644 --- a/packages/google-cloud-oslogin/protos/protos.json +++ b/packages/google-cloud-oslogin/protos/protos.json @@ -129,9 +129,29 @@ "OsLoginService": { "options": { "(google.api.default_host)": "oslogin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/compute" + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only,https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/compute.readonly" }, "methods": { + "CreateSshPublicKey": { + "requestType": "CreateSshPublicKeyRequest", + "responseType": "google.cloud.oslogin.common.SshPublicKey", + "options": { + "(google.api.http).post": "/v1/{parent=users/*}/sshPublicKeys", + "(google.api.http).body": "ssh_public_key", + "(google.api.method_signature)": "parent,ssh_public_key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=users/*}/sshPublicKeys", + "body": "ssh_public_key" + } + }, + { + "(google.api.method_signature)": "parent,ssh_public_key" + } + ] + }, "DeletePosixAccount": { "requestType": "DeletePosixAccountRequest", "responseType": "google.protobuf.Empty", @@ -273,6 +293,25 @@ } } }, + "CreateSshPublicKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "oslogin.googleapis.com/SshPublicKey" + } + }, + "sshPublicKey": { + "type": "google.cloud.oslogin.common.SshPublicKey", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "DeletePosixAccountRequest": { "fields": { "name": { @@ -357,6 +396,10 @@ "loginProfile": { "type": "LoginProfile", "id": 1 + }, + "details": { + "type": "string", + "id": 2 } } }, @@ -402,6 +445,26 @@ "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only,https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/compute.readonly" }, "methods": { + "CreateSshPublicKey": { + "requestType": "CreateSshPublicKeyRequest", + "responseType": "google.cloud.oslogin.common.SshPublicKey", + "options": { + "(google.api.http).post": "/v1beta/{parent=users/*}/sshPublicKeys", + "(google.api.http).body": "ssh_public_key", + "(google.api.method_signature)": "parent,ssh_public_key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta/{parent=users/*}/sshPublicKeys", + "body": "ssh_public_key" + } + }, + { + "(google.api.method_signature)": "parent,ssh_public_key" + } + ] + }, "DeletePosixAccount": { "requestType": "DeletePosixAccountRequest", "responseType": "google.protobuf.Empty", @@ -540,6 +603,30 @@ "keyType": "string", "type": "google.cloud.oslogin.common.SshPublicKey", "id": 3 + }, + "securityKeys": { + "rule": "repeated", + "type": "SecurityKey", + "id": 5 + } + } + }, + "CreateSshPublicKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "oslogin.googleapis.com/SshPublicKey" + } + }, + "sshPublicKey": { + "type": "google.cloud.oslogin.common.SshPublicKey", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, @@ -584,6 +671,10 @@ "systemId": { "type": "string", "id": 3 + }, + "view": { + "type": "LoginProfileView", + "id": 4 } } }, @@ -618,6 +709,10 @@ "projectId": { "type": "string", "id": 3 + }, + "view": { + "type": "LoginProfileView", + "id": 4 } } }, @@ -626,6 +721,10 @@ "loginProfile": { "type": "LoginProfile", "id": 1 + }, + "details": { + "type": "string", + "id": 2 } } }, @@ -651,6 +750,57 @@ "id": 3 } } + }, + "SecurityKey": { + "oneofs": { + "protocolType": { + "oneof": [ + "universalTwoFactor", + "webAuthn" + ] + } + }, + "fields": { + "publicKey": { + "type": "string", + "id": 1 + }, + "privateKey": { + "type": "string", + "id": 2 + }, + "universalTwoFactor": { + "type": "UniversalTwoFactor", + "id": 3 + }, + "webAuthn": { + "type": "WebAuthn", + "id": 4 + } + } + }, + "UniversalTwoFactor": { + "fields": { + "appId": { + "type": "string", + "id": 1 + } + } + }, + "WebAuthn": { + "fields": { + "rpId": { + "type": "string", + "id": 1 + } + } + }, + "LoginProfileView": { + "values": { + "LOGIN_PROFILE_VIEW_UNSPECIFIED": 0, + "BASIC": 1, + "SECURITY_KEY": 2 + } } } } diff --git a/packages/google-cloud-oslogin/samples/README.md b/packages/google-cloud-oslogin/samples/README.md index d30af6f0f6a..3dc20ff6749 100644 --- a/packages/google-cloud-oslogin/samples/README.md +++ b/packages/google-cloud-oslogin/samples/README.md @@ -12,12 +12,14 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Os_login_service.create_ssh_public_key](#os_login_service.create_ssh_public_key) * [Os_login_service.delete_posix_account](#os_login_service.delete_posix_account) * [Os_login_service.delete_ssh_public_key](#os_login_service.delete_ssh_public_key) * [Os_login_service.get_login_profile](#os_login_service.get_login_profile) * [Os_login_service.get_ssh_public_key](#os_login_service.get_ssh_public_key) * [Os_login_service.import_ssh_public_key](#os_login_service.import_ssh_public_key) * [Os_login_service.update_ssh_public_key](#os_login_service.update_ssh_public_key) + * [Os_login_service.create_ssh_public_key](#os_login_service.create_ssh_public_key) * [Os_login_service.delete_posix_account](#os_login_service.delete_posix_account) * [Os_login_service.delete_ssh_public_key](#os_login_service.delete_ssh_public_key) * [Os_login_service.get_login_profile](#os_login_service.get_login_profile) @@ -42,6 +44,23 @@ Before running the samples, make sure you've followed the steps outlined in +### Os_login_service.create_ssh_public_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js` + + +----- + + + + ### Os_login_service.delete_posix_account View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js). @@ -144,6 +163,23 @@ __Usage:__ +### Os_login_service.create_ssh_public_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js` + + +----- + + + + ### Os_login_service.delete_posix_account View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js). diff --git a/owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.create_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js similarity index 100% rename from owl-bot-staging/google-cloud-oslogin/v1/samples/generated/v1/os_login_service.create_ssh_public_key.js rename to packages/google-cloud-oslogin/samples/generated/v1/os_login_service.create_ssh_public_key.js diff --git a/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json b/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json index c2069880555..f2a4dcdab33 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json +++ b/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json @@ -11,6 +11,50 @@ ] }, "snippets": [ + { + "regionTag": "oslogin_v1_generated_OsLoginService_CreateSshPublicKey_async", + "title": "OsLoginService createSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Create an SSH public key", + "canonical": true, + "file": "os_login_service.create_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.CreateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, { "regionTag": "oslogin_v1_generated_OsLoginService_DeletePosixAccount_async", "title": "OsLoginService deletePosixAccount Sample", diff --git a/owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.create_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js similarity index 100% rename from owl-bot-staging/google-cloud-oslogin/v1beta/samples/generated/v1beta/os_login_service.create_ssh_public_key.js rename to packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.create_ssh_public_key.js diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js index 97028d9fcd4..ed9ae4af370 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js @@ -40,6 +40,10 @@ function main(name) { * A system ID for filtering the results of the request. */ // const systemId = 'abc123' + /** + * The view configures whether to retrieve security keys information. + */ + // const view = {} // Imports the Oslogin library const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js index d1af96117a4..d3bb62a2ab4 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js @@ -40,6 +40,10 @@ function main(sshPublicKey) { * The project ID of the Google Cloud Platform project. */ // const projectId = 'abc123' + /** + * The view configures whether to retrieve security keys information. + */ + // const view = {} // Imports the Oslogin library const {OsLoginServiceClient} = require('@google-cloud/os-login').v1beta; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json b/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json index a101e659acd..b82dbdbc81c 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json @@ -11,6 +11,50 @@ ] }, "snippets": [ + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_async", + "title": "OsLoginService createSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Create an SSH public key", + "canonical": true, + "file": "os_login_service.create_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "CreateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.CreateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, { "regionTag": "oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_async", "title": "OsLoginService deletePosixAccount Sample", @@ -102,7 +146,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 65, "type": "FULL" } ], @@ -122,6 +166,10 @@ { "name": "system_id", "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.oslogin.v1beta.LoginProfileView" } ], "resultType": ".google.cloud.oslogin.v1beta.LoginProfile", @@ -190,7 +238,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 65, "type": "FULL" } ], @@ -210,6 +258,10 @@ { "name": "project_id", "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.oslogin.v1beta.LoginProfileView" } ], "resultType": ".google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse", diff --git a/packages/google-cloud-oslogin/src/v1/gapic_metadata.json b/packages/google-cloud-oslogin/src/v1/gapic_metadata.json index f89ea9a8605..fc08cf26063 100644 --- a/packages/google-cloud-oslogin/src/v1/gapic_metadata.json +++ b/packages/google-cloud-oslogin/src/v1/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "OsLoginServiceClient", "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, "DeletePosixAccount": { "methods": [ "deletePosixAccount" @@ -45,6 +50,11 @@ "grpc-fallback": { "libraryClient": "OsLoginServiceClient", "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, "DeletePosixAccount": { "methods": [ "deletePosixAccount" diff --git a/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts b/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts index 7d4b6790c93..646d45d18ce 100644 --- a/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts +++ b/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts @@ -121,6 +121,9 @@ export class OsLoginServiceClient { (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; @@ -235,6 +238,7 @@ export class OsLoginServiceClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const osLoginServiceStubMethods = [ + 'createSshPublicKey', 'deletePosixAccount', 'deleteSshPublicKey', 'getLoginProfile', @@ -304,7 +308,9 @@ export class OsLoginServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only', 'https://www.googleapis.com/auth/compute', + 'https://www.googleapis.com/auth/compute.readonly', ]; } @@ -327,6 +333,99 @@ export class OsLoginServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Create an SSH public key + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/os_login_service.create_ssh_public_key.js + * region_tag:oslogin_v1_generated_OsLoginService_CreateSshPublicKey_async + */ + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest | undefined, + {} | undefined + ] + >; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1.ICreateSshPublicKeyRequest | 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.createSshPublicKey(request, options, callback); + } /** * Deletes a POSIX account. * diff --git a/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json b/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json index fc7cef92246..afdd4ec0a35 100644 --- a/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json +++ b/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json @@ -20,6 +20,10 @@ } }, "methods": { + "CreateSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "DeletePosixAccount": { "timeout_millis": 10000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-oslogin/src/v1beta/gapic_metadata.json b/packages/google-cloud-oslogin/src/v1beta/gapic_metadata.json index 10c49f7afb6..ad42910537d 100644 --- a/packages/google-cloud-oslogin/src/v1beta/gapic_metadata.json +++ b/packages/google-cloud-oslogin/src/v1beta/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "OsLoginServiceClient", "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, "DeletePosixAccount": { "methods": [ "deletePosixAccount" @@ -45,6 +50,11 @@ "grpc-fallback": { "libraryClient": "OsLoginServiceClient", "rpcs": { + "CreateSshPublicKey": { + "methods": [ + "createSshPublicKey" + ] + }, "DeletePosixAccount": { "methods": [ "deletePosixAccount" diff --git a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts index 1a09589b039..2649fe6ae63 100644 --- a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts +++ b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts @@ -121,6 +121,9 @@ export class OsLoginServiceClient { (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; @@ -235,6 +238,7 @@ export class OsLoginServiceClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const osLoginServiceStubMethods = [ + 'createSshPublicKey', 'deletePosixAccount', 'deleteSshPublicKey', 'getLoginProfile', @@ -329,6 +333,99 @@ export class OsLoginServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Create an SSH public key + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @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 [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/os_login_service.create_ssh_public_key.js + * region_tag:oslogin_v1beta_generated_OsLoginService_CreateSshPublicKey_async + */ + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest | undefined, + {} | undefined + ] + >; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSshPublicKey( + request: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + callback: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSshPublicKey( + request?: protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.oslogin.common.ISshPublicKey, + | protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.oslogin.common.ISshPublicKey, + protos.google.cloud.oslogin.v1beta.ICreateSshPublicKeyRequest | 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.createSshPublicKey(request, options, callback); + } /** * Deletes a POSIX account. * @@ -527,6 +624,8 @@ export class OsLoginServiceClient { * The project ID of the Google Cloud Platform project. * @param {string} request.systemId * A system ID for filtering the results of the request. + * @param {google.cloud.oslogin.v1beta.LoginProfileView} request.view + * The view configures whether to retrieve security keys information. * @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. @@ -717,6 +816,8 @@ export class OsLoginServiceClient { * Required. The SSH public key and expiration time. * @param {string} request.projectId * The project ID of the Google Cloud Platform project. + * @param {google.cloud.oslogin.v1beta.LoginProfileView} request.view + * The view configures whether to retrieve security keys information. * @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. diff --git a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client_config.json b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client_config.json index 6dba4859a32..d45946b5241 100644 --- a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client_config.json +++ b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client_config.json @@ -20,6 +20,10 @@ } }, "methods": { + "CreateSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "DeletePosixAccount": { "timeout_millis": 10000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts index 782c2f881cd..0e5e028af8f 100644 --- a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts +++ b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts @@ -164,6 +164,137 @@ describe('v1.OsLoginServiceClient', () => { }); }); + describe('createSshPublicKey', () => { + it('invokes createSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = + stubSimpleCall(expectedResponse); + const [response] = await client.createSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSshPublicKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.oslogin.common.ISshPublicKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSshPublicKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createSshPublicKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSshPublicKey(request), expectedError); + }); + }); + describe('deletePosixAccount', () => { it('invokes deletePosixAccount without error', async () => { const client = new osloginserviceModule.v1.OsLoginServiceClient({ diff --git a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts index 2569ed64caa..beb2206e3c7 100644 --- a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts +++ b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts @@ -164,6 +164,137 @@ describe('v1beta.OsLoginServiceClient', () => { }); }); + describe('createSshPublicKey', () => { + it('invokes createSshPublicKey without error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = + stubSimpleCall(expectedResponse); + const [response] = await client.createSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey without error using callback', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.oslogin.common.SshPublicKey() + ); + client.innerApiCalls.createSshPublicKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSshPublicKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.oslogin.common.ISshPublicKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with error', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSshPublicKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createSshPublicKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSshPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.oslogin.v1beta.CreateSshPublicKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSshPublicKey(request), expectedError); + }); + }); + describe('deletePosixAccount', () => { it('invokes deletePosixAccount without error', async () => { const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ diff --git a/release-please-config.json b/release-please-config.json index 3790b02fa0d..c41931bd7f9 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -78,7 +78,6 @@ "packages/google-cloud-security-privateca": {}, "packages/google-cloud-secretmanager": {}, "packages/google-cloud-scheduler": {}, - "packages/google-cloud-secretmanager": {}, "packages/google-cloud-security-publicca": {}, "packages/google-cloud-servicedirectory": {}, "packages/google-cloud-shell": {},