From c2e630c71b7cace48a29602210875a2f72f96e25 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 09:23:43 -0700 Subject: [PATCH] docs: fix docstring formatting and add generated samples (#84) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: fix docstring formatting Committer: @parthea PiperOrigin-RevId: 404008335 Source-Link: https://github.com/googleapis/googleapis/commit/4dd603675ff73897600a5a94ec42606a6f83f907 Source-Link: https://github.com/googleapis/googleapis-gen/commit/5fb830d4b2d873a982c2ac8a04087b021f3b2408 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWZiODMwZDRiMmQ4NzNhOTgyYzJhYzhhMDQwODdiMDIxZjNiMjQwOCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../api/servicecontrol/v1/distribution.proto | 8 +- .../v1/quota_controller.allocate_quota.js | 62 ++++++++++++++++ .../generated/v1/service_controller.check.js | 65 +++++++++++++++++ .../generated/v1/service_controller.report.js | 73 +++++++++++++++++++ 4 files changed, 204 insertions(+), 4 deletions(-) create mode 100644 packages/google-api-servicecontrol/samples/generated/v1/quota_controller.allocate_quota.js create mode 100644 packages/google-api-servicecontrol/samples/generated/v1/service_controller.check.js create mode 100644 packages/google-api-servicecontrol/samples/generated/v1/service_controller.report.js diff --git a/packages/google-api-servicecontrol/protos/google/api/servicecontrol/v1/distribution.proto b/packages/google-api-servicecontrol/protos/google/api/servicecontrol/v1/distribution.proto index 946a2f97e64..e874e44aa64 100644 --- a/packages/google-api-servicecontrol/protos/google/api/servicecontrol/v1/distribution.proto +++ b/packages/google-api-servicecontrol/protos/google/api/servicecontrol/v1/distribution.proto @@ -31,10 +31,10 @@ option ruby_package = "Google::Cloud::ServiceControl::V1"; // points. It contains the size of the population of sample points plus // additional optional information: // -// - the arithmetic mean of the samples -// - the minimum and maximum of the samples -// - the sum-squared-deviation of the samples, used to compute variance -// - a histogram of the values of the sample points +// * the arithmetic mean of the samples +// * the minimum and maximum of the samples +// * the sum-squared-deviation of the samples, used to compute variance +// * a histogram of the values of the sample points message Distribution { // Describing buckets with constant width. message LinearBuckets { diff --git a/packages/google-api-servicecontrol/samples/generated/v1/quota_controller.allocate_quota.js b/packages/google-api-servicecontrol/samples/generated/v1/quota_controller.allocate_quota.js new file mode 100644 index 00000000000..c53b45b01e6 --- /dev/null +++ b/packages/google-api-servicecontrol/samples/generated/v1/quota_controller.allocate_quota.js @@ -0,0 +1,62 @@ +// 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 servicecontrol_v1_generated_QuotaController_AllocateQuota_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the service as specified in the service configuration. For example, + * `"pubsub.googleapis.com"`. + * See [google.api.Service][google.api.Service] for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * Operation that describes the quota allocation. + */ + // const allocateOperation = '' + /** + * Specifies which version of service configuration should be used to process + * the request. If unspecified or no matching version can be found, the latest + * one will be used. + */ + // const serviceConfigId = 'abc123' + + // Imports the Servicecontrol library + const {QuotaControllerClient} = require('@google-cloud/service-control').v1; + + // Instantiates a client + const servicecontrolClient = new QuotaControllerClient(); + + async function allocateQuota() { + // Construct request + const request = {}; + + // Run request + const response = await servicecontrolClient.allocateQuota(request); + console.log(response); + } + + allocateQuota(); + // [END servicecontrol_v1_generated_QuotaController_AllocateQuota_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-servicecontrol/samples/generated/v1/service_controller.check.js b/packages/google-api-servicecontrol/samples/generated/v1/service_controller.check.js new file mode 100644 index 00000000000..29cde8a82b5 --- /dev/null +++ b/packages/google-api-servicecontrol/samples/generated/v1/service_controller.check.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() { + // [START servicecontrol_v1_generated_ServiceController_Check_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * See + * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * The operation to be checked. + */ + // const operation = '' + /** + * Specifies which version of service configuration should be used to process + * the request. + * If unspecified or no matching version can be found, the + * latest one will be used. + */ + // const serviceConfigId = 'abc123' + + // Imports the Servicecontrol library + const {ServiceControllerClient} = require('@google-cloud/service-control').v1; + + // Instantiates a client + const servicecontrolClient = new ServiceControllerClient(); + + async function check() { + // Construct request + const request = {}; + + // Run request + const response = await servicecontrolClient.check(request); + console.log(response); + } + + check(); + // [END servicecontrol_v1_generated_ServiceController_Check_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-servicecontrol/samples/generated/v1/service_controller.report.js b/packages/google-api-servicecontrol/samples/generated/v1/service_controller.report.js new file mode 100644 index 00000000000..8a27729512c --- /dev/null +++ b/packages/google-api-servicecontrol/samples/generated/v1/service_controller.report.js @@ -0,0 +1,73 @@ +// 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 servicecontrol_v1_generated_ServiceController_Report_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The service name as specified in its service configuration. For example, + * `"pubsub.googleapis.com"`. + * See + * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + * for the definition of a service name. + */ + // const serviceName = 'abc123' + /** + * Operations to be reported. + * Typically the service should report one operation per request. + * Putting multiple operations into a single request is allowed, but should + * be used only when multiple operations are natually available at the time + * of the report. + * There is no limit on the number of operations in the same ReportRequest, + * however the ReportRequest size should be no larger than 1MB. See + * [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] + * for partial failure behavior. + */ + // const operations = 1234 + /** + * Specifies which version of service config should be used to process the + * request. + * If unspecified or no matching version can be found, the + * latest one will be used. + */ + // const serviceConfigId = 'abc123' + + // Imports the Servicecontrol library + const {ServiceControllerClient} = require('@google-cloud/service-control').v1; + + // Instantiates a client + const servicecontrolClient = new ServiceControllerClient(); + + async function report() { + // Construct request + const request = {}; + + // Run request + const response = await servicecontrolClient.report(request); + console.log(response); + } + + report(); + // [END servicecontrol_v1_generated_ServiceController_Report_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2));