From 2104c0a03f77e8c5ba7687f0d70151a6c342f3cc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 02:02:49 +0000 Subject: [PATCH] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#511) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 429395631 Source-Link: https://github.com/googleapis/googleapis/commit/84594b35af0c38efcd6967e8179d801702ad96ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/ed74f970fd82914874e6b27b04763cfa66bafe9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9 --- .../os_login_service.delete_posix_account.js | 9 +- .../os_login_service.delete_ssh_public_key.js | 9 +- .../v1/os_login_service.get_login_profile.js | 9 +- .../v1/os_login_service.get_ssh_public_key.js | 9 +- .../os_login_service.import_ssh_public_key.js | 9 +- .../os_login_service.update_ssh_public_key.js | 9 +- ...ppet_metadata.google.cloud.oslogin.v1.json | 279 ++++++++++++++++++ .../os_login_service.delete_posix_account.js | 9 +- .../os_login_service.delete_ssh_public_key.js | 9 +- .../os_login_service.get_login_profile.js | 9 +- .../os_login_service.get_ssh_public_key.js | 9 +- .../os_login_service.import_ssh_public_key.js | 9 +- .../os_login_service.update_ssh_public_key.js | 9 +- ..._metadata.google.cloud.oslogin.v1beta.json | 279 ++++++++++++++++++ .../src/v1/os_login_service_client.ts | 5 +- .../src/v1beta/os_login_service_client.ts | 5 +- .../test/gapic_os_login_service_v1.ts | 115 +++++++- .../test/gapic_os_login_service_v1beta.ts | 115 +++++++- 18 files changed, 872 insertions(+), 34 deletions(-) create mode 100644 packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json create mode 100644 packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json diff --git a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js index 5ddf0fa85db..756c03d06c1 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js +++ b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_posix_account.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_ssh_public_key.js index f27150b4f0d..68fffcfaf18 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.delete_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_login_profile.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_login_profile.js index 563164e236a..eadc1b4087d 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_login_profile.js +++ b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_login_profile.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_ssh_public_key.js index f16ab16d561..5238c5c1768 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.get_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.import_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.import_ssh_public_key.js index 53662004d29..c058b899a31 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.import_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.import_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.update_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.update_ssh_public_key.js index c2accd56d44..86debd03143 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.update_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1/os_login_service.update_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json b/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json new file mode 100644 index 00000000000..f5e474d91b8 --- /dev/null +++ b/packages/google-cloud-oslogin/samples/generated/v1/snippet_metadata.google.cloud.oslogin.v1.json @@ -0,0 +1,279 @@ +{ + "clientLibrary": { + "name": "nodejs-oslogin", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.oslogin.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "oslogin_v1_generated_OsLoginService_DeletePosixAccount_async", + "title": "OsLoginService deletePosixAccount Sample", + "origin": "API_DEFINITION", + "description": " Deletes a POSIX account.", + "canonical": true, + "file": "os_login_service.delete_posix_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeletePosixAccount", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_DeleteSshPublicKey_async", + "title": "OsLoginService deleteSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Deletes an SSH public key.", + "canonical": true, + "file": "os_login_service.delete_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_GetLoginProfile_async", + "title": "OsLoginService getLoginProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.", + "canonical": true, + "file": "os_login_service.get_login_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetLoginProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "system_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.v1.LoginProfile", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetLoginProfile", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_GetSshPublicKey_async", + "title": "OsLoginService getSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an SSH public key.", + "canonical": true, + "file": "os_login_service.get_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.GetSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_ImportSshPublicKey_async", + "title": "OsLoginService importSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.", + "canonical": true, + "file": "os_login_service.import_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.v1.ImportSshPublicKeyResponse", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1_generated_OsLoginService_UpdateSshPublicKey_async", + "title": "OsLoginService updateSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Updates an SSH public key and returns the profile information. This method supports patch semantics.", + "canonical": true, + "file": "os_login_service.update_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1.OsLoginServiceClient" + }, + "method": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1.OsLoginService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js index a098cc495b7..08085911a2f 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_posix_account.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js index 03b71f51e87..621bdd46779 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.delete_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js index ace1552613c..56121215d8d 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_login_profile.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_ssh_public_key.js index 9fbbc5039c8..4e89ec3ea65 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.get_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js index 3108346b88a..eede9105190 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.import_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.update_ssh_public_key.js b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.update_ssh_public_key.js index 519961b53ce..83b7246042d 100644 --- a/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.update_ssh_public_key.js +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/os_login_service.update_ssh_public_key.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json b/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json new file mode 100644 index 00000000000..d949c3311a5 --- /dev/null +++ b/packages/google-cloud-oslogin/samples/generated/v1beta/snippet_metadata.google.cloud.oslogin.v1beta.json @@ -0,0 +1,279 @@ +{ + "clientLibrary": { + "name": "nodejs-oslogin", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.oslogin.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_DeletePosixAccount_async", + "title": "OsLoginService deletePosixAccount Sample", + "origin": "API_DEFINITION", + "description": " Deletes a POSIX account.", + "canonical": true, + "file": "os_login_service.delete_posix_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "DeletePosixAccount", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeletePosixAccount", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_DeleteSshPublicKey_async", + "title": "OsLoginService deleteSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Deletes an SSH public key.", + "canonical": true, + "file": "os_login_service.delete_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "DeleteSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.DeleteSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_GetLoginProfile_async", + "title": "OsLoginService getLoginProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.", + "canonical": true, + "file": "os_login_service.get_login_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "system_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.v1beta.LoginProfile", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "GetLoginProfile", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetLoginProfile", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_GetSshPublicKey_async", + "title": "OsLoginService getSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an SSH public key.", + "canonical": true, + "file": "os_login_service.get_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "GetSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.GetSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_ImportSshPublicKey_async", + "title": "OsLoginService importSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.", + "canonical": true, + "file": "os_login_service.import_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "ImportSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.ImportSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + }, + { + "regionTag": "oslogin_v1beta_generated_OsLoginService_UpdateSshPublicKey_async", + "title": "OsLoginService updateSshPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Updates an SSH public key and returns the profile information. This method supports patch semantics.", + "canonical": true, + "file": "os_login_service.update_ssh_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ssh_public_key", + "type": ".google.cloud.oslogin.common.SshPublicKey" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.oslogin.common.SshPublicKey", + "client": { + "shortName": "OsLoginServiceClient", + "fullName": "google.cloud.oslogin.v1beta.OsLoginServiceClient" + }, + "method": { + "shortName": "UpdateSshPublicKey", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService.UpdateSshPublicKey", + "service": { + "shortName": "OsLoginService", + "fullName": "google.cloud.oslogin.v1beta.OsLoginService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts b/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts index c9ccb62c118..e8775cee616 100644 --- a/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts +++ b/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts @@ -977,9 +977,8 @@ export class OsLoginServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.osLoginServiceStub!.then(stub => { + if (this.osLoginServiceStub && !this._terminated) { + return this.osLoginServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts index 1704c7f6feb..16c64d043ae 100644 --- a/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts +++ b/packages/google-cloud-oslogin/src/v1beta/os_login_service_client.ts @@ -991,9 +991,8 @@ export class OsLoginServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.osLoginServiceStub!.then(stub => { + if (this.osLoginServiceStub && !this._terminated) { + return this.osLoginServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts index 49b3012ac2e..7e643735357 100644 --- a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts +++ b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1.ts @@ -90,12 +90,27 @@ describe('v1.OsLoginServiceClient', () => { assert(client.osLoginServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new osloginserviceModule.v1.OsLoginServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.osLoginServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.osLoginServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -242,6 +257,22 @@ describe('v1.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deletePosixAccount with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeletePosixAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deletePosixAccount(request), expectedError); + }); }); describe('deleteSshPublicKey', () => { @@ -354,6 +385,22 @@ describe('v1.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + }); }); describe('getLoginProfile', () => { @@ -465,6 +512,22 @@ describe('v1.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getLoginProfile with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetLoginProfileRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLoginProfile(request), expectedError); + }); }); describe('getSshPublicKey', () => { @@ -576,6 +639,22 @@ describe('v1.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.GetSshPublicKeyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSshPublicKey(request), expectedError); + }); }); describe('importSshPublicKey', () => { @@ -688,6 +767,22 @@ describe('v1.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes importSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.ImportSshPublicKeyRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.importSshPublicKey(request), expectedError); + }); }); describe('updateSshPublicKey', () => { @@ -800,6 +895,22 @@ describe('v1.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + }); }); describe('Path templates', () => { diff --git a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts index e2b3c406731..9ad708f8277 100644 --- a/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts +++ b/packages/google-cloud-oslogin/test/gapic_os_login_service_v1beta.ts @@ -90,12 +90,27 @@ describe('v1beta.OsLoginServiceClient', () => { assert(client.osLoginServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.osLoginServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.osLoginServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -242,6 +257,22 @@ describe('v1beta.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deletePosixAccount with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeletePosixAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deletePosixAccount(request), expectedError); + }); }); describe('deleteSshPublicKey', () => { @@ -354,6 +385,22 @@ describe('v1beta.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSshPublicKey(request), expectedError); + }); }); describe('getLoginProfile', () => { @@ -465,6 +512,22 @@ describe('v1beta.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getLoginProfile with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetLoginProfileRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getLoginProfile(request), expectedError); + }); }); describe('getSshPublicKey', () => { @@ -576,6 +639,22 @@ describe('v1beta.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.GetSshPublicKeyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSshPublicKey(request), expectedError); + }); }); describe('importSshPublicKey', () => { @@ -688,6 +767,22 @@ describe('v1beta.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes importSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.importSshPublicKey(request), expectedError); + }); }); describe('updateSshPublicKey', () => { @@ -800,6 +895,22 @@ describe('v1beta.OsLoginServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateSshPublicKey with closed client', async () => { + const client = new osloginserviceModule.v1beta.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSshPublicKey(request), expectedError); + }); }); describe('Path templates', () => {