From 6cb3acfbe2811bbc46accac4aba476d3534077f5 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 22 Jun 2021 00:54:42 +0000 Subject: [PATCH 1/2] chore: remove all monolith Bazel deps chore: release gapic-generator-csharp v1.3.7 chore: release gapic-generator-go 0.20.5 chore: release gapic-generator-java 1.0.14 chore: release gapic-generator-php 1.0.1 chore: release gapic-generator-python 0.50.0 chore: update gapic-generator-ruby to the latest commit chore: release gapic-generator-typescript 1.5.0 Committer: @miraleung PiperOrigin-RevId: 380641501 Source-Link: https://github.com/googleapis/googleapis/commit/076f7e9f0b258bdb54338895d7251b202e8f0de3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/27e4c88b4048e5f56508d4e1aa417d60a3380892 --- owl-bot-staging/v1/.eslintignore | 6 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 ++ owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 10 + owl-bot-staging/v1/package.json | 64 ++ .../google/cloud/oslogin/common/common.proto | 111 +++ .../google/cloud/oslogin/v1/oslogin.proto | 212 +++++ owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 83 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/src/v1/os_login_service_client.ts | 850 +++++++++++++++++ .../v1/os_login_service_client_config.json | 56 ++ .../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 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_os_login_service_v1.ts | 733 +++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 ++ owl-bot-staging/v1beta/.eslintignore | 6 + owl-bot-staging/v1beta/.eslintrc.json | 3 + owl-bot-staging/v1beta/.gitignore | 14 + owl-bot-staging/v1beta/.jsdoc.js | 55 ++ owl-bot-staging/v1beta/.mocharc.js | 33 + owl-bot-staging/v1beta/.prettierrc.js | 22 + owl-bot-staging/v1beta/README.md | 1 + owl-bot-staging/v1beta/linkinator.config.json | 10 + owl-bot-staging/v1beta/package.json | 64 ++ .../google/cloud/oslogin/common/common.proto | 111 +++ .../google/cloud/oslogin/v1beta/oslogin.proto | 208 +++++ owl-bot-staging/v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/gapic_metadata.json | 83 ++ owl-bot-staging/v1beta/src/v1beta/index.ts | 19 + .../src/v1beta/os_login_service_client.ts | 852 ++++++++++++++++++ .../os_login_service_client_config.json | 56 ++ .../v1beta/os_login_service_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1beta/system-test/install.ts | 49 + .../test/gapic_os_login_service_v1beta.ts | 733 +++++++++++++++ owl-bot-staging/v1beta/tsconfig.json | 19 + owl-bot-staging/v1beta/webpack.config.js | 64 ++ 46 files changed, 4982 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/oslogin/v1/oslogin.proto create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/os_login_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/os_login_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/os_login_service_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_os_login_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1beta/.eslintignore create mode 100644 owl-bot-staging/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/v1beta/.gitignore create mode 100644 owl-bot-staging/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/v1beta/.mocharc.js create mode 100644 owl-bot-staging/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/v1beta/README.md create mode 100644 owl-bot-staging/v1beta/linkinator.config.json create mode 100644 owl-bot-staging/v1beta/package.json create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto create mode 100644 owl-bot-staging/v1beta/src/index.ts create mode 100644 owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts create mode 100644 owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json create mode 100644 owl-bot-staging/v1beta/src/v1beta/os_login_service_proto_list.json create mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts create mode 100644 owl-bot-staging/v1beta/tsconfig.json create mode 100644 owl-bot-staging/v1beta/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..521dc25 --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..68c8a94 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/os-login', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..50bc7f7 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..84f4713 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..f7acdc8 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Oslogin: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..29a223b --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..255fd59 --- /dev/null +++ b/owl-bot-staging/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/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.15.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^8.4.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto new file mode 100644 index 0000000..4d9755f --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto @@ -0,0 +1,111 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.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"; + +// Define a "User" resource owned by OS Login. +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/v1/protos/google/cloud/oslogin/v1/oslogin.proto b/owl-bot-staging/v1/protos/google/cloud/oslogin/v1/oslogin.proto new file mode 100644 index 0000000..25e9be0 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/oslogin/v1/oslogin.proto @@ -0,0 +1,212 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.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/compute"; + + // 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 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; +} + +// 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/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..c88a38f --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const 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/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..f89ea9a --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,83 @@ +{ + "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": { + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "OsLoginServiceClient", + "rpcs": { + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..a977968 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/v1/src/v1/os_login_service_client.ts b/owl-bot-staging/v1/src/v1/os_login_service_client.ts new file mode 100644 index 0000000..e566a50 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/os_login_service_client.ts @@ -0,0 +1,850 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} 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 _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + 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/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof OsLoginServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + 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 = {}; + } + + /** + * 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) 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 = + ['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.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/compute' + ]; + } + + 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 -- + // ------------------- + 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; +/** + * 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 + * const [response] = await client.deletePosixAccount(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deletePosixAccount(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.deleteSshPublicKey(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSshPublicKey(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.getLoginProfile(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getLoginProfile(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.getSshPublicKey(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSshPublicKey(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.importSshPublicKey(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importSshPublicKey(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.updateSshPublicKey(request); + */ + 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' + ] = gax.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 { + this.initialize(); + if (!this._terminated) { + return this.osLoginServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/os_login_service_client_config.json b/owl-bot-staging/v1/src/v1/os_login_service_client_config.json new file mode 100644 index 0000000..fc7cef9 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/os_login_service_client_config.json @@ -0,0 +1,56 @@ +{ + "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": { + "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/v1/src/v1/os_login_service_proto_list.json b/owl-bot-staging/v1/src/v1/os_login_service_proto_list.json new file mode 100644 index 0000000..46f125e --- /dev/null +++ b/owl-bot-staging/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/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..106f705 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const oslogin = require('@google-cloud/os-login'); + +function main() { + const osLoginServiceClient = new oslogin.OsLoginServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..5a540eb --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {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/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..1f850b5 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_os_login_service_v1.ts b/owl-bot-staging/v1/test/gapic_os_login_service_v1.ts new file mode 100644 index 0000000..7abbdf0 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_os_login_service_v1.ts @@ -0,0 +1,733 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as osloginserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1.OsLoginServiceClient', () => { + 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', () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + 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('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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); + const [response] = await client.deletePosixAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deletePosixAccount(request), expectedError); + assert((client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLoginProfile(request), expectedError); + assert((client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSshPublicKey(request), expectedError); + assert((client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.importSshPublicKey(request), expectedError); + assert((client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + assert((client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..67fc391 --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: '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/v1beta/.eslintignore b/owl-bot-staging/v1beta/.eslintignore new file mode 100644 index 0000000..521dc25 --- /dev/null +++ b/owl-bot-staging/v1beta/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ diff --git a/owl-bot-staging/v1beta/.eslintrc.json b/owl-bot-staging/v1beta/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta/.gitignore b/owl-bot-staging/v1beta/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/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/v1beta/.jsdoc.js b/owl-bot-staging/v1beta/.jsdoc.js new file mode 100644 index 0000000..68c8a94 --- /dev/null +++ b/owl-bot-staging/v1beta/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/os-login', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta/.mocharc.js b/owl-bot-staging/v1beta/.mocharc.js new file mode 100644 index 0000000..50bc7f7 --- /dev/null +++ b/owl-bot-staging/v1beta/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1beta/.prettierrc.js b/owl-bot-staging/v1beta/.prettierrc.js new file mode 100644 index 0000000..84f4713 --- /dev/null +++ b/owl-bot-staging/v1beta/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1beta/README.md b/owl-bot-staging/v1beta/README.md new file mode 100644 index 0000000..f7acdc8 --- /dev/null +++ b/owl-bot-staging/v1beta/README.md @@ -0,0 +1 @@ +Oslogin: Nodejs Client diff --git a/owl-bot-staging/v1beta/linkinator.config.json b/owl-bot-staging/v1beta/linkinator.config.json new file mode 100644 index 0000000..29a223b --- /dev/null +++ b/owl-bot-staging/v1beta/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v1beta/package.json b/owl-bot-staging/v1beta/package.json new file mode 100644 index 0000000..255fd59 --- /dev/null +++ b/owl-bot-staging/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/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.15.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.17.3", + "@types/sinon": "^10.0.2", + "c8": "^7.7.3", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.0", + "jsdoc-region-tag": "^1.1.0", + "linkinator": "^2.13.6", + "mocha": "^8.4.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.1", + "ts-loader": "^9.2.3", + "typescript": "^4.3.4", + "webpack": "^5.39.1", + "webpack-cli": "^4.7.2" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto new file mode 100644 index 0000000..4d9755f --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto @@ -0,0 +1,111 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.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"; + +// Define a "User" resource owned by OS Login. +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/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto b/owl-bot-staging/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto new file mode 100644 index 0000000..a5d7847 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto @@ -0,0 +1,208 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.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"; + + // 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; +} + +// 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; +} + +// 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; +} + +// A response message for importing an SSH public key. +message ImportSshPublicKeyResponse { + // The login profile information for the user. + LoginProfile login_profile = 1; +} + +// 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/v1beta/src/index.ts b/owl-bot-staging/v1beta/src/index.ts new file mode 100644 index 0000000..1af2a90 --- /dev/null +++ b/owl-bot-staging/v1beta/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as 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/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 0000000..10c49f7 --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,83 @@ +{ + "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": { + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "OsLoginServiceClient", + "rpcs": { + "DeletePosixAccount": { + "methods": [ + "deletePosixAccount" + ] + }, + "DeleteSshPublicKey": { + "methods": [ + "deleteSshPublicKey" + ] + }, + "GetLoginProfile": { + "methods": [ + "getLoginProfile" + ] + }, + "GetSshPublicKey": { + "methods": [ + "getSshPublicKey" + ] + }, + "ImportSshPublicKey": { + "methods": [ + "importSshPublicKey" + ] + }, + "UpdateSshPublicKey": { + "methods": [ + "updateSshPublicKey" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta/src/v1beta/index.ts b/owl-bot-staging/v1beta/src/v1beta/index.ts new file mode 100644 index 0000000..a977968 --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/index.ts @@ -0,0 +1,19 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts b/owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts new file mode 100644 index 0000000..fe1b46a --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts @@ -0,0 +1,852 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} 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 _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + 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/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof OsLoginServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + 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 = {}; + } + + /** + * 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) 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 = + ['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.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 -- + // ------------------- + 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; +/** + * 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 + * const [response] = await client.deletePosixAccount(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deletePosixAccount(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.deleteSshPublicKey(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSshPublicKey(request, options, callback); + } + 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; +/** + * 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.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 + * const [response] = await client.getLoginProfile(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getLoginProfile(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.getSshPublicKey(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSshPublicKey(request, options, callback); + } + 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; +/** + * 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 {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 + * const [response] = await client.importSshPublicKey(request); + */ + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importSshPublicKey(request, options, callback); + } + 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; +/** + * 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 + * const [response] = await client.updateSshPublicKey(request); + */ + 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' + ] = gax.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 { + this.initialize(); + if (!this._terminated) { + return this.osLoginServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json b/owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json new file mode 100644 index 0000000..6dba485 --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json @@ -0,0 +1,56 @@ +{ + "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": { + "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/v1beta/src/v1beta/os_login_service_proto_list.json b/owl-bot-staging/v1beta/src/v1beta/os_login_service_proto_list.json new file mode 100644 index 0000000..078ed1d --- /dev/null +++ b/owl-bot-staging/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/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..106f705 --- /dev/null +++ b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const oslogin = require('@google-cloud/os-login'); + +function main() { + const osLoginServiceClient = new oslogin.OsLoginServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..5a540eb --- /dev/null +++ b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {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/v1beta/system-test/install.ts b/owl-bot-staging/v1beta/system-test/install.ts new file mode 100644 index 0000000..1f850b5 --- /dev/null +++ b/owl-bot-staging/v1beta/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts b/owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts new file mode 100644 index 0000000..16bd8ee --- /dev/null +++ b/owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts @@ -0,0 +1,733 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as osloginserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1beta.OsLoginServiceClient', () => { + 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', () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + 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('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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); + const [response] = await client.deletePosixAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deletePosixAccount(request), expectedError); + assert((client.innerApiCalls.deletePosixAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSshPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLoginProfile(request), expectedError); + assert((client.innerApiCalls.getLoginProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSshPublicKey(request), expectedError); + assert((client.innerApiCalls.getSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.importSshPublicKey(request), expectedError); + assert((client.innerApiCalls.importSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + assert((client.innerApiCalls.updateSshPublicKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + 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/v1beta/tsconfig.json b/owl-bot-staging/v1beta/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/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/v1beta/webpack.config.js b/owl-bot-staging/v1beta/webpack.config.js new file mode 100644 index 0000000..67fc391 --- /dev/null +++ b/owl-bot-staging/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 a13dd89f600b9efaeed3823b3ce5d61f8928f334 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 25 Jun 2021 16:22:56 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 6 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 -- owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 10 - owl-bot-staging/v1/package.json | 64 -- .../google/cloud/oslogin/common/common.proto | 111 --- .../google/cloud/oslogin/v1/oslogin.proto | 212 ----- owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 83 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/src/v1/os_login_service_client.ts | 850 ----------------- .../v1/os_login_service_client_config.json | 56 -- .../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 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_os_login_service_v1.ts | 733 --------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 -- owl-bot-staging/v1beta/.eslintignore | 6 - owl-bot-staging/v1beta/.eslintrc.json | 3 - owl-bot-staging/v1beta/.gitignore | 14 - owl-bot-staging/v1beta/.jsdoc.js | 55 -- owl-bot-staging/v1beta/.mocharc.js | 33 - owl-bot-staging/v1beta/.prettierrc.js | 22 - owl-bot-staging/v1beta/README.md | 1 - owl-bot-staging/v1beta/linkinator.config.json | 10 - owl-bot-staging/v1beta/package.json | 64 -- .../google/cloud/oslogin/common/common.proto | 111 --- .../google/cloud/oslogin/v1beta/oslogin.proto | 208 ----- owl-bot-staging/v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/gapic_metadata.json | 83 -- owl-bot-staging/v1beta/src/v1beta/index.ts | 19 - .../src/v1beta/os_login_service_client.ts | 852 ------------------ .../os_login_service_client_config.json | 56 -- .../v1beta/os_login_service_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1beta/system-test/install.ts | 49 - .../test/gapic_os_login_service_v1beta.ts | 733 --------------- owl-bot-staging/v1beta/tsconfig.json | 19 - owl-bot-staging/v1beta/webpack.config.js | 64 -- src/v1/os_login_service_client.ts | 24 +- src/v1beta/os_login_service_client.ts | 24 +- 48 files changed, 24 insertions(+), 5006 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/oslogin/v1/oslogin.proto delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/os_login_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/os_login_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/os_login_service_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_os_login_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1beta/.eslintignore delete mode 100644 owl-bot-staging/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta/.gitignore delete mode 100644 owl-bot-staging/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta/README.md delete mode 100644 owl-bot-staging/v1beta/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta/package.json delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto delete mode 100644 owl-bot-staging/v1beta/src/index.ts delete mode 100644 owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts delete mode 100644 owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json delete mode 100644 owl-bot-staging/v1beta/src/v1beta/os_login_service_proto_list.json delete mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts delete mode 100644 owl-bot-staging/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/v1beta/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index 521dc25..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 68c8a94..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/os-login', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 50bc7f7..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 84f4713..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index f7acdc8..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Oslogin: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index 29a223b..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 255fd59..0000000 --- a/owl-bot-staging/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/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.15.0" - }, - "devDependencies": { - "@types/mocha": "^8.2.2", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^8.4.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto deleted file mode 100644 index 4d9755f..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/oslogin/common/common.proto +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.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"; - -// Define a "User" resource owned by OS Login. -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/v1/protos/google/cloud/oslogin/v1/oslogin.proto b/owl-bot-staging/v1/protos/google/cloud/oslogin/v1/oslogin.proto deleted file mode 100644 index 25e9be0..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/oslogin/v1/oslogin.proto +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.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/compute"; - - // 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 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; -} - -// 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/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index c88a38f..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const 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/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index f89ea9a..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,83 +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": { - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "OsLoginServiceClient", - "rpcs": { - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index a977968..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/v1/src/v1/os_login_service_client.ts b/owl-bot-staging/v1/src/v1/os_login_service_client.ts deleted file mode 100644 index e566a50..0000000 --- a/owl-bot-staging/v1/src/v1/os_login_service_client.ts +++ /dev/null @@ -1,850 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} 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 _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - 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/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof OsLoginServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - 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 = {}; - } - - /** - * 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) 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 = - ['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.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/compute' - ]; - } - - 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 -- - // ------------------- - 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; -/** - * 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 - * const [response] = await client.deletePosixAccount(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deletePosixAccount(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.deleteSshPublicKey(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSshPublicKey(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.getLoginProfile(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getLoginProfile(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.getSshPublicKey(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSshPublicKey(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.importSshPublicKey(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.importSshPublicKey(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.updateSshPublicKey(request); - */ - 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' - ] = gax.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 { - this.initialize(); - if (!this._terminated) { - return this.osLoginServiceStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/os_login_service_client_config.json b/owl-bot-staging/v1/src/v1/os_login_service_client_config.json deleted file mode 100644 index fc7cef9..0000000 --- a/owl-bot-staging/v1/src/v1/os_login_service_client_config.json +++ /dev/null @@ -1,56 +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": { - "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/v1/src/v1/os_login_service_proto_list.json b/owl-bot-staging/v1/src/v1/os_login_service_proto_list.json deleted file mode 100644 index 46f125e..0000000 --- a/owl-bot-staging/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/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 106f705..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const oslogin = require('@google-cloud/os-login'); - -function main() { - const osLoginServiceClient = new oslogin.OsLoginServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 5a540eb..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {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/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 1f850b5..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_os_login_service_v1.ts b/owl-bot-staging/v1/test/gapic_os_login_service_v1.ts deleted file mode 100644 index 7abbdf0..0000000 --- a/owl-bot-staging/v1/test/gapic_os_login_service_v1.ts +++ /dev/null @@ -1,733 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as osloginserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.OsLoginServiceClient', () => { - 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', () => { - const client = new osloginserviceModule.v1.OsLoginServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); - }); - - 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('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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); - const [response] = await client.deletePosixAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deletePosixAccount(request), expectedError); - assert((client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSshPublicKey(request), expectedError); - assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoginProfile(request), expectedError); - assert((client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSshPublicKey(request), expectedError); - assert((client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importSshPublicKey(request), expectedError); - assert((client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSshPublicKey(request), expectedError); - assert((client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 67fc391..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: '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/v1beta/.eslintignore b/owl-bot-staging/v1beta/.eslintignore deleted file mode 100644 index 521dc25..0000000 --- a/owl-bot-staging/v1beta/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ diff --git a/owl-bot-staging/v1beta/.eslintrc.json b/owl-bot-staging/v1beta/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta/.gitignore b/owl-bot-staging/v1beta/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/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/v1beta/.jsdoc.js b/owl-bot-staging/v1beta/.jsdoc.js deleted file mode 100644 index 68c8a94..0000000 --- a/owl-bot-staging/v1beta/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/os-login', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta/.mocharc.js b/owl-bot-staging/v1beta/.mocharc.js deleted file mode 100644 index 50bc7f7..0000000 --- a/owl-bot-staging/v1beta/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1beta/.prettierrc.js b/owl-bot-staging/v1beta/.prettierrc.js deleted file mode 100644 index 84f4713..0000000 --- a/owl-bot-staging/v1beta/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1beta/README.md b/owl-bot-staging/v1beta/README.md deleted file mode 100644 index f7acdc8..0000000 --- a/owl-bot-staging/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Oslogin: Nodejs Client diff --git a/owl-bot-staging/v1beta/linkinator.config.json b/owl-bot-staging/v1beta/linkinator.config.json deleted file mode 100644 index 29a223b..0000000 --- a/owl-bot-staging/v1beta/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 10 -} diff --git a/owl-bot-staging/v1beta/package.json b/owl-bot-staging/v1beta/package.json deleted file mode 100644 index 255fd59..0000000 --- a/owl-bot-staging/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/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.15.0" - }, - "devDependencies": { - "@types/mocha": "^8.2.2", - "@types/node": "^14.17.3", - "@types/sinon": "^10.0.2", - "c8": "^7.7.3", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.0", - "jsdoc-region-tag": "^1.1.0", - "linkinator": "^2.13.6", - "mocha": "^8.4.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.1", - "ts-loader": "^9.2.3", - "typescript": "^4.3.4", - "webpack": "^5.39.1", - "webpack-cli": "^4.7.2" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto b/owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto deleted file mode 100644 index 4d9755f..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/oslogin/common/common.proto +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.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"; - -// Define a "User" resource owned by OS Login. -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/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto b/owl-bot-staging/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto deleted file mode 100644 index a5d7847..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/oslogin/v1beta/oslogin.proto +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2019 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.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"; - - // 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; -} - -// 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; -} - -// 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; -} - -// A response message for importing an SSH public key. -message ImportSshPublicKeyResponse { - // The login profile information for the user. - LoginProfile login_profile = 1; -} - -// 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/v1beta/src/index.ts b/owl-bot-staging/v1beta/src/index.ts deleted file mode 100644 index 1af2a90..0000000 --- a/owl-bot-staging/v1beta/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as 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/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index 10c49f7..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,83 +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": { - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "OsLoginServiceClient", - "rpcs": { - "DeletePosixAccount": { - "methods": [ - "deletePosixAccount" - ] - }, - "DeleteSshPublicKey": { - "methods": [ - "deleteSshPublicKey" - ] - }, - "GetLoginProfile": { - "methods": [ - "getLoginProfile" - ] - }, - "GetSshPublicKey": { - "methods": [ - "getSshPublicKey" - ] - }, - "ImportSshPublicKey": { - "methods": [ - "importSshPublicKey" - ] - }, - "UpdateSshPublicKey": { - "methods": [ - "updateSshPublicKey" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta/src/v1beta/index.ts b/owl-bot-staging/v1beta/src/v1beta/index.ts deleted file mode 100644 index a977968..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {OsLoginServiceClient} from './os_login_service_client'; diff --git a/owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts b/owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts deleted file mode 100644 index fe1b46a..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/os_login_service_client.ts +++ /dev/null @@ -1,852 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} 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 _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - 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/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof OsLoginServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - 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 = {}; - } - - /** - * 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) 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 = - ['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.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 -- - // ------------------- - 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; -/** - * 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 - * const [response] = await client.deletePosixAccount(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deletePosixAccount(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.deleteSshPublicKey(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSshPublicKey(request, options, callback); - } - 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; -/** - * 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.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 - * const [response] = await client.getLoginProfile(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getLoginProfile(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.getSshPublicKey(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSshPublicKey(request, options, callback); - } - 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; -/** - * 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 {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 - * const [response] = await client.importSshPublicKey(request); - */ - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.importSshPublicKey(request, options, callback); - } - 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; -/** - * 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 - * const [response] = await client.updateSshPublicKey(request); - */ - 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' - ] = gax.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 { - this.initialize(); - if (!this._terminated) { - return this.osLoginServiceStub!.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json b/owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json deleted file mode 100644 index 6dba485..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/os_login_service_client_config.json +++ /dev/null @@ -1,56 +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": { - "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/v1beta/src/v1beta/os_login_service_proto_list.json b/owl-bot-staging/v1beta/src/v1beta/os_login_service_proto_list.json deleted file mode 100644 index 078ed1d..0000000 --- a/owl-bot-staging/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/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 106f705..0000000 --- a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const oslogin = require('@google-cloud/os-login'); - -function main() { - const osLoginServiceClient = new oslogin.OsLoginServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 5a540eb..0000000 --- a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {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/v1beta/system-test/install.ts b/owl-bot-staging/v1beta/system-test/install.ts deleted file mode 100644 index 1f850b5..0000000 --- a/owl-bot-staging/v1beta/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts b/owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts deleted file mode 100644 index 16bd8ee..0000000 --- a/owl-bot-staging/v1beta/test/gapic_os_login_service_v1beta.ts +++ /dev/null @@ -1,733 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as osloginserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta.OsLoginServiceClient', () => { - 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', () => { - const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); - }); - - 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('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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(expectedResponse); - const [response] = await client.deletePosixAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePosixAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deletePosixAccount(request), expectedError); - assert((client.innerApiCalls.deletePosixAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSshPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSshPublicKey(request), expectedError); - assert((client.innerApiCalls.deleteSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoginProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoginProfile(request), expectedError); - assert((client.innerApiCalls.getLoginProfile as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSshPublicKey(request), expectedError); - assert((client.innerApiCalls.getSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.importSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importSshPublicKey(request), expectedError); - assert((client.innerApiCalls.importSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSshPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSshPublicKey(request), expectedError); - assert((client.innerApiCalls.updateSshPublicKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - 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/v1beta/tsconfig.json b/owl-bot-staging/v1beta/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/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/v1beta/webpack.config.js b/owl-bot-staging/v1beta/webpack.config.js deleted file mode 100644 index 67fc391..0000000 --- a/owl-bot-staging/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/src/v1/os_login_service_client.ts b/src/v1/os_login_service_client.ts index ddb54b9..294c280 100644 --- a/src/v1/os_login_service_client.ts +++ b/src/v1/os_login_service_client.ts @@ -294,7 +294,7 @@ export class OsLoginServiceClient { // -- Service calls -- // ------------------- deletePosixAccount( - request: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + request?: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, options?: CallOptions ): Promise< [ @@ -344,7 +344,7 @@ export class OsLoginServiceClient { * const [response] = await client.deletePosixAccount(request); */ deletePosixAccount( - request: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + request?: protos.google.cloud.oslogin.v1.IDeletePosixAccountRequest, optionsOrCallback?: | CallOptions | Callback< @@ -387,7 +387,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.deletePosixAccount(request, options, callback); } deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -437,7 +437,7 @@ export class OsLoginServiceClient { * const [response] = await client.deleteSshPublicKey(request); */ deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -480,7 +480,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.deleteSshPublicKey(request, options, callback); } getLoginProfile( - request: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, + request?: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, options?: CallOptions ): Promise< [ @@ -529,7 +529,7 @@ export class OsLoginServiceClient { * const [response] = await client.getLoginProfile(request); */ getLoginProfile( - request: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, + request?: protos.google.cloud.oslogin.v1.IGetLoginProfileRequest, optionsOrCallback?: | CallOptions | Callback< @@ -570,7 +570,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.getLoginProfile(request, options, callback); } getSshPublicKey( - request: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -616,7 +616,7 @@ export class OsLoginServiceClient { * const [response] = await client.getSshPublicKey(request); */ getSshPublicKey( - request: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -657,7 +657,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.getSshPublicKey(request, options, callback); } importSshPublicKey( - request: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -711,7 +711,7 @@ export class OsLoginServiceClient { * const [response] = await client.importSshPublicKey(request); */ importSshPublicKey( - request: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -754,7 +754,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.importSshPublicKey(request, options, callback); } updateSshPublicKey( - request: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -809,7 +809,7 @@ export class OsLoginServiceClient { * const [response] = await client.updateSshPublicKey(request); */ updateSshPublicKey( - request: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/src/v1beta/os_login_service_client.ts b/src/v1beta/os_login_service_client.ts index 291f53d..2d01a1f 100644 --- a/src/v1beta/os_login_service_client.ts +++ b/src/v1beta/os_login_service_client.ts @@ -296,7 +296,7 @@ export class OsLoginServiceClient { // -- Service calls -- // ------------------- deletePosixAccount( - request: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, + request?: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, options?: CallOptions ): Promise< [ @@ -346,7 +346,7 @@ export class OsLoginServiceClient { * const [response] = await client.deletePosixAccount(request); */ deletePosixAccount( - request: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, + request?: protos.google.cloud.oslogin.v1beta.IDeletePosixAccountRequest, optionsOrCallback?: | CallOptions | Callback< @@ -389,7 +389,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.deletePosixAccount(request, options, callback); } deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -439,7 +439,7 @@ export class OsLoginServiceClient { * const [response] = await client.deleteSshPublicKey(request); */ deleteSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -482,7 +482,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.deleteSshPublicKey(request, options, callback); } getLoginProfile( - request: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, + request?: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, options?: CallOptions ): Promise< [ @@ -535,7 +535,7 @@ export class OsLoginServiceClient { * const [response] = await client.getLoginProfile(request); */ getLoginProfile( - request: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, + request?: protos.google.cloud.oslogin.v1beta.IGetLoginProfileRequest, optionsOrCallback?: | CallOptions | Callback< @@ -578,7 +578,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.getLoginProfile(request, options, callback); } getSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -628,7 +628,7 @@ export class OsLoginServiceClient { * const [response] = await client.getSshPublicKey(request); */ getSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -671,7 +671,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.getSshPublicKey(request, options, callback); } importSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -725,7 +725,7 @@ export class OsLoginServiceClient { * const [response] = await client.importSshPublicKey(request); */ importSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -768,7 +768,7 @@ export class OsLoginServiceClient { return this.innerApiCalls.importSshPublicKey(request, options, callback); } updateSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, options?: CallOptions ): Promise< [ @@ -823,7 +823,7 @@ export class OsLoginServiceClient { * const [response] = await client.updateSshPublicKey(request); */ updateSshPublicKey( - request: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, + request?: protos.google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest, optionsOrCallback?: | CallOptions | Callback<