diff --git a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service.js index 35c94909c6f..26c31d0abe4 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service.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-api-servicemanagement/samples/generated/v1/service_manager.create_service_config.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_config.js index d5ca5953db8..aed8f8a2056 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_config.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_config.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-api-servicemanagement/samples/generated/v1/service_manager.create_service_rollout.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_rollout.js index 5319bbc1642..d15ce6a1a8e 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_rollout.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_rollout.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-api-servicemanagement/samples/generated/v1/service_manager.delete_service.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.delete_service.js index 6273706958a..12b4c1dae6a 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.delete_service.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.delete_service.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-api-servicemanagement/samples/generated/v1/service_manager.generate_config_report.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.generate_config_report.js index fbeeb9643ca..8b3b0db76c2 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.generate_config_report.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.generate_config_report.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-api-servicemanagement/samples/generated/v1/service_manager.get_service.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service.js index af79dbac99a..1d535cdc6a0 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service.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-api-servicemanagement/samples/generated/v1/service_manager.get_service_config.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_config.js index 6329a1e410d..c71641d944d 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_config.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_config.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-api-servicemanagement/samples/generated/v1/service_manager.get_service_rollout.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_rollout.js index 2fa2fe7e485..de526cc506a 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_rollout.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_rollout.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-api-servicemanagement/samples/generated/v1/service_manager.list_service_configs.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_configs.js index 3a04a24cbf3..b450a3817ce 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_configs.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_configs.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-api-servicemanagement/samples/generated/v1/service_manager.list_service_rollouts.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_rollouts.js index b041e39bc32..e1009d41874 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_rollouts.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_rollouts.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-api-servicemanagement/samples/generated/v1/service_manager.list_services.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_services.js index 9f65fae4ce1..a260fd2de1e 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_services.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_services.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-api-servicemanagement/samples/generated/v1/service_manager.submit_config_source.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.submit_config_source.js index 467bc4f2e80..006bc9ba011 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.submit_config_source.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.submit_config_source.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-api-servicemanagement/samples/generated/v1/service_manager.undelete_service.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.undelete_service.js index efa9a68ffc9..eae76d05be2 100644 --- a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.undelete_service.js +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.undelete_service.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-api-servicemanagement/samples/generated/v1/snippet_metadata.google.api.servicemanagement.v1.json b/packages/google-api-servicemanagement/samples/generated/v1/snippet_metadata.google.api.servicemanagement.v1.json new file mode 100644 index 00000000000..324c6d944d4 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/snippet_metadata.google.api.servicemanagement.v1.json @@ -0,0 +1,599 @@ +{ + "clientLibrary": { + "name": "nodejs-servicemanagement", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.api.servicemanagement.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_ListServices_async", + "title": "ServiceManager listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists managed services. Returns all public services. For authenticated users, also returns all services the calling user has \"servicemanagement.services.get\" permission for.", + "canonical": true, + "file": "service_manager.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.api.servicemanagement.v1.ServiceManager.ListServices", + "async": true, + "parameters": [ + { + "name": "producer_project_id", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "consumer_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicemanagement.v1.ListServicesResponse", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.api.servicemanagement.v1.ServiceManager.ListServices", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_GetService_async", + "title": "ServiceManager getService Sample", + "origin": "API_DEFINITION", + "description": " Gets a managed service. Authentication is required unless the service is public.", + "canonical": true, + "file": "service_manager.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GetService", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicemanagement.v1.ManagedService", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GetService", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_CreateService_async", + "title": "ServiceManager createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a new managed service. A managed service is immutable, and is subject to mandatory 30-day data retention. You cannot move a service or recreate it within 30 days after deletion. One producer project can own no more than 500 services. For security and reliability purposes, a production service should be hosted in a dedicated producer project. Operation", + "canonical": true, + "file": "service_manager.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.CreateService", + "async": true, + "parameters": [ + { + "name": "service", + "type": ".google.api.servicemanagement.v1.ManagedService" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.CreateService", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_DeleteService_async", + "title": "ServiceManager deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a managed service. This method will change the service to the `Soft-Delete` state for 30 days. Within this period, service producers may call [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService] to restore the service. After 30 days, the service will be permanently deleted. Operation", + "canonical": true, + "file": "service_manager.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.DeleteService", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.DeleteService", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_UndeleteService_async", + "title": "ServiceManager undeleteService Sample", + "origin": "API_DEFINITION", + "description": " Revives a previously deleted managed service. The method restores the service using the configuration at the time the service was deleted. The target service must exist and must have been deleted within the last 30 days. Operation", + "canonical": true, + "file": "service_manager.undelete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeleteService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.UndeleteService", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "UndeleteService", + "fullName": "google.api.servicemanagement.v1.ServiceManager.UndeleteService", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_ListServiceConfigs_async", + "title": "ServiceManager listServiceConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists the history of the service configuration for a managed service, from the newest to the oldest.", + "canonical": true, + "file": "service_manager.list_service_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServiceConfigs", + "fullName": "google.api.servicemanagement.v1.ServiceManager.ListServiceConfigs", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.api.servicemanagement.v1.ListServiceConfigsResponse", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "ListServiceConfigs", + "fullName": "google.api.servicemanagement.v1.ServiceManager.ListServiceConfigs", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_GetServiceConfig_async", + "title": "ServiceManager getServiceConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a service configuration (version) for a managed service.", + "canonical": true, + "file": "service_manager.get_service_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServiceConfig", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GetServiceConfig", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.api.servicemanagement.v1.GetServiceConfigRequest.ConfigView" + } + ], + "resultType": ".google.api.Service", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "GetServiceConfig", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GetServiceConfig", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_CreateServiceConfig_async", + "title": "ServiceManager createServiceConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new service configuration (version) for a managed service. This method only stores the service configuration. To roll out the service configuration to backend systems please call [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. Only the 100 most recent service configurations and ones referenced by existing rollouts are kept for each service. The rest will be deleted eventually.", + "canonical": true, + "file": "service_manager.create_service_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServiceConfig", + "fullName": "google.api.servicemanagement.v1.ServiceManager.CreateServiceConfig", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "service_config", + "type": ".google.api.Service" + } + ], + "resultType": ".google.api.Service", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "CreateServiceConfig", + "fullName": "google.api.servicemanagement.v1.ServiceManager.CreateServiceConfig", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_SubmitConfigSource_async", + "title": "ServiceManager submitConfigSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a new service configuration (version) for a managed service based on user-supplied configuration source files (for example: OpenAPI Specification). This method stores the source configurations as well as the generated service configuration. To rollout the service configuration to other services, please call [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. Only the 100 most recent configuration sources and ones referenced by existing service configurtions are kept for each service. The rest will be deleted eventually. Operation", + "canonical": true, + "file": "service_manager.submit_config_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SubmitConfigSource", + "fullName": "google.api.servicemanagement.v1.ServiceManager.SubmitConfigSource", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "config_source", + "type": ".google.api.servicemanagement.v1.ConfigSource" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "SubmitConfigSource", + "fullName": "google.api.servicemanagement.v1.ServiceManager.SubmitConfigSource", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_ListServiceRollouts_async", + "title": "ServiceManager listServiceRollouts Sample", + "origin": "API_DEFINITION", + "description": " Lists the history of the service configuration rollouts for a managed service, from the newest to the oldest.", + "canonical": true, + "file": "service_manager.list_service_rollouts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServiceRollouts", + "fullName": "google.api.servicemanagement.v1.ServiceManager.ListServiceRollouts", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicemanagement.v1.ListServiceRolloutsResponse", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "ListServiceRollouts", + "fullName": "google.api.servicemanagement.v1.ServiceManager.ListServiceRollouts", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_GetServiceRollout_async", + "title": "ServiceManager getServiceRollout Sample", + "origin": "API_DEFINITION", + "description": " Gets a service configuration [rollout][google.api.servicemanagement.v1.Rollout].", + "canonical": true, + "file": "service_manager.get_service_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServiceRollout", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GetServiceRollout", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "rollout_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.servicemanagement.v1.Rollout", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "GetServiceRollout", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GetServiceRollout", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_CreateServiceRollout_async", + "title": "ServiceManager createServiceRollout Sample", + "origin": "API_DEFINITION", + "description": " Creates a new service configuration rollout. Based on rollout, the Google Service Management will roll out the service configurations to different backend services. For example, the logging configuration will be pushed to Google Cloud Logging. Please note that any previous pending and running Rollouts and associated Operations will be automatically cancelled so that the latest Rollout will not be blocked by previous Rollouts. Only the 100 most recent (in any state) and the last 10 successful (if not already part of the set of 100 most recent) rollouts are kept for each service. The rest will be deleted eventually. Operation", + "canonical": true, + "file": "service_manager.create_service_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServiceRollout", + "fullName": "google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout", + "async": true, + "parameters": [ + { + "name": "service_name", + "type": "TYPE_STRING" + }, + { + "name": "rollout", + "type": ".google.api.servicemanagement.v1.Rollout" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "CreateServiceRollout", + "fullName": "google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + }, + { + "regionTag": "servicemanagement_v1_generated_ServiceManager_GenerateConfigReport_async", + "title": "ServiceManager generateConfigReport Sample", + "origin": "API_DEFINITION", + "description": " Generates and returns a report (errors, warnings and changes from existing configurations) associated with GenerateConfigReportRequest.new_value If GenerateConfigReportRequest.old_value is specified, GenerateConfigReportRequest will contain a single ChangeReport based on the comparison between GenerateConfigReportRequest.new_value and GenerateConfigReportRequest.old_value. If GenerateConfigReportRequest.old_value is not specified, this method will compare GenerateConfigReportRequest.new_value with the last pushed service configuration.", + "canonical": true, + "file": "service_manager.generate_config_report.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateConfigReport", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GenerateConfigReport", + "async": true, + "parameters": [ + { + "name": "new_config", + "type": ".google.protobuf.Any" + }, + { + "name": "old_config", + "type": ".google.protobuf.Any" + } + ], + "resultType": ".google.api.servicemanagement.v1.GenerateConfigReportResponse", + "client": { + "shortName": "ServiceManagerClient", + "fullName": "google.api.servicemanagement.v1.ServiceManagerClient" + }, + "method": { + "shortName": "GenerateConfigReport", + "fullName": "google.api.servicemanagement.v1.ServiceManager.GenerateConfigReport", + "service": { + "shortName": "ServiceManager", + "fullName": "google.api.servicemanagement.v1.ServiceManager" + } + } + } + } + ] +} diff --git a/packages/google-api-servicemanagement/src/v1/service_manager_client.ts b/packages/google-api-servicemanagement/src/v1/service_manager_client.ts index 1a8f2ab77ab..da1dbb97e61 100644 --- a/packages/google-api-servicemanagement/src/v1/service_manager_client.ts +++ b/packages/google-api-servicemanagement/src/v1/service_manager_client.ts @@ -2296,9 +2296,8 @@ export class ServiceManagerClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.serviceManagerStub!.then(stub => { + if (this.serviceManagerStub && !this._terminated) { + return this.serviceManagerStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-api-servicemanagement/test/gapic_service_manager_v1.ts b/packages/google-api-servicemanagement/test/gapic_service_manager_v1.ts index 7cf7a848f8f..cfec331e64c 100644 --- a/packages/google-api-servicemanagement/test/gapic_service_manager_v1.ts +++ b/packages/google-api-servicemanagement/test/gapic_service_manager_v1.ts @@ -185,12 +185,27 @@ describe('v1.ServiceManagerClient', () => { assert(client.serviceManagerStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new servicemanagerModule.v1.ServiceManagerClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.serviceManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new servicemanagerModule.v1.ServiceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceManagerStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -336,6 +351,22 @@ describe('v1.ServiceManagerClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getService with closed client', async () => { + const client = new servicemanagerModule.v1.ServiceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.servicemanagement.v1.GetServiceRequest() + ); + request.serviceName = ''; + const expectedHeaderRequestParams = 'service_name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); }); describe('getServiceConfig', () => { @@ -444,6 +475,22 @@ describe('v1.ServiceManagerClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getServiceConfig with closed client', async () => { + const client = new servicemanagerModule.v1.ServiceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.servicemanagement.v1.GetServiceConfigRequest() + ); + request.serviceName = ''; + const expectedHeaderRequestParams = 'service_name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServiceConfig(request), expectedError); + }); }); describe('createServiceConfig', () => { @@ -553,6 +600,22 @@ describe('v1.ServiceManagerClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createServiceConfig with closed client', async () => { + const client = new servicemanagerModule.v1.ServiceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.servicemanagement.v1.CreateServiceConfigRequest() + ); + request.serviceName = ''; + const expectedHeaderRequestParams = 'service_name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createServiceConfig(request), expectedError); + }); }); describe('getServiceRollout', () => { @@ -664,6 +727,22 @@ describe('v1.ServiceManagerClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getServiceRollout with closed client', async () => { + const client = new servicemanagerModule.v1.ServiceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.servicemanagement.v1.GetServiceRolloutRequest() + ); + request.serviceName = ''; + const expectedHeaderRequestParams = 'service_name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServiceRollout(request), expectedError); + }); }); describe('generateConfigReport', () => { @@ -752,6 +831,20 @@ describe('v1.ServiceManagerClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes generateConfigReport with closed client', async () => { + const client = new servicemanagerModule.v1.ServiceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.servicemanagement.v1.GenerateConfigReportRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateConfigReport(request), expectedError); + }); }); describe('createService', () => {