From 3437b1cee0aab0be09cd1ecf55e9d04f8ddd4e81 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Tue, 6 Dec 2022 11:36:08 -0500 Subject: [PATCH] feat: [monitoring-metricsscope] new module for monitoring-metricsscope (#8875) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: [monitoring-metricsscope] new module for monitoring-metricsscope * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- gapic-libraries-bom/pom.xml | 7 + java-monitoring-metricsscope/.OwlBot.yaml | 33 + .../.repo-metadata.json | 16 + java-monitoring-metricsscope/README.md | 201 ++ .../pom.xml | 44 + .../pom.xml | 113 ++ .../metricsscope/v1/MetricsScopesClient.java | 691 +++++++ .../v1/MetricsScopesSettings.java | 254 +++ .../metricsscope/v1/gapic_metadata.json | 30 + .../metricsscope/v1/package-info.java | 44 + .../GrpcMetricsScopesCallableFactory.java | 113 ++ .../v1/stub/GrpcMetricsScopesStub.java | 308 +++ .../v1/stub/MetricsScopesStub.java | 81 + .../v1/stub/MetricsScopesStubSettings.java | 469 +++++ .../v1/MetricsScopesClientTest.java | 403 ++++ .../metricsscope/v1/MockMetricsScopes.java | 59 + .../v1/MockMetricsScopesImpl.java | 146 ++ .../pom.xml | 45 + .../metricsscope/v1/MetricsScopesGrpc.java | 763 +++++++ java-monitoring-metricsscope/owlbot.py | 36 + java-monitoring-metricsscope/pom.xml | 54 + .../clirr-ignored-differences.xml | 19 + .../pom.xml | 37 + .../v1/CreateMonitoredProjectRequest.java | 995 +++++++++ ...reateMonitoredProjectRequestOrBuilder.java | 110 + .../v1/DeleteMonitoredProjectRequest.java | 675 +++++++ ...eleteMonitoredProjectRequestOrBuilder.java | 64 + .../v1/GetMetricsScopeRequest.java | 647 ++++++ .../v1/GetMetricsScopeRequestOrBuilder.java | 58 + ...etricsScopesByMonitoredProjectRequest.java | 672 +++++++ ...pesByMonitoredProjectRequestOrBuilder.java | 54 + ...tricsScopesByMonitoredProjectResponse.java | 1001 ++++++++++ ...esByMonitoredProjectResponseOrBuilder.java | 82 + .../metricsscope/v1/MetricsScope.java | 1779 +++++++++++++++++ .../metricsscope/v1/MetricsScopeName.java | 168 ++ .../v1/MetricsScopeOrBuilder.java | 199 ++ .../metricsscope/v1/MetricsScopeProto.java | 109 + .../metricsscope/v1/MetricsScopesProto.java | 213 ++ .../metricsscope/v1/MonitoredProject.java | 932 +++++++++ .../metricsscope/v1/MonitoredProjectName.java | 193 ++ .../v1/MonitoredProjectOrBuilder.java | 96 + .../metricsscope/v1/OperationMetadata.java | 1326 ++++++++++++ .../v1/OperationMetadataOrBuilder.java | 120 ++ .../metricsscope/v1/metrics_scope.proto | 77 + .../metricsscope/v1/metrics_scopes.proto | 183 ++ pom.xml | 1 + versions.txt | 3 + 47 files changed, 13723 insertions(+) create mode 100644 java-monitoring-metricsscope/.OwlBot.yaml create mode 100644 java-monitoring-metricsscope/.repo-metadata.json create mode 100644 java-monitoring-metricsscope/README.md create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope-bom/pom.xml create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/pom.xml create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesClient.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesSettings.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/gapic_metadata.json create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/package-info.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesCallableFactory.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesStub.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStub.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStubSettings.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MetricsScopesClientTest.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopes.java create mode 100644 java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopesImpl.java create mode 100644 java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/pom.xml create mode 100644 java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesGrpc.java create mode 100644 java-monitoring-metricsscope/owlbot.py create mode 100644 java-monitoring-metricsscope/pom.xml create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/clirr-ignored-differences.xml create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/pom.xml create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequest.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequestOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequest.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequestOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequest.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequestOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequest.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequestOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponse.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponseOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScope.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeName.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeProto.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesProto.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProject.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectName.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadata.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadataOrBuilder.java create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scope.proto create mode 100644 java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scopes.proto diff --git a/gapic-libraries-bom/pom.xml b/gapic-libraries-bom/pom.xml index 640550f5897b..e5a5a942e04c 100644 --- a/gapic-libraries-bom/pom.xml +++ b/gapic-libraries-bom/pom.xml @@ -616,6 +616,13 @@ pom import + + com.google.cloud + google-cloud-monitoring-metricsscope-bom + 0.0.1-SNAPSHOT + pom + import + com.google.cloud google-cloud-networkconnectivity-bom diff --git a/java-monitoring-metricsscope/.OwlBot.yaml b/java-monitoring-metricsscope/.OwlBot.yaml new file mode 100644 index 000000000000..1b75ae2f6129 --- /dev/null +++ b/java-monitoring-metricsscope/.OwlBot.yaml @@ -0,0 +1,33 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + + +deep-remove-regex: +- "/java-monitoring-metricsscope/grpc-google-.*/src" +- "/java-monitoring-metricsscope/proto-google-.*/src" +- "/java-monitoring-metricsscope/google-.*/src" + +deep-preserve-regex: +- "/java-monitoring-metricsscope/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" + +deep-copy-regex: +- source: "/google/monitoring/metricsscope/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/java-monitoring-metricsscope/$1/proto-google-cloud-monitoring-metricsscope-$1/src" +- source: "/google/monitoring/metricsscope/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/java-monitoring-metricsscope/$1/grpc-google-cloud-monitoring-metricsscope-$1/src" +- source: "/google/monitoring/metricsscope/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/java-monitoring-metricsscope/$1/google-cloud-monitoring-metricsscope/src" + + +api-name: java-monitoring-metricsscope \ No newline at end of file diff --git a/java-monitoring-metricsscope/.repo-metadata.json b/java-monitoring-metricsscope/.repo-metadata.json new file mode 100644 index 000000000000..d73525ff15dc --- /dev/null +++ b/java-monitoring-metricsscope/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "api_shortname": "monitoring-metricsscope", + "name_pretty": "Monitoring Metrics Scopes", + "product_documentation": "https://cloud.google.com/monitoring/api/ref_v3/rest/v1/locations.global.metricsScopes", + "api_description": "The metrics scope defines the set of Google Cloud projects whose metrics the current Google Cloud project can access.", + "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/overview", + "release_level": "preview", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-monitoring-metricsscope", + "repo_short": "java-monitoring-metricsscope", + "distribution_name": "com.google.cloud:google-cloud-monitoring-metricsscope", + "api_id": "monitoring.googleapis.com", + "library_type": "GAPIC_AUTO", + "requires_billing": true +} \ No newline at end of file diff --git a/java-monitoring-metricsscope/README.md b/java-monitoring-metricsscope/README.md new file mode 100644 index 000000000000..6a0e2a9ba57c --- /dev/null +++ b/java-monitoring-metricsscope/README.md @@ -0,0 +1,201 @@ +# Google Monitoring Metrics Scopes Client for Java + +Java idiomatic client for [Monitoring Metrics Scopes][product-docs]. + +[![Maven][maven-version-image]][maven-version-link] +![Stability][stability-image] + +- [Product Documentation][product-docs] +- [Client Library Documentation][javadocs] + +> Note: This client is a work-in-progress, and may occasionally +> make backwards-incompatible changes. + + +## Quickstart + + +If you are using Maven, add this to your pom.xml file: + + +```xml + + com.google.cloud + google-cloud-monitoring-metricsscope + 0.0.0 + +``` + +If you are using Gradle without BOM, add this to your dependencies: + +```Groovy +implementation 'com.google.cloud:google-cloud-monitoring-metricsscope:0.0.0' +``` + +If you are using SBT, add this to your dependencies: + +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-monitoring-metricsscope" % "0.0.0" +``` + +## Authentication + +See the [Authentication][authentication] section in the base directory's README. + +## Authorization + +The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Monitoring Metrics Scopes APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Monitoring Metrics Scopes API calls. + +## Getting Started + +### Prerequisites + +You will need a [Google Cloud Platform Console][developer-console] project with the Monitoring Metrics Scopes [API enabled][enable-api]. +You will need to [enable billing][enable-billing] to use Google Monitoring Metrics Scopes. +[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by +[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: +`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +### Installation and setup + +You'll need to obtain the `google-cloud-monitoring-metricsscope` library. See the [Quickstart](#quickstart) section +to add `google-cloud-monitoring-metricsscope` as a dependency in your code. + +## About Monitoring Metrics Scopes + + +[Monitoring Metrics Scopes][product-docs] The metrics scope defines the set of Google Cloud projects whose metrics the current Google Cloud project can access. + +See the [Monitoring Metrics Scopes client library docs][javadocs] to learn how to +use this Monitoring Metrics Scopes Client Library. + + + + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +Monitoring Metrics Scopes uses gRPC for the transport layer. + +## Supported Java Versions + +Java 8 or above is required for using this client. + +Google's Java client libraries, +[Google Cloud Client Libraries][cloudlibs] +and +[Google Cloud API Libraries][apilibs], +follow the +[Oracle Java SE support roadmap][oracle] +(see the Oracle Java SE Product Releases section). + +### For new development + +In general, new feature development occurs with support for the lowest Java +LTS version covered by Oracle's Premier Support (which typically lasts 5 years +from initial General Availability). If the minimum required JVM for a given +library is changed, it is accompanied by a [semver][semver] major release. + +Java 11 and (in September 2021) Java 17 are the best choices for new +development. + +### Keeping production systems current + +Google tests its client libraries with all current LTS versions covered by +Oracle's Extended Support (which typically lasts 8 years from initial +General Availability). + +#### Legacy support + +Google's client libraries support legacy versions of Java runtimes with long +term stable libraries that don't receive feature updates on a best efforts basis +as it may not be possible to backport all patches. + +Google provides updates on a best efforts basis to apps that continue to use +Java 7, though apps might need to upgrade to current versions of the library +that supports their JVM. + +#### Where to find specific information + +The latest versions and the supported Java versions are identified on +the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` +and on [google-cloud-java][g-c-j]. + +## Versioning + + +This library follows [Semantic Versioning](http://semver.org/). + + +It is currently in major version zero (``0.y.z``), which means that anything may change at any time +and the public API should not be considered stable. + + +## Contributing + + +Contributions to this library are always welcome and highly encouraged. + +See [CONTRIBUTING][contributing] for more information how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in +this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more +information. + + +## License + +Apache 2.0 - See [LICENSE][license] for more information. + +## CI Status + +Java Version | Status +------------ | ------ +Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] +Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] +Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] +Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] + +Java is a registered trademark of Oracle and/or its affiliates. + +[product-docs]: https://cloud.google.com/monitoring/api/ref_v3/rest/v1/locations.global.metricsScopes +[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/overview +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-monitoring-metricsscope/java11.html +[stability-image]: https://img.shields.io/badge/stability-preview-yellow +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-monitoring-metricsscope.svg +[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-monitoring-metricsscope&core=gav +[authentication]: https://github.com/googleapis/google-cloud-java#authentication +[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes +[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles +[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy +[developer-console]: https://console.developers.google.com/ +[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects +[cloud-sdk]: https://cloud.google.com/sdk/ +[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting +[contributing]: https://github.com/googleapis/java-monitoring-metricsscope/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-monitoring-metricsscope/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-monitoring-metricsscope/blob/main/LICENSE +[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing +[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=monitoring.googleapis.com +[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + +[semver]: https://semver.org/ +[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained +[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries +[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html +[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope-bom/pom.xml b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope-bom/pom.xml new file mode 100644 index 000000000000..162dd2e8fa0e --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope-bom/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + com.google.cloud + google-cloud-monitoring-metricsscope-bom + 0.0.1-SNAPSHOT + pom + + + com.google.cloud + google-cloud-pom-parent + 1.1.0-SNAPSHOT + ../../google-cloud-pom-parent/pom.xml + + + Google Monitoring Metrics Scopes BOM + + BOM for Monitoring Metrics Scopes + + + + true + + + + + + com.google.cloud + google-cloud-monitoring-metricsscope + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-monitoring-metricsscope-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-monitoring-metricsscope-v1 + 0.0.1-SNAPSHOT + + + + diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/pom.xml b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/pom.xml new file mode 100644 index 000000000000..6aecb5ba64d7 --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + com.google.cloud + google-cloud-monitoring-metricsscope + 0.0.1-SNAPSHOT + jar + Google Monitoring Metrics Scopes + Monitoring Metrics Scopes The metrics scope defines the set of Google Cloud projects whose metrics the current Google Cloud project can access. + + com.google.cloud + google-cloud-monitoring-metricsscope-parent + 0.0.1-SNAPSHOT + + + google-cloud-monitoring-metricsscope + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-monitoring-metricsscope-v1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + com.google.api + gax-httpjson + + + com.google.api.grpc + grpc-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api.grpc + grpc-google-iam-v1 + + + org.threeten + threetenbp + + + + + junit + junit + test + + + + com.google.api.grpc + grpc-google-cloud-monitoring-metricsscope-v1 + test + + + + com.google.api + gax + testlib + test + + + com.google.api + gax-grpc + testlib + test + + + com.google.api + gax-httpjson + testlib + test + + + diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesClient.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesClient.java new file mode 100644 index 000000000000..234d906473bd --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesClient.java @@ -0,0 +1,691 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import com.google.monitoring.metricsscope.v1.stub.MetricsScopesStub; +import com.google.monitoring.metricsscope.v1.stub.MetricsScopesStubSettings; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud + * projects and AWS accounts. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+ *   MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]");
+ *   MetricsScope response = metricsScopesClient.getMetricsScope(name);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the MetricsScopesClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of MetricsScopesSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * MetricsScopesSettings metricsScopesSettings =
+ *     MetricsScopesSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * MetricsScopesClient metricsScopesClient = MetricsScopesClient.create(metricsScopesSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * MetricsScopesSettings metricsScopesSettings =
+ *     MetricsScopesSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * MetricsScopesClient metricsScopesClient = MetricsScopesClient.create(metricsScopesSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class MetricsScopesClient implements BackgroundResource { + private final MetricsScopesSettings settings; + private final MetricsScopesStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of MetricsScopesClient with default settings. */ + public static final MetricsScopesClient create() throws IOException { + return create(MetricsScopesSettings.newBuilder().build()); + } + + /** + * Constructs an instance of MetricsScopesClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final MetricsScopesClient create(MetricsScopesSettings settings) + throws IOException { + return new MetricsScopesClient(settings); + } + + /** + * Constructs an instance of MetricsScopesClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(MetricsScopesSettings). + */ + public static final MetricsScopesClient create(MetricsScopesStub stub) { + return new MetricsScopesClient(stub); + } + + /** + * Constructs an instance of MetricsScopesClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected MetricsScopesClient(MetricsScopesSettings settings) throws IOException { + this.settings = settings; + this.stub = ((MetricsScopesStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + protected MetricsScopesClient(MetricsScopesStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final MetricsScopesSettings getSettings() { + return settings; + } + + public MetricsScopesStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a specific `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]");
+   *   MetricsScope response = metricsScopesClient.getMetricsScope(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the `Metrics Scope`. Example: + * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricsScope getMetricsScope(MetricsScopeName name) { + GetMetricsScopeRequest request = + GetMetricsScopeRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getMetricsScope(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a specific `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   String name = MetricsScopeName.of("[METRICS_SCOPE]").toString();
+   *   MetricsScope response = metricsScopesClient.getMetricsScope(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the `Metrics Scope`. Example: + * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricsScope getMetricsScope(String name) { + GetMetricsScopeRequest request = GetMetricsScopeRequest.newBuilder().setName(name).build(); + return getMetricsScope(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a specific `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   GetMetricsScopeRequest request =
+   *       GetMetricsScopeRequest.newBuilder()
+   *           .setName(MetricsScopeName.of("[METRICS_SCOPE]").toString())
+   *           .build();
+   *   MetricsScope response = metricsScopesClient.getMetricsScope(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricsScope getMetricsScope(GetMetricsScopeRequest request) { + return getMetricsScopeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a specific `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   GetMetricsScopeRequest request =
+   *       GetMetricsScopeRequest.newBuilder()
+   *           .setName(MetricsScopeName.of("[METRICS_SCOPE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       metricsScopesClient.getMetricsScopeCallable().futureCall(request);
+   *   // Do something.
+   *   MetricsScope response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getMetricsScopeCallable() { + return stub.getMetricsScopeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a list of every `Metrics Scope` that a specific `MonitoredProject` has been added to. + * The metrics scope representing the specified monitored project will always be the first entry + * in the response. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   ListMetricsScopesByMonitoredProjectRequest request =
+   *       ListMetricsScopesByMonitoredProjectRequest.newBuilder()
+   *           .setMonitoredResourceContainer("monitoredResourceContainer884669850")
+   *           .build();
+   *   ListMetricsScopesByMonitoredProjectResponse response =
+   *       metricsScopesClient.listMetricsScopesByMonitoredProject(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListMetricsScopesByMonitoredProjectResponse listMetricsScopesByMonitoredProject( + ListMetricsScopesByMonitoredProjectRequest request) { + return listMetricsScopesByMonitoredProjectCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a list of every `Metrics Scope` that a specific `MonitoredProject` has been added to. + * The metrics scope representing the specified monitored project will always be the first entry + * in the response. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   ListMetricsScopesByMonitoredProjectRequest request =
+   *       ListMetricsScopesByMonitoredProjectRequest.newBuilder()
+   *           .setMonitoredResourceContainer("monitoredResourceContainer884669850")
+   *           .build();
+   *   ApiFuture future =
+   *       metricsScopesClient.listMetricsScopesByMonitoredProjectCallable().futureCall(request);
+   *   // Do something.
+   *   ListMetricsScopesByMonitoredProjectResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectCallable() { + return stub.listMetricsScopesByMonitoredProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a `MonitoredProject` with the given project ID to the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   MetricsScopeName parent = MetricsScopeName.of("[METRICS_SCOPE]");
+   *   MonitoredProject monitoredProject = MonitoredProject.newBuilder().build();
+   *   MonitoredProject response =
+   *       metricsScopesClient.createMonitoredProjectAsync(parent, monitoredProject).get();
+   * }
+   * }
+ * + * @param parent Required. The resource name of the existing `Metrics Scope` that will monitor + * this project. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + * @param monitoredProject Required. The initial `MonitoredProject` configuration. Specify only + * the `monitored_project.name` field. All other fields are ignored. The + * `monitored_project.name` must be in the format: + * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createMonitoredProjectAsync( + MetricsScopeName parent, MonitoredProject monitoredProject) { + CreateMonitoredProjectRequest request = + CreateMonitoredProjectRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setMonitoredProject(monitoredProject) + .build(); + return createMonitoredProjectAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a `MonitoredProject` with the given project ID to the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   String parent = MetricsScopeName.of("[METRICS_SCOPE]").toString();
+   *   MonitoredProject monitoredProject = MonitoredProject.newBuilder().build();
+   *   MonitoredProject response =
+   *       metricsScopesClient.createMonitoredProjectAsync(parent, monitoredProject).get();
+   * }
+   * }
+ * + * @param parent Required. The resource name of the existing `Metrics Scope` that will monitor + * this project. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + * @param monitoredProject Required. The initial `MonitoredProject` configuration. Specify only + * the `monitored_project.name` field. All other fields are ignored. The + * `monitored_project.name` must be in the format: + * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createMonitoredProjectAsync( + String parent, MonitoredProject monitoredProject) { + CreateMonitoredProjectRequest request = + CreateMonitoredProjectRequest.newBuilder() + .setParent(parent) + .setMonitoredProject(monitoredProject) + .build(); + return createMonitoredProjectAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a `MonitoredProject` with the given project ID to the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   CreateMonitoredProjectRequest request =
+   *       CreateMonitoredProjectRequest.newBuilder()
+   *           .setParent(MetricsScopeName.of("[METRICS_SCOPE]").toString())
+   *           .setMonitoredProject(MonitoredProject.newBuilder().build())
+   *           .build();
+   *   MonitoredProject response = metricsScopesClient.createMonitoredProjectAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createMonitoredProjectAsync( + CreateMonitoredProjectRequest request) { + return createMonitoredProjectOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a `MonitoredProject` with the given project ID to the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   CreateMonitoredProjectRequest request =
+   *       CreateMonitoredProjectRequest.newBuilder()
+   *           .setParent(MetricsScopeName.of("[METRICS_SCOPE]").toString())
+   *           .setMonitoredProject(MonitoredProject.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       metricsScopesClient.createMonitoredProjectOperationCallable().futureCall(request);
+   *   // Do something.
+   *   MonitoredProject response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createMonitoredProjectOperationCallable() { + return stub.createMonitoredProjectOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a `MonitoredProject` with the given project ID to the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   CreateMonitoredProjectRequest request =
+   *       CreateMonitoredProjectRequest.newBuilder()
+   *           .setParent(MetricsScopeName.of("[METRICS_SCOPE]").toString())
+   *           .setMonitoredProject(MonitoredProject.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       metricsScopesClient.createMonitoredProjectCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + createMonitoredProjectCallable() { + return stub.createMonitoredProjectCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a `MonitoredProject` from the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   MonitoredProjectName name = MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]");
+   *   metricsScopesClient.deleteMonitoredProjectAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The resource name of the `MonitoredProject`. Example: + * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + *

Authorization requires the following [Google IAM](https://cloud.google.com/iam) + * permissions on both the `Metrics Scope` and on the `MonitoredProject`: + * `monitoring.metricsScopes.link` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteMonitoredProjectAsync( + MonitoredProjectName name) { + DeleteMonitoredProjectRequest request = + DeleteMonitoredProjectRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return deleteMonitoredProjectAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a `MonitoredProject` from the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   String name = MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString();
+   *   metricsScopesClient.deleteMonitoredProjectAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The resource name of the `MonitoredProject`. Example: + * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + *

Authorization requires the following [Google IAM](https://cloud.google.com/iam) + * permissions on both the `Metrics Scope` and on the `MonitoredProject`: + * `monitoring.metricsScopes.link` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteMonitoredProjectAsync(String name) { + DeleteMonitoredProjectRequest request = + DeleteMonitoredProjectRequest.newBuilder().setName(name).build(); + return deleteMonitoredProjectAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a `MonitoredProject` from the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   DeleteMonitoredProjectRequest request =
+   *       DeleteMonitoredProjectRequest.newBuilder()
+   *           .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString())
+   *           .build();
+   *   metricsScopesClient.deleteMonitoredProjectAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteMonitoredProjectAsync( + DeleteMonitoredProjectRequest request) { + return deleteMonitoredProjectOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a `MonitoredProject` from the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   DeleteMonitoredProjectRequest request =
+   *       DeleteMonitoredProjectRequest.newBuilder()
+   *           .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       metricsScopesClient.deleteMonitoredProjectOperationCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deleteMonitoredProjectOperationCallable() { + return stub.deleteMonitoredProjectOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a `MonitoredProject` from the specified `Metrics Scope`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+   *   DeleteMonitoredProjectRequest request =
+   *       DeleteMonitoredProjectRequest.newBuilder()
+   *           .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       metricsScopesClient.deleteMonitoredProjectCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + deleteMonitoredProjectCallable() { + return stub.deleteMonitoredProjectCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesSettings.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesSettings.java new file mode 100644 index 000000000000..5a3cd0d06bfc --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesSettings.java @@ -0,0 +1,254 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.longrunning.Operation; +import com.google.monitoring.metricsscope.v1.stub.MetricsScopesStubSettings; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link MetricsScopesClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (monitoring.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getMetricsScope to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * MetricsScopesSettings.Builder metricsScopesSettingsBuilder = MetricsScopesSettings.newBuilder();
+ * metricsScopesSettingsBuilder
+ *     .getMetricsScopeSettings()
+ *     .setRetrySettings(
+ *         metricsScopesSettingsBuilder.getMetricsScopeSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * MetricsScopesSettings metricsScopesSettings = metricsScopesSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class MetricsScopesSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to getMetricsScope. */ + public UnaryCallSettings getMetricsScopeSettings() { + return ((MetricsScopesStubSettings) getStubSettings()).getMetricsScopeSettings(); + } + + /** Returns the object with the settings used for calls to listMetricsScopesByMonitoredProject. */ + public UnaryCallSettings< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectSettings() { + return ((MetricsScopesStubSettings) getStubSettings()) + .listMetricsScopesByMonitoredProjectSettings(); + } + + /** Returns the object with the settings used for calls to createMonitoredProject. */ + public UnaryCallSettings + createMonitoredProjectSettings() { + return ((MetricsScopesStubSettings) getStubSettings()).createMonitoredProjectSettings(); + } + + /** Returns the object with the settings used for calls to createMonitoredProject. */ + public OperationCallSettings + createMonitoredProjectOperationSettings() { + return ((MetricsScopesStubSettings) getStubSettings()) + .createMonitoredProjectOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteMonitoredProject. */ + public UnaryCallSettings + deleteMonitoredProjectSettings() { + return ((MetricsScopesStubSettings) getStubSettings()).deleteMonitoredProjectSettings(); + } + + /** Returns the object with the settings used for calls to deleteMonitoredProject. */ + public OperationCallSettings + deleteMonitoredProjectOperationSettings() { + return ((MetricsScopesStubSettings) getStubSettings()) + .deleteMonitoredProjectOperationSettings(); + } + + public static final MetricsScopesSettings create(MetricsScopesStubSettings stub) + throws IOException { + return new MetricsScopesSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return MetricsScopesStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return MetricsScopesStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return MetricsScopesStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return MetricsScopesStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return MetricsScopesStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return MetricsScopesStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return MetricsScopesStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected MetricsScopesSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for MetricsScopesSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(MetricsScopesStubSettings.newBuilder(clientContext)); + } + + protected Builder(MetricsScopesSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(MetricsScopesStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(MetricsScopesStubSettings.newBuilder()); + } + + public MetricsScopesStubSettings.Builder getStubSettingsBuilder() { + return ((MetricsScopesStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getMetricsScope. */ + public UnaryCallSettings.Builder + getMetricsScopeSettings() { + return getStubSettingsBuilder().getMetricsScopeSettings(); + } + + /** + * Returns the builder for the settings used for calls to listMetricsScopesByMonitoredProject. + */ + public UnaryCallSettings.Builder< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectSettings() { + return getStubSettingsBuilder().listMetricsScopesByMonitoredProjectSettings(); + } + + /** Returns the builder for the settings used for calls to createMonitoredProject. */ + public UnaryCallSettings.Builder + createMonitoredProjectSettings() { + return getStubSettingsBuilder().createMonitoredProjectSettings(); + } + + /** Returns the builder for the settings used for calls to createMonitoredProject. */ + public OperationCallSettings.Builder< + CreateMonitoredProjectRequest, MonitoredProject, OperationMetadata> + createMonitoredProjectOperationSettings() { + return getStubSettingsBuilder().createMonitoredProjectOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteMonitoredProject. */ + public UnaryCallSettings.Builder + deleteMonitoredProjectSettings() { + return getStubSettingsBuilder().deleteMonitoredProjectSettings(); + } + + /** Returns the builder for the settings used for calls to deleteMonitoredProject. */ + public OperationCallSettings.Builder + deleteMonitoredProjectOperationSettings() { + return getStubSettingsBuilder().deleteMonitoredProjectOperationSettings(); + } + + @Override + public MetricsScopesSettings build() throws IOException { + return new MetricsScopesSettings(this); + } + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/gapic_metadata.json b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/gapic_metadata.json new file mode 100644 index 000000000000..b2d734f42645 --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/gapic_metadata.json @@ -0,0 +1,30 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.monitoring.metricsscope.v1", + "libraryPackage": "com.google.monitoring.metricsscope.v1", + "services": { + "MetricsScopes": { + "clients": { + "grpc": { + "libraryClient": "MetricsScopesClient", + "rpcs": { + "CreateMonitoredProject": { + "methods": ["createMonitoredProjectAsync", "createMonitoredProjectAsync", "createMonitoredProjectAsync", "createMonitoredProjectOperationCallable", "createMonitoredProjectCallable"] + }, + "DeleteMonitoredProject": { + "methods": ["deleteMonitoredProjectAsync", "deleteMonitoredProjectAsync", "deleteMonitoredProjectAsync", "deleteMonitoredProjectOperationCallable", "deleteMonitoredProjectCallable"] + }, + "GetMetricsScope": { + "methods": ["getMetricsScope", "getMetricsScope", "getMetricsScope", "getMetricsScopeCallable"] + }, + "ListMetricsScopesByMonitoredProject": { + "methods": ["listMetricsScopesByMonitoredProject", "listMetricsScopesByMonitoredProjectCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/package-info.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/package-info.java new file mode 100644 index 000000000000..38fa51f52161 --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/package-info.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Cloud Monitoring API + * + *

The interfaces provided are listed below, along with usage samples. + * + *

======================= MetricsScopesClient ======================= + * + *

Service Description: Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google + * Cloud projects and AWS accounts. + * + *

Sample for MetricsScopesClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
+ *   MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]");
+ *   MetricsScope response = metricsScopesClient.getMetricsScope(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.monitoring.metricsscope.v1; + +import javax.annotation.Generated; diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesCallableFactory.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesCallableFactory.java new file mode 100644 index 000000000000..022db39cf795 --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the MetricsScopes service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcMetricsScopesCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesStub.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesStub.java new file mode 100644 index 000000000000..973edb0e9efe --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/GrpcMetricsScopesStub.java @@ -0,0 +1,308 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest; +import com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse; +import com.google.monitoring.metricsscope.v1.MetricsScope; +import com.google.monitoring.metricsscope.v1.MonitoredProject; +import com.google.monitoring.metricsscope.v1.OperationMetadata; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the MetricsScopes service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcMetricsScopesStub extends MetricsScopesStub { + private static final MethodDescriptor + getMetricsScopeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.metricsscope.v1.MetricsScopes/GetMetricsScope") + .setRequestMarshaller( + ProtoUtils.marshaller(GetMetricsScopeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(MetricsScope.getDefaultInstance())) + .build(); + + private static final MethodDescriptor< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectMethodDescriptor = + MethodDescriptor + . + newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.metricsscope.v1.MetricsScopes/ListMetricsScopesByMonitoredProject") + .setRequestMarshaller( + ProtoUtils.marshaller( + ListMetricsScopesByMonitoredProjectRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller( + ListMetricsScopesByMonitoredProjectResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createMonitoredProjectMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.metricsscope.v1.MetricsScopes/CreateMonitoredProject") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateMonitoredProjectRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteMonitoredProjectMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.metricsscope.v1.MetricsScopes/DeleteMonitoredProject") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteMonitoredProjectRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable getMetricsScopeCallable; + private final UnaryCallable< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectCallable; + private final UnaryCallable + createMonitoredProjectCallable; + private final OperationCallable< + CreateMonitoredProjectRequest, MonitoredProject, OperationMetadata> + createMonitoredProjectOperationCallable; + private final UnaryCallable + deleteMonitoredProjectCallable; + private final OperationCallable + deleteMonitoredProjectOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcMetricsScopesStub create(MetricsScopesStubSettings settings) + throws IOException { + return new GrpcMetricsScopesStub(settings, ClientContext.create(settings)); + } + + public static final GrpcMetricsScopesStub create(ClientContext clientContext) throws IOException { + return new GrpcMetricsScopesStub(MetricsScopesStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcMetricsScopesStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcMetricsScopesStub( + MetricsScopesStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcMetricsScopesStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcMetricsScopesStub(MetricsScopesStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcMetricsScopesCallableFactory()); + } + + /** + * Constructs an instance of GrpcMetricsScopesStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcMetricsScopesStub( + MetricsScopesStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings getMetricsScopeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getMetricsScopeMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectTransportSettings = + GrpcCallSettings + . + newBuilder() + .setMethodDescriptor(listMetricsScopesByMonitoredProjectMethodDescriptor) + .build(); + GrpcCallSettings + createMonitoredProjectTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createMonitoredProjectMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings + deleteMonitoredProjectTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteMonitoredProjectMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + + this.getMetricsScopeCallable = + callableFactory.createUnaryCallable( + getMetricsScopeTransportSettings, settings.getMetricsScopeSettings(), clientContext); + this.listMetricsScopesByMonitoredProjectCallable = + callableFactory.createUnaryCallable( + listMetricsScopesByMonitoredProjectTransportSettings, + settings.listMetricsScopesByMonitoredProjectSettings(), + clientContext); + this.createMonitoredProjectCallable = + callableFactory.createUnaryCallable( + createMonitoredProjectTransportSettings, + settings.createMonitoredProjectSettings(), + clientContext); + this.createMonitoredProjectOperationCallable = + callableFactory.createOperationCallable( + createMonitoredProjectTransportSettings, + settings.createMonitoredProjectOperationSettings(), + clientContext, + operationsStub); + this.deleteMonitoredProjectCallable = + callableFactory.createUnaryCallable( + deleteMonitoredProjectTransportSettings, + settings.deleteMonitoredProjectSettings(), + clientContext); + this.deleteMonitoredProjectOperationCallable = + callableFactory.createOperationCallable( + deleteMonitoredProjectTransportSettings, + settings.deleteMonitoredProjectOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable getMetricsScopeCallable() { + return getMetricsScopeCallable; + } + + @Override + public UnaryCallable< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectCallable() { + return listMetricsScopesByMonitoredProjectCallable; + } + + @Override + public UnaryCallable createMonitoredProjectCallable() { + return createMonitoredProjectCallable; + } + + @Override + public OperationCallable + createMonitoredProjectOperationCallable() { + return createMonitoredProjectOperationCallable; + } + + @Override + public UnaryCallable deleteMonitoredProjectCallable() { + return deleteMonitoredProjectCallable; + } + + @Override + public OperationCallable + deleteMonitoredProjectOperationCallable() { + return deleteMonitoredProjectOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStub.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStub.java new file mode 100644 index 000000000000..e38e05645bab --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStub.java @@ -0,0 +1,81 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest; +import com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse; +import com.google.monitoring.metricsscope.v1.MetricsScope; +import com.google.monitoring.metricsscope.v1.MonitoredProject; +import com.google.monitoring.metricsscope.v1.OperationMetadata; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the MetricsScopes service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class MetricsScopesStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable getMetricsScopeCallable() { + throw new UnsupportedOperationException("Not implemented: getMetricsScopeCallable()"); + } + + public UnaryCallable< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectCallable() { + throw new UnsupportedOperationException( + "Not implemented: listMetricsScopesByMonitoredProjectCallable()"); + } + + public OperationCallable + createMonitoredProjectOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: createMonitoredProjectOperationCallable()"); + } + + public UnaryCallable createMonitoredProjectCallable() { + throw new UnsupportedOperationException("Not implemented: createMonitoredProjectCallable()"); + } + + public OperationCallable + deleteMonitoredProjectOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: deleteMonitoredProjectOperationCallable()"); + } + + public UnaryCallable deleteMonitoredProjectCallable() { + throw new UnsupportedOperationException("Not implemented: deleteMonitoredProjectCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStubSettings.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStubSettings.java new file mode 100644 index 000000000000..9c026c1cbd6c --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/stub/MetricsScopesStubSettings.java @@ -0,0 +1,469 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest; +import com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest; +import com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse; +import com.google.monitoring.metricsscope.v1.MetricsScope; +import com.google.monitoring.metricsscope.v1.MonitoredProject; +import com.google.monitoring.metricsscope.v1.OperationMetadata; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link MetricsScopesStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (monitoring.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getMetricsScope to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * MetricsScopesStubSettings.Builder metricsScopesSettingsBuilder =
+ *     MetricsScopesStubSettings.newBuilder();
+ * metricsScopesSettingsBuilder
+ *     .getMetricsScopeSettings()
+ *     .setRetrySettings(
+ *         metricsScopesSettingsBuilder.getMetricsScopeSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * MetricsScopesStubSettings metricsScopesSettings = metricsScopesSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class MetricsScopesStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/monitoring") + .add("https://www.googleapis.com/auth/monitoring.read") + .add("https://www.googleapis.com/auth/monitoring.write") + .build(); + + private final UnaryCallSettings getMetricsScopeSettings; + private final UnaryCallSettings< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectSettings; + private final UnaryCallSettings + createMonitoredProjectSettings; + private final OperationCallSettings< + CreateMonitoredProjectRequest, MonitoredProject, OperationMetadata> + createMonitoredProjectOperationSettings; + private final UnaryCallSettings + deleteMonitoredProjectSettings; + private final OperationCallSettings + deleteMonitoredProjectOperationSettings; + + /** Returns the object with the settings used for calls to getMetricsScope. */ + public UnaryCallSettings getMetricsScopeSettings() { + return getMetricsScopeSettings; + } + + /** Returns the object with the settings used for calls to listMetricsScopesByMonitoredProject. */ + public UnaryCallSettings< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectSettings() { + return listMetricsScopesByMonitoredProjectSettings; + } + + /** Returns the object with the settings used for calls to createMonitoredProject. */ + public UnaryCallSettings + createMonitoredProjectSettings() { + return createMonitoredProjectSettings; + } + + /** Returns the object with the settings used for calls to createMonitoredProject. */ + public OperationCallSettings + createMonitoredProjectOperationSettings() { + return createMonitoredProjectOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteMonitoredProject. */ + public UnaryCallSettings + deleteMonitoredProjectSettings() { + return deleteMonitoredProjectSettings; + } + + /** Returns the object with the settings used for calls to deleteMonitoredProject. */ + public OperationCallSettings + deleteMonitoredProjectOperationSettings() { + return deleteMonitoredProjectOperationSettings; + } + + public MetricsScopesStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcMetricsScopesStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "monitoring.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "monitoring.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(MetricsScopesStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected MetricsScopesStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getMetricsScopeSettings = settingsBuilder.getMetricsScopeSettings().build(); + listMetricsScopesByMonitoredProjectSettings = + settingsBuilder.listMetricsScopesByMonitoredProjectSettings().build(); + createMonitoredProjectSettings = settingsBuilder.createMonitoredProjectSettings().build(); + createMonitoredProjectOperationSettings = + settingsBuilder.createMonitoredProjectOperationSettings().build(); + deleteMonitoredProjectSettings = settingsBuilder.deleteMonitoredProjectSettings().build(); + deleteMonitoredProjectOperationSettings = + settingsBuilder.deleteMonitoredProjectOperationSettings().build(); + } + + /** Builder for MetricsScopesStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + getMetricsScopeSettings; + private final UnaryCallSettings.Builder< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectSettings; + private final UnaryCallSettings.Builder + createMonitoredProjectSettings; + private final OperationCallSettings.Builder< + CreateMonitoredProjectRequest, MonitoredProject, OperationMetadata> + createMonitoredProjectOperationSettings; + private final UnaryCallSettings.Builder + deleteMonitoredProjectSettings; + private final OperationCallSettings.Builder< + DeleteMonitoredProjectRequest, Empty, OperationMetadata> + deleteMonitoredProjectOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getMetricsScopeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listMetricsScopesByMonitoredProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createMonitoredProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createMonitoredProjectOperationSettings = OperationCallSettings.newBuilder(); + deleteMonitoredProjectSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteMonitoredProjectOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getMetricsScopeSettings, + listMetricsScopesByMonitoredProjectSettings, + createMonitoredProjectSettings, + deleteMonitoredProjectSettings); + initDefaults(this); + } + + protected Builder(MetricsScopesStubSettings settings) { + super(settings); + + getMetricsScopeSettings = settings.getMetricsScopeSettings.toBuilder(); + listMetricsScopesByMonitoredProjectSettings = + settings.listMetricsScopesByMonitoredProjectSettings.toBuilder(); + createMonitoredProjectSettings = settings.createMonitoredProjectSettings.toBuilder(); + createMonitoredProjectOperationSettings = + settings.createMonitoredProjectOperationSettings.toBuilder(); + deleteMonitoredProjectSettings = settings.deleteMonitoredProjectSettings.toBuilder(); + deleteMonitoredProjectOperationSettings = + settings.deleteMonitoredProjectOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getMetricsScopeSettings, + listMetricsScopesByMonitoredProjectSettings, + createMonitoredProjectSettings, + deleteMonitoredProjectSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .getMetricsScopeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listMetricsScopesByMonitoredProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createMonitoredProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteMonitoredProjectSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createMonitoredProjectOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(MonitoredProject.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(2.0) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(900000L)) + .build())); + + builder + .deleteMonitoredProjectOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(2.0) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(900000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getMetricsScope. */ + public UnaryCallSettings.Builder + getMetricsScopeSettings() { + return getMetricsScopeSettings; + } + + /** + * Returns the builder for the settings used for calls to listMetricsScopesByMonitoredProject. + */ + public UnaryCallSettings.Builder< + ListMetricsScopesByMonitoredProjectRequest, ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProjectSettings() { + return listMetricsScopesByMonitoredProjectSettings; + } + + /** Returns the builder for the settings used for calls to createMonitoredProject. */ + public UnaryCallSettings.Builder + createMonitoredProjectSettings() { + return createMonitoredProjectSettings; + } + + /** Returns the builder for the settings used for calls to createMonitoredProject. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + CreateMonitoredProjectRequest, MonitoredProject, OperationMetadata> + createMonitoredProjectOperationSettings() { + return createMonitoredProjectOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteMonitoredProject. */ + public UnaryCallSettings.Builder + deleteMonitoredProjectSettings() { + return deleteMonitoredProjectSettings; + } + + /** Returns the builder for the settings used for calls to deleteMonitoredProject. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteMonitoredProjectOperationSettings() { + return deleteMonitoredProjectOperationSettings; + } + + @Override + public MetricsScopesStubSettings build() throws IOException { + return new MetricsScopesStubSettings(this); + } + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MetricsScopesClientTest.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MetricsScopesClientTest.java new file mode 100644 index 000000000000..aa26b1949f39 --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MetricsScopesClientTest.java @@ -0,0 +1,403 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class MetricsScopesClientTest { + private static MockMetricsScopes mockMetricsScopes; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private MetricsScopesClient client; + + @BeforeClass + public static void startStaticServer() { + mockMetricsScopes = new MockMetricsScopes(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockMetricsScopes)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + MetricsScopesSettings settings = + MetricsScopesSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = MetricsScopesClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void getMetricsScopeTest() throws Exception { + MetricsScope expectedResponse = + MetricsScope.newBuilder() + .setName(MetricsScopeName.of("[METRICS_SCOPE]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllMonitoredProjects(new ArrayList()) + .build(); + mockMetricsScopes.addResponse(expectedResponse); + + MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]"); + + MetricsScope actualResponse = client.getMetricsScope(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetMetricsScopeRequest actualRequest = ((GetMetricsScopeRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getMetricsScopeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]"); + client.getMetricsScope(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getMetricsScopeTest2() throws Exception { + MetricsScope expectedResponse = + MetricsScope.newBuilder() + .setName(MetricsScopeName.of("[METRICS_SCOPE]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllMonitoredProjects(new ArrayList()) + .build(); + mockMetricsScopes.addResponse(expectedResponse); + + String name = "name3373707"; + + MetricsScope actualResponse = client.getMetricsScope(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetMetricsScopeRequest actualRequest = ((GetMetricsScopeRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getMetricsScopeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + String name = "name3373707"; + client.getMetricsScope(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listMetricsScopesByMonitoredProjectTest() throws Exception { + ListMetricsScopesByMonitoredProjectResponse expectedResponse = + ListMetricsScopesByMonitoredProjectResponse.newBuilder() + .addAllMetricsScopes(new ArrayList()) + .build(); + mockMetricsScopes.addResponse(expectedResponse); + + ListMetricsScopesByMonitoredProjectRequest request = + ListMetricsScopesByMonitoredProjectRequest.newBuilder() + .setMonitoredResourceContainer("monitoredResourceContainer884669850") + .build(); + + ListMetricsScopesByMonitoredProjectResponse actualResponse = + client.listMetricsScopesByMonitoredProject(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListMetricsScopesByMonitoredProjectRequest actualRequest = + ((ListMetricsScopesByMonitoredProjectRequest) actualRequests.get(0)); + + Assert.assertEquals( + request.getMonitoredResourceContainer(), actualRequest.getMonitoredResourceContainer()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listMetricsScopesByMonitoredProjectExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + ListMetricsScopesByMonitoredProjectRequest request = + ListMetricsScopesByMonitoredProjectRequest.newBuilder() + .setMonitoredResourceContainer("monitoredResourceContainer884669850") + .build(); + client.listMetricsScopesByMonitoredProject(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createMonitoredProjectTest() throws Exception { + MonitoredProject expectedResponse = + MonitoredProject.newBuilder() + .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createMonitoredProjectTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockMetricsScopes.addResponse(resultOperation); + + MetricsScopeName parent = MetricsScopeName.of("[METRICS_SCOPE]"); + MonitoredProject monitoredProject = MonitoredProject.newBuilder().build(); + + MonitoredProject actualResponse = + client.createMonitoredProjectAsync(parent, monitoredProject).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateMonitoredProjectRequest actualRequest = + ((CreateMonitoredProjectRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(monitoredProject, actualRequest.getMonitoredProject()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createMonitoredProjectExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + MetricsScopeName parent = MetricsScopeName.of("[METRICS_SCOPE]"); + MonitoredProject monitoredProject = MonitoredProject.newBuilder().build(); + client.createMonitoredProjectAsync(parent, monitoredProject).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createMonitoredProjectTest2() throws Exception { + MonitoredProject expectedResponse = + MonitoredProject.newBuilder() + .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createMonitoredProjectTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockMetricsScopes.addResponse(resultOperation); + + String parent = "parent-995424086"; + MonitoredProject monitoredProject = MonitoredProject.newBuilder().build(); + + MonitoredProject actualResponse = + client.createMonitoredProjectAsync(parent, monitoredProject).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateMonitoredProjectRequest actualRequest = + ((CreateMonitoredProjectRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(monitoredProject, actualRequest.getMonitoredProject()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createMonitoredProjectExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + String parent = "parent-995424086"; + MonitoredProject monitoredProject = MonitoredProject.newBuilder().build(); + client.createMonitoredProjectAsync(parent, monitoredProject).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteMonitoredProjectTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteMonitoredProjectTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockMetricsScopes.addResponse(resultOperation); + + MonitoredProjectName name = MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]"); + + client.deleteMonitoredProjectAsync(name).get(); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteMonitoredProjectRequest actualRequest = + ((DeleteMonitoredProjectRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteMonitoredProjectExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + MonitoredProjectName name = MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]"); + client.deleteMonitoredProjectAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteMonitoredProjectTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteMonitoredProjectTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockMetricsScopes.addResponse(resultOperation); + + String name = "name3373707"; + + client.deleteMonitoredProjectAsync(name).get(); + + List actualRequests = mockMetricsScopes.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteMonitoredProjectRequest actualRequest = + ((DeleteMonitoredProjectRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteMonitoredProjectExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockMetricsScopes.addException(exception); + + try { + String name = "name3373707"; + client.deleteMonitoredProjectAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopes.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopes.java new file mode 100644 index 000000000000..681f9bb5815f --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopes.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockMetricsScopes implements MockGrpcService { + private final MockMetricsScopesImpl serviceImpl; + + public MockMetricsScopes() { + serviceImpl = new MockMetricsScopesImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopesImpl.java b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopesImpl.java new file mode 100644 index 000000000000..5e93c0033e48 --- /dev/null +++ b/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/test/java/com/google/monitoring/metricsscope/v1/MockMetricsScopesImpl.java @@ -0,0 +1,146 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.core.BetaApi; +import com.google.longrunning.Operation; +import com.google.monitoring.metricsscope.v1.MetricsScopesGrpc.MetricsScopesImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockMetricsScopesImpl extends MetricsScopesImplBase { + private List requests; + private Queue responses; + + public MockMetricsScopesImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void getMetricsScope( + GetMetricsScopeRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof MetricsScope) { + requests.add(request); + responseObserver.onNext(((MetricsScope) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetMetricsScope, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + MetricsScope.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listMetricsScopesByMonitoredProject( + ListMetricsScopesByMonitoredProjectRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListMetricsScopesByMonitoredProjectResponse) { + requests.add(request); + responseObserver.onNext(((ListMetricsScopesByMonitoredProjectResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListMetricsScopesByMonitoredProject, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListMetricsScopesByMonitoredProjectResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createMonitoredProject( + CreateMonitoredProjectRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateMonitoredProject, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteMonitoredProject( + DeleteMonitoredProjectRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteMonitoredProject, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/pom.xml b/java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/pom.xml new file mode 100644 index 000000000000..dd8c04a3fa08 --- /dev/null +++ b/java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/pom.xml @@ -0,0 +1,45 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-monitoring-metricsscope-v1 + 0.0.1-SNAPSHOT + grpc-google-cloud-monitoring-metricsscope-v1 + GRPC library for google-cloud-monitoring-metricsscope + + com.google.cloud + google-cloud-monitoring-metricsscope-parent + 0.0.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-monitoring-metricsscope-v1 + + + com.google.guava + guava + + + \ No newline at end of file diff --git a/java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesGrpc.java b/java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesGrpc.java new file mode 100644 index 000000000000..b87eb7a14b10 --- /dev/null +++ b/java-monitoring-metricsscope/grpc-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesGrpc.java @@ -0,0 +1,763 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.monitoring.metricsscope.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
+ * projects and AWS accounts.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/monitoring/metricsscope/v1/metrics_scopes.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class MetricsScopesGrpc { + + private MetricsScopesGrpc() {} + + public static final String SERVICE_NAME = "google.monitoring.metricsscope.v1.MetricsScopes"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest, + com.google.monitoring.metricsscope.v1.MetricsScope> + getGetMetricsScopeMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetMetricsScope", + requestType = com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.class, + responseType = com.google.monitoring.metricsscope.v1.MetricsScope.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest, + com.google.monitoring.metricsscope.v1.MetricsScope> + getGetMetricsScopeMethod() { + io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest, + com.google.monitoring.metricsscope.v1.MetricsScope> + getGetMetricsScopeMethod; + if ((getGetMetricsScopeMethod = MetricsScopesGrpc.getGetMetricsScopeMethod) == null) { + synchronized (MetricsScopesGrpc.class) { + if ((getGetMetricsScopeMethod = MetricsScopesGrpc.getGetMetricsScopeMethod) == null) { + MetricsScopesGrpc.getGetMetricsScopeMethod = + getGetMetricsScopeMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetMetricsScope")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.monitoring.metricsscope.v1.MetricsScope + .getDefaultInstance())) + .setSchemaDescriptor( + new MetricsScopesMethodDescriptorSupplier("GetMetricsScope")) + .build(); + } + } + } + return getGetMetricsScopeMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse> + getListMetricsScopesByMonitoredProjectMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListMetricsScopesByMonitoredProject", + requestType = + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest.class, + responseType = + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse> + getListMetricsScopesByMonitoredProjectMethod() { + io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse> + getListMetricsScopesByMonitoredProjectMethod; + if ((getListMetricsScopesByMonitoredProjectMethod = + MetricsScopesGrpc.getListMetricsScopesByMonitoredProjectMethod) + == null) { + synchronized (MetricsScopesGrpc.class) { + if ((getListMetricsScopesByMonitoredProjectMethod = + MetricsScopesGrpc.getListMetricsScopesByMonitoredProjectMethod) + == null) { + MetricsScopesGrpc.getListMetricsScopesByMonitoredProjectMethod = + getListMetricsScopesByMonitoredProjectMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + SERVICE_NAME, "ListMetricsScopesByMonitoredProject")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new MetricsScopesMethodDescriptorSupplier( + "ListMetricsScopesByMonitoredProject")) + .build(); + } + } + } + return getListMetricsScopesByMonitoredProjectMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest, + com.google.longrunning.Operation> + getCreateMonitoredProjectMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateMonitoredProject", + requestType = com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest, + com.google.longrunning.Operation> + getCreateMonitoredProjectMethod() { + io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest, + com.google.longrunning.Operation> + getCreateMonitoredProjectMethod; + if ((getCreateMonitoredProjectMethod = MetricsScopesGrpc.getCreateMonitoredProjectMethod) + == null) { + synchronized (MetricsScopesGrpc.class) { + if ((getCreateMonitoredProjectMethod = MetricsScopesGrpc.getCreateMonitoredProjectMethod) + == null) { + MetricsScopesGrpc.getCreateMonitoredProjectMethod = + getCreateMonitoredProjectMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "CreateMonitoredProject")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new MetricsScopesMethodDescriptorSupplier("CreateMonitoredProject")) + .build(); + } + } + } + return getCreateMonitoredProjectMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest, + com.google.longrunning.Operation> + getDeleteMonitoredProjectMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteMonitoredProject", + requestType = com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest, + com.google.longrunning.Operation> + getDeleteMonitoredProjectMethod() { + io.grpc.MethodDescriptor< + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest, + com.google.longrunning.Operation> + getDeleteMonitoredProjectMethod; + if ((getDeleteMonitoredProjectMethod = MetricsScopesGrpc.getDeleteMonitoredProjectMethod) + == null) { + synchronized (MetricsScopesGrpc.class) { + if ((getDeleteMonitoredProjectMethod = MetricsScopesGrpc.getDeleteMonitoredProjectMethod) + == null) { + MetricsScopesGrpc.getDeleteMonitoredProjectMethod = + getDeleteMonitoredProjectMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "DeleteMonitoredProject")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new MetricsScopesMethodDescriptorSupplier("DeleteMonitoredProject")) + .build(); + } + } + } + return getDeleteMonitoredProjectMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static MetricsScopesStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public MetricsScopesStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new MetricsScopesStub(channel, callOptions); + } + }; + return MetricsScopesStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static MetricsScopesBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public MetricsScopesBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new MetricsScopesBlockingStub(channel, callOptions); + } + }; + return MetricsScopesBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static MetricsScopesFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public MetricsScopesFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new MetricsScopesFutureStub(channel, callOptions); + } + }; + return MetricsScopesFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
+   * projects and AWS accounts.
+   * 
+ */ + public abstract static class MetricsScopesImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Returns a specific `Metrics Scope`.
+     * 
+ */ + public void getMetricsScope( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetMetricsScopeMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns a list of every `Metrics Scope` that a specific `MonitoredProject`
+     * has been added to. The metrics scope representing the specified monitored
+     * project will always be the first entry in the response.
+     * 
+ */ + public void listMetricsScopesByMonitoredProject( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest request, + io.grpc.stub.StreamObserver< + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse> + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListMetricsScopesByMonitoredProjectMethod(), responseObserver); + } + + /** + * + * + *
+     * Adds a `MonitoredProject` with the given project ID
+     * to the specified `Metrics Scope`.
+     * 
+ */ + public void createMonitoredProject( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateMonitoredProjectMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a `MonitoredProject` from the specified `Metrics Scope`.
+     * 
+ */ + public void deleteMonitoredProject( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteMonitoredProjectMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetMetricsScopeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest, + com.google.monitoring.metricsscope.v1.MetricsScope>( + this, METHODID_GET_METRICS_SCOPE))) + .addMethod( + getListMetricsScopesByMonitoredProjectMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectRequest, + com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectResponse>( + this, METHODID_LIST_METRICS_SCOPES_BY_MONITORED_PROJECT))) + .addMethod( + getCreateMonitoredProjectMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest, + com.google.longrunning.Operation>(this, METHODID_CREATE_MONITORED_PROJECT))) + .addMethod( + getDeleteMonitoredProjectMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_MONITORED_PROJECT))) + .build(); + } + } + + /** + * + * + *
+   * Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
+   * projects and AWS accounts.
+   * 
+ */ + public static final class MetricsScopesStub + extends io.grpc.stub.AbstractAsyncStub { + private MetricsScopesStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected MetricsScopesStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new MetricsScopesStub(channel, callOptions); + } + + /** + * + * + *
+     * Returns a specific `Metrics Scope`.
+     * 
+ */ + public void getMetricsScope( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetMetricsScopeMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns a list of every `Metrics Scope` that a specific `MonitoredProject`
+     * has been added to. The metrics scope representing the specified monitored
+     * project will always be the first entry in the response.
+     * 
+ */ + public void listMetricsScopesByMonitoredProject( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest request, + io.grpc.stub.StreamObserver< + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse> + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListMetricsScopesByMonitoredProjectMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Adds a `MonitoredProject` with the given project ID
+     * to the specified `Metrics Scope`.
+     * 
+ */ + public void createMonitoredProject( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateMonitoredProjectMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a `MonitoredProject` from the specified `Metrics Scope`.
+     * 
+ */ + public void deleteMonitoredProject( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteMonitoredProjectMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
+   * projects and AWS accounts.
+   * 
+ */ + public static final class MetricsScopesBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private MetricsScopesBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected MetricsScopesBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new MetricsScopesBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Returns a specific `Metrics Scope`.
+     * 
+ */ + public com.google.monitoring.metricsscope.v1.MetricsScope getMetricsScope( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetMetricsScopeMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns a list of every `Metrics Scope` that a specific `MonitoredProject`
+     * has been added to. The metrics scope representing the specified monitored
+     * project will always be the first entry in the response.
+     * 
+ */ + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + listMetricsScopesByMonitoredProject( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListMetricsScopesByMonitoredProjectMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Adds a `MonitoredProject` with the given project ID
+     * to the specified `Metrics Scope`.
+     * 
+ */ + public com.google.longrunning.Operation createMonitoredProject( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateMonitoredProjectMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a `MonitoredProject` from the specified `Metrics Scope`.
+     * 
+ */ + public com.google.longrunning.Operation deleteMonitoredProject( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteMonitoredProjectMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
+   * projects and AWS accounts.
+   * 
+ */ + public static final class MetricsScopesFutureStub + extends io.grpc.stub.AbstractFutureStub { + private MetricsScopesFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected MetricsScopesFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new MetricsScopesFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Returns a specific `Metrics Scope`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.monitoring.metricsscope.v1.MetricsScope> + getMetricsScope(com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetMetricsScopeMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns a list of every `Metrics Scope` that a specific `MonitoredProject`
+     * has been added to. The metrics scope representing the specified monitored
+     * project will always be the first entry in the response.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse> + listMetricsScopesByMonitoredProject( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListMetricsScopesByMonitoredProjectMethod(), getCallOptions()), + request); + } + + /** + * + * + *
+     * Adds a `MonitoredProject` with the given project ID
+     * to the specified `Metrics Scope`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createMonitoredProject( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateMonitoredProjectMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a `MonitoredProject` from the specified `Metrics Scope`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteMonitoredProject( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteMonitoredProjectMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_METRICS_SCOPE = 0; + private static final int METHODID_LIST_METRICS_SCOPES_BY_MONITORED_PROJECT = 1; + private static final int METHODID_CREATE_MONITORED_PROJECT = 2; + private static final int METHODID_DELETE_MONITORED_PROJECT = 3; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final MetricsScopesImplBase serviceImpl; + private final int methodId; + + MethodHandlers(MetricsScopesImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_GET_METRICS_SCOPE: + serviceImpl.getMetricsScope( + (com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_METRICS_SCOPES_BY_MONITORED_PROJECT: + serviceImpl.listMetricsScopesByMonitoredProject( + (com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + request, + (io.grpc.stub.StreamObserver< + com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectResponse>) + responseObserver); + break; + case METHODID_CREATE_MONITORED_PROJECT: + serviceImpl.createMonitoredProject( + (com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_MONITORED_PROJECT: + serviceImpl.deleteMonitoredProject( + (com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class MetricsScopesBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + MetricsScopesBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("MetricsScopes"); + } + } + + private static final class MetricsScopesFileDescriptorSupplier + extends MetricsScopesBaseDescriptorSupplier { + MetricsScopesFileDescriptorSupplier() {} + } + + private static final class MetricsScopesMethodDescriptorSupplier + extends MetricsScopesBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + MetricsScopesMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (MetricsScopesGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new MetricsScopesFileDescriptorSupplier()) + .addMethod(getGetMetricsScopeMethod()) + .addMethod(getListMetricsScopesByMonitoredProjectMethod()) + .addMethod(getCreateMonitoredProjectMethod()) + .addMethod(getDeleteMonitoredProjectMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-monitoring-metricsscope/owlbot.py b/java-monitoring-metricsscope/owlbot.py new file mode 100644 index 000000000000..03c0f6686d3f --- /dev/null +++ b/java-monitoring-metricsscope/owlbot.py @@ -0,0 +1,36 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import synthtool as s +from synthtool.languages import java + + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.move(library) + +s.remove_staging_dirs() +java.common_templates(monorepo=True, excludes=[ + ".github/*", + ".kokoro/*", + "samples/*", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "SECURITY.md", + "java.header", + "license-checks.xml", + "renovate.json", + ".gitignore" +]) \ No newline at end of file diff --git a/java-monitoring-metricsscope/pom.xml b/java-monitoring-metricsscope/pom.xml new file mode 100644 index 000000000000..adb0b4991d0f --- /dev/null +++ b/java-monitoring-metricsscope/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + com.google.cloud + google-cloud-monitoring-metricsscope-parent + pom + 0.0.1-SNAPSHOT + Google Monitoring Metrics Scopes Parent + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-jar-parent + 1.1.0-SNAPSHOT + ../google-cloud-jar-parent/pom.xml + + + + UTF-8 + UTF-8 + github + google-cloud-monitoring-metricsscope-parent + + + + + + com.google.cloud + google-cloud-monitoring-metricsscope + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-monitoring-metricsscope-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-monitoring-metricsscope-v1 + 0.0.1-SNAPSHOT + + + + + + google-cloud-monitoring-metricsscope + grpc-google-cloud-monitoring-metricsscope-v1 + proto-google-cloud-monitoring-metricsscope-v1 + google-cloud-monitoring-metricsscope-bom + + + diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/clirr-ignored-differences.xml b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/clirr-ignored-differences.xml new file mode 100644 index 000000000000..dc1a5edf7a96 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/monitoring/metricsscope/v1/*OrBuilder + * get*(*) + + + 7012 + com/google/monitoring/metricsscope/v1/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/monitoring/metricsscope/v1/*OrBuilder + boolean has*(*) + + diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/pom.xml b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/pom.xml new file mode 100644 index 000000000000..e681485e30c6 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-monitoring-metricsscope-v1 + 0.0.1-SNAPSHOT + proto-google-cloud-monitoring-metricsscope-v1 + Proto library for google-cloud-monitoring-metricsscope + + com.google.cloud + google-cloud-monitoring-metricsscope-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequest.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequest.java new file mode 100644 index 000000000000..066714e6d1f3 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequest.java @@ -0,0 +1,995 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Request for the `CreateMonitoredProject` method.
+ * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest} + */ +public final class CreateMonitoredProjectRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) + CreateMonitoredProjectRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateMonitoredProjectRequest.newBuilder() to construct. + private CreateMonitoredProjectRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateMonitoredProjectRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateMonitoredProjectRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest.class, + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The resource name of the existing `Metrics Scope` that will monitor this
+   * project.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the existing `Metrics Scope` that will monitor this
+   * project.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MONITORED_PROJECT_FIELD_NUMBER = 2; + private com.google.monitoring.metricsscope.v1.MonitoredProject monitoredProject_; + /** + * + * + *
+   * Required. The initial `MonitoredProject` configuration.
+   * Specify only the `monitored_project.name` field. All other fields are
+   * ignored. The `monitored_project.name` must be in the format:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the monitoredProject field is set. + */ + @java.lang.Override + public boolean hasMonitoredProject() { + return monitoredProject_ != null; + } + /** + * + * + *
+   * Required. The initial `MonitoredProject` configuration.
+   * Specify only the `monitored_project.name` field. All other fields are
+   * ignored. The `monitored_project.name` must be in the format:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The monitoredProject. + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProject getMonitoredProject() { + return monitoredProject_ == null + ? com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance() + : monitoredProject_; + } + /** + * + * + *
+   * Required. The initial `MonitoredProject` configuration.
+   * Specify only the `monitored_project.name` field. All other fields are
+   * ignored. The `monitored_project.name` must be in the format:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder + getMonitoredProjectOrBuilder() { + return getMonitoredProject(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (monitoredProject_ != null) { + output.writeMessage(2, getMonitoredProject()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (monitoredProject_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getMonitoredProject()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest other = + (com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasMonitoredProject() != other.hasMonitoredProject()) return false; + if (hasMonitoredProject()) { + if (!getMonitoredProject().equals(other.getMonitoredProject())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasMonitoredProject()) { + hash = (37 * hash) + MONITORED_PROJECT_FIELD_NUMBER; + hash = (53 * hash) + getMonitoredProject().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for the `CreateMonitoredProject` method.
+   * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest.class, + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest.Builder.class); + } + + // Construct using + // com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (monitoredProjectBuilder_ == null) { + monitoredProject_ = null; + } else { + monitoredProject_ = null; + monitoredProjectBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest build() { + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest buildPartial() { + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest result = + new com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest(this); + result.parent_ = parent_; + if (monitoredProjectBuilder_ == null) { + result.monitoredProject_ = monitoredProject_; + } else { + result.monitoredProject_ = monitoredProjectBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) { + return mergeFrom( + (com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest other) { + if (other + == com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + .getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasMonitoredProject()) { + mergeMonitoredProject(other.getMonitoredProject()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage( + getMonitoredProjectFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource name of the existing `Metrics Scope` that will monitor this
+     * project.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the existing `Metrics Scope` that will monitor this
+     * project.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the existing `Metrics Scope` that will monitor this
+     * project.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the existing `Metrics Scope` that will monitor this
+     * project.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the existing `Metrics Scope` that will monitor this
+     * project.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.monitoring.metricsscope.v1.MonitoredProject monitoredProject_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MonitoredProject, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder, + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder> + monitoredProjectBuilder_; + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the monitoredProject field is set. + */ + public boolean hasMonitoredProject() { + return monitoredProjectBuilder_ != null || monitoredProject_ != null; + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The monitoredProject. + */ + public com.google.monitoring.metricsscope.v1.MonitoredProject getMonitoredProject() { + if (monitoredProjectBuilder_ == null) { + return monitoredProject_ == null + ? com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance() + : monitoredProject_; + } else { + return monitoredProjectBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setMonitoredProject( + com.google.monitoring.metricsscope.v1.MonitoredProject value) { + if (monitoredProjectBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + monitoredProject_ = value; + onChanged(); + } else { + monitoredProjectBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setMonitoredProject( + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder builderForValue) { + if (monitoredProjectBuilder_ == null) { + monitoredProject_ = builderForValue.build(); + onChanged(); + } else { + monitoredProjectBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeMonitoredProject( + com.google.monitoring.metricsscope.v1.MonitoredProject value) { + if (monitoredProjectBuilder_ == null) { + if (monitoredProject_ != null) { + monitoredProject_ = + com.google.monitoring.metricsscope.v1.MonitoredProject.newBuilder(monitoredProject_) + .mergeFrom(value) + .buildPartial(); + } else { + monitoredProject_ = value; + } + onChanged(); + } else { + monitoredProjectBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearMonitoredProject() { + if (monitoredProjectBuilder_ == null) { + monitoredProject_ = null; + onChanged(); + } else { + monitoredProject_ = null; + monitoredProjectBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProject.Builder + getMonitoredProjectBuilder() { + + onChanged(); + return getMonitoredProjectFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder + getMonitoredProjectOrBuilder() { + if (monitoredProjectBuilder_ != null) { + return monitoredProjectBuilder_.getMessageOrBuilder(); + } else { + return monitoredProject_ == null + ? com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance() + : monitoredProject_; + } + } + /** + * + * + *
+     * Required. The initial `MonitoredProject` configuration.
+     * Specify only the `monitored_project.name` field. All other fields are
+     * ignored. The `monitored_project.name` must be in the format:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MonitoredProject, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder, + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder> + getMonitoredProjectFieldBuilder() { + if (monitoredProjectBuilder_ == null) { + monitoredProjectBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MonitoredProject, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder, + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder>( + getMonitoredProject(), getParentForChildren(), isClean()); + monitoredProject_ = null; + } + return monitoredProjectBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) + private static final com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest(); + } + + public static com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateMonitoredProjectRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequestOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequestOrBuilder.java new file mode 100644 index 000000000000..aeb89661ccc0 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/CreateMonitoredProjectRequestOrBuilder.java @@ -0,0 +1,110 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public interface CreateMonitoredProjectRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the existing `Metrics Scope` that will monitor this
+   * project.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource name of the existing `Metrics Scope` that will monitor this
+   * project.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The initial `MonitoredProject` configuration.
+   * Specify only the `monitored_project.name` field. All other fields are
+   * ignored. The `monitored_project.name` must be in the format:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the monitoredProject field is set. + */ + boolean hasMonitoredProject(); + /** + * + * + *
+   * Required. The initial `MonitoredProject` configuration.
+   * Specify only the `monitored_project.name` field. All other fields are
+   * ignored. The `monitored_project.name` must be in the format:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The monitoredProject. + */ + com.google.monitoring.metricsscope.v1.MonitoredProject getMonitoredProject(); + /** + * + * + *
+   * Required. The initial `MonitoredProject` configuration.
+   * Specify only the `monitored_project.name` field. All other fields are
+   * ignored. The `monitored_project.name` must be in the format:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * .google.monitoring.metricsscope.v1.MonitoredProject monitored_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder getMonitoredProjectOrBuilder(); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequest.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequest.java new file mode 100644 index 000000000000..4bd8858f4589 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequest.java @@ -0,0 +1,675 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Request for the `DeleteMonitoredProject` method.
+ * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest} + */ +public final class DeleteMonitoredProjectRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) + DeleteMonitoredProjectRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteMonitoredProjectRequest.newBuilder() to construct. + private DeleteMonitoredProjectRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteMonitoredProjectRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteMonitoredProjectRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest.class, + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the `MonitoredProject`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * Authorization requires the following [Google
+   * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+   * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the `MonitoredProject`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * Authorization requires the following [Google
+   * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+   * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest other = + (com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for the `DeleteMonitoredProject` method.
+   * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest.class, + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest.Builder.class); + } + + // Construct using + // com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest build() { + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest buildPartial() { + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest result = + new com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) { + return mergeFrom( + (com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest other) { + if (other + == com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + .getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the `MonitoredProject`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * Authorization requires the following [Google
+     * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+     * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the `MonitoredProject`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * Authorization requires the following [Google
+     * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+     * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the `MonitoredProject`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * Authorization requires the following [Google
+     * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+     * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the `MonitoredProject`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * Authorization requires the following [Google
+     * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+     * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the `MonitoredProject`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * Authorization requires the following [Google
+     * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+     * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) + private static final com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest(); + } + + public static com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteMonitoredProjectRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequestOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequestOrBuilder.java new file mode 100644 index 000000000000..3e2b9e6cafed --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/DeleteMonitoredProjectRequestOrBuilder.java @@ -0,0 +1,64 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public interface DeleteMonitoredProjectRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the `MonitoredProject`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * Authorization requires the following [Google
+   * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+   * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the `MonitoredProject`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * Authorization requires the following [Google
+   * IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
+   * and on the `MonitoredProject`: `monitoring.metricsScopes.link`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequest.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequest.java new file mode 100644 index 000000000000..283e535f54a9 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequest.java @@ -0,0 +1,647 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Request for the `GetMetricsScope` method.
+ * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.GetMetricsScopeRequest} + */ +public final class GetMetricsScopeRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.GetMetricsScopeRequest) + GetMetricsScopeRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetMetricsScopeRequest.newBuilder() to construct. + private GetMetricsScopeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetMetricsScopeRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetMetricsScopeRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.class, + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the `Metrics Scope`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the `Metrics Scope`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest other = + (com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for the `GetMetricsScope` method.
+   * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.GetMetricsScopeRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.GetMetricsScopeRequest) + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.class, + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.Builder.class); + } + + // Construct using com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest + getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest build() { + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest buildPartial() { + com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest result = + new com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest) { + return mergeFrom((com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest other) { + if (other + == com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the `Metrics Scope`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the `Metrics Scope`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the `Metrics Scope`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the `Metrics Scope`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the `Metrics Scope`.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.GetMetricsScopeRequest) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.GetMetricsScopeRequest) + private static final com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest(); + } + + public static com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetMetricsScopeRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequestOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequestOrBuilder.java new file mode 100644 index 000000000000..51ef7468c351 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/GetMetricsScopeRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public interface GetMetricsScopeRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.GetMetricsScopeRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the `Metrics Scope`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the `Metrics Scope`.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequest.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequest.java new file mode 100644 index 000000000000..4f3b017ff530 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequest.java @@ -0,0 +1,672 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Request for the `ListMetricsScopesByMonitoredProject` method.
+ * 
+ * + * Protobuf type {@code + * google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest} + */ +public final class ListMetricsScopesByMonitoredProjectRequest + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + ListMetricsScopesByMonitoredProjectRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListMetricsScopesByMonitoredProjectRequest.newBuilder() to construct. + private ListMetricsScopesByMonitoredProjectRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListMetricsScopesByMonitoredProjectRequest() { + monitoredResourceContainer_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListMetricsScopesByMonitoredProjectRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest.class, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest.Builder + .class); + } + + public static final int MONITORED_RESOURCE_CONTAINER_FIELD_NUMBER = 1; + private volatile java.lang.Object monitoredResourceContainer_; + /** + * + * + *
+   * Required. The resource name of the `Monitored Project` being requested.
+   * Example:
+   * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The monitoredResourceContainer. + */ + @java.lang.Override + public java.lang.String getMonitoredResourceContainer() { + java.lang.Object ref = monitoredResourceContainer_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + monitoredResourceContainer_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the `Monitored Project` being requested.
+   * Example:
+   * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for monitoredResourceContainer. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMonitoredResourceContainerBytes() { + java.lang.Object ref = monitoredResourceContainer_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + monitoredResourceContainer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(monitoredResourceContainer_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, monitoredResourceContainer_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(monitoredResourceContainer_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize(1, monitoredResourceContainer_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest other = + (com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) obj; + + if (!getMonitoredResourceContainer().equals(other.getMonitoredResourceContainer())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MONITORED_RESOURCE_CONTAINER_FIELD_NUMBER; + hash = (53 * hash) + getMonitoredResourceContainer().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for the `ListMetricsScopesByMonitoredProject` method.
+   * 
+ * + * Protobuf type {@code + * google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + .class, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + .Builder.class); + } + + // Construct using + // com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + monitoredResourceContainer_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + build() { + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + buildPartial() { + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest result = + new com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest( + this); + result.monitoredResourceContainer_ = monitoredResourceContainer_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) { + return mergeFrom( + (com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest other) { + if (other + == com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + .getDefaultInstance()) return this; + if (!other.getMonitoredResourceContainer().isEmpty()) { + monitoredResourceContainer_ = other.monitoredResourceContainer_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + monitoredResourceContainer_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object monitoredResourceContainer_ = ""; + /** + * + * + *
+     * Required. The resource name of the `Monitored Project` being requested.
+     * Example:
+     * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The monitoredResourceContainer. + */ + public java.lang.String getMonitoredResourceContainer() { + java.lang.Object ref = monitoredResourceContainer_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + monitoredResourceContainer_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the `Monitored Project` being requested.
+     * Example:
+     * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The bytes for monitoredResourceContainer. + */ + public com.google.protobuf.ByteString getMonitoredResourceContainerBytes() { + java.lang.Object ref = monitoredResourceContainer_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + monitoredResourceContainer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the `Monitored Project` being requested.
+     * Example:
+     * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The monitoredResourceContainer to set. + * @return This builder for chaining. + */ + public Builder setMonitoredResourceContainer(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + monitoredResourceContainer_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the `Monitored Project` being requested.
+     * Example:
+     * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearMonitoredResourceContainer() { + + monitoredResourceContainer_ = getDefaultInstance().getMonitoredResourceContainer(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the `Monitored Project` being requested.
+     * Example:
+     * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The bytes for monitoredResourceContainer to set. + * @return This builder for chaining. + */ + public Builder setMonitoredResourceContainerBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + monitoredResourceContainer_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + private static final com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest(); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListMetricsScopesByMonitoredProjectRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequestOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequestOrBuilder.java new file mode 100644 index 000000000000..235a855bdb9b --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectRequestOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public interface ListMetricsScopesByMonitoredProjectRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the `Monitored Project` being requested.
+   * Example:
+   * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The monitoredResourceContainer. + */ + java.lang.String getMonitoredResourceContainer(); + /** + * + * + *
+   * Required. The resource name of the `Monitored Project` being requested.
+   * Example:
+   * `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string monitored_resource_container = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for monitoredResourceContainer. + */ + com.google.protobuf.ByteString getMonitoredResourceContainerBytes(); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponse.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponse.java new file mode 100644 index 000000000000..479fdd2a9496 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponse.java @@ -0,0 +1,1001 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Response for the `ListMetricsScopesByMonitoredProject` method.
+ * 
+ * + * Protobuf type {@code + * google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse} + */ +public final class ListMetricsScopesByMonitoredProjectResponse + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) + ListMetricsScopesByMonitoredProjectResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListMetricsScopesByMonitoredProjectResponse.newBuilder() to construct. + private ListMetricsScopesByMonitoredProjectResponse( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListMetricsScopesByMonitoredProjectResponse() { + metricsScopes_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListMetricsScopesByMonitoredProjectResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse.class, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + .Builder.class); + } + + public static final int METRICS_SCOPES_FIELD_NUMBER = 1; + private java.util.List metricsScopes_; + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + @java.lang.Override + public java.util.List getMetricsScopesList() { + return metricsScopes_; + } + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + @java.lang.Override + public java.util.List + getMetricsScopesOrBuilderList() { + return metricsScopes_; + } + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + @java.lang.Override + public int getMetricsScopesCount() { + return metricsScopes_.size(); + } + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MetricsScope getMetricsScopes(int index) { + return metricsScopes_.get(index); + } + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder getMetricsScopesOrBuilder( + int index) { + return metricsScopes_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < metricsScopes_.size(); i++) { + output.writeMessage(1, metricsScopes_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < metricsScopes_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, metricsScopes_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse other = + (com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) obj; + + if (!getMetricsScopesList().equals(other.getMetricsScopesList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getMetricsScopesCount() > 0) { + hash = (37 * hash) + METRICS_SCOPES_FIELD_NUMBER; + hash = (53 * hash) + getMetricsScopesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response for the `ListMetricsScopesByMonitoredProject` method.
+   * 
+ * + * Protobuf type {@code + * google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + .class, + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + .Builder.class); + } + + // Construct using + // com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (metricsScopesBuilder_ == null) { + metricsScopes_ = java.util.Collections.emptyList(); + } else { + metricsScopes_ = null; + metricsScopesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + build() { + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + buildPartial() { + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse result = + new com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse( + this); + int from_bitField0_ = bitField0_; + if (metricsScopesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + metricsScopes_ = java.util.Collections.unmodifiableList(metricsScopes_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.metricsScopes_ = metricsScopes_; + } else { + result.metricsScopes_ = metricsScopesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) { + return mergeFrom( + (com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse other) { + if (other + == com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + .getDefaultInstance()) return this; + if (metricsScopesBuilder_ == null) { + if (!other.metricsScopes_.isEmpty()) { + if (metricsScopes_.isEmpty()) { + metricsScopes_ = other.metricsScopes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMetricsScopesIsMutable(); + metricsScopes_.addAll(other.metricsScopes_); + } + onChanged(); + } + } else { + if (!other.metricsScopes_.isEmpty()) { + if (metricsScopesBuilder_.isEmpty()) { + metricsScopesBuilder_.dispose(); + metricsScopesBuilder_ = null; + metricsScopes_ = other.metricsScopes_; + bitField0_ = (bitField0_ & ~0x00000001); + metricsScopesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getMetricsScopesFieldBuilder() + : null; + } else { + metricsScopesBuilder_.addAllMessages(other.metricsScopes_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.monitoring.metricsscope.v1.MetricsScope m = + input.readMessage( + com.google.monitoring.metricsscope.v1.MetricsScope.parser(), + extensionRegistry); + if (metricsScopesBuilder_ == null) { + ensureMetricsScopesIsMutable(); + metricsScopes_.add(m); + } else { + metricsScopesBuilder_.addMessage(m); + } + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List metricsScopes_ = + java.util.Collections.emptyList(); + + private void ensureMetricsScopesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + metricsScopes_ = + new java.util.ArrayList( + metricsScopes_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MetricsScope, + com.google.monitoring.metricsscope.v1.MetricsScope.Builder, + com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder> + metricsScopesBuilder_; + + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public java.util.List + getMetricsScopesList() { + if (metricsScopesBuilder_ == null) { + return java.util.Collections.unmodifiableList(metricsScopes_); + } else { + return metricsScopesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public int getMetricsScopesCount() { + if (metricsScopesBuilder_ == null) { + return metricsScopes_.size(); + } else { + return metricsScopesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public com.google.monitoring.metricsscope.v1.MetricsScope getMetricsScopes(int index) { + if (metricsScopesBuilder_ == null) { + return metricsScopes_.get(index); + } else { + return metricsScopesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder setMetricsScopes( + int index, com.google.monitoring.metricsscope.v1.MetricsScope value) { + if (metricsScopesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMetricsScopesIsMutable(); + metricsScopes_.set(index, value); + onChanged(); + } else { + metricsScopesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder setMetricsScopes( + int index, com.google.monitoring.metricsscope.v1.MetricsScope.Builder builderForValue) { + if (metricsScopesBuilder_ == null) { + ensureMetricsScopesIsMutable(); + metricsScopes_.set(index, builderForValue.build()); + onChanged(); + } else { + metricsScopesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder addMetricsScopes(com.google.monitoring.metricsscope.v1.MetricsScope value) { + if (metricsScopesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMetricsScopesIsMutable(); + metricsScopes_.add(value); + onChanged(); + } else { + metricsScopesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder addMetricsScopes( + int index, com.google.monitoring.metricsscope.v1.MetricsScope value) { + if (metricsScopesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMetricsScopesIsMutable(); + metricsScopes_.add(index, value); + onChanged(); + } else { + metricsScopesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder addMetricsScopes( + com.google.monitoring.metricsscope.v1.MetricsScope.Builder builderForValue) { + if (metricsScopesBuilder_ == null) { + ensureMetricsScopesIsMutable(); + metricsScopes_.add(builderForValue.build()); + onChanged(); + } else { + metricsScopesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder addMetricsScopes( + int index, com.google.monitoring.metricsscope.v1.MetricsScope.Builder builderForValue) { + if (metricsScopesBuilder_ == null) { + ensureMetricsScopesIsMutable(); + metricsScopes_.add(index, builderForValue.build()); + onChanged(); + } else { + metricsScopesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder addAllMetricsScopes( + java.lang.Iterable values) { + if (metricsScopesBuilder_ == null) { + ensureMetricsScopesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, metricsScopes_); + onChanged(); + } else { + metricsScopesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder clearMetricsScopes() { + if (metricsScopesBuilder_ == null) { + metricsScopes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + metricsScopesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public Builder removeMetricsScopes(int index) { + if (metricsScopesBuilder_ == null) { + ensureMetricsScopesIsMutable(); + metricsScopes_.remove(index); + onChanged(); + } else { + metricsScopesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public com.google.monitoring.metricsscope.v1.MetricsScope.Builder getMetricsScopesBuilder( + int index) { + return getMetricsScopesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder getMetricsScopesOrBuilder( + int index) { + if (metricsScopesBuilder_ == null) { + return metricsScopes_.get(index); + } else { + return metricsScopesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public java.util.List + getMetricsScopesOrBuilderList() { + if (metricsScopesBuilder_ != null) { + return metricsScopesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(metricsScopes_); + } + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public com.google.monitoring.metricsscope.v1.MetricsScope.Builder addMetricsScopesBuilder() { + return getMetricsScopesFieldBuilder() + .addBuilder(com.google.monitoring.metricsscope.v1.MetricsScope.getDefaultInstance()); + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public com.google.monitoring.metricsscope.v1.MetricsScope.Builder addMetricsScopesBuilder( + int index) { + return getMetricsScopesFieldBuilder() + .addBuilder( + index, com.google.monitoring.metricsscope.v1.MetricsScope.getDefaultInstance()); + } + /** + * + * + *
+     * A set of all metrics scopes that the specified monitored project has been
+     * added to.
+     * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + public java.util.List + getMetricsScopesBuilderList() { + return getMetricsScopesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MetricsScope, + com.google.monitoring.metricsscope.v1.MetricsScope.Builder, + com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder> + getMetricsScopesFieldBuilder() { + if (metricsScopesBuilder_ == null) { + metricsScopesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MetricsScope, + com.google.monitoring.metricsscope.v1.MetricsScope.Builder, + com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder>( + metricsScopes_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + metricsScopes_ = null; + } + return metricsScopesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) + private static final com.google.monitoring.metricsscope.v1 + .ListMetricsScopesByMonitoredProjectResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse(); + } + + public static com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListMetricsScopesByMonitoredProjectResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser + getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponseOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponseOrBuilder.java new file mode 100644 index 000000000000..8397864f8c95 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/ListMetricsScopesByMonitoredProjectResponseOrBuilder.java @@ -0,0 +1,82 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public interface ListMetricsScopesByMonitoredProjectResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + java.util.List getMetricsScopesList(); + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + com.google.monitoring.metricsscope.v1.MetricsScope getMetricsScopes(int index); + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + int getMetricsScopesCount(); + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + java.util.List + getMetricsScopesOrBuilderList(); + /** + * + * + *
+   * A set of all metrics scopes that the specified monitored project has been
+   * added to.
+   * 
+ * + * repeated .google.monitoring.metricsscope.v1.MetricsScope metrics_scopes = 1; + */ + com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder getMetricsScopesOrBuilder(int index); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScope.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScope.java new file mode 100644 index 000000000000..a40d47439baa --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScope.java @@ -0,0 +1,1779 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scope.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Represents a [Metrics
+ * Scope](https://cloud.google.com/monitoring/settings#concept-scope) in Cloud
+ * Monitoring, which specifies one or more Google projects and zero or more AWS
+ * accounts to monitor together.
+ * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.MetricsScope} + */ +public final class MetricsScope extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.MetricsScope) + MetricsScopeOrBuilder { + private static final long serialVersionUID = 0L; + // Use MetricsScope.newBuilder() to construct. + private MetricsScope(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private MetricsScope() { + name_ = ""; + monitoredProjects_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new MetricsScope(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MetricsScope_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MetricsScope_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.MetricsScope.class, + com.google.monitoring.metricsscope.v1.MetricsScope.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Immutable. The resource name of the Monitoring Metrics Scope.
+   * On input, the resource name can be specified with the
+   * scoping project ID or number. On output, the resource name is
+   * specified with the scoping project number.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. The resource name of the Monitoring Metrics Scope.
+   * On input, the resource name can be specified with the
+   * scoping project ID or number. On output, the resource name is
+   * specified with the scoping project number.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` record was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` record was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` record was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int MONITORED_PROJECTS_FIELD_NUMBER = 4; + private java.util.List monitoredProjects_; + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getMonitoredProjectsList() { + return monitoredProjects_; + } + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getMonitoredProjectsOrBuilderList() { + return monitoredProjects_; + } + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getMonitoredProjectsCount() { + return monitoredProjects_.size(); + } + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProject getMonitoredProjects(int index) { + return monitoredProjects_.get(index); + } + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder + getMonitoredProjectsOrBuilder(int index) { + return monitoredProjects_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (createTime_ != null) { + output.writeMessage(2, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(3, getUpdateTime()); + } + for (int i = 0; i < monitoredProjects_.size(); i++) { + output.writeMessage(4, monitoredProjects_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateTime()); + } + for (int i = 0; i < monitoredProjects_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(4, monitoredProjects_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.monitoring.metricsscope.v1.MetricsScope)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.MetricsScope other = + (com.google.monitoring.metricsscope.v1.MetricsScope) obj; + + if (!getName().equals(other.getName())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getMonitoredProjectsList().equals(other.getMonitoredProjectsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (getMonitoredProjectsCount() > 0) { + hash = (37 * hash) + MONITORED_PROJECTS_FIELD_NUMBER; + hash = (53 * hash) + getMonitoredProjectsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.monitoring.metricsscope.v1.MetricsScope prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents a [Metrics
+   * Scope](https://cloud.google.com/monitoring/settings#concept-scope) in Cloud
+   * Monitoring, which specifies one or more Google projects and zero or more AWS
+   * accounts to monitor together.
+   * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.MetricsScope} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.MetricsScope) + com.google.monitoring.metricsscope.v1.MetricsScopeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MetricsScope_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MetricsScope_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.MetricsScope.class, + com.google.monitoring.metricsscope.v1.MetricsScope.Builder.class); + } + + // Construct using com.google.monitoring.metricsscope.v1.MetricsScope.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (monitoredProjectsBuilder_ == null) { + monitoredProjects_ = java.util.Collections.emptyList(); + } else { + monitoredProjects_ = null; + monitoredProjectsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MetricsScope_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MetricsScope getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.MetricsScope.getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MetricsScope build() { + com.google.monitoring.metricsscope.v1.MetricsScope result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MetricsScope buildPartial() { + com.google.monitoring.metricsscope.v1.MetricsScope result = + new com.google.monitoring.metricsscope.v1.MetricsScope(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (monitoredProjectsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + monitoredProjects_ = java.util.Collections.unmodifiableList(monitoredProjects_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.monitoredProjects_ = monitoredProjects_; + } else { + result.monitoredProjects_ = monitoredProjectsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.monitoring.metricsscope.v1.MetricsScope) { + return mergeFrom((com.google.monitoring.metricsscope.v1.MetricsScope) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.monitoring.metricsscope.v1.MetricsScope other) { + if (other == com.google.monitoring.metricsscope.v1.MetricsScope.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (monitoredProjectsBuilder_ == null) { + if (!other.monitoredProjects_.isEmpty()) { + if (monitoredProjects_.isEmpty()) { + monitoredProjects_ = other.monitoredProjects_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.addAll(other.monitoredProjects_); + } + onChanged(); + } + } else { + if (!other.monitoredProjects_.isEmpty()) { + if (monitoredProjectsBuilder_.isEmpty()) { + monitoredProjectsBuilder_.dispose(); + monitoredProjectsBuilder_ = null; + monitoredProjects_ = other.monitoredProjects_; + bitField0_ = (bitField0_ & ~0x00000001); + monitoredProjectsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getMonitoredProjectsFieldBuilder() + : null; + } else { + monitoredProjectsBuilder_.addAllMessages(other.monitoredProjects_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + case 26: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 26 + case 34: + { + com.google.monitoring.metricsscope.v1.MonitoredProject m = + input.readMessage( + com.google.monitoring.metricsscope.v1.MonitoredProject.parser(), + extensionRegistry); + if (monitoredProjectsBuilder_ == null) { + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.add(m); + } else { + monitoredProjectsBuilder_.addMessage(m); + } + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Immutable. The resource name of the Monitoring Metrics Scope.
+     * On input, the resource name can be specified with the
+     * scoping project ID or number. On output, the resource name is
+     * specified with the scoping project number.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. The resource name of the Monitoring Metrics Scope.
+     * On input, the resource name can be specified with the
+     * scoping project ID or number. On output, the resource name is
+     * specified with the scoping project number.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. The resource name of the Monitoring Metrics Scope.
+     * On input, the resource name can be specified with the
+     * scoping project ID or number. On output, the resource name is
+     * specified with the scoping project number.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The resource name of the Monitoring Metrics Scope.
+     * On input, the resource name can be specified with the
+     * scoping project ID or number. On output, the resource name is
+     * specified with the scoping project number.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The resource name of the Monitoring Metrics Scope.
+     * On input, the resource name can be specified with the
+     * scoping project ID or number. On output, the resource name is
+     * specified with the scoping project number.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The time when this `Metrics Scope` record was last updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private java.util.List + monitoredProjects_ = java.util.Collections.emptyList(); + + private void ensureMonitoredProjectsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + monitoredProjects_ = + new java.util.ArrayList( + monitoredProjects_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MonitoredProject, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder, + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder> + monitoredProjectsBuilder_; + + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getMonitoredProjectsList() { + if (monitoredProjectsBuilder_ == null) { + return java.util.Collections.unmodifiableList(monitoredProjects_); + } else { + return monitoredProjectsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getMonitoredProjectsCount() { + if (monitoredProjectsBuilder_ == null) { + return monitoredProjects_.size(); + } else { + return monitoredProjectsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProject getMonitoredProjects(int index) { + if (monitoredProjectsBuilder_ == null) { + return monitoredProjects_.get(index); + } else { + return monitoredProjectsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setMonitoredProjects( + int index, com.google.monitoring.metricsscope.v1.MonitoredProject value) { + if (monitoredProjectsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.set(index, value); + onChanged(); + } else { + monitoredProjectsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setMonitoredProjects( + int index, com.google.monitoring.metricsscope.v1.MonitoredProject.Builder builderForValue) { + if (monitoredProjectsBuilder_ == null) { + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.set(index, builderForValue.build()); + onChanged(); + } else { + monitoredProjectsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addMonitoredProjects( + com.google.monitoring.metricsscope.v1.MonitoredProject value) { + if (monitoredProjectsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.add(value); + onChanged(); + } else { + monitoredProjectsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addMonitoredProjects( + int index, com.google.monitoring.metricsscope.v1.MonitoredProject value) { + if (monitoredProjectsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.add(index, value); + onChanged(); + } else { + monitoredProjectsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addMonitoredProjects( + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder builderForValue) { + if (monitoredProjectsBuilder_ == null) { + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.add(builderForValue.build()); + onChanged(); + } else { + monitoredProjectsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addMonitoredProjects( + int index, com.google.monitoring.metricsscope.v1.MonitoredProject.Builder builderForValue) { + if (monitoredProjectsBuilder_ == null) { + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.add(index, builderForValue.build()); + onChanged(); + } else { + monitoredProjectsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllMonitoredProjects( + java.lang.Iterable + values) { + if (monitoredProjectsBuilder_ == null) { + ensureMonitoredProjectsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, monitoredProjects_); + onChanged(); + } else { + monitoredProjectsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearMonitoredProjects() { + if (monitoredProjectsBuilder_ == null) { + monitoredProjects_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + monitoredProjectsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeMonitoredProjects(int index) { + if (monitoredProjectsBuilder_ == null) { + ensureMonitoredProjectsIsMutable(); + monitoredProjects_.remove(index); + onChanged(); + } else { + monitoredProjectsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProject.Builder + getMonitoredProjectsBuilder(int index) { + return getMonitoredProjectsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder + getMonitoredProjectsOrBuilder(int index) { + if (monitoredProjectsBuilder_ == null) { + return monitoredProjects_.get(index); + } else { + return monitoredProjectsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getMonitoredProjectsOrBuilderList() { + if (monitoredProjectsBuilder_ != null) { + return monitoredProjectsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(monitoredProjects_); + } + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProject.Builder + addMonitoredProjectsBuilder() { + return getMonitoredProjectsFieldBuilder() + .addBuilder(com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.monitoring.metricsscope.v1.MonitoredProject.Builder + addMonitoredProjectsBuilder(int index) { + return getMonitoredProjectsFieldBuilder() + .addBuilder( + index, com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The list of projects monitored by this `Metrics Scope`.
+     * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getMonitoredProjectsBuilderList() { + return getMonitoredProjectsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MonitoredProject, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder, + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder> + getMonitoredProjectsFieldBuilder() { + if (monitoredProjectsBuilder_ == null) { + monitoredProjectsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.monitoring.metricsscope.v1.MonitoredProject, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder, + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder>( + monitoredProjects_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + monitoredProjects_ = null; + } + return monitoredProjectsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.MetricsScope) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.MetricsScope) + private static final com.google.monitoring.metricsscope.v1.MetricsScope DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.monitoring.metricsscope.v1.MetricsScope(); + } + + public static com.google.monitoring.metricsscope.v1.MetricsScope getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MetricsScope parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MetricsScope getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeName.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeName.java new file mode 100644 index 000000000000..890bd82b2da7 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeName.java @@ -0,0 +1,168 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class MetricsScopeName implements ResourceName { + private static final PathTemplate METRICS_SCOPE = + PathTemplate.createWithoutUrlEncoding("locations/global/metricsScope/{metrics_scope}"); + private volatile Map fieldValuesMap; + private final String metricsScope; + + @Deprecated + protected MetricsScopeName() { + metricsScope = null; + } + + private MetricsScopeName(Builder builder) { + metricsScope = Preconditions.checkNotNull(builder.getMetricsScope()); + } + + public String getMetricsScope() { + return metricsScope; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static MetricsScopeName of(String metricsScope) { + return newBuilder().setMetricsScope(metricsScope).build(); + } + + public static String format(String metricsScope) { + return newBuilder().setMetricsScope(metricsScope).build().toString(); + } + + public static MetricsScopeName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + METRICS_SCOPE.validatedMatch( + formattedString, "MetricsScopeName.parse: formattedString not in valid format"); + return of(matchMap.get("metrics_scope")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (MetricsScopeName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return METRICS_SCOPE.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (metricsScope != null) { + fieldMapBuilder.put("metrics_scope", metricsScope); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return METRICS_SCOPE.instantiate("metrics_scope", metricsScope); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + MetricsScopeName that = ((MetricsScopeName) o); + return Objects.equals(this.metricsScope, that.metricsScope); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(metricsScope); + return h; + } + + /** Builder for locations/global/metricsScope/{metrics_scope}. */ + public static class Builder { + private String metricsScope; + + protected Builder() {} + + public String getMetricsScope() { + return metricsScope; + } + + public Builder setMetricsScope(String metricsScope) { + this.metricsScope = metricsScope; + return this; + } + + private Builder(MetricsScopeName metricsScopeName) { + this.metricsScope = metricsScopeName.metricsScope; + } + + public MetricsScopeName build() { + return new MetricsScopeName(this); + } + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeOrBuilder.java new file mode 100644 index 000000000000..fdc9a2c59b48 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeOrBuilder.java @@ -0,0 +1,199 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scope.proto + +package com.google.monitoring.metricsscope.v1; + +public interface MetricsScopeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.MetricsScope) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Immutable. The resource name of the Monitoring Metrics Scope.
+   * On input, the resource name can be specified with the
+   * scoping project ID or number. On output, the resource name is
+   * specified with the scoping project number.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Immutable. The resource name of the Monitoring Metrics Scope.
+   * On input, the resource name can be specified with the
+   * scoping project ID or number. On output, the resource name is
+   * specified with the scoping project number.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` record was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` record was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The time when this `Metrics Scope` record was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getMonitoredProjectsList(); + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.monitoring.metricsscope.v1.MonitoredProject getMonitoredProjects(int index); + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getMonitoredProjectsCount(); + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List + getMonitoredProjectsOrBuilderList(); + /** + * + * + *
+   * Output only. The list of projects monitored by this `Metrics Scope`.
+   * 
+ * + * + * repeated .google.monitoring.metricsscope.v1.MonitoredProject monitored_projects = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder getMonitoredProjectsOrBuilder( + int index); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeProto.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeProto.java new file mode 100644 index 000000000000..44a0a72cc6a2 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopeProto.java @@ -0,0 +1,109 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scope.proto + +package com.google.monitoring.metricsscope.v1; + +public final class MetricsScopeProto { + private MetricsScopeProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_MetricsScope_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_MetricsScope_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_MonitoredProject_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_MonitoredProject_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n5google/monitoring/metricsscope/v1/metr" + + "ics_scope.proto\022!google.monitoring.metri" + + "csscope.v1\032\037google/api/field_behavior.pr" + + "oto\032\031google/api/resource.proto\032\037google/p" + + "rotobuf/timestamp.proto\"\277\002\n\014MetricsScope" + + "\022\021\n\004name\030\001 \001(\tB\003\340A\005\0224\n\013create_time\030\002 \001(\013" + + "2\032.google.protobuf.TimestampB\003\340A\003\0224\n\013upd" + + "ate_time\030\003 \001(\0132\032.google.protobuf.Timesta" + + "mpB\003\340A\003\022T\n\022monitored_projects\030\004 \003(\01323.go" + + "ogle.monitoring.metricsscope.v1.Monitore" + + "dProjectB\003\340A\003:Z\352AW\n&monitoring.googleapi" + + "s.com/MetricsScope\022-locations/global/met" + + "ricsScope/{metrics_scope}\"\317\001\n\020MonitoredP" + + "roject\022\021\n\004name\030\001 \001(\tB\003\340A\005\0224\n\013create_time" + + "\030\006 \001(\0132\032.google.protobuf.TimestampB\003\340A\003:" + + "r\352Ao\n*monitoring.googleapis.com/Monitore" + + "dProject\022Alocations/global/metricsScopes" + + "/{metrics_scope}/projects/{project}B\215\002\n%" + + "com.google.monitoring.metricsscope.v1B\021M" + + "etricsScopeProtoP\001ZMgoogle.golang.org/ge" + + "nproto/googleapis/monitoring/metricsscop" + + "e/v1;metricsscope\252\002\'Google.Cloud.Monitor" + + "ing.MetricsScope.V1\312\002\'Google\\Cloud\\Monit" + + "oring\\MetricsScope\\V1\352\002+Google::Cloud::M" + + "onitoring::MetricsScope::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_monitoring_metricsscope_v1_MetricsScope_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_monitoring_metricsscope_v1_MetricsScope_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_MetricsScope_descriptor, + new java.lang.String[] { + "Name", "CreateTime", "UpdateTime", "MonitoredProjects", + }); + internal_static_google_monitoring_metricsscope_v1_MonitoredProject_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_monitoring_metricsscope_v1_MonitoredProject_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_MonitoredProject_descriptor, + new java.lang.String[] { + "Name", "CreateTime", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.ResourceProto.resource); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesProto.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesProto.java new file mode 100644 index 000000000000..676b857067ce --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesProto.java @@ -0,0 +1,213 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public final class MetricsScopesProto { + private MetricsScopesProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_monitoring_metricsscope_v1_OperationMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_monitoring_metricsscope_v1_OperationMetadata_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n6google/monitoring/metricsscope/v1/metr" + + "ics_scopes.proto\022!google.monitoring.metr" + + "icsscope.v1\032\034google/api/annotations.prot" + + "o\032\027google/api/client.proto\032\037google/api/f" + + "ield_behavior.proto\032\031google/api/resource" + + ".proto\032#google/longrunning/operations.pr" + + "oto\0325google/monitoring/metricsscope/v1/m" + + "etrics_scope.proto\032\037google/protobuf/time" + + "stamp.proto\"V\n\026GetMetricsScopeRequest\022<\n" + + "\004name\030\001 \001(\tB.\340A\002\372A(\n&monitoring.googleap" + + "is.com/MetricsScope\"W\n*ListMetricsScopes" + + "ByMonitoredProjectRequest\022)\n\034monitored_r" + + "esource_container\030\001 \001(\tB\003\340A\002\"v\n+ListMetr" + + "icsScopesByMonitoredProjectResponse\022G\n\016m" + + "etrics_scopes\030\001 \003(\0132/.google.monitoring." + + "metricsscope.v1.MetricsScope\"\264\001\n\035CreateM" + + "onitoredProjectRequest\022>\n\006parent\030\001 \001(\tB." + + "\340A\002\372A(\n&monitoring.googleapis.com/Metric" + + "sScope\022S\n\021monitored_project\030\002 \001(\01323.goog" + + "le.monitoring.metricsscope.v1.MonitoredP" + + "rojectB\003\340A\002\"a\n\035DeleteMonitoredProjectReq" + + "uest\022@\n\004name\030\001 \001(\tB2\340A\002\372A,\n*monitoring.g" + + "oogleapis.com/MonitoredProject\"\223\002\n\021Opera" + + "tionMetadata\022I\n\005state\030\001 \001(\0162:.google.mon" + + "itoring.metricsscope.v1.OperationMetadat" + + "a.State\022/\n\013create_time\030\005 \001(\0132\032.google.pr" + + "otobuf.Timestamp\022/\n\013update_time\030\006 \001(\0132\032." + + "google.protobuf.Timestamp\"Q\n\005State\022\025\n\021ST" + + "ATE_UNSPECIFIED\020\000\022\013\n\007CREATED\020\001\022\013\n\007RUNNIN" + + "G\020\002\022\010\n\004DONE\020\003\022\r\n\tCANCELLED\020\0042\302\t\n\rMetrics" + + "Scopes\022\271\001\n\017GetMetricsScope\0229.google.moni" + + "toring.metricsscope.v1.GetMetricsScopeRe" + + "quest\032/.google.monitoring.metricsscope.v" + + "1.MetricsScope\":\202\323\344\223\002-\022+/v1/{name=locati" + + "ons/global/metricsScopes/*}\332A\004name\022\224\002\n#L" + + "istMetricsScopesByMonitoredProject\022M.goo" + + "gle.monitoring.metricsscope.v1.ListMetri" + + "csScopesByMonitoredProjectRequest\032N.goog" + + "le.monitoring.metricsscope.v1.ListMetric" + + "sScopesByMonitoredProjectResponse\"N\202\323\344\223\002" + + "H\022F/v1/locations/global/metricsScopes:li" + + "stMetricsScopesByMonitoredProject\022\220\002\n\026Cr" + + "eateMonitoredProject\022@.google.monitoring" + + ".metricsscope.v1.CreateMonitoredProjectR" + + "equest\032\035.google.longrunning.Operation\"\224\001" + + "\202\323\344\223\002K\"6/v1/{parent=locations/global/met" + + "ricsScopes/*}/projects:\021monitored_projec" + + "t\332A\030parent,monitored_project\312A%\n\020Monitor" + + "edProject\022\021OperationMetadata\022\355\001\n\026DeleteM" + + "onitoredProject\022@.google.monitoring.metr" + + "icsscope.v1.DeleteMonitoredProjectReques" + + "t\032\035.google.longrunning.Operation\"r\202\323\344\223\0028" + + "*6/v1/{name=locations/global/metricsScop" + + "es/*/projects/*}\332A\004name\312A*\n\025google.proto" + + "buf.Empty\022\021OperationMetadata\032\332\001\312A\031monito" + + "ring.googleapis.com\322A\272\001https://www.googl" + + "eapis.com/auth/cloud-platform,https://ww" + + "w.googleapis.com/auth/monitoring,https:/" + + "/www.googleapis.com/auth/monitoring.read" + + ",https://www.googleapis.com/auth/monitor" + + "ing.writeB\216\002\n%com.google.monitoring.metr" + + "icsscope.v1B\022MetricsScopesProtoP\001ZMgoogl" + + "e.golang.org/genproto/googleapis/monitor" + + "ing/metricsscope/v1;metricsscope\252\002\'Googl" + + "e.Cloud.Monitoring.MetricsScope.V1\312\002\'Goo" + + "gle\\Cloud\\Monitoring\\MetricsScope\\V1\352\002+G" + + "oogle::Cloud::Monitoring::MetricsScope::" + + "V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.monitoring.metricsscope.v1.MetricsScopeProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_GetMetricsScopeRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectRequest_descriptor, + new java.lang.String[] { + "MonitoredResourceContainer", + }); + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_ListMetricsScopesByMonitoredProjectResponse_descriptor, + new java.lang.String[] { + "MetricsScopes", + }); + internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_CreateMonitoredProjectRequest_descriptor, + new java.lang.String[] { + "Parent", "MonitoredProject", + }); + internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_DeleteMonitoredProjectRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_monitoring_metricsscope_v1_OperationMetadata_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_monitoring_metricsscope_v1_OperationMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_monitoring_metricsscope_v1_OperationMetadata_descriptor, + new java.lang.String[] { + "State", "CreateTime", "UpdateTime", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.monitoring.metricsscope.v1.MetricsScopeProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProject.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProject.java new file mode 100644 index 000000000000..7cb163a4c797 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProject.java @@ -0,0 +1,932 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scope.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * A [project being
+ * monitored](https://cloud.google.com/monitoring/settings/multiple-projects#create-multi)
+ * by a `Metrics Scope`.
+ * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.MonitoredProject} + */ +public final class MonitoredProject extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.MonitoredProject) + MonitoredProjectOrBuilder { + private static final long serialVersionUID = 0L; + // Use MonitoredProject.newBuilder() to construct. + private MonitoredProject(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private MonitoredProject() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new MonitoredProject(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MonitoredProject_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MonitoredProject_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.MonitoredProject.class, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+   * includes the scoping project ID and monitored project ID. On output, it
+   * contains the equivalent project numbers.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+   * includes the scoping project ID and monitored project ID. On output, it
+   * contains the equivalent project numbers.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The time when this `MonitoredProject` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. The time when this `MonitoredProject` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The time when this `MonitoredProject` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.monitoring.metricsscope.v1.MonitoredProject)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.MonitoredProject other = + (com.google.monitoring.metricsscope.v1.MonitoredProject) obj; + + if (!getName().equals(other.getName())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.MonitoredProject prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A [project being
+   * monitored](https://cloud.google.com/monitoring/settings/multiple-projects#create-multi)
+   * by a `Metrics Scope`.
+   * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.MonitoredProject} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.MonitoredProject) + com.google.monitoring.metricsscope.v1.MonitoredProjectOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MonitoredProject_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MonitoredProject_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.MonitoredProject.class, + com.google.monitoring.metricsscope.v1.MonitoredProject.Builder.class); + } + + // Construct using com.google.monitoring.metricsscope.v1.MonitoredProject.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopeProto + .internal_static_google_monitoring_metricsscope_v1_MonitoredProject_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProject getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProject build() { + com.google.monitoring.metricsscope.v1.MonitoredProject result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProject buildPartial() { + com.google.monitoring.metricsscope.v1.MonitoredProject result = + new com.google.monitoring.metricsscope.v1.MonitoredProject(this); + result.name_ = name_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.monitoring.metricsscope.v1.MonitoredProject) { + return mergeFrom((com.google.monitoring.metricsscope.v1.MonitoredProject) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.monitoring.metricsscope.v1.MonitoredProject other) { + if (other == com.google.monitoring.metricsscope.v1.MonitoredProject.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 50: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+     * includes the scoping project ID and monitored project ID. On output, it
+     * contains the equivalent project numbers.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+     * includes the scoping project ID and monitored project ID. On output, it
+     * contains the equivalent project numbers.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+     * includes the scoping project ID and monitored project ID. On output, it
+     * contains the equivalent project numbers.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+     * includes the scoping project ID and monitored project ID. On output, it
+     * contains the equivalent project numbers.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+     * includes the scoping project ID and monitored project ID. On output, it
+     * contains the equivalent project numbers.
+     * Example:
+     * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The time when this `MonitoredProject` was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.MonitoredProject) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.MonitoredProject) + private static final com.google.monitoring.metricsscope.v1.MonitoredProject DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.monitoring.metricsscope.v1.MonitoredProject(); + } + + public static com.google.monitoring.metricsscope.v1.MonitoredProject getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MonitoredProject parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.MonitoredProject getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectName.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectName.java new file mode 100644 index 000000000000..a0abe3d73142 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectName.java @@ -0,0 +1,193 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.monitoring.metricsscope.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class MonitoredProjectName implements ResourceName { + private static final PathTemplate METRICS_SCOPE_PROJECT = + PathTemplate.createWithoutUrlEncoding( + "locations/global/metricsScopes/{metrics_scope}/projects/{project}"); + private volatile Map fieldValuesMap; + private final String metricsScope; + private final String project; + + @Deprecated + protected MonitoredProjectName() { + metricsScope = null; + project = null; + } + + private MonitoredProjectName(Builder builder) { + metricsScope = Preconditions.checkNotNull(builder.getMetricsScope()); + project = Preconditions.checkNotNull(builder.getProject()); + } + + public String getMetricsScope() { + return metricsScope; + } + + public String getProject() { + return project; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static MonitoredProjectName of(String metricsScope, String project) { + return newBuilder().setMetricsScope(metricsScope).setProject(project).build(); + } + + public static String format(String metricsScope, String project) { + return newBuilder().setMetricsScope(metricsScope).setProject(project).build().toString(); + } + + public static MonitoredProjectName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + METRICS_SCOPE_PROJECT.validatedMatch( + formattedString, "MonitoredProjectName.parse: formattedString not in valid format"); + return of(matchMap.get("metrics_scope"), matchMap.get("project")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (MonitoredProjectName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return METRICS_SCOPE_PROJECT.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (metricsScope != null) { + fieldMapBuilder.put("metrics_scope", metricsScope); + } + if (project != null) { + fieldMapBuilder.put("project", project); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return METRICS_SCOPE_PROJECT.instantiate("metrics_scope", metricsScope, "project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + MonitoredProjectName that = ((MonitoredProjectName) o); + return Objects.equals(this.metricsScope, that.metricsScope) + && Objects.equals(this.project, that.project); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(metricsScope); + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for locations/global/metricsScopes/{metrics_scope}/projects/{project}. */ + public static class Builder { + private String metricsScope; + private String project; + + protected Builder() {} + + public String getMetricsScope() { + return metricsScope; + } + + public String getProject() { + return project; + } + + public Builder setMetricsScope(String metricsScope) { + this.metricsScope = metricsScope; + return this; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder(MonitoredProjectName monitoredProjectName) { + this.metricsScope = monitoredProjectName.metricsScope; + this.project = monitoredProjectName.project; + } + + public MonitoredProjectName build() { + return new MonitoredProjectName(this); + } + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectOrBuilder.java new file mode 100644 index 000000000000..99fa02ffb6b6 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/MonitoredProjectOrBuilder.java @@ -0,0 +1,96 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scope.proto + +package com.google.monitoring.metricsscope.v1; + +public interface MonitoredProjectOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.MonitoredProject) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+   * includes the scoping project ID and monitored project ID. On output, it
+   * contains the equivalent project numbers.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Immutable. The resource name of the `MonitoredProject`. On input, the resource name
+   * includes the scoping project ID and monitored project ID. On output, it
+   * contains the equivalent project numbers.
+   * Example:
+   * `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. The time when this `MonitoredProject` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The time when this `MonitoredProject` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The time when this `MonitoredProject` was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadata.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadata.java new file mode 100644 index 000000000000..452d8ff34bb6 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadata.java @@ -0,0 +1,1326 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +/** + * + * + *
+ * Contains metadata for longrunning operation for the edit Metrics Scope
+ * endpoints.
+ * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.OperationMetadata} + */ +public final class OperationMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.monitoring.metricsscope.v1.OperationMetadata) + OperationMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use OperationMetadata.newBuilder() to construct. + private OperationMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private OperationMetadata() { + state_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new OperationMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_OperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_OperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.OperationMetadata.class, + com.google.monitoring.metricsscope.v1.OperationMetadata.Builder.class); + } + + /** + * + * + *
+   * Batch operation states.
+   * 
+ * + * Protobuf enum {@code google.monitoring.metricsscope.v1.OperationMetadata.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * Request has been received.
+     * 
+ * + * CREATED = 1; + */ + CREATED(1), + /** + * + * + *
+     * Request is actively being processed.
+     * 
+ * + * RUNNING = 2; + */ + RUNNING(2), + /** + * + * + *
+     * The batch processing is done.
+     * 
+ * + * DONE = 3; + */ + DONE(3), + /** + * + * + *
+     * The batch processing was cancelled.
+     * 
+ * + * CANCELLED = 4; + */ + CANCELLED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Request has been received.
+     * 
+ * + * CREATED = 1; + */ + public static final int CREATED_VALUE = 1; + /** + * + * + *
+     * Request is actively being processed.
+     * 
+ * + * RUNNING = 2; + */ + public static final int RUNNING_VALUE = 2; + /** + * + * + *
+     * The batch processing is done.
+     * 
+ * + * DONE = 3; + */ + public static final int DONE_VALUE = 3; + /** + * + * + *
+     * The batch processing was cancelled.
+     * 
+ * + * CANCELLED = 4; + */ + public static final int CANCELLED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return CREATED; + case 2: + return RUNNING; + case 3: + return DONE; + case 4: + return CANCELLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.OperationMetadata.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.monitoring.metricsscope.v1.OperationMetadata.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_; + /** + * + * + *
+   * Current state of the batch operation.
+   * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Current state of the batch operation.
+   * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return The state. + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.OperationMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.monitoring.metricsscope.v1.OperationMetadata.State result = + com.google.monitoring.metricsscope.v1.OperationMetadata.State.valueOf(state_); + return result == null + ? com.google.monitoring.metricsscope.v1.OperationMetadata.State.UNRECOGNIZED + : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * The time when the batch request was received.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * The time when the batch request was received.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * The time when the batch request was received.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * The time when the operation result was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6; + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * The time when the operation result was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6; + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * The time when the operation result was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.monitoring.metricsscope.v1.OperationMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (createTime_ != null) { + output.writeMessage(5, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(6, getUpdateTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.monitoring.metricsscope.v1.OperationMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getUpdateTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.monitoring.metricsscope.v1.OperationMetadata)) { + return super.equals(obj); + } + com.google.monitoring.metricsscope.v1.OperationMetadata other = + (com.google.monitoring.metricsscope.v1.OperationMetadata) obj; + + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.monitoring.metricsscope.v1.OperationMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Contains metadata for longrunning operation for the edit Metrics Scope
+   * endpoints.
+   * 
+ * + * Protobuf type {@code google.monitoring.metricsscope.v1.OperationMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.monitoring.metricsscope.v1.OperationMetadata) + com.google.monitoring.metricsscope.v1.OperationMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_OperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_OperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.monitoring.metricsscope.v1.OperationMetadata.class, + com.google.monitoring.metricsscope.v1.OperationMetadata.Builder.class); + } + + // Construct using com.google.monitoring.metricsscope.v1.OperationMetadata.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + state_ = 0; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.monitoring.metricsscope.v1.MetricsScopesProto + .internal_static_google_monitoring_metricsscope_v1_OperationMetadata_descriptor; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.OperationMetadata getDefaultInstanceForType() { + return com.google.monitoring.metricsscope.v1.OperationMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.OperationMetadata build() { + com.google.monitoring.metricsscope.v1.OperationMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.OperationMetadata buildPartial() { + com.google.monitoring.metricsscope.v1.OperationMetadata result = + new com.google.monitoring.metricsscope.v1.OperationMetadata(this); + result.state_ = state_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.monitoring.metricsscope.v1.OperationMetadata) { + return mergeFrom((com.google.monitoring.metricsscope.v1.OperationMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.monitoring.metricsscope.v1.OperationMetadata other) { + if (other == com.google.monitoring.metricsscope.v1.OperationMetadata.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + + break; + } // case 8 + case 42: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 42 + case 50: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * Current state of the batch operation.
+     * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Current state of the batch operation.
+     * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Current state of the batch operation.
+     * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return The state. + */ + @java.lang.Override + public com.google.monitoring.metricsscope.v1.OperationMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.monitoring.metricsscope.v1.OperationMetadata.State result = + com.google.monitoring.metricsscope.v1.OperationMetadata.State.valueOf(state_); + return result == null + ? com.google.monitoring.metricsscope.v1.OperationMetadata.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Current state of the batch operation.
+     * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.monitoring.metricsscope.v1.OperationMetadata.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Current state of the batch operation.
+     * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return This builder for chaining. + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * The time when the batch request was received.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * The time when the operation result was last updated.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.monitoring.metricsscope.v1.OperationMetadata) + } + + // @@protoc_insertion_point(class_scope:google.monitoring.metricsscope.v1.OperationMetadata) + private static final com.google.monitoring.metricsscope.v1.OperationMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.monitoring.metricsscope.v1.OperationMetadata(); + } + + public static com.google.monitoring.metricsscope.v1.OperationMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OperationMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.monitoring.metricsscope.v1.OperationMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadataOrBuilder.java b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadataOrBuilder.java new file mode 100644 index 000000000000..ae1de88b6749 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/java/com/google/monitoring/metricsscope/v1/OperationMetadataOrBuilder.java @@ -0,0 +1,120 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/monitoring/metricsscope/v1/metrics_scopes.proto + +package com.google.monitoring.metricsscope.v1; + +public interface OperationMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.monitoring.metricsscope.v1.OperationMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Current state of the batch operation.
+   * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Current state of the batch operation.
+   * 
+ * + * .google.monitoring.metricsscope.v1.OperationMetadata.State state = 1; + * + * @return The state. + */ + com.google.monitoring.metricsscope.v1.OperationMetadata.State getState(); + + /** + * + * + *
+   * The time when the batch request was received.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * The time when the batch request was received.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * The time when the batch request was received.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * The time when the operation result was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6; + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * The time when the operation result was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6; + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * The time when the operation result was last updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6; + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scope.proto b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scope.proto new file mode 100644 index 000000000000..436a0578852d --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scope.proto @@ -0,0 +1,77 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.metricsscope.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/monitoring/metricsscope/v1;metricsscope"; +option java_multiple_files = true; +option java_outer_classname = "MetricsScopeProto"; +option java_package = "com.google.monitoring.metricsscope.v1"; +option csharp_namespace = "Google.Cloud.Monitoring.MetricsScope.V1"; +option php_namespace = "Google\\Cloud\\Monitoring\\MetricsScope\\V1"; +option ruby_package = "Google::Cloud::Monitoring::MetricsScope::V1"; + +// Represents a [Metrics +// Scope](https://cloud.google.com/monitoring/settings#concept-scope) in Cloud +// Monitoring, which specifies one or more Google projects and zero or more AWS +// accounts to monitor together. +message MetricsScope { + option (google.api.resource) = { + type: "monitoring.googleapis.com/MetricsScope" + pattern: "locations/global/metricsScope/{metrics_scope}" + }; + + // Immutable. The resource name of the Monitoring Metrics Scope. + // On input, the resource name can be specified with the + // scoping project ID or number. On output, the resource name is + // specified with the scoping project number. + // Example: + // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when this `Metrics Scope` was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when this `Metrics Scope` record was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of projects monitored by this `Metrics Scope`. + repeated MonitoredProject monitored_projects = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A [project being +// monitored](https://cloud.google.com/monitoring/settings/multiple-projects#create-multi) +// by a `Metrics Scope`. +message MonitoredProject { + option (google.api.resource) = { + type: "monitoring.googleapis.com/MonitoredProject" + pattern: "locations/global/metricsScopes/{metrics_scope}/projects/{project}" + }; + + // Immutable. The resource name of the `MonitoredProject`. On input, the resource name + // includes the scoping project ID and monitored project ID. On output, it + // contains the equivalent project numbers. + // Example: + // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when this `MonitoredProject` was created. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scopes.proto b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scopes.proto new file mode 100644 index 000000000000..3b1b0ae297b1 --- /dev/null +++ b/java-monitoring-metricsscope/proto-google-cloud-monitoring-metricsscope-v1/src/main/proto/google/monitoring/metricsscope/v1/metrics_scopes.proto @@ -0,0 +1,183 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.metricsscope.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/monitoring/metricsscope/v1/metrics_scope.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/monitoring/metricsscope/v1;metricsscope"; +option java_multiple_files = true; +option java_outer_classname = "MetricsScopesProto"; +option java_package = "com.google.monitoring.metricsscope.v1"; +option csharp_namespace = "Google.Cloud.Monitoring.MetricsScope.V1"; +option php_namespace = "Google\\Cloud\\Monitoring\\MetricsScope\\V1"; +option ruby_package = "Google::Cloud::Monitoring::MetricsScope::V1"; + +// Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud +// projects and AWS accounts. +service MetricsScopes { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read," + "https://www.googleapis.com/auth/monitoring.write"; + + // Returns a specific `Metrics Scope`. + rpc GetMetricsScope(GetMetricsScopeRequest) returns (MetricsScope) { + option (google.api.http) = { + get: "/v1/{name=locations/global/metricsScopes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of every `Metrics Scope` that a specific `MonitoredProject` + // has been added to. The metrics scope representing the specified monitored + // project will always be the first entry in the response. + rpc ListMetricsScopesByMonitoredProject(ListMetricsScopesByMonitoredProjectRequest) returns (ListMetricsScopesByMonitoredProjectResponse) { + option (google.api.http) = { + get: "/v1/locations/global/metricsScopes:listMetricsScopesByMonitoredProject" + }; + } + + // Adds a `MonitoredProject` with the given project ID + // to the specified `Metrics Scope`. + rpc CreateMonitoredProject(CreateMonitoredProjectRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=locations/global/metricsScopes/*}/projects" + body: "monitored_project" + }; + option (google.api.method_signature) = "parent,monitored_project"; + option (google.longrunning.operation_info) = { + response_type: "MonitoredProject" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a `MonitoredProject` from the specified `Metrics Scope`. + rpc DeleteMonitoredProject(DeleteMonitoredProjectRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=locations/global/metricsScopes/*/projects/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Request for the `GetMetricsScope` method. +message GetMetricsScopeRequest { + // Required. The resource name of the `Metrics Scope`. + // Example: + // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/MetricsScope" + } + ]; +} + +// Request for the `ListMetricsScopesByMonitoredProject` method. +message ListMetricsScopesByMonitoredProjectRequest { + // Required. The resource name of the `Monitored Project` being requested. + // Example: + // `projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + string monitored_resource_container = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the `ListMetricsScopesByMonitoredProject` method. +message ListMetricsScopesByMonitoredProjectResponse { + // A set of all metrics scopes that the specified monitored project has been + // added to. + repeated MetricsScope metrics_scopes = 1; +} + +// Request for the `CreateMonitoredProject` method. +message CreateMonitoredProjectRequest { + // Required. The resource name of the existing `Metrics Scope` that will monitor this + // project. + // Example: + // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/MetricsScope" + } + ]; + + // Required. The initial `MonitoredProject` configuration. + // Specify only the `monitored_project.name` field. All other fields are + // ignored. The `monitored_project.name` must be in the format: + // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + MonitoredProject monitored_project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteMonitoredProject` method. +message DeleteMonitoredProjectRequest { + // Required. The resource name of the `MonitoredProject`. + // Example: + // `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}` + // + // Authorization requires the following [Google + // IAM](https://cloud.google.com/iam) permissions on both the `Metrics Scope` + // and on the `MonitoredProject`: `monitoring.metricsScopes.link` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/MonitoredProject" + } + ]; +} + +// Contains metadata for longrunning operation for the edit Metrics Scope +// endpoints. +message OperationMetadata { + // Batch operation states. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request has been received. + CREATED = 1; + + // Request is actively being processed. + RUNNING = 2; + + // The batch processing is done. + DONE = 3; + + // The batch processing was cancelled. + CANCELLED = 4; + } + + // Current state of the batch operation. + State state = 1; + + // The time when the batch request was received. + google.protobuf.Timestamp create_time = 5; + + // The time when the operation result was last updated. + google.protobuf.Timestamp update_time = 6; +} diff --git a/pom.xml b/pom.xml index d56b9b510782..64a67ccb5afe 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,7 @@ java-mediatranslation java-memcache java-monitoring-dashboards + java-monitoring-metricsscope java-monitoring java-networkconnectivity java-network-management diff --git a/versions.txt b/versions.txt index 02d2294c1de5..560b10968664 100644 --- a/versions.txt +++ b/versions.txt @@ -593,3 +593,6 @@ grpc-google-cloud-vmwareengine-v1:0.0.0:0.0.1-SNAPSHOT google-maps-addressvalidation:0.0.0:0.0.1-SNAPSHOT proto-google-maps-addressvalidation-v1:0.0.0:0.0.1-SNAPSHOT grpc-google-maps-addressvalidation-v1:0.0.0:0.0.1-SNAPSHOT +google-cloud-monitoring-metricsscope:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-monitoring-metricsscope-v1:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-monitoring-metricsscope-v1:0.0.0:0.0.1-SNAPSHOT