diff --git a/packages/google-api-servicemanagement/linkinator.config.json b/packages/google-api-servicemanagement/linkinator.config.json index 29a223b6db6..0121dfa684f 100644 --- a/packages/google-api-servicemanagement/linkinator.config.json +++ b/packages/google-api-servicemanagement/linkinator.config.json @@ -6,5 +6,5 @@ "img.shields.io" ], "silent": true, - "concurrency": 10 + "concurrency": 5 } 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 new file mode 100644 index 00000000000..55bf7963f3b --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service.js @@ -0,0 +1,53 @@ +// 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 +// +// 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. + +'use strict'; + +function main(service) { + // [START servicemanagement_v1_generated_ServiceManager_CreateService_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Initial values for the service resource. + */ + // const service = {} + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callCreateService() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await servicemanagementClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END servicemanagement_v1_generated_ServiceManager_CreateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..edafb7a9e6e --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_config.js @@ -0,0 +1,58 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, serviceConfig) { + // [START servicemanagement_v1_generated_ServiceManager_CreateServiceConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * Required. The service configuration resource. + */ + // const serviceConfig = {} + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callCreateServiceConfig() { + // Construct request + const request = { + serviceName, + serviceConfig, + }; + + // Run request + const response = await servicemanagementClient.createServiceConfig(request); + console.log(response); + } + + callCreateServiceConfig(); + // [END servicemanagement_v1_generated_ServiceManager_CreateServiceConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..c1288506952 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.create_service_rollout.js @@ -0,0 +1,61 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, rollout) { + // [START servicemanagement_v1_generated_ServiceManager_CreateServiceRollout_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * Required. The rollout resource. The `service_name` field is output only. + */ + // const rollout = {} + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callCreateServiceRollout() { + // Construct request + const request = { + serviceName, + rollout, + }; + + // Run request + const [operation] = await servicemanagementClient.createServiceRollout( + request + ); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateServiceRollout(); + // [END servicemanagement_v1_generated_ServiceManager_CreateServiceRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..ccaf69b7711 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.delete_service.js @@ -0,0 +1,54 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName) { + // [START servicemanagement_v1_generated_ServiceManager_DeleteService_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callDeleteService() { + // Construct request + const request = { + serviceName, + }; + + // Run request + const [operation] = await servicemanagementClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END servicemanagement_v1_generated_ServiceManager_DeleteService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.disable_service.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.disable_service.js new file mode 100644 index 00000000000..693c8ecd5b1 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.disable_service.js @@ -0,0 +1,65 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, consumerId) { + // [START servicemanagement_v1_generated_ServiceManager_DisableService_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the service to disable. Specifying an unknown service name + * will cause the request to fail. + */ + // const serviceName = 'abc123' + /** + * Required. The identity of consumer resource which service disablement will be + * applied to. + * The Google Service Management implementation accepts the following + * forms: + * - "project:" + * Note: this is made compatible with + * google.api.servicecontrol.v1.Operation.consumer_id. + */ + // const consumerId = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callDisableService() { + // Construct request + const request = { + serviceName, + consumerId, + }; + + // Run request + const [operation] = await servicemanagementClient.disableService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDisableService(); + // [END servicemanagement_v1_generated_ServiceManager_DisableService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-servicemanagement/samples/generated/v1/service_manager.enable_service.js b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.enable_service.js new file mode 100644 index 00000000000..86e2e65e823 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.enable_service.js @@ -0,0 +1,65 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, consumerId) { + // [START servicemanagement_v1_generated_ServiceManager_EnableService_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the service to enable. Specifying an unknown service name will + * cause the request to fail. + */ + // const serviceName = 'abc123' + /** + * Required. The identity of consumer resource which service enablement will be + * applied to. + * The Google Service Management implementation accepts the following + * forms: + * - "project:" + * Note: this is made compatible with + * google.api.servicecontrol.v1.Operation.consumer_id. + */ + // const consumerId = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callEnableService() { + // Construct request + const request = { + serviceName, + consumerId, + }; + + // Run request + const [operation] = await servicemanagementClient.enableService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEnableService(); + // [END servicemanagement_v1_generated_ServiceManager_EnableService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..cbd977f44a9 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.generate_config_report.js @@ -0,0 +1,66 @@ +// 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 +// +// 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. + +'use strict'; + +function main(newConfig) { + // [START servicemanagement_v1_generated_ServiceManager_GenerateConfigReport_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Service configuration for which we want to generate the report. + * For this version of API, the supported types are + * google.api.servicemanagement.v1.ConfigRef google.api.servicemanagement.v1.ConfigRef, + * google.api.servicemanagement.v1.ConfigSource google.api.servicemanagement.v1.ConfigSource, + * and google.api.Service google.api.Service + */ + // const newConfig = {} + /** + * Optional. Service configuration against which the comparison will be done. + * For this version of API, the supported types are + * google.api.servicemanagement.v1.ConfigRef google.api.servicemanagement.v1.ConfigRef, + * google.api.servicemanagement.v1.ConfigSource google.api.servicemanagement.v1.ConfigSource, + * and google.api.Service google.api.Service + */ + // const oldConfig = {} + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callGenerateConfigReport() { + // Construct request + const request = { + newConfig, + }; + + // Run request + const response = await servicemanagementClient.generateConfigReport( + request + ); + console.log(response); + } + + callGenerateConfigReport(); + // [END servicemanagement_v1_generated_ServiceManager_GenerateConfigReport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..d27f3b33ea9 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service.js @@ -0,0 +1,53 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName) { + // [START servicemanagement_v1_generated_ServiceManager_GetService_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the `ServiceManager` overview for naming + * requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callGetService() { + // Construct request + const request = { + serviceName, + }; + + // Run request + const response = await servicemanagementClient.getService(request); + console.log(response); + } + + callGetService(); + // [END servicemanagement_v1_generated_ServiceManager_GetService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..c81fcf3392a --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_config.js @@ -0,0 +1,65 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, configId) { + // [START servicemanagement_v1_generated_ServiceManager_GetServiceConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * Required. The id of the service configuration resource. + * This field must be specified for the server to return all fields, including + * `SourceInfo`. + */ + // const configId = 'abc123' + /** + * Specifies which parts of the Service Config should be returned in the + * response. + */ + // const view = {} + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callGetServiceConfig() { + // Construct request + const request = { + serviceName, + configId, + }; + + // Run request + const response = await servicemanagementClient.getServiceConfig(request); + console.log(response); + } + + callGetServiceConfig(); + // [END servicemanagement_v1_generated_ServiceManager_GetServiceConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..368704d34bd --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.get_service_rollout.js @@ -0,0 +1,58 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, rolloutId) { + // [START servicemanagement_v1_generated_ServiceManager_GetServiceRollout_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * Required. The id of the rollout resource. + */ + // const rolloutId = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callGetServiceRollout() { + // Construct request + const request = { + serviceName, + rolloutId, + }; + + // Run request + const response = await servicemanagementClient.getServiceRollout(request); + console.log(response); + } + + callGetServiceRollout(); + // [END servicemanagement_v1_generated_ServiceManager_GetServiceRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..51cfa2a7c00 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_configs.js @@ -0,0 +1,66 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName) { + // [START servicemanagement_v1_generated_ServiceManager_ListServiceConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * The token of the page to retrieve. + */ + // const pageToken = 'abc123' + /** + * The max number of items to include in the response list. Page size is 50 + * if not specified. Maximum value is 100. + */ + // const pageSize = 1234 + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callListServiceConfigs() { + // Construct request + const request = { + serviceName, + }; + + // Run request + const iterable = await servicemanagementClient.listServiceConfigsAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + callListServiceConfigs(); + // [END servicemanagement_v1_generated_ServiceManager_ListServiceConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..a721153f523 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_service_rollouts.js @@ -0,0 +1,78 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, filter) { + // [START servicemanagement_v1_generated_ServiceManager_ListServiceRollouts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * The token of the page to retrieve. + */ + // const pageToken = 'abc123' + /** + * The max number of items to include in the response list. Page size is 50 + * if not specified. Maximum value is 100. + */ + // const pageSize = 1234 + /** + * Required. Use `filter` to return subset of rollouts. + * The following filters are supported: + * -- To limit the results to only those in + * status (google.api.servicemanagement.v1.RolloutStatus) 'SUCCESS', + * use filter='status=SUCCESS' + * -- To limit the results to those in + * status (google.api.servicemanagement.v1.RolloutStatus) 'CANCELLED' + * or 'FAILED', use filter='status=CANCELLED OR status=FAILED' + */ + // const filter = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callListServiceRollouts() { + // Construct request + const request = { + serviceName, + filter, + }; + + // Run request + const iterable = await servicemanagementClient.listServiceRolloutsAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + callListServiceRollouts(); + // [END servicemanagement_v1_generated_ServiceManager_ListServiceRollouts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..1c1257af881 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.list_services.js @@ -0,0 +1,69 @@ +// 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 +// +// 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. + +'use strict'; + +function main() { + // [START servicemanagement_v1_generated_ServiceManager_ListServices_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Include services produced by the specified project. + */ + // const producerProjectId = 'abc123' + /** + * The max number of items to include in the response list. Page size is 50 + * if not specified. Maximum value is 100. + */ + // const pageSize = 1234 + /** + * Token identifying which result to start with; returned by a previous list + * call. + */ + // const pageToken = 'abc123' + /** + * Include services consumed by the specified consumer. + * The Google Service Management implementation accepts the following + * forms: + * - project: + */ + // const consumerId = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callListServices() { + // Construct request + const request = {}; + + // Run request + const iterable = await servicemanagementClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END servicemanagement_v1_generated_ServiceManager_ListServices_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..f43d86d8d14 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.submit_config_source.js @@ -0,0 +1,67 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName, configSource) { + // [START servicemanagement_v1_generated_ServiceManager_SubmitConfigSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + /** + * Required. The source configuration for the service. + */ + // const configSource = {} + /** + * Optional. If set, this will result in the generation of a + * `google.api.Service` configuration based on the `ConfigSource` provided, + * but the generated config and the sources will NOT be persisted. + */ + // const validateOnly = true + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callSubmitConfigSource() { + // Construct request + const request = { + serviceName, + configSource, + }; + + // Run request + const [operation] = await servicemanagementClient.submitConfigSource( + request + ); + const [response] = await operation.promise(); + console.log(response); + } + + callSubmitConfigSource(); + // [END servicemanagement_v1_generated_ServiceManager_SubmitConfigSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 new file mode 100644 index 00000000000..4e2ec50a874 --- /dev/null +++ b/packages/google-api-servicemanagement/samples/generated/v1/service_manager.undelete_service.js @@ -0,0 +1,54 @@ +// 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 +// +// 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. + +'use strict'; + +function main(serviceName) { + // [START servicemanagement_v1_generated_ServiceManager_UndeleteService_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. See the overview (https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + */ + // const serviceName = 'abc123' + + // Imports the Servicemanagement library + const {ServiceManagerClient} = require('@google-cloud/service-management').v1; + + // Instantiates a client + const servicemanagementClient = new ServiceManagerClient(); + + async function callUndeleteService() { + // Construct request + const request = { + serviceName, + }; + + // Run request + const [operation] = await servicemanagementClient.undeleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeleteService(); + // [END servicemanagement_v1_generated_ServiceManager_UndeleteService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); 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 8827794a273..b2fadeae40c 100644 --- a/packages/google-api-servicemanagement/src/v1/service_manager_client.ts +++ b/packages/google-api-servicemanagement/src/v1/service_manager_client.ts @@ -430,6 +430,25 @@ export class ServiceManagerClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Gets a managed service. Authentication is required unless the service is + * public. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the `ServiceManager` overview for naming + * requirements. For example: `example.googleapis.com`. + * @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 [ManagedService]{@link google.api.servicemanagement.v1.ManagedService}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.get_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_GetService_async + */ getService( request?: protos.google.api.servicemanagement.v1.IGetServiceRequest, options?: CallOptions @@ -461,25 +480,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * Gets a managed service. Authentication is required unless the service is - * public. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the `ServiceManager` overview for naming - * requirements. For example: `example.googleapis.com`. - * @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 [ManagedService]{@link google.api.servicemanagement.v1.ManagedService}. - * 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.getService(request); - */ getService( request?: protos.google.api.servicemanagement.v1.IGetServiceRequest, optionsOrCallback?: @@ -523,6 +523,32 @@ export class ServiceManagerClient { this.initialize(); return this.innerApiCalls.getService(request, options, callback); } + /** + * Gets a service configuration (version) for a managed service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {string} request.configId + * Required. The id of the service configuration resource. + * + * This field must be specified for the server to return all fields, including + * `SourceInfo`. + * @param {google.api.servicemanagement.v1.GetServiceConfigRequest.ConfigView} request.view + * Specifies which parts of the Service Config should be returned in the + * response. + * @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 [Service]{@link google.api.Service}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.get_service_config.js + * region_tag:servicemanagement_v1_generated_ServiceManager_GetServiceConfig_async + */ getServiceConfig( request?: protos.google.api.servicemanagement.v1.IGetServiceConfigRequest, options?: CallOptions @@ -557,32 +583,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * Gets a service configuration (version) for a managed service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {string} request.configId - * Required. The id of the service configuration resource. - * - * This field must be specified for the server to return all fields, including - * `SourceInfo`. - * @param {google.api.servicemanagement.v1.GetServiceConfigRequest.ConfigView} request.view - * Specifies which parts of the Service Config should be returned in the - * response. - * @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 [Service]{@link google.api.Service}. - * 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.getServiceConfig(request); - */ getServiceConfig( request?: protos.google.api.servicemanagement.v1.IGetServiceConfigRequest, optionsOrCallback?: @@ -629,6 +629,33 @@ export class ServiceManagerClient { this.initialize(); return this.innerApiCalls.getServiceConfig(request, options, callback); } + /** + * 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 + * {@link google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout|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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {google.api.Service} request.serviceConfig + * Required. The service configuration resource. + * @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 [Service]{@link google.api.Service}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.create_service_config.js + * region_tag:servicemanagement_v1_generated_ServiceManager_CreateServiceConfig_async + */ createServiceConfig( request?: protos.google.api.servicemanagement.v1.ICreateServiceConfigRequest, options?: CallOptions @@ -663,33 +690,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * 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 - * {@link google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout|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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {google.api.Service} request.serviceConfig - * Required. The service configuration resource. - * @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 [Service]{@link google.api.Service}. - * 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.createServiceConfig(request); - */ createServiceConfig( request?: protos.google.api.servicemanagement.v1.ICreateServiceConfigRequest, optionsOrCallback?: @@ -736,6 +736,26 @@ export class ServiceManagerClient { this.initialize(); return this.innerApiCalls.createServiceConfig(request, options, callback); } + /** + * Gets a service configuration {@link google.api.servicemanagement.v1.Rollout|rollout}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {string} request.rolloutId + * Required. The id of the rollout resource. + * @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 [Rollout]{@link google.api.servicemanagement.v1.Rollout}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.get_service_rollout.js + * region_tag:servicemanagement_v1_generated_ServiceManager_GetServiceRollout_async + */ getServiceRollout( request?: protos.google.api.servicemanagement.v1.IGetServiceRolloutRequest, options?: CallOptions @@ -770,26 +790,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * Gets a service configuration {@link google.api.servicemanagement.v1.Rollout|rollout}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {string} request.rolloutId - * Required. The id of the rollout resource. - * @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 [Rollout]{@link google.api.servicemanagement.v1.Rollout}. - * 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.getServiceRollout(request); - */ getServiceRollout( request?: protos.google.api.servicemanagement.v1.IGetServiceRolloutRequest, optionsOrCallback?: @@ -836,40 +836,6 @@ export class ServiceManagerClient { this.initialize(); return this.innerApiCalls.getServiceRollout(request, options, callback); } - generateConfigReport( - request?: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, - options?: CallOptions - ): Promise< - [ - protos.google.api.servicemanagement.v1.IGenerateConfigReportResponse, - ( - | protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest - | undefined - ), - {} | undefined - ] - >; - generateConfigReport( - request: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, - options: CallOptions, - callback: Callback< - protos.google.api.servicemanagement.v1.IGenerateConfigReportResponse, - | protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest - | null - | undefined, - {} | null | undefined - > - ): void; - generateConfigReport( - request: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, - callback: Callback< - protos.google.api.servicemanagement.v1.IGenerateConfigReportResponse, - | protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Generates and returns a report (errors, warnings and changes from * existing configurations) associated with @@ -904,9 +870,43 @@ export class ServiceManagerClient { * 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.generateConfigReport(request); + * @example include:samples/generated/v1/service_manager.generate_config_report.js + * region_tag:servicemanagement_v1_generated_ServiceManager_GenerateConfigReport_async */ + generateConfigReport( + request?: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.servicemanagement.v1.IGenerateConfigReportResponse, + ( + | protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest + | undefined + ), + {} | undefined + ] + >; + generateConfigReport( + request: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, + options: CallOptions, + callback: Callback< + protos.google.api.servicemanagement.v1.IGenerateConfigReportResponse, + | protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateConfigReport( + request: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, + callback: Callback< + protos.google.api.servicemanagement.v1.IGenerateConfigReportResponse, + | protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest + | null + | undefined, + {} | null | undefined + > + ): void; generateConfigReport( request?: protos.google.api.servicemanagement.v1.IGenerateConfigReportRequest, optionsOrCallback?: @@ -944,10 +944,34 @@ export class ServiceManagerClient { options = optionsOrCallback as CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); return this.innerApiCalls.generateConfigReport(request, options, callback); } + /** + * Creates a new managed service. + * Please note one producer project can own no more than 20 services. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {google.api.servicemanagement.v1.ManagedService} request.service + * Required. Initial values for the service resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.create_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_CreateService_async + */ createService( request?: protos.google.api.servicemanagement.v1.ICreateServiceRequest, options?: CallOptions @@ -984,29 +1008,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * Creates a new managed service. - * Please note one producer project can own no more than 20 services. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {google.api.servicemanagement.v1.ManagedService} request.service - * Required. Initial values for the service resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.createService(request); - * const [response] = await operation.promise(); - */ createService( request?: protos.google.api.servicemanagement.v1.ICreateServiceRequest, optionsOrCallback?: @@ -1046,6 +1047,8 @@ export class ServiceManagerClient { options = optionsOrCallback as CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); return this.innerApiCalls.createService(request, options, callback); } @@ -1058,11 +1061,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkCreateServiceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.create_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_CreateService_async */ async checkCreateServiceProgress( name: string @@ -1086,6 +1086,31 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } + /** + * 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 {@link google.api.servicemanagement.v1.ServiceManager.UndeleteService|UndeleteService} to restore the service. + * After 30 days, the service will be permanently deleted. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.delete_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_DeleteService_async + */ deleteService( request?: protos.google.api.servicemanagement.v1.IDeleteServiceRequest, options?: CallOptions @@ -1119,35 +1144,9 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - /** - * 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 {@link google.api.servicemanagement.v1.ServiceManager.UndeleteService|UndeleteService} to restore the service. - * After 30 days, the service will be permanently deleted. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.deleteService(request); - * const [response] = await operation.promise(); - */ + {} | null | undefined + > + ): void; deleteService( request?: protos.google.api.servicemanagement.v1.IDeleteServiceRequest, optionsOrCallback?: @@ -1205,11 +1204,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkDeleteServiceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.delete_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_DeleteService_async */ async checkDeleteServiceProgress( name: string @@ -1233,6 +1229,31 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } + /** + * 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 + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.undelete_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_UndeleteService_async + */ undeleteService( request?: protos.google.api.servicemanagement.v1.IUndeleteServiceRequest, options?: CallOptions @@ -1269,32 +1290,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * 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 - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.undeleteService(request); - * const [response] = await operation.promise(); - */ undeleteService( request?: protos.google.api.servicemanagement.v1.IUndeleteServiceRequest, optionsOrCallback?: @@ -1352,11 +1347,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkUndeleteServiceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.undelete_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_UndeleteService_async */ async checkUndeleteServiceProgress( name: string @@ -1380,42 +1372,6 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } - submitConfigSource( - request?: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.api.servicemanagement.v1.ISubmitConfigSourceResponse, - protos.google.api.servicemanagement.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - submitConfigSource( - request: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.api.servicemanagement.v1.ISubmitConfigSourceResponse, - protos.google.api.servicemanagement.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - submitConfigSource( - request: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, - callback: Callback< - LROperation< - protos.google.api.servicemanagement.v1.ISubmitConfigSourceResponse, - protos.google.api.servicemanagement.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Creates a new service configuration (version) for a managed service based * on @@ -1451,10 +1407,45 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.submitConfigSource(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v1/service_manager.submit_config_source.js + * region_tag:servicemanagement_v1_generated_ServiceManager_SubmitConfigSource_async */ + submitConfigSource( + request?: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.api.servicemanagement.v1.ISubmitConfigSourceResponse, + protos.google.api.servicemanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + submitConfigSource( + request: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.api.servicemanagement.v1.ISubmitConfigSourceResponse, + protos.google.api.servicemanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + submitConfigSource( + request: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, + callback: Callback< + LROperation< + protos.google.api.servicemanagement.v1.ISubmitConfigSourceResponse, + protos.google.api.servicemanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; submitConfigSource( request?: protos.google.api.servicemanagement.v1.ISubmitConfigSourceRequest, optionsOrCallback?: @@ -1512,11 +1503,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkSubmitConfigSourceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.submit_config_source.js + * region_tag:servicemanagement_v1_generated_ServiceManager_SubmitConfigSource_async */ async checkSubmitConfigSourceProgress( name: string @@ -1540,6 +1528,41 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } + /** + * 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 + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {google.api.servicemanagement.v1.Rollout} request.rollout + * Required. The rollout resource. The `service_name` field is output only. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.create_service_rollout.js + * region_tag:servicemanagement_v1_generated_ServiceManager_CreateServiceRollout_async + */ createServiceRollout( request?: protos.google.api.servicemanagement.v1.ICreateServiceRolloutRequest, options?: CallOptions @@ -1576,42 +1599,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * 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 - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {google.api.servicemanagement.v1.Rollout} request.rollout - * Required. The rollout resource. The `service_name` field is output only. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.createServiceRollout(request); - * const [response] = await operation.promise(); - */ createServiceRollout( request?: protos.google.api.servicemanagement.v1.ICreateServiceRolloutRequest, optionsOrCallback?: @@ -1669,11 +1656,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkCreateServiceRolloutProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.create_service_rollout.js + * region_tag:servicemanagement_v1_generated_ServiceManager_CreateServiceRollout_async */ async checkCreateServiceRolloutProgress( name: string @@ -1697,42 +1681,6 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } - enableService( - request?: protos.google.api.servicemanagement.v1.IEnableServiceRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.api.servicemanagement.v1.IEnableServiceResponse, - protos.google.api.servicemanagement.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - enableService( - request: protos.google.api.servicemanagement.v1.IEnableServiceRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.api.servicemanagement.v1.IEnableServiceResponse, - protos.google.api.servicemanagement.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - enableService( - request: protos.google.api.servicemanagement.v1.IEnableServiceRequest, - callback: Callback< - LROperation< - protos.google.api.servicemanagement.v1.IEnableServiceResponse, - protos.google.api.servicemanagement.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Enables a {@link google.api.servicemanagement.v1.ManagedService|service} for a project, so it can be used * for the project. See @@ -1765,11 +1713,46 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.enableService(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v1/service_manager.enable_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_EnableService_async * @deprecated EnableService is deprecated and may be removed in a future version. */ + enableService( + request?: protos.google.api.servicemanagement.v1.IEnableServiceRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.api.servicemanagement.v1.IEnableServiceResponse, + protos.google.api.servicemanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + enableService( + request: protos.google.api.servicemanagement.v1.IEnableServiceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.api.servicemanagement.v1.IEnableServiceResponse, + protos.google.api.servicemanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableService( + request: protos.google.api.servicemanagement.v1.IEnableServiceRequest, + callback: Callback< + LROperation< + protos.google.api.servicemanagement.v1.IEnableServiceResponse, + protos.google.api.servicemanagement.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; enableService( request?: protos.google.api.servicemanagement.v1.IEnableServiceRequest, optionsOrCallback?: @@ -1832,11 +1815,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkEnableServiceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.enable_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_EnableService_async * @deprecated EnableService is deprecated and may be removed in a future version. */ async checkEnableServiceProgress( @@ -1866,6 +1846,41 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } + /** + * Disables a {@link google.api.servicemanagement.v1.ManagedService|service} for a project, so it can no longer be + * be used for the project. It prevents accidental usage that may cause + * unexpected billing charges or security leaks. + * + * Operation + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. Name of the service to disable. Specifying an unknown service name + * will cause the request to fail. + * @param {string} request.consumerId + * Required. The identity of consumer resource which service disablement will be + * applied to. + * + * The Google Service Management implementation accepts the following + * forms: + * - "project:" + * + * Note: this is made compatible with + * google.api.servicecontrol.v1.Operation.consumer_id. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/service_manager.disable_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_DisableService_async + * @deprecated DisableService is deprecated and may be removed in a future version. + */ disableService( request?: protos.google.api.servicemanagement.v1.IDisableServiceRequest, options?: CallOptions @@ -1902,42 +1917,6 @@ export class ServiceManagerClient { {} | null | undefined > ): void; - /** - * Disables a {@link google.api.servicemanagement.v1.ManagedService|service} for a project, so it can no longer be - * be used for the project. It prevents accidental usage that may cause - * unexpected billing charges or security leaks. - * - * Operation - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. Name of the service to disable. Specifying an unknown service name - * will cause the request to fail. - * @param {string} request.consumerId - * Required. The identity of consumer resource which service disablement will be - * applied to. - * - * The Google Service Management implementation accepts the following - * forms: - * - "project:" - * - * Note: this is made compatible with - * google.api.servicecontrol.v1.Operation.consumer_id. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.disableService(request); - * const [response] = await operation.promise(); - * @deprecated DisableService is deprecated and may be removed in a future version. - */ disableService( request?: protos.google.api.servicemanagement.v1.IDisableServiceRequest, optionsOrCallback?: @@ -2000,11 +1979,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkDisableServiceProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/service_manager.disable_service.js + * region_tag:servicemanagement_v1_generated_ServiceManager_DisableService_async * @deprecated DisableService is deprecated and may be removed in a future version. */ async checkDisableServiceProgress( @@ -2034,37 +2010,6 @@ export class ServiceManagerClient { protos.google.api.servicemanagement.v1.OperationMetadata >; } - listServices( - request?: protos.google.api.servicemanagement.v1.IListServicesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.api.servicemanagement.v1.IManagedService[], - protos.google.api.servicemanagement.v1.IListServicesRequest | null, - protos.google.api.servicemanagement.v1.IListServicesResponse - ] - >; - listServices( - request: protos.google.api.servicemanagement.v1.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.api.servicemanagement.v1.IListServicesRequest, - | protos.google.api.servicemanagement.v1.IListServicesResponse - | null - | undefined, - protos.google.api.servicemanagement.v1.IManagedService - > - ): void; - listServices( - request: protos.google.api.servicemanagement.v1.IListServicesRequest, - callback: PaginationCallback< - protos.google.api.servicemanagement.v1.IListServicesRequest, - | protos.google.api.servicemanagement.v1.IListServicesResponse - | null - | undefined, - protos.google.api.servicemanagement.v1.IManagedService - > - ): void; /** * Lists managed services. * @@ -2105,6 +2050,37 @@ export class ServiceManagerClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listServices( + request?: protos.google.api.servicemanagement.v1.IListServicesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.servicemanagement.v1.IManagedService[], + protos.google.api.servicemanagement.v1.IListServicesRequest | null, + protos.google.api.servicemanagement.v1.IListServicesResponse + ] + >; + listServices( + request: protos.google.api.servicemanagement.v1.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.api.servicemanagement.v1.IListServicesRequest, + | protos.google.api.servicemanagement.v1.IListServicesResponse + | null + | undefined, + protos.google.api.servicemanagement.v1.IManagedService + > + ): void; + listServices( + request: protos.google.api.servicemanagement.v1.IListServicesRequest, + callback: PaginationCallback< + protos.google.api.servicemanagement.v1.IListServicesRequest, + | protos.google.api.servicemanagement.v1.IListServicesResponse + | null + | undefined, + protos.google.api.servicemanagement.v1.IManagedService + > + ): void; listServices( request?: protos.google.api.servicemanagement.v1.IListServicesRequest, optionsOrCallback?: @@ -2139,6 +2115,8 @@ export class ServiceManagerClient { options = optionsOrCallback as CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); return this.innerApiCalls.listServices(request, options, callback); } @@ -2179,7 +2157,10 @@ export class ServiceManagerClient { ): Transform { request = request || {}; options = options || {}; - const callSettings = new gax.CallSettings(options); + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServices.createStream( this.innerApiCalls.listServices as gax.GaxCall, @@ -2218,11 +2199,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listServicesAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/service_manager.list_services.js + * region_tag:servicemanagement_v1_generated_ServiceManager_ListServices_async */ listServicesAsync( request?: protos.google.api.servicemanagement.v1.IListServicesRequest, @@ -2230,8 +2208,10 @@ export class ServiceManagerClient { ): AsyncIterable { request = request || {}; options = options || {}; - options = options || {}; - const callSettings = new gax.CallSettings(options); + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, @@ -2239,6 +2219,33 @@ export class ServiceManagerClient { callSettings ) as AsyncIterable; } + /** + * Lists the history of the service configuration for a managed service, + * from the newest to the oldest. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.serviceName + * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) + * for naming requirements. For example: `example.googleapis.com`. + * @param {string} request.pageToken + * The token of the page to retrieve. + * @param {number} request.pageSize + * The max number of items to include in the response list. Page size is 50 + * if not specified. Maximum value is 100. + * @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 Array of [Service]{@link google.api.Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServiceConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listServiceConfigs( request?: protos.google.api.servicemanagement.v1.IListServiceConfigsRequest, options?: CallOptions @@ -2270,33 +2277,6 @@ export class ServiceManagerClient { protos.google.api.IService > ): void; - /** - * Lists the history of the service configuration for a managed service, - * from the newest to the oldest. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.serviceName - * Required. The name of the service. See the [overview](https://cloud.google.com/service-management/overview) - * for naming requirements. For example: `example.googleapis.com`. - * @param {string} request.pageToken - * The token of the page to retrieve. - * @param {number} request.pageSize - * The max number of items to include in the response list. Page size is 50 - * if not specified. Maximum value is 100. - * @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 Array of [Service]{@link google.api.Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServiceConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ listServiceConfigs( request?: protos.google.api.servicemanagement.v1.IListServiceConfigsRequest, optionsOrCallback?: @@ -2377,7 +2357,8 @@ export class ServiceManagerClient { gax.routingHeader.fromParams({ service_name: request.serviceName || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listServiceConfigs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServiceConfigs.createStream( this.innerApiCalls.listServiceConfigs as gax.GaxCall, @@ -2410,11 +2391,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listServiceConfigsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/service_manager.list_service_configs.js + * region_tag:servicemanagement_v1_generated_ServiceManager_ListServiceConfigs_async */ listServiceConfigsAsync( request?: protos.google.api.servicemanagement.v1.IListServiceConfigsRequest, @@ -2428,8 +2406,8 @@ export class ServiceManagerClient { gax.routingHeader.fromParams({ service_name: request.serviceName || '', }); - options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listServiceConfigs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServiceConfigs.asyncIterate( this.innerApiCalls['listServiceConfigs'] as GaxCall, @@ -2437,37 +2415,6 @@ export class ServiceManagerClient { callSettings ) as AsyncIterable; } - listServiceRollouts( - request?: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.api.servicemanagement.v1.IRollout[], - protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest | null, - protos.google.api.servicemanagement.v1.IListServiceRolloutsResponse - ] - >; - listServiceRollouts( - request: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, - | protos.google.api.servicemanagement.v1.IListServiceRolloutsResponse - | null - | undefined, - protos.google.api.servicemanagement.v1.IRollout - > - ): void; - listServiceRollouts( - request: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, - callback: PaginationCallback< - protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, - | protos.google.api.servicemanagement.v1.IListServiceRolloutsResponse - | null - | undefined, - protos.google.api.servicemanagement.v1.IRollout - > - ): void; /** * Lists the history of the service configuration rollouts for a managed * service, from the newest to the oldest. @@ -2504,6 +2451,37 @@ export class ServiceManagerClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listServiceRollouts( + request?: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.servicemanagement.v1.IRollout[], + protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest | null, + protos.google.api.servicemanagement.v1.IListServiceRolloutsResponse + ] + >; + listServiceRollouts( + request: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, + | protos.google.api.servicemanagement.v1.IListServiceRolloutsResponse + | null + | undefined, + protos.google.api.servicemanagement.v1.IRollout + > + ): void; + listServiceRollouts( + request: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, + callback: PaginationCallback< + protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, + | protos.google.api.servicemanagement.v1.IListServiceRolloutsResponse + | null + | undefined, + protos.google.api.servicemanagement.v1.IRollout + > + ): void; listServiceRollouts( request?: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, optionsOrCallback?: @@ -2593,7 +2571,8 @@ export class ServiceManagerClient { gax.routingHeader.fromParams({ service_name: request.serviceName || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listServiceRollouts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServiceRollouts.createStream( this.innerApiCalls.listServiceRollouts as gax.GaxCall, @@ -2635,11 +2614,8 @@ export class ServiceManagerClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listServiceRolloutsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/service_manager.list_service_rollouts.js + * region_tag:servicemanagement_v1_generated_ServiceManager_ListServiceRollouts_async */ listServiceRolloutsAsync( request?: protos.google.api.servicemanagement.v1.IListServiceRolloutsRequest, @@ -2653,8 +2629,8 @@ export class ServiceManagerClient { gax.routingHeader.fromParams({ service_name: request.serviceName || '', }); - options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listServiceRollouts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServiceRollouts.asyncIterate( this.innerApiCalls['listServiceRollouts'] as GaxCall, 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 b02094e8c78..dbe0d0bf5df 100644 --- a/packages/google-api-servicemanagement/test/gapic_service_manager_v1.ts +++ b/packages/google-api-servicemanagement/test/gapic_service_manager_v1.ts @@ -676,7 +676,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.GenerateConfigReportRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.api.servicemanagement.v1.GenerateConfigReportResponse() ); @@ -700,7 +700,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.GenerateConfigReportRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.api.servicemanagement.v1.GenerateConfigReportResponse() ); @@ -739,7 +739,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.GenerateConfigReportRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.generateConfigReport = stubSimpleCall( undefined, @@ -764,7 +764,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.CreateServiceRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -789,7 +789,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.CreateServiceRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -835,7 +835,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.CreateServiceRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.createService = stubLongRunningCall( undefined, @@ -858,7 +858,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.CreateServiceRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.createService = stubLongRunningCall( undefined, @@ -2114,7 +2114,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.ListServicesRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.api.servicemanagement.v1.ManagedService() @@ -2145,7 +2145,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.ListServicesRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.api.servicemanagement.v1.ManagedService() @@ -2194,7 +2194,7 @@ describe('v1.ServiceManagerClient', () => { const request = generateSampleMessage( new protos.google.api.servicemanagement.v1.ListServicesRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.listServices = stubSimpleCall( undefined,