diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 28fe78c1b62d..ed15a74ed8ce 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -57,6 +57,8 @@ "google-cloud-app_engine+FILLER": "0.0.0", "google-cloud-app_engine-v1": "0.10.0", "google-cloud-app_engine-v1+FILLER": "0.0.0", + "google-cloud-app_hub-v1": "0.0.1", + "google-cloud-app_hub-v1+FILLER": "0.0.0", "google-cloud-artifact_registry": "1.4.0", "google-cloud-artifact_registry+FILLER": "0.0.0", "google-cloud-artifact_registry-v1": "0.13.0", diff --git a/google-cloud-app_hub-v1/.OwlBot.yaml b/google-cloud-app_hub-v1/.OwlBot.yaml new file mode 100644 index 000000000000..6f2fcf81448e --- /dev/null +++ b/google-cloud-app_hub-v1/.OwlBot.yaml @@ -0,0 +1,3 @@ +deep-copy-regex: + - source: /google/cloud/apphub/v1/[^/]+-ruby/(.*) + dest: /owl-bot-staging/google-cloud-app_hub-v1/$1 diff --git a/google-cloud-app_hub-v1/.gitignore b/google-cloud-app_hub-v1/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/google-cloud-app_hub-v1/.gitignore @@ -0,0 +1,22 @@ +# Ignore bundler lockfiles +Gemfile.lock +gems.locked + +# Ignore documentation output +doc/* +.yardoc/* + +# Ignore test output +coverage/* + +# Ignore build artifacts +pkg/* + +# Ignore files commonly present in certain dev environments +.vagrant +.DS_STORE +.idea +*.iml + +# Ignore synth output +__pycache__ diff --git a/google-cloud-app_hub-v1/.owlbot-manifest.json b/google-cloud-app_hub-v1/.owlbot-manifest.json new file mode 100644 index 000000000000..144e64ce4d8a --- /dev/null +++ b/google-cloud-app_hub-v1/.owlbot-manifest.json @@ -0,0 +1,95 @@ +{ + "generated": [ + ".gitignore", + ".repo-metadata.json", + ".rubocop.yml", + ".toys.rb", + ".yardopts", + "AUTHENTICATION.md", + "CHANGELOG.md", + "Gemfile", + "LICENSE.md", + "README.md", + "Rakefile", + "gapic_metadata.json", + "google-cloud-app_hub-v1.gemspec", + "lib/google-cloud-app_hub-v1.rb", + "lib/google/cloud/app_hub/v1.rb", + "lib/google/cloud/app_hub/v1/app_hub.rb", + "lib/google/cloud/app_hub/v1/app_hub/client.rb", + "lib/google/cloud/app_hub/v1/app_hub/credentials.rb", + "lib/google/cloud/app_hub/v1/app_hub/operations.rb", + "lib/google/cloud/app_hub/v1/app_hub/paths.rb", + "lib/google/cloud/app_hub/v1/app_hub/rest.rb", + "lib/google/cloud/app_hub/v1/app_hub/rest/client.rb", + "lib/google/cloud/app_hub/v1/app_hub/rest/operations.rb", + "lib/google/cloud/app_hub/v1/app_hub/rest/service_stub.rb", + "lib/google/cloud/app_hub/v1/bindings_override.rb", + "lib/google/cloud/app_hub/v1/rest.rb", + "lib/google/cloud/app_hub/v1/version.rb", + "lib/google/cloud/apphub/v1/apphub_service_pb.rb", + "lib/google/cloud/apphub/v1/apphub_service_services_pb.rb", + "lib/google/cloud/apphub/v1/application_pb.rb", + "lib/google/cloud/apphub/v1/attributes_pb.rb", + "lib/google/cloud/apphub/v1/service_pb.rb", + "lib/google/cloud/apphub/v1/service_project_attachment_pb.rb", + "lib/google/cloud/apphub/v1/workload_pb.rb", + "proto_docs/README.md", + "proto_docs/google/api/client.rb", + "proto_docs/google/api/field_behavior.rb", + "proto_docs/google/api/field_info.rb", + "proto_docs/google/api/launch_stage.rb", + "proto_docs/google/api/resource.rb", + "proto_docs/google/cloud/apphub/v1/apphub_service.rb", + "proto_docs/google/cloud/apphub/v1/application.rb", + "proto_docs/google/cloud/apphub/v1/attributes.rb", + "proto_docs/google/cloud/apphub/v1/service.rb", + "proto_docs/google/cloud/apphub/v1/service_project_attachment.rb", + "proto_docs/google/cloud/apphub/v1/workload.rb", + "proto_docs/google/longrunning/operations.rb", + "proto_docs/google/protobuf/any.rb", + "proto_docs/google/protobuf/duration.rb", + "proto_docs/google/protobuf/empty.rb", + "proto_docs/google/protobuf/field_mask.rb", + "proto_docs/google/protobuf/timestamp.rb", + "proto_docs/google/rpc/status.rb", + "proto_docs/google/type/expr.rb", + "snippets/Gemfile", + "snippets/app_hub/create_application.rb", + "snippets/app_hub/create_service.rb", + "snippets/app_hub/create_service_project_attachment.rb", + "snippets/app_hub/create_workload.rb", + "snippets/app_hub/delete_application.rb", + "snippets/app_hub/delete_service.rb", + "snippets/app_hub/delete_service_project_attachment.rb", + "snippets/app_hub/delete_workload.rb", + "snippets/app_hub/detach_service_project_attachment.rb", + "snippets/app_hub/get_application.rb", + "snippets/app_hub/get_discovered_service.rb", + "snippets/app_hub/get_discovered_workload.rb", + "snippets/app_hub/get_service.rb", + "snippets/app_hub/get_service_project_attachment.rb", + "snippets/app_hub/get_workload.rb", + "snippets/app_hub/list_applications.rb", + "snippets/app_hub/list_discovered_services.rb", + "snippets/app_hub/list_discovered_workloads.rb", + "snippets/app_hub/list_service_project_attachments.rb", + "snippets/app_hub/list_services.rb", + "snippets/app_hub/list_workloads.rb", + "snippets/app_hub/lookup_discovered_service.rb", + "snippets/app_hub/lookup_discovered_workload.rb", + "snippets/app_hub/lookup_service_project_attachment.rb", + "snippets/app_hub/update_application.rb", + "snippets/app_hub/update_service.rb", + "snippets/app_hub/update_workload.rb", + "snippets/snippet_metadata_google.cloud.apphub.v1.json", + "test/google/cloud/app_hub/v1/app_hub_operations_test.rb", + "test/google/cloud/app_hub/v1/app_hub_paths_test.rb", + "test/google/cloud/app_hub/v1/app_hub_rest_test.rb", + "test/google/cloud/app_hub/v1/app_hub_test.rb", + "test/helper.rb" + ], + "static": [ + ".OwlBot.yaml" + ] +} diff --git a/google-cloud-app_hub-v1/.repo-metadata.json b/google-cloud-app_hub-v1/.repo-metadata.json new file mode 100644 index 000000000000..118640b1b4b6 --- /dev/null +++ b/google-cloud-app_hub-v1/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "api_id": "apphub.googleapis.com", + "api_shortname": "apphub", + "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-app_hub-v1/latest", + "distribution_name": "google-cloud-app_hub-v1", + "is_cloud": true, + "language": "ruby", + "name": "apphub", + "name_pretty": "App Hub V1 API", + "product_documentation": "https://cloud.google.com/app-hub/docs/overview", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "google-cloud-app_hub-v1 is the official client library for the App Hub V1 API. Note that google-cloud-app_hub-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-app_hub instead. See the readme for more details.", + "ruby-cloud-product-url": "https://cloud.google.com/app-hub/docs/overview", + "library_type": "GAPIC_AUTO" +} diff --git a/google-cloud-app_hub-v1/.rubocop.yml b/google-cloud-app_hub-v1/.rubocop.yml new file mode 100644 index 000000000000..aac5e1a2d3f1 --- /dev/null +++ b/google-cloud-app_hub-v1/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-cloud-app_hub-v1.gemspec" + - "lib/**/*_pb.rb" + - "proto_docs/**/*" + - "test/**/*" + - "acceptance/**/*" + - "samples/acceptance/**/*" + - "Rakefile" + +Layout/LineLength: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/AccessorMethodName: + Exclude: + - "snippets/**/*.rb" +Naming/FileName: + Exclude: + - "lib/google-cloud-app_hub-v1.rb" diff --git a/google-cloud-app_hub-v1/.toys.rb b/google-cloud-app_hub-v1/.toys.rb new file mode 100644 index 000000000000..23434bdd5d5b --- /dev/null +++ b/google-cloud-app_hub-v1/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +toys_version! ">= 0.15.3" + +if ENV["RUBY_COMMON_TOOLS"] + common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] + load File.join(common_tools_dir, "toys", "gapic") +else + load_git remote: "https://github.com/googleapis/ruby-common-tools.git", + path: "toys/gapic", + update: true +end diff --git a/google-cloud-app_hub-v1/.yardopts b/google-cloud-app_hub-v1/.yardopts new file mode 100644 index 000000000000..47c312defbe7 --- /dev/null +++ b/google-cloud-app_hub-v1/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="App Hub V1 API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/google-cloud-app_hub-v1/AUTHENTICATION.md b/google-cloud-app_hub-v1/AUTHENTICATION.md new file mode 100644 index 000000000000..56078e3eba52 --- /dev/null +++ b/google-cloud-app_hub-v1/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-cloud-app_hub-v1 library is to use +[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). +To review all of your authentication options, see [Credentials lookup](#credential-lookup). + +## Quickstart + +The following example shows how to set up authentication for a local development +environment with your user credentials. + +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. + +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: + +```sh +gcloud auth application-default login +``` + +3. Write code as if already authenticated. + +For more information about setting up authentication for a local development environment, see +[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). + +## Credential Lookup + +The google-cloud-app_hub-v1 library provides several mechanisms to configure your system. +Generally, using Application Default Credentials to facilitate automatic +credentials discovery is the easist method. But if you need to explicitly specify +credentials, there are several methods available to you. + +Credentials are accepted in the following ways, in the following order or precedence: + +1. Credentials specified in method arguments +2. Credentials specified in configuration +3. Credentials pointed to or included in environment variables +4. Credentials found in local ADC file +5. Credentials returned by the metadata server for the attached service account (GCP) + +### Configuration + +You can configure a path to a JSON credentials file, either for an individual client object or +globally, for all client objects. The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +To configure a credentials file for an individual client initialization: + +```ruby +require "google/cloud/app_hub/v1" + +client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/cloud/app_hub/v1" + +::Google::Cloud::AppHub::V1::AppHub::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Cloud::AppHub::V1::AppHub::Client.new +``` + +### Environment Variables + +You can also use an environment variable to provide a JSON credentials file. +The environment variable can contain a path to the credentials file or, for +environments such as Docker containers where writing files is not encouraged, +you can include the credentials file itself. + +The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +The environment variables that google-cloud-app_hub-v1 +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/cloud/app_hub/v1" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Cloud::AppHub::V1::AppHub::Client.new +``` + +### Local ADC file + +You can set up a local ADC file with your user credentials for authentication during +development. If credentials are not provided in code or in environment variables, +then the local ADC credentials are discovered. + +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. + +### Google Cloud Platform environments + +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, credentials are retrieved from the attached +service account automatically. Code should be written as if already authenticated. + +For more information, see +[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/google-cloud-app_hub-v1/CHANGELOG.md b/google-cloud-app_hub-v1/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/google-cloud-app_hub-v1/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/google-cloud-app_hub-v1/Gemfile b/google-cloud-app_hub-v1/Gemfile new file mode 100644 index 000000000000..95163a6d11f8 --- /dev/null +++ b/google-cloud-app_hub-v1/Gemfile @@ -0,0 +1,11 @@ +source "https://rubygems.org" + +gemspec + +gem "google-style", "~> 1.27.1" +gem "minitest", "~> 5.22" +gem "minitest-focus", "~> 1.4" +gem "minitest-rg", "~> 5.3" +gem "rake", ">= 13.0" +gem "redcarpet", "~> 3.6" +gem "yard", "~> 0.9" diff --git a/google-cloud-app_hub-v1/LICENSE.md b/google-cloud-app_hub-v1/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/google-cloud-app_hub-v1/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/google-cloud-app_hub-v1/README.md b/google-cloud-app_hub-v1/README.md new file mode 100644 index 000000000000..457314800fed --- /dev/null +++ b/google-cloud-app_hub-v1/README.md @@ -0,0 +1,144 @@ +# Ruby Client for the App Hub V1 API + +API Client library for the App Hub V1 API + +google-cloud-app_hub-v1 is the official client library for the App Hub V1 API. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the App Hub V1 API. Most users should consider using +the main client gem, +[google-cloud-app_hub](https://rubygems.org/gems/google-cloud-app_hub). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-cloud-app_hub-v1 +``` + +## Before You Begin + +In order to use this library, you first need to go through the following steps: + +1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) +1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) +1. [Enable the API.](https://console.cloud.google.com/apis/library/apphub.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/cloud/app_hub/v1" + +client = ::Google::Cloud::AppHub::V1::AppHub::Client.new +request = ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new # (request fields as keyword arguments...) +response = client.lookup_service_project_attachment request +``` + +View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-app_hub-v1/latest) +for class and method documentation. + +See also the [Product Documentation](https://cloud.google.com/app-hub/docs/overview) +for general usage information. + +## Enabling Logging + +To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. +The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below, +or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest) +that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb) +and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information. + +Configuring a Ruby stdlib logger: + +```ruby +require "logger" + +module MyLogger + LOGGER = Logger.new $stderr, level: Logger::WARN + def logger + LOGGER + end +end + +# Define a gRPC module-level logger method before grpc/logconfig.rb loads. +module GRPC + extend MyLogger +end +``` + + +## Google Cloud Samples + +To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). + +## Supported Ruby Versions + +This library is supported on Ruby 2.7+. + +Google provides official support for Ruby versions that are actively supported +by Ruby Core—that is, Ruby versions that are either in normal maintenance or +in security maintenance, and not end of life. Older versions of Ruby _may_ +still work, but are unsupported and not recommended. See +https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby +support schedule. + +## Which client should I use? + +Most modern Ruby client libraries for Google APIs come in two flavors: the main +client library with a name such as `google-cloud-app_hub`, +and lower-level _versioned_ client libraries with names such as +`google-cloud-app_hub-v1`. +_In most cases, you should install the main client._ + +### What's the difference between the main client and a versioned client? + +A _versioned client_ provides a basic set of data types and client classes for +a _single version_ of a specific service. (That is, for a service with multiple +versions, there might be a separate versioned client for each service version.) +Most versioned clients are written and maintained by a code generator. + +The _main client_ is designed to provide you with the _recommended_ client +interfaces for the service. There will be only one main client for any given +service, even a service with multiple versions. The main client includes +factory methods for constructing the client objects we recommend for most +users. In some cases, those will be classes provided by an underlying versioned +client; in other cases, they will be handwritten higher-level client objects +with additional capabilities, convenience methods, or best practices built in. +Generally, the main client will default to a recommended service version, +although in some cases you can override this if you need to talk to a specific +service version. + +### Why would I want to use the main client? + +We recommend that most users install the main client gem for a service. You can +identify this gem as the one _without_ a version in its name, e.g. +`google-cloud-app_hub`. +The main client is recommended because it will embody the best practices for +accessing the service, and may also provide more convenient interfaces or +tighter integration into frameworks and third-party libraries. In addition, the +documentation and samples published by Google will generally demonstrate use of +the main client. + +### Why would I want to use a versioned client? + +You can use a versioned client if you are content with a possibly lower-level +class interface, you explicitly want to avoid features provided by the main +client, or you want to access a specific service version not be covered by the +main client. You can identify versioned client gems because the service version +is part of the name, e.g. `google-cloud-app_hub-v1`. + +### What about the google-apis- clients? + +Client library gems with names that begin with `google-apis-` are based on an +older code generation technology. They talk to a REST/JSON backend (whereas +most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may +not offer the same performance, features, and ease of use provided by more +modern clients. + +The `google-apis-` clients have wide coverage across Google services, so you +might need to use one if there is no modern client available for the service. +However, if a modern client is available, we generally recommend it over the +older `google-apis-` clients. diff --git a/google-cloud-app_hub-v1/Rakefile b/google-cloud-app_hub-v1/Rakefile new file mode 100644 index 000000000000..324e67a3cd41 --- /dev/null +++ b/google-cloud-app_hub-v1/Rakefile @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "bundler/setup" +require "bundler/gem_tasks" + +require "rubocop/rake_task" +RuboCop::RakeTask.new + +require "rake/testtask" +desc "Run tests." +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList["test/**/*_test.rb"] + t.warning = false +end + +desc "Runs the smoke tests." +Rake::TestTask.new :smoke_test do |t| + t.test_files = FileList["acceptance/**/*smoke_test.rb"] + t.warning = false +end + +# Acceptance tests +desc "Run the google-cloud-app_hub-v1 acceptance tests." +task :acceptance, :project, :keyfile do |t, args| + project = args[:project] + project ||= + ENV["GOOGLE_CLOUD_TEST_PROJECT"] || + ENV["GCLOUD_TEST_PROJECT"] + keyfile = args[:keyfile] + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE"] || + ENV["GCLOUD_TEST_KEYFILE"] + if keyfile + keyfile = File.read keyfile + else + keyfile ||= + ENV["GOOGLE_CLOUD_TEST_KEYFILE_JSON"] || + ENV["GCLOUD_TEST_KEYFILE_JSON"] + end + if project.nil? || keyfile.nil? + fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or GOOGLE_CLOUD_TEST_PROJECT=test123 GOOGLE_CLOUD_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" + end + require "google/cloud/app_hub/v1/app_hub/credentials" + ::Google::Cloud::AppHub::V1::AppHub::Credentials.env_vars.each do |path| + ENV[path] = nil + end + ENV["GOOGLE_CLOUD_PROJECT"] = project + ENV["GOOGLE_CLOUD_TEST_PROJECT"] = project + ENV["GOOGLE_CLOUD_KEYFILE_JSON"] = keyfile + + Rake::Task["acceptance:run"].invoke +end + +namespace :acceptance do + task :run do + if File.directory? "acceptance" + Rake::Task[:smoke_test].invoke + else + puts "The google-cloud-app_hub-v1 gem has no acceptance tests." + end + end + + desc "Run acceptance cleanup." + task :cleanup do + end +end + +task :samples do + Rake::Task["samples:latest"].invoke +end + +namespace :samples do + task :latest do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-app_hub-v1 gem has no samples to test." + end + end + + task :master do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-app_hub-v1 gem has no samples to test." + end + end +end + +require "yard" +require "yard/rake/yardoc_task" +YARD::Rake::YardocTask.new do |y| + y.options << "--fail-on-warning" +end + +desc "Run yard-doctest example tests." +task :doctest do + puts "The google-cloud-app_hub-v1 gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-cloud-app_hub-v1" + header "google-cloud-app_hub-v1 rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-cloud-app_hub-v1 yard", "*" + Rake::Task[:yard].invoke + header "google-cloud-app_hub-v1 test", "*" + Rake::Task[:test].invoke +end + +namespace :ci do + desc "Run the CI build, with smoke tests." + task :smoke_test do + Rake::Task[:ci].invoke + header "google-cloud-app_hub-v1 smoke_test", "*" + Rake::Task[:smoke_test].invoke + end + desc "Run the CI build, with acceptance tests." + task :acceptance do + Rake::Task[:ci].invoke + header "google-cloud-app_hub-v1 acceptance", "*" + Rake::Task[:acceptance].invoke + end + task :a do + # This is a handy shortcut to save typing + Rake::Task["ci:acceptance"].invoke + end +end + +task default: :test + +def header str, token = "#" + line_length = str.length + 8 + puts "" + puts token * line_length + puts "#{token * 3} #{str} #{token * 3}" + puts token * line_length + puts "" +end diff --git a/google-cloud-app_hub-v1/gapic_metadata.json b/google-cloud-app_hub-v1/gapic_metadata.json new file mode 100644 index 000000000000..b9d4fe1df12e --- /dev/null +++ b/google-cloud-app_hub-v1/gapic_metadata.json @@ -0,0 +1,153 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.cloud.apphub.v1", + "libraryPackage": "::Google::Cloud::AppHub::V1", + "services": { + "AppHub": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::AppHub::V1::AppHub::Client", + "rpcs": { + "LookupServiceProjectAttachment": { + "methods": [ + "lookup_service_project_attachment" + ] + }, + "ListServiceProjectAttachments": { + "methods": [ + "list_service_project_attachments" + ] + }, + "CreateServiceProjectAttachment": { + "methods": [ + "create_service_project_attachment" + ] + }, + "GetServiceProjectAttachment": { + "methods": [ + "get_service_project_attachment" + ] + }, + "DeleteServiceProjectAttachment": { + "methods": [ + "delete_service_project_attachment" + ] + }, + "DetachServiceProjectAttachment": { + "methods": [ + "detach_service_project_attachment" + ] + }, + "ListDiscoveredServices": { + "methods": [ + "list_discovered_services" + ] + }, + "GetDiscoveredService": { + "methods": [ + "get_discovered_service" + ] + }, + "LookupDiscoveredService": { + "methods": [ + "lookup_discovered_service" + ] + }, + "ListServices": { + "methods": [ + "list_services" + ] + }, + "CreateService": { + "methods": [ + "create_service" + ] + }, + "GetService": { + "methods": [ + "get_service" + ] + }, + "UpdateService": { + "methods": [ + "update_service" + ] + }, + "DeleteService": { + "methods": [ + "delete_service" + ] + }, + "ListDiscoveredWorkloads": { + "methods": [ + "list_discovered_workloads" + ] + }, + "GetDiscoveredWorkload": { + "methods": [ + "get_discovered_workload" + ] + }, + "LookupDiscoveredWorkload": { + "methods": [ + "lookup_discovered_workload" + ] + }, + "ListWorkloads": { + "methods": [ + "list_workloads" + ] + }, + "CreateWorkload": { + "methods": [ + "create_workload" + ] + }, + "GetWorkload": { + "methods": [ + "get_workload" + ] + }, + "UpdateWorkload": { + "methods": [ + "update_workload" + ] + }, + "DeleteWorkload": { + "methods": [ + "delete_workload" + ] + }, + "ListApplications": { + "methods": [ + "list_applications" + ] + }, + "CreateApplication": { + "methods": [ + "create_application" + ] + }, + "GetApplication": { + "methods": [ + "get_application" + ] + }, + "UpdateApplication": { + "methods": [ + "update_application" + ] + }, + "DeleteApplication": { + "methods": [ + "delete_application" + ] + } + } + } + } + } + } +} diff --git a/google-cloud-app_hub-v1/google-cloud-app_hub-v1.gemspec b/google-cloud-app_hub-v1/google-cloud-app_hub-v1.gemspec new file mode 100644 index 000000000000..52501850eb74 --- /dev/null +++ b/google-cloud-app_hub-v1/google-cloud-app_hub-v1.gemspec @@ -0,0 +1,30 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/cloud/app_hub/v1/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-cloud-app_hub-v1" + gem.version = Google::Cloud::AppHub::V1::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "google-cloud-app_hub-v1 is the official client library for the App Hub V1 API. Note that google-cloud-app_hub-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-app_hub instead. See the readme for more details." + gem.summary = "API Client library for the App Hub V1 API" + gem.homepage = "https://github.com/googleapis/google-cloud-ruby" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + `git ls-files -- proto_docs/*`.split("\n") + + ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 2.7" + + gem.add_dependency "gapic-common", ">= 0.21.1", "< 2.a" + gem.add_dependency "google-cloud-errors", "~> 1.0" + gem.add_dependency "google-cloud-location", ">= 0.7", "< 2.a" + gem.add_dependency "google-iam-v1", ">= 0.7", "< 2.a" +end diff --git a/google-cloud-app_hub-v1/lib/google-cloud-app_hub-v1.rb b/google-cloud-app_hub-v1/lib/google-cloud-app_hub-v1.rb new file mode 100644 index 000000000000..bcca01af4f4b --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google-cloud-app_hub-v1.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# This gem does not autoload during Bundler.require. To load this gem, +# issue explicit require statements for the packages desired, e.g.: +# require "google/cloud/app_hub/v1" diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1.rb new file mode 100644 index 000000000000..fe563a1e205f --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/app_hub/v1/app_hub" +require "google/cloud/app_hub/v1/version" + +module Google + module Cloud + module AppHub + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/cloud/app_hub/v1" + # client = ::Google::Cloud::AppHub::V1::AppHub::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/cloud/app_hub/v1" + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + module V1 + end + end + end +end + +helper_path = ::File.join __dir__, "v1", "_helpers.rb" +require "google/cloud/app_hub/v1/_helpers" if ::File.file? helper_path diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub.rb new file mode 100644 index 000000000000..930909b80ac2 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/app_hub/v1/version" + +require "google/cloud/app_hub/v1/app_hub/credentials" +require "google/cloud/app_hub/v1/app_hub/paths" +require "google/cloud/app_hub/v1/app_hub/operations" +require "google/cloud/app_hub/v1/app_hub/client" +require "google/cloud/app_hub/v1/app_hub/rest" + +module Google + module Cloud + module AppHub + module V1 + ## + # The App Hub API allows you to manage App Hub resources. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/app_hub/v1/app_hub" + # client = ::Google::Cloud::AppHub::V1::AppHub::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/app_hub/v1/app_hub/rest" + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + module AppHub + end + end + end + end +end + +helper_path = ::File.join __dir__, "app_hub", "helpers.rb" +require "google/cloud/app_hub/v1/app_hub/helpers" if ::File.file? helper_path diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/client.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/client.rb new file mode 100644 index 000000000000..50116eeb20a1 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/client.rb @@ -0,0 +1,3396 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/apphub/v1/apphub_service_pb" +require "google/cloud/location" +require "google/iam/v1" + +module Google + module Cloud + module AppHub + module V1 + module AppHub + ## + # Client for the AppHub service. + # + # The App Hub API allows you to manage App Hub resources. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "apphub.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :app_hub_stub + + ## + # Configure the AppHub Client class. + # + # See {::Google::Cloud::AppHub::V1::AppHub::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all AppHub clients + # ::Google::Cloud::AppHub::V1::AppHub::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "AppHub", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.lookup_service_project_attachment.timeout = 60.0 + default_config.rpcs.lookup_service_project_attachment.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_service_project_attachments.timeout = 60.0 + default_config.rpcs.list_service_project_attachments.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_service_project_attachment.timeout = 60.0 + + default_config.rpcs.get_service_project_attachment.timeout = 60.0 + default_config.rpcs.get_service_project_attachment.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.delete_service_project_attachment.timeout = 60.0 + + default_config.rpcs.detach_service_project_attachment.timeout = 60.0 + + default_config.rpcs.list_discovered_services.timeout = 60.0 + default_config.rpcs.list_discovered_services.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_discovered_service.timeout = 60.0 + default_config.rpcs.get_discovered_service.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.lookup_discovered_service.timeout = 60.0 + default_config.rpcs.lookup_discovered_service.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_services.timeout = 60.0 + default_config.rpcs.list_services.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_service.timeout = 60.0 + + default_config.rpcs.get_service.timeout = 60.0 + default_config.rpcs.get_service.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_service.timeout = 60.0 + + default_config.rpcs.delete_service.timeout = 60.0 + + default_config.rpcs.list_discovered_workloads.timeout = 60.0 + default_config.rpcs.list_discovered_workloads.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_discovered_workload.timeout = 60.0 + default_config.rpcs.get_discovered_workload.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.lookup_discovered_workload.timeout = 60.0 + default_config.rpcs.lookup_discovered_workload.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_workloads.timeout = 60.0 + default_config.rpcs.list_workloads.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_workload.timeout = 60.0 + + default_config.rpcs.get_workload.timeout = 60.0 + default_config.rpcs.get_workload.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_workload.timeout = 60.0 + + default_config.rpcs.delete_workload.timeout = 60.0 + + default_config.rpcs.list_applications.timeout = 60.0 + default_config.rpcs.list_applications.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_application.timeout = 60.0 + + default_config.rpcs.get_application.timeout = 60.0 + default_config.rpcs.get_application.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_application.timeout = 60.0 + + default_config.rpcs.delete_application.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the AppHub Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::AppHub::V1::AppHub::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @app_hub_stub.universe_domain + end + + ## + # Create a new AppHub client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the AppHub client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/apphub/v1/apphub_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @app_hub_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::AppHub::V1::AppHub::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @app_hub_stub.endpoint + config.universe_domain = @app_hub_stub.universe_domain + end + + @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @app_hub_stub.endpoint + config.universe_domain = @app_hub_stub.universe_domain + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::AppHub::V1::AppHub::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # Get the associated client for mix-in of the IAMPolicy. + # + # @return [Google::Iam::V1::IAMPolicy::Client] + # + attr_reader :iam_policy_client + + # Service calls + + ## + # Lists a service project attachment for a given service project. You can + # call this API from any project to find if it is attached to a host project. + # + # @overload lookup_service_project_attachment(request, options = nil) + # Pass arguments to `lookup_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload lookup_service_project_attachment(name: nil) + # Pass arguments to `lookup_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Service project ID and location to lookup service project + # attachment for. Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new + # + # # Call the lookup_service_project_attachment method. + # result = client.lookup_service_project_attachment request + # + # # The returned object is of type Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse. + # p result + # + def lookup_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.lookup_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.lookup_service_project_attachment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.lookup_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :lookup_service_project_attachment, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists service projects attached to the host project. + # + # @overload list_service_project_attachments(request, options = nil) + # Pass arguments to `list_service_project_attachments` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_service_project_attachments(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_service_project_attachments` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to list service project attachments. + # Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::ServiceProjectAttachment>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::ServiceProjectAttachment>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new + # + # # Call the list_service_project_attachments method. + # result = client.list_service_project_attachments request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::ServiceProjectAttachment. + # p item + # end + # + def list_service_project_attachments request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_service_project_attachments.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_service_project_attachments.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_service_project_attachments.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :list_service_project_attachments, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @app_hub_stub, :list_service_project_attachments, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Attaches a service project to the host project. + # + # @overload create_service_project_attachment(request, options = nil) + # Pass arguments to `create_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_service_project_attachment(parent: nil, service_project_attachment_id: nil, service_project_attachment: nil, request_id: nil) + # Pass arguments to `create_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to which service project is being + # attached. Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @param service_project_attachment_id [::String] + # Required. The service project attachment identifier must contain the + # project id of the service project specified in the + # service_project_attachment.service_project field. + # @param service_project_attachment [::Google::Cloud::AppHub::V1::ServiceProjectAttachment, ::Hash] + # Required. The resource being created. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new + # + # # Call the create_service_project_attachment method. + # result = client.create_service_project_attachment request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_service_project_attachment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :create_service_project_attachment, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a service project attachment. + # + # @overload get_service_project_attachment(request, options = nil) + # Pass arguments to `get_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_service_project_attachment(name: nil) + # Pass arguments to `get_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the service project attachment to + # retrieve. Expected format: + # `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new + # + # # Call the get_service_project_attachment method. + # result = client.get_service_project_attachment request + # + # # The returned object is of type Google::Cloud::AppHub::V1::ServiceProjectAttachment. + # p result + # + def get_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_service_project_attachment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :get_service_project_attachment, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a service project attachment. + # + # @overload delete_service_project_attachment(request, options = nil) + # Pass arguments to `delete_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_service_project_attachment(name: nil, request_id: nil) + # Pass arguments to `delete_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the service project attachment to delete. + # Expected format: + # `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new + # + # # Call the delete_service_project_attachment method. + # result = client.delete_service_project_attachment request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_service_project_attachment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :delete_service_project_attachment, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Detaches a service project from a host project. + # You can call this API from any service project without needing access to + # the host project that it is attached to. + # + # @overload detach_service_project_attachment(request, options = nil) + # Pass arguments to `detach_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload detach_service_project_attachment(name: nil) + # Pass arguments to `detach_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Service project id and location to detach from a host project. + # Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new + # + # # Call the detach_service_project_attachment method. + # result = client.detach_service_project_attachment request + # + # # The returned object is of type Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse. + # p result + # + def detach_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.detach_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.detach_service_project_attachment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.detach_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :detach_service_project_attachment, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Discovered Services that can be added to an Application in a host + # project and location. + # + # @overload list_discovered_services(request, options = nil) + # Pass arguments to `list_discovered_services` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_discovered_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_discovered_services` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to list Discovered Services on. + # Expected format: `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::DiscoveredService>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::DiscoveredService>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new + # + # # Call the list_discovered_services method. + # result = client.list_discovered_services request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::DiscoveredService. + # p item + # end + # + def list_discovered_services request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_discovered_services.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_discovered_services.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_discovered_services.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :list_discovered_services, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @app_hub_stub, :list_discovered_services, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Discovered Service in a host project and location. + # + # @overload get_discovered_service(request, options = nil) + # Pass arguments to `get_discovered_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_discovered_service(name: nil) + # Pass arguments to `get_discovered_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Discovered Service to fetch. + # Expected format: + # `projects/{project}/locations/{location}/discoveredServices/{discoveredService}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::DiscoveredService] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::DiscoveredService] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new + # + # # Call the get_discovered_service method. + # result = client.get_discovered_service request + # + # # The returned object is of type Google::Cloud::AppHub::V1::DiscoveredService. + # p result + # + def get_discovered_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_discovered_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_discovered_service.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_discovered_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :get_discovered_service, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists a Discovered Service in a host project and location, with a + # given resource URI. + # + # @overload lookup_discovered_service(request, options = nil) + # Pass arguments to `lookup_discovered_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload lookup_discovered_service(parent: nil, uri: nil) + # Pass arguments to `lookup_discovered_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to lookup Discovered Service in. + # Expected format: `projects/{project}/locations/{location}`. + # @param uri [::String] + # Required. Resource URI to find DiscoveredService for. + # Accepts both project number and project ID and does translation when + # needed. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new + # + # # Call the lookup_discovered_service method. + # result = client.lookup_discovered_service request + # + # # The returned object is of type Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse. + # p result + # + def lookup_discovered_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.lookup_discovered_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.lookup_discovered_service.timeout, + metadata: metadata, + retry_policy: @config.rpcs.lookup_discovered_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :lookup_discovered_service, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Services in an Application. + # + # @overload list_services(request, options = nil) + # Pass arguments to `list_services` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListServicesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListServicesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_services` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the parent Application to list Services + # for. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results + # @param order_by [::String] + # Optional. Hint for how to order the results + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::Service>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::Service>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListServicesRequest.new + # + # # Call the list_services method. + # result = client.list_services request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::Service. + # p item + # end + # + def list_services request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListServicesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_services.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_services.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_services.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :list_services, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @app_hub_stub, :list_services, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Service in an Application. + # + # @overload create_service(request, options = nil) + # Pass arguments to `create_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_service(parent: nil, service_id: nil, service: nil, request_id: nil) + # Pass arguments to `create_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the parent Application to create the + # Service in. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param service_id [::String] + # Required. The Service identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @param service [::Google::Cloud::AppHub::V1::Service, ::Hash] + # Required. The resource being created. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateServiceRequest.new + # + # # Call the create_service method. + # result = client.create_service request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_service.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :create_service, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Service in an Application. + # + # @overload get_service(request, options = nil) + # Pass arguments to `get_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_service(name: nil) + # Pass arguments to `get_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Service to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}/services/{service}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::Service] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::Service] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetServiceRequest.new + # + # # Call the get_service method. + # result = client.get_service request + # + # # The returned object is of type Google::Cloud::AppHub::V1::Service. + # p result + # + def get_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_service.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :get_service, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a Service in an Application. + # + # @overload update_service(request, options = nil) + # Pass arguments to `update_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::UpdateServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::UpdateServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_service(update_mask: nil, service: nil, request_id: nil) + # Pass arguments to `update_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. Field mask is used to specify the fields to be overwritten in the + # Service resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @param service [::Google::Cloud::AppHub::V1::Service, ::Hash] + # Required. The resource being updated. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::UpdateServiceRequest.new + # + # # Call the update_service method. + # result = client.update_service request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::UpdateServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.service&.name + header_params["service.name"] = request.service.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_service.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :update_service, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Service from an Application. + # + # @overload delete_service(request, options = nil) + # Pass arguments to `delete_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_service(name: nil, request_id: nil) + # Pass arguments to `delete_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Service to delete from an + # Application. Expected format: + # `projects/{project}/locations/{location}/applications/{application}/services/{service}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteServiceRequest.new + # + # # Call the delete_service method. + # result = client.delete_service request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_service.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :delete_service, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Discovered Workloads that can be added to an Application in a host + # project and location. + # + # @overload list_discovered_workloads(request, options = nil) + # Pass arguments to `list_discovered_workloads` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_discovered_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_discovered_workloads` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to list Discovered Workloads on. + # Expected format: `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::DiscoveredWorkload>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::DiscoveredWorkload>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new + # + # # Call the list_discovered_workloads method. + # result = client.list_discovered_workloads request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::DiscoveredWorkload. + # p item + # end + # + def list_discovered_workloads request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_discovered_workloads.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_discovered_workloads.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_discovered_workloads.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :list_discovered_workloads, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @app_hub_stub, :list_discovered_workloads, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Discovered Workload in a host project and location. + # + # @overload get_discovered_workload(request, options = nil) + # Pass arguments to `get_discovered_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_discovered_workload(name: nil) + # Pass arguments to `get_discovered_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Discovered Workload to fetch. + # Expected format: + # `projects/{project}/locations/{location}/discoveredWorkloads/{discoveredWorkload}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new + # + # # Call the get_discovered_workload method. + # result = client.get_discovered_workload request + # + # # The returned object is of type Google::Cloud::AppHub::V1::DiscoveredWorkload. + # p result + # + def get_discovered_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_discovered_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_discovered_workload.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_discovered_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :get_discovered_workload, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists a Discovered Workload in a host project and location, with a + # given resource URI. + # + # @overload lookup_discovered_workload(request, options = nil) + # Pass arguments to `lookup_discovered_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload lookup_discovered_workload(parent: nil, uri: nil) + # Pass arguments to `lookup_discovered_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to lookup Discovered Workload in. + # Expected format: `projects/{project}/locations/{location}`. + # @param uri [::String] + # Required. Resource URI to find Discovered Workload for. + # Accepts both project number and project ID and does translation when + # needed. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new + # + # # Call the lookup_discovered_workload method. + # result = client.lookup_discovered_workload request + # + # # The returned object is of type Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse. + # p result + # + def lookup_discovered_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.lookup_discovered_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.lookup_discovered_workload.timeout, + metadata: metadata, + retry_policy: @config.rpcs.lookup_discovered_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :lookup_discovered_workload, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Workloads in an Application. + # + # @overload list_workloads(request, options = nil) + # Pass arguments to `list_workloads` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListWorkloadsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListWorkloadsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_workloads` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the parent Application to list Workloads + # for. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::Workload>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::Workload>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListWorkloadsRequest.new + # + # # Call the list_workloads method. + # result = client.list_workloads request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::Workload. + # p item + # end + # + def list_workloads request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListWorkloadsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_workloads.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_workloads.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_workloads.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :list_workloads, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @app_hub_stub, :list_workloads, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Workload in an Application. + # + # @overload create_workload(request, options = nil) + # Pass arguments to `create_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_workload(parent: nil, workload_id: nil, workload: nil, request_id: nil) + # Pass arguments to `create_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the Application to create Workload in. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param workload_id [::String] + # Required. The Workload identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @param workload [::Google::Cloud::AppHub::V1::Workload, ::Hash] + # Required. The resource being created. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateWorkloadRequest.new + # + # # Call the create_workload method. + # result = client.create_workload request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_workload.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :create_workload, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Workload in an Application. + # + # @overload get_workload(request, options = nil) + # Pass arguments to `get_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_workload(name: nil) + # Pass arguments to `get_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Workload to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::Workload] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::Workload] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetWorkloadRequest.new + # + # # Call the get_workload method. + # result = client.get_workload request + # + # # The returned object is of type Google::Cloud::AppHub::V1::Workload. + # p result + # + def get_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_workload.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :get_workload, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a Workload in an Application. + # + # @overload update_workload(request, options = nil) + # Pass arguments to `update_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::UpdateWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::UpdateWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_workload(update_mask: nil, workload: nil, request_id: nil) + # Pass arguments to `update_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. Field mask is used to specify the fields to be overwritten in the + # Workload resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @param workload [::Google::Cloud::AppHub::V1::Workload, ::Hash] + # Required. The resource being updated. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new + # + # # Call the update_workload method. + # result = client.update_workload request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::UpdateWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.workload&.name + header_params["workload.name"] = request.workload.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_workload.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :update_workload, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Workload from an Application. + # + # @overload delete_workload(request, options = nil) + # Pass arguments to `delete_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_workload(name: nil, request_id: nil) + # Pass arguments to `delete_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Workload to delete from an + # Application. Expected format: + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new + # + # # Call the delete_workload method. + # result = client.delete_workload request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_workload.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :delete_workload, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Applications in a host project and location. + # + # @overload list_applications(request, options = nil) + # Pass arguments to `list_applications` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListApplicationsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListApplicationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_applications(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_applications` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to list Applications on. + # Expected format: `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::Application>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::AppHub::V1::Application>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListApplicationsRequest.new + # + # # Call the list_applications method. + # result = client.list_applications request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::Application. + # p item + # end + # + def list_applications request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListApplicationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_applications.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_applications.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_applications.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :list_applications, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @app_hub_stub, :list_applications, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates an Application in a host project and location. + # + # @overload create_application(request, options = nil) + # Pass arguments to `create_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_application(parent: nil, application_id: nil, application: nil, request_id: nil) + # Pass arguments to `create_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to create Application in. + # Expected format: `projects/{project}/locations/{location}`. + # @param application_id [::String] + # Required. The Application identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @param application [::Google::Cloud::AppHub::V1::Application, ::Hash] + # Required. The resource being created + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateApplicationRequest.new + # + # # Call the create_application method. + # result = client.create_application request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_application.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :create_application, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets an Application in a host project and location. + # + # @overload get_application(request, options = nil) + # Pass arguments to `get_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_application(name: nil) + # Pass arguments to `get_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Application to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::AppHub::V1::Application] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::AppHub::V1::Application] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetApplicationRequest.new + # + # # Call the get_application method. + # result = client.get_application request + # + # # The returned object is of type Google::Cloud::AppHub::V1::Application. + # p result + # + def get_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_application.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :get_application, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates an Application in a host project and location. + # + # @overload update_application(request, options = nil) + # Pass arguments to `update_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::UpdateApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::UpdateApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_application(update_mask: nil, application: nil, request_id: nil) + # Pass arguments to `update_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. Field mask is used to specify the fields to be overwritten in the + # Application resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @param application [::Google::Cloud::AppHub::V1::Application, ::Hash] + # Required. The resource being updated. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::UpdateApplicationRequest.new + # + # # Call the update_application method. + # result = client.update_application request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::UpdateApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.application&.name + header_params["application.name"] = request.application.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_application.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :update_application, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an Application in a host project and location. + # + # @overload delete_application(request, options = nil) + # Pass arguments to `delete_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_application(name: nil, request_id: nil) + # Pass arguments to `delete_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Application to delete. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteApplicationRequest.new + # + # # Call the delete_application method. + # result = client.delete_application request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_application.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.call_rpc :delete_application, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the AppHub API. + # + # This class represents the configuration for AppHub, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::AppHub::V1::AppHub::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # lookup_service_project_attachment to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::AppHub::V1::AppHub::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.lookup_service_project_attachment.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.lookup_service_project_attachment.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "apphub.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the AppHub API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `lookup_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :lookup_service_project_attachment + ## + # RPC-specific configuration for `list_service_project_attachments` + # @return [::Gapic::Config::Method] + # + attr_reader :list_service_project_attachments + ## + # RPC-specific configuration for `create_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :create_service_project_attachment + ## + # RPC-specific configuration for `get_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :get_service_project_attachment + ## + # RPC-specific configuration for `delete_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_service_project_attachment + ## + # RPC-specific configuration for `detach_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :detach_service_project_attachment + ## + # RPC-specific configuration for `list_discovered_services` + # @return [::Gapic::Config::Method] + # + attr_reader :list_discovered_services + ## + # RPC-specific configuration for `get_discovered_service` + # @return [::Gapic::Config::Method] + # + attr_reader :get_discovered_service + ## + # RPC-specific configuration for `lookup_discovered_service` + # @return [::Gapic::Config::Method] + # + attr_reader :lookup_discovered_service + ## + # RPC-specific configuration for `list_services` + # @return [::Gapic::Config::Method] + # + attr_reader :list_services + ## + # RPC-specific configuration for `create_service` + # @return [::Gapic::Config::Method] + # + attr_reader :create_service + ## + # RPC-specific configuration for `get_service` + # @return [::Gapic::Config::Method] + # + attr_reader :get_service + ## + # RPC-specific configuration for `update_service` + # @return [::Gapic::Config::Method] + # + attr_reader :update_service + ## + # RPC-specific configuration for `delete_service` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_service + ## + # RPC-specific configuration for `list_discovered_workloads` + # @return [::Gapic::Config::Method] + # + attr_reader :list_discovered_workloads + ## + # RPC-specific configuration for `get_discovered_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :get_discovered_workload + ## + # RPC-specific configuration for `lookup_discovered_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :lookup_discovered_workload + ## + # RPC-specific configuration for `list_workloads` + # @return [::Gapic::Config::Method] + # + attr_reader :list_workloads + ## + # RPC-specific configuration for `create_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :create_workload + ## + # RPC-specific configuration for `get_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :get_workload + ## + # RPC-specific configuration for `update_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :update_workload + ## + # RPC-specific configuration for `delete_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_workload + ## + # RPC-specific configuration for `list_applications` + # @return [::Gapic::Config::Method] + # + attr_reader :list_applications + ## + # RPC-specific configuration for `create_application` + # @return [::Gapic::Config::Method] + # + attr_reader :create_application + ## + # RPC-specific configuration for `get_application` + # @return [::Gapic::Config::Method] + # + attr_reader :get_application + ## + # RPC-specific configuration for `update_application` + # @return [::Gapic::Config::Method] + # + attr_reader :update_application + ## + # RPC-specific configuration for `delete_application` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_application + + # @private + def initialize parent_rpcs = nil + lookup_service_project_attachment_config = parent_rpcs.lookup_service_project_attachment if parent_rpcs.respond_to? :lookup_service_project_attachment + @lookup_service_project_attachment = ::Gapic::Config::Method.new lookup_service_project_attachment_config + list_service_project_attachments_config = parent_rpcs.list_service_project_attachments if parent_rpcs.respond_to? :list_service_project_attachments + @list_service_project_attachments = ::Gapic::Config::Method.new list_service_project_attachments_config + create_service_project_attachment_config = parent_rpcs.create_service_project_attachment if parent_rpcs.respond_to? :create_service_project_attachment + @create_service_project_attachment = ::Gapic::Config::Method.new create_service_project_attachment_config + get_service_project_attachment_config = parent_rpcs.get_service_project_attachment if parent_rpcs.respond_to? :get_service_project_attachment + @get_service_project_attachment = ::Gapic::Config::Method.new get_service_project_attachment_config + delete_service_project_attachment_config = parent_rpcs.delete_service_project_attachment if parent_rpcs.respond_to? :delete_service_project_attachment + @delete_service_project_attachment = ::Gapic::Config::Method.new delete_service_project_attachment_config + detach_service_project_attachment_config = parent_rpcs.detach_service_project_attachment if parent_rpcs.respond_to? :detach_service_project_attachment + @detach_service_project_attachment = ::Gapic::Config::Method.new detach_service_project_attachment_config + list_discovered_services_config = parent_rpcs.list_discovered_services if parent_rpcs.respond_to? :list_discovered_services + @list_discovered_services = ::Gapic::Config::Method.new list_discovered_services_config + get_discovered_service_config = parent_rpcs.get_discovered_service if parent_rpcs.respond_to? :get_discovered_service + @get_discovered_service = ::Gapic::Config::Method.new get_discovered_service_config + lookup_discovered_service_config = parent_rpcs.lookup_discovered_service if parent_rpcs.respond_to? :lookup_discovered_service + @lookup_discovered_service = ::Gapic::Config::Method.new lookup_discovered_service_config + list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services + @list_services = ::Gapic::Config::Method.new list_services_config + create_service_config = parent_rpcs.create_service if parent_rpcs.respond_to? :create_service + @create_service = ::Gapic::Config::Method.new create_service_config + get_service_config = parent_rpcs.get_service if parent_rpcs.respond_to? :get_service + @get_service = ::Gapic::Config::Method.new get_service_config + update_service_config = parent_rpcs.update_service if parent_rpcs.respond_to? :update_service + @update_service = ::Gapic::Config::Method.new update_service_config + delete_service_config = parent_rpcs.delete_service if parent_rpcs.respond_to? :delete_service + @delete_service = ::Gapic::Config::Method.new delete_service_config + list_discovered_workloads_config = parent_rpcs.list_discovered_workloads if parent_rpcs.respond_to? :list_discovered_workloads + @list_discovered_workloads = ::Gapic::Config::Method.new list_discovered_workloads_config + get_discovered_workload_config = parent_rpcs.get_discovered_workload if parent_rpcs.respond_to? :get_discovered_workload + @get_discovered_workload = ::Gapic::Config::Method.new get_discovered_workload_config + lookup_discovered_workload_config = parent_rpcs.lookup_discovered_workload if parent_rpcs.respond_to? :lookup_discovered_workload + @lookup_discovered_workload = ::Gapic::Config::Method.new lookup_discovered_workload_config + list_workloads_config = parent_rpcs.list_workloads if parent_rpcs.respond_to? :list_workloads + @list_workloads = ::Gapic::Config::Method.new list_workloads_config + create_workload_config = parent_rpcs.create_workload if parent_rpcs.respond_to? :create_workload + @create_workload = ::Gapic::Config::Method.new create_workload_config + get_workload_config = parent_rpcs.get_workload if parent_rpcs.respond_to? :get_workload + @get_workload = ::Gapic::Config::Method.new get_workload_config + update_workload_config = parent_rpcs.update_workload if parent_rpcs.respond_to? :update_workload + @update_workload = ::Gapic::Config::Method.new update_workload_config + delete_workload_config = parent_rpcs.delete_workload if parent_rpcs.respond_to? :delete_workload + @delete_workload = ::Gapic::Config::Method.new delete_workload_config + list_applications_config = parent_rpcs.list_applications if parent_rpcs.respond_to? :list_applications + @list_applications = ::Gapic::Config::Method.new list_applications_config + create_application_config = parent_rpcs.create_application if parent_rpcs.respond_to? :create_application + @create_application = ::Gapic::Config::Method.new create_application_config + get_application_config = parent_rpcs.get_application if parent_rpcs.respond_to? :get_application + @get_application = ::Gapic::Config::Method.new get_application_config + update_application_config = parent_rpcs.update_application if parent_rpcs.respond_to? :update_application + @update_application = ::Gapic::Config::Method.new update_application_config + delete_application_config = parent_rpcs.delete_application if parent_rpcs.respond_to? :delete_application + @delete_application = ::Gapic::Config::Method.new delete_application_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/credentials.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/credentials.rb new file mode 100644 index 000000000000..3d62e12bd671 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/credentials.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module AppHub + module V1 + module AppHub + # Credentials for the AppHub API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/operations.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/operations.rb new file mode 100644 index 000000000000..acbfd08c77d4 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/operations.rb @@ -0,0 +1,801 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module AppHub + module V1 + module AppHub + # Service that implements Longrunning Operations API. + class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "apphub.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the AppHub Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the AppHub Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # NOTE: the `name` binding allows API services to override the binding + # to use different resource name schemes, such as `users/*/operations`. To + # override the binding, API services can add a binding such as + # `"/v1/{name=users/*}/operations"` to their service configuration. + # For backwards compatibility, the default name includes the operations + # collection id, however overriding users must ensure the name binding + # is the parent resource, without the operations collection id. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1, + # corresponding to `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "apphub.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/paths.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/paths.rb new file mode 100644 index 000000000000..b21cd612451a --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/paths.rb @@ -0,0 +1,182 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + module AppHub + # Path helper methods for the AppHub API. + module Paths + ## + # Create a fully-qualified Application resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/applications/{application}` + # + # @param project [String] + # @param location [String] + # @param application [String] + # + # @return [::String] + def application_path project:, location:, application: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/applications/#{application}" + end + + ## + # Create a fully-qualified DiscoveredService resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/discoveredServices/{discovered_service}` + # + # @param project [String] + # @param location [String] + # @param discovered_service [String] + # + # @return [::String] + def discovered_service_path project:, location:, discovered_service: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/discoveredServices/#{discovered_service}" + end + + ## + # Create a fully-qualified DiscoveredWorkload resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/discoveredWorkloads/{discovered_workload}` + # + # @param project [String] + # @param location [String] + # @param discovered_workload [String] + # + # @return [::String] + def discovered_workload_path project:, location:, discovered_workload: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/discoveredWorkloads/#{discovered_workload}" + end + + ## + # Create a fully-qualified Location resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}` + # + # @param project [String] + # @param location [String] + # + # @return [::String] + def location_path project:, location: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/locations/#{location}" + end + + ## + # Create a fully-qualified Project resource string. + # + # The resource will be in the following format: + # + # `projects/{project}` + # + # @param project [String] + # + # @return [::String] + def project_path project: + "projects/#{project}" + end + + ## + # Create a fully-qualified Service resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/applications/{application}/services/{service}` + # + # @param project [String] + # @param location [String] + # @param application [String] + # @param service [String] + # + # @return [::String] + def service_path project:, location:, application:, service: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "application cannot contain /" if application.to_s.include? "/" + + "projects/#{project}/locations/#{location}/applications/#{application}/services/#{service}" + end + + ## + # Create a fully-qualified ServiceProjectAttachment resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/serviceProjectAttachments/{service_project_attachment}` + # + # @param project [String] + # @param location [String] + # @param service_project_attachment [String] + # + # @return [::String] + def service_project_attachment_path project:, location:, service_project_attachment: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/serviceProjectAttachments/#{service_project_attachment}" + end + + ## + # Create a fully-qualified Workload resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}` + # + # @param project [String] + # @param location [String] + # @param application [String] + # @param workload [String] + # + # @return [::String] + def workload_path project:, location:, application:, workload: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "application cannot contain /" if application.to_s.include? "/" + + "projects/#{project}/locations/#{location}/applications/#{application}/workloads/#{workload}" + end + + extend self + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest.rb new file mode 100644 index 000000000000..df909f22c353 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/app_hub/v1/version" +require "google/cloud/app_hub/v1/bindings_override" + +require "google/cloud/app_hub/v1/app_hub/credentials" +require "google/cloud/app_hub/v1/app_hub/paths" +require "google/cloud/app_hub/v1/app_hub/rest/operations" +require "google/cloud/app_hub/v1/app_hub/rest/client" + +module Google + module Cloud + module AppHub + module V1 + ## + # The App Hub API allows you to manage App Hub resources. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/app_hub/v1/app_hub/rest" + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + module AppHub + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/app_hub/v1/app_hub/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/client.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/client.rb new file mode 100644 index 000000000000..9b116fa22e88 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/client.rb @@ -0,0 +1,3184 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/apphub/v1/apphub_service_pb" +require "google/cloud/app_hub/v1/app_hub/rest/service_stub" +require "google/cloud/location/rest" +require "google/iam/v1/rest" + +module Google + module Cloud + module AppHub + module V1 + module AppHub + module Rest + ## + # REST client for the AppHub service. + # + # The App Hub API allows you to manage App Hub resources. + # + class Client + # @private + DEFAULT_ENDPOINT_TEMPLATE = "apphub.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :app_hub_stub + + ## + # Configure the AppHub Client class. + # + # See {::Google::Cloud::AppHub::V1::AppHub::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all AppHub clients + # ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "AppHub", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.lookup_service_project_attachment.timeout = 60.0 + default_config.rpcs.lookup_service_project_attachment.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_service_project_attachments.timeout = 60.0 + default_config.rpcs.list_service_project_attachments.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_service_project_attachment.timeout = 60.0 + + default_config.rpcs.get_service_project_attachment.timeout = 60.0 + default_config.rpcs.get_service_project_attachment.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.delete_service_project_attachment.timeout = 60.0 + + default_config.rpcs.detach_service_project_attachment.timeout = 60.0 + + default_config.rpcs.list_discovered_services.timeout = 60.0 + default_config.rpcs.list_discovered_services.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_discovered_service.timeout = 60.0 + default_config.rpcs.get_discovered_service.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.lookup_discovered_service.timeout = 60.0 + default_config.rpcs.lookup_discovered_service.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_services.timeout = 60.0 + default_config.rpcs.list_services.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_service.timeout = 60.0 + + default_config.rpcs.get_service.timeout = 60.0 + default_config.rpcs.get_service.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_service.timeout = 60.0 + + default_config.rpcs.delete_service.timeout = 60.0 + + default_config.rpcs.list_discovered_workloads.timeout = 60.0 + default_config.rpcs.list_discovered_workloads.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_discovered_workload.timeout = 60.0 + default_config.rpcs.get_discovered_workload.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.lookup_discovered_workload.timeout = 60.0 + default_config.rpcs.lookup_discovered_workload.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_workloads.timeout = 60.0 + default_config.rpcs.list_workloads.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_workload.timeout = 60.0 + + default_config.rpcs.get_workload.timeout = 60.0 + default_config.rpcs.get_workload.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_workload.timeout = 60.0 + + default_config.rpcs.delete_workload.timeout = 60.0 + + default_config.rpcs.list_applications.timeout = 60.0 + default_config.rpcs.list_applications.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_application.timeout = 60.0 + + default_config.rpcs.get_application.timeout = 60.0 + default_config.rpcs.get_application.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_application.timeout = 60.0 + + default_config.rpcs.delete_application.timeout = 60.0 + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the AppHub Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::AppHub::V1::AppHub::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @app_hub_stub.universe_domain + end + + ## + # Create a new AppHub REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the AppHub client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @app_hub_stub = ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @app_hub_stub.endpoint + config.universe_domain = @app_hub_stub.universe_domain + config.bindings_override = @config.bindings_override + end + + @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @app_hub_stub.endpoint + config.universe_domain = @app_hub_stub.universe_domain + config.bindings_override = @config.bindings_override + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::AppHub::V1::AppHub::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # Get the associated client for mix-in of the IAMPolicy. + # + # @return [Google::Iam::V1::IAMPolicy::Rest::Client] + # + attr_reader :iam_policy_client + + # Service calls + + ## + # Lists a service project attachment for a given service project. You can + # call this API from any project to find if it is attached to a host project. + # + # @overload lookup_service_project_attachment(request, options = nil) + # Pass arguments to `lookup_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload lookup_service_project_attachment(name: nil) + # Pass arguments to `lookup_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Service project ID and location to lookup service project + # attachment for. Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new + # + # # Call the lookup_service_project_attachment method. + # result = client.lookup_service_project_attachment request + # + # # The returned object is of type Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse. + # p result + # + def lookup_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.lookup_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.lookup_service_project_attachment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.lookup_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.lookup_service_project_attachment request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists service projects attached to the host project. + # + # @overload list_service_project_attachments(request, options = nil) + # Pass arguments to `list_service_project_attachments` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_service_project_attachments(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_service_project_attachments` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to list service project attachments. + # Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new + # + # # Call the list_service_project_attachments method. + # result = client.list_service_project_attachments request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::ServiceProjectAttachment. + # p item + # end + # + def list_service_project_attachments request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_service_project_attachments.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_service_project_attachments.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_service_project_attachments.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.list_service_project_attachments request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Attaches a service project to the host project. + # + # @overload create_service_project_attachment(request, options = nil) + # Pass arguments to `create_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_service_project_attachment(parent: nil, service_project_attachment_id: nil, service_project_attachment: nil, request_id: nil) + # Pass arguments to `create_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to which service project is being + # attached. Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @param service_project_attachment_id [::String] + # Required. The service project attachment identifier must contain the + # project id of the service project specified in the + # service_project_attachment.service_project field. + # @param service_project_attachment [::Google::Cloud::AppHub::V1::ServiceProjectAttachment, ::Hash] + # Required. The resource being created. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new + # + # # Call the create_service_project_attachment method. + # result = client.create_service_project_attachment request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_service_project_attachment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.create_service_project_attachment request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a service project attachment. + # + # @overload get_service_project_attachment(request, options = nil) + # Pass arguments to `get_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_service_project_attachment(name: nil) + # Pass arguments to `get_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the service project attachment to + # retrieve. Expected format: + # `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new + # + # # Call the get_service_project_attachment method. + # result = client.get_service_project_attachment request + # + # # The returned object is of type Google::Cloud::AppHub::V1::ServiceProjectAttachment. + # p result + # + def get_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_service_project_attachment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.get_service_project_attachment request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a service project attachment. + # + # @overload delete_service_project_attachment(request, options = nil) + # Pass arguments to `delete_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_service_project_attachment(name: nil, request_id: nil) + # Pass arguments to `delete_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the service project attachment to delete. + # Expected format: + # `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new + # + # # Call the delete_service_project_attachment method. + # result = client.delete_service_project_attachment request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_service_project_attachment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.delete_service_project_attachment request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Detaches a service project from a host project. + # You can call this API from any service project without needing access to + # the host project that it is attached to. + # + # @overload detach_service_project_attachment(request, options = nil) + # Pass arguments to `detach_service_project_attachment` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload detach_service_project_attachment(name: nil) + # Pass arguments to `detach_service_project_attachment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Service project id and location to detach from a host project. + # Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new + # + # # Call the detach_service_project_attachment method. + # result = client.detach_service_project_attachment request + # + # # The returned object is of type Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse. + # p result + # + def detach_service_project_attachment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.detach_service_project_attachment.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.detach_service_project_attachment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.detach_service_project_attachment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.detach_service_project_attachment request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Discovered Services that can be added to an Application in a host + # project and location. + # + # @overload list_discovered_services(request, options = nil) + # Pass arguments to `list_discovered_services` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_discovered_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_discovered_services` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to list Discovered Services on. + # Expected format: `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new + # + # # Call the list_discovered_services method. + # result = client.list_discovered_services request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::DiscoveredService. + # p item + # end + # + def list_discovered_services request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_discovered_services.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_discovered_services.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_discovered_services.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.list_discovered_services request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Discovered Service in a host project and location. + # + # @overload get_discovered_service(request, options = nil) + # Pass arguments to `get_discovered_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_discovered_service(name: nil) + # Pass arguments to `get_discovered_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Discovered Service to fetch. + # Expected format: + # `projects/{project}/locations/{location}/discoveredServices/{discoveredService}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::DiscoveredService] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::DiscoveredService] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new + # + # # Call the get_discovered_service method. + # result = client.get_discovered_service request + # + # # The returned object is of type Google::Cloud::AppHub::V1::DiscoveredService. + # p result + # + def get_discovered_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_discovered_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_discovered_service.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_discovered_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.get_discovered_service request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists a Discovered Service in a host project and location, with a + # given resource URI. + # + # @overload lookup_discovered_service(request, options = nil) + # Pass arguments to `lookup_discovered_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload lookup_discovered_service(parent: nil, uri: nil) + # Pass arguments to `lookup_discovered_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to lookup Discovered Service in. + # Expected format: `projects/{project}/locations/{location}`. + # @param uri [::String] + # Required. Resource URI to find DiscoveredService for. + # Accepts both project number and project ID and does translation when + # needed. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new + # + # # Call the lookup_discovered_service method. + # result = client.lookup_discovered_service request + # + # # The returned object is of type Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse. + # p result + # + def lookup_discovered_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.lookup_discovered_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.lookup_discovered_service.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.lookup_discovered_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.lookup_discovered_service request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Services in an Application. + # + # @overload list_services(request, options = nil) + # Pass arguments to `list_services` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListServicesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListServicesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_services` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the parent Application to list Services + # for. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results + # @param order_by [::String] + # Optional. Hint for how to order the results + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListServicesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListServicesResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListServicesRequest.new + # + # # Call the list_services method. + # result = client.list_services request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::Service. + # p item + # end + # + def list_services request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListServicesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_services.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_services.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_services.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.list_services request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Service in an Application. + # + # @overload create_service(request, options = nil) + # Pass arguments to `create_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_service(parent: nil, service_id: nil, service: nil, request_id: nil) + # Pass arguments to `create_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the parent Application to create the + # Service in. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param service_id [::String] + # Required. The Service identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @param service [::Google::Cloud::AppHub::V1::Service, ::Hash] + # Required. The resource being created. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateServiceRequest.new + # + # # Call the create_service method. + # result = client.create_service request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_service.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.create_service request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Service in an Application. + # + # @overload get_service(request, options = nil) + # Pass arguments to `get_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_service(name: nil) + # Pass arguments to `get_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Service to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}/services/{service}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::Service] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::Service] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetServiceRequest.new + # + # # Call the get_service method. + # result = client.get_service request + # + # # The returned object is of type Google::Cloud::AppHub::V1::Service. + # p result + # + def get_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_service.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.get_service request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a Service in an Application. + # + # @overload update_service(request, options = nil) + # Pass arguments to `update_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::UpdateServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::UpdateServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_service(update_mask: nil, service: nil, request_id: nil) + # Pass arguments to `update_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. Field mask is used to specify the fields to be overwritten in the + # Service resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @param service [::Google::Cloud::AppHub::V1::Service, ::Hash] + # Required. The resource being updated. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::UpdateServiceRequest.new + # + # # Call the update_service method. + # result = client.update_service request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::UpdateServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_service.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.update_service request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Service from an Application. + # + # @overload delete_service(request, options = nil) + # Pass arguments to `delete_service` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteServiceRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_service(name: nil, request_id: nil) + # Pass arguments to `delete_service` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Service to delete from an + # Application. Expected format: + # `projects/{project}/locations/{location}/applications/{application}/services/{service}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteServiceRequest.new + # + # # Call the delete_service method. + # result = client.delete_service request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_service request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteServiceRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_service.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_service.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_service.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.delete_service request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Discovered Workloads that can be added to an Application in a host + # project and location. + # + # @overload list_discovered_workloads(request, options = nil) + # Pass arguments to `list_discovered_workloads` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_discovered_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_discovered_workloads` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to list Discovered Workloads on. + # Expected format: `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new + # + # # Call the list_discovered_workloads method. + # result = client.list_discovered_workloads request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::DiscoveredWorkload. + # p item + # end + # + def list_discovered_workloads request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_discovered_workloads.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_discovered_workloads.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_discovered_workloads.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.list_discovered_workloads request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Discovered Workload in a host project and location. + # + # @overload get_discovered_workload(request, options = nil) + # Pass arguments to `get_discovered_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_discovered_workload(name: nil) + # Pass arguments to `get_discovered_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Discovered Workload to fetch. + # Expected format: + # `projects/{project}/locations/{location}/discoveredWorkloads/{discoveredWorkload}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new + # + # # Call the get_discovered_workload method. + # result = client.get_discovered_workload request + # + # # The returned object is of type Google::Cloud::AppHub::V1::DiscoveredWorkload. + # p result + # + def get_discovered_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_discovered_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_discovered_workload.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_discovered_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.get_discovered_workload request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists a Discovered Workload in a host project and location, with a + # given resource URI. + # + # @overload lookup_discovered_workload(request, options = nil) + # Pass arguments to `lookup_discovered_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload lookup_discovered_workload(parent: nil, uri: nil) + # Pass arguments to `lookup_discovered_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Host project ID and location to lookup Discovered Workload in. + # Expected format: `projects/{project}/locations/{location}`. + # @param uri [::String] + # Required. Resource URI to find Discovered Workload for. + # Accepts both project number and project ID and does translation when + # needed. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new + # + # # Call the lookup_discovered_workload method. + # result = client.lookup_discovered_workload request + # + # # The returned object is of type Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse. + # p result + # + def lookup_discovered_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.lookup_discovered_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.lookup_discovered_workload.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.lookup_discovered_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.lookup_discovered_workload request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Workloads in an Application. + # + # @overload list_workloads(request, options = nil) + # Pass arguments to `list_workloads` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListWorkloadsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListWorkloadsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_workloads` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the parent Application to list Workloads + # for. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListWorkloadsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListWorkloadsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListWorkloadsRequest.new + # + # # Call the list_workloads method. + # result = client.list_workloads request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::Workload. + # p item + # end + # + def list_workloads request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListWorkloadsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_workloads.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_workloads.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_workloads.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.list_workloads request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Workload in an Application. + # + # @overload create_workload(request, options = nil) + # Pass arguments to `create_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_workload(parent: nil, workload_id: nil, workload: nil, request_id: nil) + # Pass arguments to `create_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Fully qualified name of the Application to create Workload in. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param workload_id [::String] + # Required. The Workload identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @param workload [::Google::Cloud::AppHub::V1::Workload, ::Hash] + # Required. The resource being created. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateWorkloadRequest.new + # + # # Call the create_workload method. + # result = client.create_workload request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_workload.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.create_workload request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Workload in an Application. + # + # @overload get_workload(request, options = nil) + # Pass arguments to `get_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_workload(name: nil) + # Pass arguments to `get_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Workload to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::Workload] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::Workload] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetWorkloadRequest.new + # + # # Call the get_workload method. + # result = client.get_workload request + # + # # The returned object is of type Google::Cloud::AppHub::V1::Workload. + # p result + # + def get_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_workload.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.get_workload request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a Workload in an Application. + # + # @overload update_workload(request, options = nil) + # Pass arguments to `update_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::UpdateWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::UpdateWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_workload(update_mask: nil, workload: nil, request_id: nil) + # Pass arguments to `update_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. Field mask is used to specify the fields to be overwritten in the + # Workload resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @param workload [::Google::Cloud::AppHub::V1::Workload, ::Hash] + # Required. The resource being updated. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new + # + # # Call the update_workload method. + # result = client.update_workload request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::UpdateWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_workload.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.update_workload request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Workload from an Application. + # + # @overload delete_workload(request, options = nil) + # Pass arguments to `delete_workload` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteWorkloadRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteWorkloadRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_workload(name: nil, request_id: nil) + # Pass arguments to `delete_workload` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Workload to delete from an + # Application. Expected format: + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new + # + # # Call the delete_workload method. + # result = client.delete_workload request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_workload request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteWorkloadRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_workload.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_workload.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_workload.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.delete_workload request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists Applications in a host project and location. + # + # @overload list_applications(request, options = nil) + # Pass arguments to `list_applications` via a request object, either of type + # {::Google::Cloud::AppHub::V1::ListApplicationsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::ListApplicationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_applications(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) + # Pass arguments to `list_applications` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to list Applications on. + # Expected format: `projects/{project}/locations/{location}`. + # @param page_size [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # @param filter [::String] + # Optional. Filtering results. + # @param order_by [::String] + # Optional. Hint for how to order the results. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListApplicationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListApplicationsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::ListApplicationsRequest.new + # + # # Call the list_applications method. + # result = client.list_applications request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::AppHub::V1::Application. + # p item + # end + # + def list_applications request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::ListApplicationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_applications.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_applications.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_applications.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.list_applications request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates an Application in a host project and location. + # + # @overload create_application(request, options = nil) + # Pass arguments to `create_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::CreateApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::CreateApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_application(parent: nil, application_id: nil, application: nil, request_id: nil) + # Pass arguments to `create_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project and location to create Application in. + # Expected format: `projects/{project}/locations/{location}`. + # @param application_id [::String] + # Required. The Application identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @param application [::Google::Cloud::AppHub::V1::Application, ::Hash] + # Required. The resource being created + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::CreateApplicationRequest.new + # + # # Call the create_application method. + # result = client.create_application request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::CreateApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_application.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.create_application request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets an Application in a host project and location. + # + # @overload get_application(request, options = nil) + # Pass arguments to `get_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::GetApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::GetApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_application(name: nil) + # Pass arguments to `get_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Application to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::Application] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::Application] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::GetApplicationRequest.new + # + # # Call the get_application method. + # result = client.get_application request + # + # # The returned object is of type Google::Cloud::AppHub::V1::Application. + # p result + # + def get_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::GetApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_application.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.get_application request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates an Application in a host project and location. + # + # @overload update_application(request, options = nil) + # Pass arguments to `update_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::UpdateApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::UpdateApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_application(update_mask: nil, application: nil, request_id: nil) + # Pass arguments to `update_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. Field mask is used to specify the fields to be overwritten in the + # Application resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @param application [::Google::Cloud::AppHub::V1::Application, ::Hash] + # Required. The resource being updated. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::UpdateApplicationRequest.new + # + # # Call the update_application method. + # result = client.update_application request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::UpdateApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_application.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.update_application request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an Application in a host project and location. + # + # @overload delete_application(request, options = nil) + # Pass arguments to `delete_application` via a request object, either of type + # {::Google::Cloud::AppHub::V1::DeleteApplicationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::AppHub::V1::DeleteApplicationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_application(name: nil, request_id: nil) + # Pass arguments to `delete_application` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Fully qualified name of the Application to delete. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @param request_id [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/app_hub/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::AppHub::V1::DeleteApplicationRequest.new + # + # # Call the delete_application method. + # result = client.delete_application request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_application request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AppHub::V1::DeleteApplicationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_application.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_application.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_application.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @app_hub_stub.delete_application request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the AppHub REST API. + # + # This class represents the configuration for AppHub REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::AppHub::V1::AppHub::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # lookup_service_project_attachment to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.lookup_service_project_attachment.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.lookup_service_project_attachment.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "apphub.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + # Overrides for http bindings for the RPCs of this service + # are only used when this service is used as mixin, and only + # by the host service. + # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] + config_attr :bindings_override, {}, ::Hash, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the AppHub API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `lookup_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :lookup_service_project_attachment + ## + # RPC-specific configuration for `list_service_project_attachments` + # @return [::Gapic::Config::Method] + # + attr_reader :list_service_project_attachments + ## + # RPC-specific configuration for `create_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :create_service_project_attachment + ## + # RPC-specific configuration for `get_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :get_service_project_attachment + ## + # RPC-specific configuration for `delete_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_service_project_attachment + ## + # RPC-specific configuration for `detach_service_project_attachment` + # @return [::Gapic::Config::Method] + # + attr_reader :detach_service_project_attachment + ## + # RPC-specific configuration for `list_discovered_services` + # @return [::Gapic::Config::Method] + # + attr_reader :list_discovered_services + ## + # RPC-specific configuration for `get_discovered_service` + # @return [::Gapic::Config::Method] + # + attr_reader :get_discovered_service + ## + # RPC-specific configuration for `lookup_discovered_service` + # @return [::Gapic::Config::Method] + # + attr_reader :lookup_discovered_service + ## + # RPC-specific configuration for `list_services` + # @return [::Gapic::Config::Method] + # + attr_reader :list_services + ## + # RPC-specific configuration for `create_service` + # @return [::Gapic::Config::Method] + # + attr_reader :create_service + ## + # RPC-specific configuration for `get_service` + # @return [::Gapic::Config::Method] + # + attr_reader :get_service + ## + # RPC-specific configuration for `update_service` + # @return [::Gapic::Config::Method] + # + attr_reader :update_service + ## + # RPC-specific configuration for `delete_service` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_service + ## + # RPC-specific configuration for `list_discovered_workloads` + # @return [::Gapic::Config::Method] + # + attr_reader :list_discovered_workloads + ## + # RPC-specific configuration for `get_discovered_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :get_discovered_workload + ## + # RPC-specific configuration for `lookup_discovered_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :lookup_discovered_workload + ## + # RPC-specific configuration for `list_workloads` + # @return [::Gapic::Config::Method] + # + attr_reader :list_workloads + ## + # RPC-specific configuration for `create_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :create_workload + ## + # RPC-specific configuration for `get_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :get_workload + ## + # RPC-specific configuration for `update_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :update_workload + ## + # RPC-specific configuration for `delete_workload` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_workload + ## + # RPC-specific configuration for `list_applications` + # @return [::Gapic::Config::Method] + # + attr_reader :list_applications + ## + # RPC-specific configuration for `create_application` + # @return [::Gapic::Config::Method] + # + attr_reader :create_application + ## + # RPC-specific configuration for `get_application` + # @return [::Gapic::Config::Method] + # + attr_reader :get_application + ## + # RPC-specific configuration for `update_application` + # @return [::Gapic::Config::Method] + # + attr_reader :update_application + ## + # RPC-specific configuration for `delete_application` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_application + + # @private + def initialize parent_rpcs = nil + lookup_service_project_attachment_config = parent_rpcs.lookup_service_project_attachment if parent_rpcs.respond_to? :lookup_service_project_attachment + @lookup_service_project_attachment = ::Gapic::Config::Method.new lookup_service_project_attachment_config + list_service_project_attachments_config = parent_rpcs.list_service_project_attachments if parent_rpcs.respond_to? :list_service_project_attachments + @list_service_project_attachments = ::Gapic::Config::Method.new list_service_project_attachments_config + create_service_project_attachment_config = parent_rpcs.create_service_project_attachment if parent_rpcs.respond_to? :create_service_project_attachment + @create_service_project_attachment = ::Gapic::Config::Method.new create_service_project_attachment_config + get_service_project_attachment_config = parent_rpcs.get_service_project_attachment if parent_rpcs.respond_to? :get_service_project_attachment + @get_service_project_attachment = ::Gapic::Config::Method.new get_service_project_attachment_config + delete_service_project_attachment_config = parent_rpcs.delete_service_project_attachment if parent_rpcs.respond_to? :delete_service_project_attachment + @delete_service_project_attachment = ::Gapic::Config::Method.new delete_service_project_attachment_config + detach_service_project_attachment_config = parent_rpcs.detach_service_project_attachment if parent_rpcs.respond_to? :detach_service_project_attachment + @detach_service_project_attachment = ::Gapic::Config::Method.new detach_service_project_attachment_config + list_discovered_services_config = parent_rpcs.list_discovered_services if parent_rpcs.respond_to? :list_discovered_services + @list_discovered_services = ::Gapic::Config::Method.new list_discovered_services_config + get_discovered_service_config = parent_rpcs.get_discovered_service if parent_rpcs.respond_to? :get_discovered_service + @get_discovered_service = ::Gapic::Config::Method.new get_discovered_service_config + lookup_discovered_service_config = parent_rpcs.lookup_discovered_service if parent_rpcs.respond_to? :lookup_discovered_service + @lookup_discovered_service = ::Gapic::Config::Method.new lookup_discovered_service_config + list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services + @list_services = ::Gapic::Config::Method.new list_services_config + create_service_config = parent_rpcs.create_service if parent_rpcs.respond_to? :create_service + @create_service = ::Gapic::Config::Method.new create_service_config + get_service_config = parent_rpcs.get_service if parent_rpcs.respond_to? :get_service + @get_service = ::Gapic::Config::Method.new get_service_config + update_service_config = parent_rpcs.update_service if parent_rpcs.respond_to? :update_service + @update_service = ::Gapic::Config::Method.new update_service_config + delete_service_config = parent_rpcs.delete_service if parent_rpcs.respond_to? :delete_service + @delete_service = ::Gapic::Config::Method.new delete_service_config + list_discovered_workloads_config = parent_rpcs.list_discovered_workloads if parent_rpcs.respond_to? :list_discovered_workloads + @list_discovered_workloads = ::Gapic::Config::Method.new list_discovered_workloads_config + get_discovered_workload_config = parent_rpcs.get_discovered_workload if parent_rpcs.respond_to? :get_discovered_workload + @get_discovered_workload = ::Gapic::Config::Method.new get_discovered_workload_config + lookup_discovered_workload_config = parent_rpcs.lookup_discovered_workload if parent_rpcs.respond_to? :lookup_discovered_workload + @lookup_discovered_workload = ::Gapic::Config::Method.new lookup_discovered_workload_config + list_workloads_config = parent_rpcs.list_workloads if parent_rpcs.respond_to? :list_workloads + @list_workloads = ::Gapic::Config::Method.new list_workloads_config + create_workload_config = parent_rpcs.create_workload if parent_rpcs.respond_to? :create_workload + @create_workload = ::Gapic::Config::Method.new create_workload_config + get_workload_config = parent_rpcs.get_workload if parent_rpcs.respond_to? :get_workload + @get_workload = ::Gapic::Config::Method.new get_workload_config + update_workload_config = parent_rpcs.update_workload if parent_rpcs.respond_to? :update_workload + @update_workload = ::Gapic::Config::Method.new update_workload_config + delete_workload_config = parent_rpcs.delete_workload if parent_rpcs.respond_to? :delete_workload + @delete_workload = ::Gapic::Config::Method.new delete_workload_config + list_applications_config = parent_rpcs.list_applications if parent_rpcs.respond_to? :list_applications + @list_applications = ::Gapic::Config::Method.new list_applications_config + create_application_config = parent_rpcs.create_application if parent_rpcs.respond_to? :create_application + @create_application = ::Gapic::Config::Method.new create_application_config + get_application_config = parent_rpcs.get_application if parent_rpcs.respond_to? :get_application + @get_application = ::Gapic::Config::Method.new get_application_config + update_application_config = parent_rpcs.update_application if parent_rpcs.respond_to? :update_application + @update_application = ::Gapic::Config::Method.new update_application_config + delete_application_config = parent_rpcs.delete_application if parent_rpcs.respond_to? :delete_application + @delete_application = ::Gapic::Config::Method.new delete_application_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/operations.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/operations.rb new file mode 100644 index 000000000000..88051f708418 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/operations.rb @@ -0,0 +1,895 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module AppHub + module V1 + module AppHub + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + DEFAULT_ENDPOINT_TEMPLATE = "apphub.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the AppHub Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the AppHub Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # NOTE: the `name` binding allows API services to override the binding + # to use different resource name schemes, such as `users/*/operations`. To + # override the binding, API services can add a binding such as + # `"/v1/{name=users/*}/operations"` to their service configuration. + # For backwards compatibility, the default name includes the operations + # collection id, however overriding users must ensure the name binding + # is the parent resource, without the operations collection id. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1, + # corresponding to `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::AppHub::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "apphub.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/service_stub.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/service_stub.rb new file mode 100644 index 000000000000..5fca0e1b3fa4 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/app_hub/rest/service_stub.rb @@ -0,0 +1,1670 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/apphub/v1/apphub_service_pb" + +module Google + module Cloud + module AppHub + module V1 + module AppHub + module Rest + ## + # REST service stub for the AppHub service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + raise_faraday_errors: false + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # Baseline implementation for the lookup_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse] + # A result object deserialized from the server's reply + def lookup_service_project_attachment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_lookup_service_project_attachment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_service_project_attachments REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse] + # A result object deserialized from the server's reply + def list_service_project_attachments request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_service_project_attachments_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the create_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_service_project_attachment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_service_project_attachment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # A result object deserialized from the server's reply + def get_service_project_attachment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_service_project_attachment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ServiceProjectAttachment.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_service_project_attachment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_service_project_attachment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the detach_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse] + # A result object deserialized from the server's reply + def detach_service_project_attachment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_detach_service_project_attachment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_discovered_services REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse] + # A result object deserialized from the server's reply + def list_discovered_services request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_discovered_services_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_discovered_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::DiscoveredService] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::DiscoveredService] + # A result object deserialized from the server's reply + def get_discovered_service request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_discovered_service_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::DiscoveredService.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the lookup_discovered_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse] + # A result object deserialized from the server's reply + def lookup_discovered_service request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_lookup_discovered_service_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_services REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListServicesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListServicesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListServicesResponse] + # A result object deserialized from the server's reply + def list_services request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_services_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ListServicesResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the create_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateServiceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_service request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_service_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetServiceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::Service] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::Service] + # A result object deserialized from the server's reply + def get_service request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_service_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::Service.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the update_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::UpdateServiceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def update_service request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_service_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteServiceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_service request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_service_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_discovered_workloads REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse] + # A result object deserialized from the server's reply + def list_discovered_workloads request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_discovered_workloads_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_discovered_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # A result object deserialized from the server's reply + def get_discovered_workload request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_discovered_workload_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::DiscoveredWorkload.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the lookup_discovered_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse] + # A result object deserialized from the server's reply + def lookup_discovered_workload request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_lookup_discovered_workload_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_workloads REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListWorkloadsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListWorkloadsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListWorkloadsResponse] + # A result object deserialized from the server's reply + def list_workloads request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_workloads_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ListWorkloadsResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the create_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateWorkloadRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_workload request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_workload_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetWorkloadRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::Workload] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::Workload] + # A result object deserialized from the server's reply + def get_workload request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_workload_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::Workload.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the update_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::UpdateWorkloadRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def update_workload request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_workload_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteWorkloadRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_workload request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_workload_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_applications REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListApplicationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::ListApplicationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::ListApplicationsResponse] + # A result object deserialized from the server's reply + def list_applications request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_applications_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::ListApplicationsResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the create_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateApplicationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_application request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_application_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetApplicationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::AppHub::V1::Application] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::AppHub::V1::Application] + # A result object deserialized from the server's reply + def get_application request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_application_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::AppHub::V1::Application.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the update_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::UpdateApplicationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def update_application request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_application_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteApplicationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_application request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_application_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the lookup_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_lookup_service_project_attachment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}:lookupServiceProjectAttachment", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_service_project_attachments REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_service_project_attachments_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/serviceProjectAttachments", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_service_project_attachment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/serviceProjectAttachments", + body: "service_project_attachment", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_service_project_attachment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/serviceProjectAttachments/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_service_project_attachment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/serviceProjectAttachments/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the detach_service_project_attachment REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_detach_service_project_attachment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:detachServiceProjectAttachment", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_discovered_services REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_discovered_services_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/discoveredServices", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_discovered_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_discovered_service_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/discoveredServices/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the lookup_discovered_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_lookup_discovered_service_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/discoveredServices:lookup", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_services REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListServicesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_services_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/services", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateServiceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_service_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/services", + body: "service", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetServiceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_service_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/services/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::UpdateServiceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_service_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{service.name}", + body: "service", + matches: [ + ["service.name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/services/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_service REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteServiceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_service_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/services/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_discovered_workloads REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_discovered_workloads_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/discoveredWorkloads", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_discovered_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_discovered_workload_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/discoveredWorkloads/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the lookup_discovered_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_lookup_discovered_workload_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/discoveredWorkloads:lookup", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_workloads REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListWorkloadsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_workloads_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/workloads", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateWorkloadRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_workload_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/workloads", + body: "workload", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetWorkloadRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_workload_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/workloads/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::UpdateWorkloadRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_workload_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{workload.name}", + body: "workload", + matches: [ + ["workload.name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/workloads/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_workload REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteWorkloadRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_workload_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/workloads/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_applications REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::ListApplicationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_applications_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/applications", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::CreateApplicationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_application_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/applications", + body: "application", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::GetApplicationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_application_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::UpdateApplicationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_application_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{application.name}", + body: "application", + matches: [ + ["application.name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_application REST call + # + # @param request_pb [::Google::Cloud::AppHub::V1::DeleteApplicationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_application_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/bindings_override.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/bindings_override.rb new file mode 100644 index 000000000000..911b86850d18 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/bindings_override.rb @@ -0,0 +1,135 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/config" + +module Google + module Cloud + module AppHub + ## + # @example Loading just the REST part of this package, including all its services, and instantiating a REST client + # + # require "google/cloud/app_hub/v1/rest" + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + module V1 + ## + # @private + # Initialize the mixin bindings configuration + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "AppHub"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + + default_config = Configuration.new parent_config + default_config.bindings_override["google.cloud.location.Locations.GetLocation"] = [ + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ], + body: nil + ) + ] + default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [ + + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :get, + uri_template: "/v1/{name}/locations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ], + body: nil + ) + ] + default_config.bindings_override["google.iam.v1.IAMPolicy.GetIamPolicy"] = [ + + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :get, + uri_template: "/v1/{resource}:getIamPolicy", + matches: [ + ["resource", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ], + body: nil + ) + ] + default_config.bindings_override["google.iam.v1.IAMPolicy.SetIamPolicy"] = [ + + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :post, + uri_template: "/v1/{resource}:setIamPolicy", + matches: [ + ["resource", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ], + body: "*" + ) + ] + default_config.bindings_override["google.iam.v1.IAMPolicy.TestIamPermissions"] = [ + + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :post, + uri_template: "/v1/{resource}:testIamPermissions", + matches: [ + ["resource", %r{^projects/[^/]+/locations/[^/]+/applications/[^/]+/?$}, false] + ], + body: "*" + ) + ] + default_config + end + yield @configure if block_given? + @configure + end + + ## + # @private + # Configuration class for the google.cloud.apphub.v1 package. + # + # This class contains common configuration for all services + # of the google.cloud.apphub.v1 package. + # + # This configuration is for internal use of the client library classes, + # and it is not intended that the end-users will read or change it. + # + class Configuration + extend ::Gapic::Config + + # @private + # Overrides for http bindings for the RPC of the mixins for this package. + # Services in this package should use these when creating clients for the mixin services. + # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] + config_attr :bindings_override, {}, ::Hash, nil + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/rest.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/rest.rb new file mode 100644 index 000000000000..82e67cf4076a --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/rest.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/app_hub/v1/app_hub/rest" +require "google/cloud/app_hub/v1/bindings_override" +require "google/cloud/app_hub/v1/version" + +module Google + module Cloud + module AppHub + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/cloud/app_hub/v1/rest" + # client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new + # + module V1 + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/version.rb b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/version.rb new file mode 100644 index 000000000000..6cfb21ad97e1 --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/app_hub/v1/version.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + VERSION = "0.0.1" + end + end + end +end diff --git a/google-cloud-app_hub-v1/lib/google/cloud/apphub/v1/apphub_service_pb.rb b/google-cloud-app_hub-v1/lib/google/cloud/apphub/v1/apphub_service_pb.rb new file mode 100644 index 000000000000..6b783e0af14e --- /dev/null +++ b/google-cloud-app_hub-v1/lib/google/cloud/apphub/v1/apphub_service_pb.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/apphub/v1/apphub_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/apphub/v1/application_pb' +require 'google/cloud/apphub/v1/service_pb' +require 'google/cloud/apphub/v1/service_project_attachment_pb' +require 'google/cloud/apphub/v1/workload_pb' +require 'google/longrunning/operations_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n+google/cloud/apphub/v1/apphub_service.proto\x12\x16google.cloud.apphub.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a(google/cloud/apphub/v1/application.proto\x1a$google/cloud/apphub/v1/service.proto\x1a\x37google/cloud/apphub/v1/service_project_attachment.proto\x1a%google/cloud/apphub/v1/workload.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"`\n%LookupServiceProjectAttachmentRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\"~\n&LookupServiceProjectAttachmentResponse\x12T\n\x1aservice_project_attachment\x18\x01 \x01(\x0b\x32\x30.google.cloud.apphub.v1.ServiceProjectAttachment\"\xcb\x01\n$ListServiceProjectAttachmentsRequest\x12\x46\n\x06parent\x18\x01 \x01(\tB6\xe0\x41\x02\xfa\x41\x30\x12.apphub.googleapis.com/ServiceProjectAttachment\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"\xac\x01\n%ListServiceProjectAttachmentsResponse\x12U\n\x1bservice_project_attachments\x18\x01 \x03(\x0b\x32\x30.google.cloud.apphub.v1.ServiceProjectAttachment\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"\x8f\x02\n%CreateServiceProjectAttachmentRequest\x12\x46\n\x06parent\x18\x01 \x01(\tB6\xe0\x41\x02\xfa\x41\x30\x12.apphub.googleapis.com/ServiceProjectAttachment\x12*\n\x1dservice_project_attachment_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12Y\n\x1aservice_project_attachment\x18\x03 \x01(\x0b\x32\x30.google.cloud.apphub.v1.ServiceProjectAttachmentB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x04 \x01(\tB\x03\xe0\x41\x01\"j\n\"GetServiceProjectAttachmentRequest\x12\x44\n\x04name\x18\x01 \x01(\tB6\xe0\x41\x02\xfa\x41\x30\n.apphub.googleapis.com/ServiceProjectAttachment\"\x86\x01\n%DeleteServiceProjectAttachmentRequest\x12\x44\n\x04name\x18\x01 \x01(\tB6\xe0\x41\x02\xfa\x41\x30\n.apphub.googleapis.com/ServiceProjectAttachment\x12\x17\n\nrequest_id\x18\x02 \x01(\tB\x03\xe0\x41\x01\"`\n%DetachServiceProjectAttachmentRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\"(\n&DetachServiceProjectAttachmentResponse\"\xa9\x01\n\x13ListServicesRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\x12\x1d\x61pphub.googleapis.com/Service\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"w\n\x14ListServicesResponse\x12\x31\n\x08services\x18\x01 \x03(\x0b\x32\x1f.google.cloud.apphub.v1.Service\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"\xbd\x01\n\x1dListDiscoveredServicesRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\x12\'apphub.googleapis.com/DiscoveredService\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"\x96\x01\n\x1eListDiscoveredServicesResponse\x12\x46\n\x13\x64iscovered_services\x18\x01 \x03(\x0b\x32).google.cloud.apphub.v1.DiscoveredService\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"\xb6\x01\n\x14\x43reateServiceRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\x12\x1d\x61pphub.googleapis.com/Service\x12\x17\n\nservice_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x35\n\x07service\x18\x03 \x01(\x0b\x32\x1f.google.cloud.apphub.v1.ServiceB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x04 \x01(\tB\x03\xe0\x41\x01\"H\n\x11GetServiceRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x61pphub.googleapis.com/Service\"\\\n\x1bGetDiscoveredServiceRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'apphub.googleapis.com/DiscoveredService\"s\n\x1eLookupDiscoveredServiceRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\x12\'apphub.googleapis.com/DiscoveredService\x12\x10\n\x03uri\x18\x02 \x01(\tB\x03\xe0\x41\x02\"h\n\x1fLookupDiscoveredServiceResponse\x12\x45\n\x12\x64iscovered_service\x18\x01 \x01(\x0b\x32).google.cloud.apphub.v1.DiscoveredService\"\x9c\x01\n\x14UpdateServiceRequest\x12\x34\n\x0bupdate_mask\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\x12\x35\n\x07service\x18\x02 \x01(\x0b\x32\x1f.google.cloud.apphub.v1.ServiceB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x03 \x01(\tB\x03\xe0\x41\x01\"d\n\x14\x44\x65leteServiceRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x61pphub.googleapis.com/Service\x12\x17\n\nrequest_id\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\xb1\x01\n\x17ListApplicationsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!apphub.googleapis.com/Application\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"\x83\x01\n\x18ListApplicationsResponse\x12\x39\n\x0c\x61pplications\x18\x01 \x03(\x0b\x32#.google.cloud.apphub.v1.Application\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"\xca\x01\n\x18\x43reateApplicationRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\x12!apphub.googleapis.com/Application\x12\x1b\n\x0e\x61pplication_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12=\n\x0b\x61pplication\x18\x03 \x01(\x0b\x32#.google.cloud.apphub.v1.ApplicationB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x04 \x01(\tB\x03\xe0\x41\x01\"P\n\x15GetApplicationRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!apphub.googleapis.com/Application\"\xa8\x01\n\x18UpdateApplicationRequest\x12\x34\n\x0bupdate_mask\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\x12=\n\x0b\x61pplication\x18\x02 \x01(\x0b\x32#.google.cloud.apphub.v1.ApplicationB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x03 \x01(\tB\x03\xe0\x41\x01\"l\n\x18\x44\x65leteApplicationRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!apphub.googleapis.com/Application\x12\x17\n\nrequest_id\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\xab\x01\n\x14ListWorkloadsRequest\x12\x36\n\x06parent\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \x12\x1e\x61pphub.googleapis.com/Workload\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"z\n\x15ListWorkloadsResponse\x12\x33\n\tworkloads\x18\x01 \x03(\x0b\x32 .google.cloud.apphub.v1.Workload\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"\xbf\x01\n\x1eListDiscoveredWorkloadsRequest\x12@\n\x06parent\x18\x01 \x01(\tB0\xe0\x41\x02\xfa\x41*\x12(apphub.googleapis.com/DiscoveredWorkload\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"\x99\x01\n\x1fListDiscoveredWorkloadsResponse\x12H\n\x14\x64iscovered_workloads\x18\x01 \x03(\x0b\x32*.google.cloud.apphub.v1.DiscoveredWorkload\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"\xbb\x01\n\x15\x43reateWorkloadRequest\x12\x36\n\x06parent\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \x12\x1e\x61pphub.googleapis.com/Workload\x12\x18\n\x0bworkload_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x37\n\x08workload\x18\x03 \x01(\x0b\x32 .google.cloud.apphub.v1.WorkloadB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x04 \x01(\tB\x03\xe0\x41\x01\"J\n\x12GetWorkloadRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x61pphub.googleapis.com/Workload\"^\n\x1cGetDiscoveredWorkloadRequest\x12>\n\x04name\x18\x01 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(apphub.googleapis.com/DiscoveredWorkload\"u\n\x1fLookupDiscoveredWorkloadRequest\x12@\n\x06parent\x18\x01 \x01(\tB0\xe0\x41\x02\xfa\x41*\x12(apphub.googleapis.com/DiscoveredWorkload\x12\x10\n\x03uri\x18\x02 \x01(\tB\x03\xe0\x41\x02\"k\n LookupDiscoveredWorkloadResponse\x12G\n\x13\x64iscovered_workload\x18\x01 \x01(\x0b\x32*.google.cloud.apphub.v1.DiscoveredWorkload\"\x9f\x01\n\x15UpdateWorkloadRequest\x12\x34\n\x0bupdate_mask\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\x12\x37\n\x08workload\x18\x02 \x01(\x0b\x32 .google.cloud.apphub.v1.WorkloadB\x03\xe0\x41\x02\x12\x17\n\nrequest_id\x18\x03 \x01(\tB\x03\xe0\x41\x01\"f\n\x15\x44\x65leteWorkloadRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x61pphub.googleapis.com/Workload\x12\x17\n\nrequest_id\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\x80\x02\n\x11OperationMetadata\x12\x34\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x13\n\x06target\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x11\n\x04verb\x18\x04 \x01(\tB\x03\xe0\x41\x03\x12\x1b\n\x0estatus_message\x18\x05 \x01(\tB\x03\xe0\x41\x03\x12#\n\x16requested_cancellation\x18\x06 \x01(\x08\x42\x03\xe0\x41\x03\x12\x18\n\x0b\x61pi_version\x18\x07 \x01(\tB\x03\xe0\x41\x03\x32\xa7/\n\x06\x41ppHub\x12\xf0\x01\n\x1eLookupServiceProjectAttachment\x12=.google.cloud.apphub.v1.LookupServiceProjectAttachmentRequest\x1a>.google.cloud.apphub.v1.LookupServiceProjectAttachmentResponse\"O\xda\x41\x04name\x82\xd3\xe4\x93\x02\x42\x12@/v1/{name=projects/*/locations/*}:lookupServiceProjectAttachment\x12\xec\x01\n\x1dListServiceProjectAttachments\x12<.google.cloud.apphub.v1.ListServiceProjectAttachmentsRequest\x1a=.google.cloud.apphub.v1.ListServiceProjectAttachmentsResponse\"N\xda\x41\x06parent\x82\xd3\xe4\x93\x02?\x12=/v1/{parent=projects/*/locations/*}/serviceProjectAttachments\x12\xd4\x02\n\x1e\x43reateServiceProjectAttachment\x12=.google.cloud.apphub.v1.CreateServiceProjectAttachmentRequest\x1a\x1d.google.longrunning.Operation\"\xd3\x01\xca\x41-\n\x18ServiceProjectAttachment\x12\x11OperationMetadata\xda\x41?parent,service_project_attachment,service_project_attachment_id\x82\xd3\xe4\x93\x02[\"=/v1/{parent=projects/*/locations/*}/serviceProjectAttachments:\x1aservice_project_attachment\x12\xd9\x01\n\x1bGetServiceProjectAttachment\x12:.google.cloud.apphub.v1.GetServiceProjectAttachmentRequest\x1a\x30.google.cloud.apphub.v1.ServiceProjectAttachment\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v1/{name=projects/*/locations/*/serviceProjectAttachments/*}\x12\xf9\x01\n\x1e\x44\x65leteServiceProjectAttachment\x12=.google.cloud.apphub.v1.DeleteServiceProjectAttachmentRequest\x1a\x1d.google.longrunning.Operation\"y\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02?*=/v1/{name=projects/*/locations/*/serviceProjectAttachments/*}\x12\xf3\x01\n\x1e\x44\x65tachServiceProjectAttachment\x12=.google.cloud.apphub.v1.DetachServiceProjectAttachmentRequest\x1a>.google.cloud.apphub.v1.DetachServiceProjectAttachmentResponse\"R\xda\x41\x04name\x82\xd3\xe4\x93\x02\x45\"@/v1/{name=projects/*/locations/*}:detachServiceProjectAttachment:\x01*\x12\xd0\x01\n\x16ListDiscoveredServices\x12\x35.google.cloud.apphub.v1.ListDiscoveredServicesRequest\x1a\x36.google.cloud.apphub.v1.ListDiscoveredServicesResponse\"G\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x38\x12\x36/v1/{parent=projects/*/locations/*}/discoveredServices\x12\xbd\x01\n\x14GetDiscoveredService\x12\x33.google.cloud.apphub.v1.GetDiscoveredServiceRequest\x1a).google.cloud.apphub.v1.DiscoveredService\"E\xda\x41\x04name\x82\xd3\xe4\x93\x02\x38\x12\x36/v1/{name=projects/*/locations/*/discoveredServices/*}\x12\xde\x01\n\x17LookupDiscoveredService\x12\x36.google.cloud.apphub.v1.LookupDiscoveredServiceRequest\x1a\x37.google.cloud.apphub.v1.LookupDiscoveredServiceResponse\"R\xda\x41\nparent,uri\x82\xd3\xe4\x93\x02?\x12=/v1/{parent=projects/*/locations/*}/discoveredServices:lookup\x12\xb7\x01\n\x0cListServices\x12+.google.cloud.apphub.v1.ListServicesRequest\x1a,.google.cloud.apphub.v1.ListServicesResponse\"L\xda\x41\x06parent\x82\xd3\xe4\x93\x02=\x12;/v1/{parent=projects/*/locations/*/applications/*}/services\x12\xe6\x01\n\rCreateService\x12,.google.cloud.apphub.v1.CreateServiceRequest\x1a\x1d.google.longrunning.Operation\"\x87\x01\xca\x41\x1c\n\x07Service\x12\x11OperationMetadata\xda\x41\x19parent,service,service_id\x82\xd3\xe4\x93\x02\x46\";/v1/{parent=projects/*/locations/*/applications/*}/services:\x07service\x12\xa4\x01\n\nGetService\x12).google.cloud.apphub.v1.GetServiceRequest\x1a\x1f.google.cloud.apphub.v1.Service\"J\xda\x41\x04name\x82\xd3\xe4\x93\x02=\x12;/v1/{name=projects/*/locations/*/applications/*/services/*}\x12\xe8\x01\n\rUpdateService\x12,.google.cloud.apphub.v1.UpdateServiceRequest\x1a\x1d.google.longrunning.Operation\"\x89\x01\xca\x41\x1c\n\x07Service\x12\x11OperationMetadata\xda\x41\x13service,update_mask\x82\xd3\xe4\x93\x02N2C/v1/{service.name=projects/*/locations/*/applications/*/services/*}:\x07service\x12\xd5\x01\n\rDeleteService\x12,.google.cloud.apphub.v1.DeleteServiceRequest\x1a\x1d.google.longrunning.Operation\"w\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02=*;/v1/{name=projects/*/locations/*/applications/*/services/*}\x12\xd4\x01\n\x17ListDiscoveredWorkloads\x12\x36.google.cloud.apphub.v1.ListDiscoveredWorkloadsRequest\x1a\x37.google.cloud.apphub.v1.ListDiscoveredWorkloadsResponse\"H\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x39\x12\x37/v1/{parent=projects/*/locations/*}/discoveredWorkloads\x12\xc1\x01\n\x15GetDiscoveredWorkload\x12\x34.google.cloud.apphub.v1.GetDiscoveredWorkloadRequest\x1a*.google.cloud.apphub.v1.DiscoveredWorkload\"F\xda\x41\x04name\x82\xd3\xe4\x93\x02\x39\x12\x37/v1/{name=projects/*/locations/*/discoveredWorkloads/*}\x12\xe2\x01\n\x18LookupDiscoveredWorkload\x12\x37.google.cloud.apphub.v1.LookupDiscoveredWorkloadRequest\x1a\x38.google.cloud.apphub.v1.LookupDiscoveredWorkloadResponse\"S\xda\x41\nparent,uri\x82\xd3\xe4\x93\x02@\x12>/v1/{parent=projects/*/locations/*}/discoveredWorkloads:lookup\x12\xbb\x01\n\rListWorkloads\x12,.google.cloud.apphub.v1.ListWorkloadsRequest\x1a-.google.cloud.apphub.v1.ListWorkloadsResponse\"M\xda\x41\x06parent\x82\xd3\xe4\x93\x02>\x12\x12*] + # The destination where API teams want this client library to be published. + class CommonLanguageSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details about how and where to publish client libraries. + # @!attribute [rw] version + # @return [::String] + # Version of the API to apply these settings to. This is the full protobuf + # package for the API, ending in the version element. + # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + # @!attribute [rw] launch_stage + # @return [::Google::Api::LaunchStage] + # Launch stage of this version of the API. + # @!attribute [rw] rest_numeric_enums + # @return [::Boolean] + # When using transport=rest, the client request will encode enums as + # numbers rather than strings. + # @!attribute [rw] java_settings + # @return [::Google::Api::JavaSettings] + # Settings for legacy Java features, supported in the Service YAML. + # @!attribute [rw] cpp_settings + # @return [::Google::Api::CppSettings] + # Settings for C++ client libraries. + # @!attribute [rw] php_settings + # @return [::Google::Api::PhpSettings] + # Settings for PHP client libraries. + # @!attribute [rw] python_settings + # @return [::Google::Api::PythonSettings] + # Settings for Python client libraries. + # @!attribute [rw] node_settings + # @return [::Google::Api::NodeSettings] + # Settings for Node client libraries. + # @!attribute [rw] dotnet_settings + # @return [::Google::Api::DotnetSettings] + # Settings for .NET client libraries. + # @!attribute [rw] ruby_settings + # @return [::Google::Api::RubySettings] + # Settings for Ruby client libraries. + # @!attribute [rw] go_settings + # @return [::Google::Api::GoSettings] + # Settings for Go client libraries. + class ClientLibrarySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message configures the settings for publishing [Google Cloud Client + # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + # generated from the service config. + # @!attribute [rw] method_settings + # @return [::Array<::Google::Api::MethodSettings>] + # A list of API method settings, e.g. the behavior for methods that use the + # long-running operation pattern. + # @!attribute [rw] new_issue_uri + # @return [::String] + # Link to a *public* URI where users can report issues. Example: + # https://issuetracker.google.com/issues/new?component=190865&template=1161103 + # @!attribute [rw] documentation_uri + # @return [::String] + # Link to product home page. Example: + # https://cloud.google.com/asset-inventory/docs/overview + # @!attribute [rw] api_short_name + # @return [::String] + # Used as a tracking tag when collecting data about the APIs developer + # relations artifacts like docs, packages delivered to package managers, + # etc. Example: "speech". + # @!attribute [rw] github_label + # @return [::String] + # GitHub label to apply to issues and pull requests opened for this API. + # @!attribute [rw] codeowner_github_teams + # @return [::Array<::String>] + # GitHub teams to be added to CODEOWNERS in the directory in GitHub + # containing source code for the client libraries for this API. + # @!attribute [rw] doc_tag_prefix + # @return [::String] + # A prefix used in sample code when demarking regions to be included in + # documentation. + # @!attribute [rw] organization + # @return [::Google::Api::ClientLibraryOrganization] + # For whom the client library is being published. + # @!attribute [rw] library_settings + # @return [::Array<::Google::Api::ClientLibrarySettings>] + # Client library settings. If the same version string appears multiple + # times in this list, then the last one wins. Settings from earlier + # settings with the same version string are discarded. + # @!attribute [rw] proto_reference_documentation_uri + # @return [::String] + # Optional link to proto reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rpc + # @!attribute [rw] rest_reference_documentation_uri + # @return [::String] + # Optional link to REST reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rest + class Publishing + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Java client libraries. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Java. Clobbers the java_package option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.java.package_name" field + # in gapic.yaml. API teams should use the protobuf java_package option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 + # @!attribute [rw] service_class_names + # @return [::Google::Protobuf::Map{::String => ::String}] + # Configure the Java class name to use instead of the service's for its + # corresponding generated GAPIC client. Keys are fully-qualified + # service names as they appear in the protobuf (including the full + # the language_settings.java.interface_names" field in gapic.yaml. API + # teams should otherwise use the service name as it appears in the + # protobuf. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class JavaSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ServiceClassNamesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for C++ client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class CppSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Php client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class PhpSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Python client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class PythonSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Node client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class NodeSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Dotnet client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from original service names to renamed versions. + # This is used when the default generated types + # would cause a naming conflict. (Neither name is + # fully-qualified.) + # Example: Subscriber to SubscriberServiceApi. + # @!attribute [rw] renamed_resources + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from full resource types to the effective short name + # for the resource. This is used when otherwise resource + # named from different services would cause naming collisions. + # Example entry: + # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + # @!attribute [rw] ignored_resources + # @return [::Array<::String>] + # List of full resource types to ignore during generation. + # This is typically used for API-specific Location resources, + # which should be handled by the generator as if they were actually + # the common Location resources. + # Example entry: "documentai.googleapis.com/Location" + # @!attribute [rw] forced_namespace_aliases + # @return [::Array<::String>] + # Namespaces which must be aliased in snippets due to + # a known (but non-generator-predictable) naming collision + # @!attribute [rw] handwritten_signatures + # @return [::Array<::String>] + # Method signatures (in the form "service.method(signature)") + # which are provided separately, so shouldn't be generated. + # Snippets *calling* these methods are still generated, however. + class DotnetSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedResourcesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Ruby client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class RubySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Go client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class GoSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Describes the generator configuration for a method. + # @!attribute [rw] selector + # @return [::String] + # The fully qualified name of the method, for which the options below apply. + # This is used to find the method to apply the options. + # @!attribute [rw] long_running + # @return [::Google::Api::MethodSettings::LongRunning] + # Describes settings to use for long-running operations when generating + # API methods for RPCs. Complements RPCs that use the annotations in + # google/longrunning/operations.proto. + # + # Example of a YAML configuration:: + # + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: + # seconds: 60 # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: + # seconds: 360 # 6 minutes + # total_poll_timeout: + # seconds: 54000 # 90 minutes + # @!attribute [rw] auto_populated_fields + # @return [::Array<::String>] + # List of top-level fields of the request message, that should be + # automatically populated by the client libraries based on their + # (google.api.field_info).format. Currently supported format: UUID4. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + class MethodSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes settings to use when generating API methods that use the + # long-running operation pattern. + # All default values below are from those used in the client library + # generators (e.g. + # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + # @!attribute [rw] initial_poll_delay + # @return [::Google::Protobuf::Duration] + # Initial delay after which the first poll request will be made. + # Default value: 5 seconds. + # @!attribute [rw] poll_delay_multiplier + # @return [::Float] + # Multiplier to gradually increase delay between subsequent polls until it + # reaches max_poll_delay. + # Default value: 1.5. + # @!attribute [rw] max_poll_delay + # @return [::Google::Protobuf::Duration] + # Maximum time between two subsequent poll requests. + # Default value: 45 seconds. + # @!attribute [rw] total_poll_timeout + # @return [::Google::Protobuf::Duration] + # Total polling timeout. + # Default value: 5 minutes. + class LongRunning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The organization for which the client libraries are being published. + # Affects the url where generated docs are published, etc. + module ClientLibraryOrganization + # Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 + + # Google Cloud Platform Org. + CLOUD = 1 + + # Ads (Advertising) Org. + ADS = 2 + + # Photos Org. + PHOTOS = 3 + + # Street View Org. + STREET_VIEW = 4 + + # Shopping Org. + SHOPPING = 5 + + # Geo Org. + GEO = 6 + + # Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7 + end + + # To where should client libraries be published? + module ClientLibraryDestination + # Client libraries will neither be generated nor published to package + # managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 + + # Generate the client library in a repo under github.com/googleapis, + # but don't publish it to package managers. + GITHUB = 10 + + # Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20 + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/api/field_behavior.rb b/google-cloud-app_hub-v1/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..b03587481349 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # An indicator of the behavior of a given field (for example, that a field + # is required in requests, or given as output but ignored as input). + # This **does not** change the behavior in protocol buffers itself; it only + # denotes the behavior and may affect how API tooling handles the field. + # + # Note: This enum **may** receive new values in the future. + module FieldBehavior + # Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0 + + # Specifically denotes a field as optional. + # While all fields in protocol buffers are optional, this may be specified + # for emphasis if appropriate. + OPTIONAL = 1 + + # Denotes a field as required. + # This indicates that the field **must** be provided as part of the request, + # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2 + + # Denotes a field as output only. + # This indicates that the field is provided in responses, but including the + # field in a request does nothing (the server *must* ignore it and + # *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3 + + # Denotes a field as input only. + # This indicates that the field is provided in requests, and the + # corresponding field is not included in output. + INPUT_ONLY = 4 + + # Denotes a field as immutable. + # This indicates that the field may be set once in a request to create a + # resource, but may not be changed thereafter. + IMMUTABLE = 5 + + # Denotes that a (repeated) field is an unordered list. + # This indicates that the service may provide the elements of the list + # in any arbitrary order, rather than the order the user originally + # provided. Additionally, the list's order may or may not be stable. + UNORDERED_LIST = 6 + + # Denotes that this field returns a non-empty default value if not set. + # This indicates that if the user provides the empty value in a request, + # a non-empty value will be returned. The user will not be aware of what + # non-empty value to expect. + NON_EMPTY_DEFAULT = 7 + + # Denotes that the field in a resource (a message annotated with + # google.api.resource) is used in the resource name to uniquely identify the + # resource. For AIP-compliant APIs, this should only be applied to the + # `name` field on the resource. + # + # This behavior should not be applied to references to other resources within + # the message. + # + # The identifier field of resources often have different field behavior + # depending on the request it is embedded in (e.g. for Create methods name + # is optional and unused, while for Update methods it is required). Instead + # of method-specific annotations, only `IDENTIFIER` is required. + IDENTIFIER = 8 + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/api/field_info.rb b/google-cloud-app_hub-v1/proto_docs/google/api/field_info.rb new file mode 100644 index 000000000000..84d6de0d67a7 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/api/field_info.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Rich semantic information of an API field beyond basic typing. + # @!attribute [rw] format + # @return [::Google::Api::FieldInfo::Format] + # The standard format of a field value. This does not explicitly configure + # any API consumer, just documents the API's format for the field it is + # applied to. + class FieldInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The standard format of a field value. The supported formats are all backed + # by either an RFC defined by the IETF or a Google-defined AIP. + module Format + # Default, unspecified value. + FORMAT_UNSPECIFIED = 0 + + # Universally Unique Identifier, version 4, value as defined by + # https://datatracker.ietf.org/doc/html/rfc4122. The value may be + # normalized to entirely lowercase letters. For example, the value + # `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to + # `f47ac10b-58cc-0372-8567-0e02b2c3d479`. + UUID4 = 1 + + # Internet Protocol v4 value as defined by [RFC + # 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be + # condensed, with leading zeros in each octet stripped. For example, + # `001.022.233.040` would be condensed to `1.22.233.40`. + IPV4 = 2 + + # Internet Protocol v6 value as defined by [RFC + # 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be + # normalized to entirely lowercase letters with zeros compressed, following + # [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example, + # the value `2001:0DB8:0::0` would be normalized to `2001:db8::`. + IPV6 = 3 + + # An IP address in either v4 or v6 format as described by the individual + # values defined herein. See the comments on the IPV4 and IPV6 types for + # allowed normalizations of each. + IPV4_OR_IPV6 = 4 + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/api/launch_stage.rb b/google-cloud-app_hub-v1/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..38b4b61e6061 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # The launch stage as defined by [Google Cloud Platform + # Launch Stages](https://cloud.google.com/terms/launch-stages). + module LaunchStage + # Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0 + + # The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6 + + # Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7 + + # Early Access features are limited to a closed group of testers. To use + # these features, you must sign up in advance and sign a Trusted Tester + # agreement (which includes confidentiality provisions). These features may + # be unstable, changed in backward-incompatible ways, and are not + # guaranteed to be released. + EARLY_ACCESS = 1 + + # Alpha is a limited availability test for releases before they are cleared + # for widespread use. By Alpha, all significant design issues are resolved + # and we are in the process of verifying functionality. Alpha customers + # need to apply for access, agree to applicable terms, and have their + # projects allowlisted. Alpha releases don't have to be feature complete, + # no SLAs are provided, and there are no technical support obligations, but + # they will be far enough along that customers can actually use them in + # test environments or for limited-use tests -- just like they would in + # normal production cases. + ALPHA = 2 + + # Beta is the point at which we are ready to open a release for any + # customer to use. There are no SLA or technical support obligations in a + # Beta release. Products will be complete from a feature perspective, but + # may have some open outstanding issues. Beta releases are suitable for + # limited production use cases. + BETA = 3 + + # GA features are open to all developers and are considered stable and + # fully qualified for production use. + GA = 4 + + # Deprecated features are scheduled to be shut down and removed. For more + # information, see the "Deprecation Policy" section of our [Terms of + # Service](https://cloud.google.com/terms/) + # and the [Google Cloud Platform Subject to the Deprecation + # Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5 + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/api/resource.rb b/google-cloud-app_hub-v1/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..6497ebc78dc1 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/api/resource.rb @@ -0,0 +1,222 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # A simple descriptor of a resource type. + # + # ResourceDescriptor annotates a resource message (either by means of a + # protobuf annotation or use in the service config), and associates the + # resource's schema, the resource type, and the pattern of the resource name. + # + # Example: + # + # message Topic { + # // Indicates this message defines a resource schema. + # // Declares the resource type in the format of {service}/{kind}. + # // For Kubernetes resources, the format is {api group}/{kind}. + # option (google.api.resource) = { + # type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # + # Sometimes, resources have multiple patterns, typically because they can + # live under multiple parents. + # + # Example: + # + # message LogEntry { + # option (google.api.resource) = { + # type: "logging.googleapis.com/LogEntry" + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: 'logging.googleapis.com/LogEntry' + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # @!attribute [rw] type + # @return [::String] + # The resource type. It must be in the format of + # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be + # singular and must not include version numbers. + # + # Example: `storage.googleapis.com/Bucket` + # + # The value of the resource_type_kind must follow the regular expression + # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + # should use PascalCase (UpperCamelCase). The maximum number of + # characters allowed for the `resource_type_kind` is 100. + # @!attribute [rw] pattern + # @return [::Array<::String>] + # Optional. The relative resource name pattern associated with this resource + # type. The DNS prefix of the full resource name shouldn't be specified here. + # + # The path pattern must follow the syntax, which aligns with HTTP binding + # syntax: + # + # Template = Segment { "/" Segment } ; + # Segment = LITERAL | Variable ; + # Variable = "{" LITERAL "}" ; + # + # Examples: + # + # - "projects/\\{project}/topics/\\{topic}" + # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" + # + # The components in braces correspond to the IDs for each resource in the + # hierarchy. It is expected that, if multiple patterns are provided, + # the same component name (e.g. "project") refers to IDs of the same + # type of resource. + # @!attribute [rw] name_field + # @return [::String] + # Optional. The field on the resource that designates the resource name + # field. If omitted, this is assumed to be "name". + # @!attribute [rw] history + # @return [::Google::Api::ResourceDescriptor::History] + # Optional. The historical or future-looking state of the resource pattern. + # + # Example: + # + # // The InspectTemplate message originally only supported resource + # // names with organization, and project was added later. + # message InspectTemplate { + # option (google.api.resource) = { + # type: "dlp.googleapis.com/InspectTemplate" + # pattern: + # "organizations/{organization}/inspectTemplates/{inspect_template}" + # pattern: "projects/{project}/inspectTemplates/{inspect_template}" + # history: ORIGINALLY_SINGLE_PATTERN + # }; + # } + # @!attribute [rw] plural + # @return [::String] + # The plural name used in the resource name and permission names, such as + # 'projects' for the resource name of 'projects/\\{project}' and the permission + # name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same + # concept of the `plural` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # + # Note: The plural form is required even for singleton resources. See + # https://aip.dev/156 + # @!attribute [rw] singular + # @return [::String] + # The same concept of the `singular` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # Such as "project" for the `resourcemanager.googleapis.com/Project` type. + # @!attribute [rw] style + # @return [::Array<::Google::Api::ResourceDescriptor::Style>] + # Style flag(s) for this resource. + # These indicate that a resource is expected to conform to a given + # style. See the specific style flags for additional information. + class ResourceDescriptor + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A description of the historical or future-looking state of the + # resource pattern. + module History + # The "unset" value. + HISTORY_UNSPECIFIED = 0 + + # The resource originally had one pattern and launched as such, and + # additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1 + + # The resource has one pattern, but the API owner expects to add more + # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + # that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2 + end + + # A flag representing a specific style that a resource claims to conform to. + module Style + # The unspecified value. Do not use. + STYLE_UNSPECIFIED = 0 + + # This resource is intended to be "declarative-friendly". + # + # Declarative-friendly resources must be more strictly consistent, and + # setting this to true communicates to tools that this resource should + # adhere to declarative-friendly expectations. + # + # Note: This is used by the API linter (linter.aip.dev) to enable + # additional checks. + DECLARATIVE_FRIENDLY = 1 + end + end + + # Defines a proto annotation that describes a string field that refers to + # an API resource. + # @!attribute [rw] type + # @return [::String] + # The resource type that the annotated field references. + # + # Example: + # + # message Subscription { + # string topic = 2 [(google.api.resource_reference) = { + # type: "pubsub.googleapis.com/Topic" + # }]; + # } + # + # Occasionally, a field may reference an arbitrary resource. In this case, + # APIs use the special value * in their resource reference. + # + # Example: + # + # message GetIamPolicyRequest { + # string resource = 2 [(google.api.resource_reference) = { + # type: "*" + # }]; + # } + # @!attribute [rw] child_type + # @return [::String] + # The resource type of a child collection that the annotated field + # references. This is useful for annotating the `parent` field that + # doesn't have a fixed resource type. + # + # Example: + # + # message ListLogEntriesRequest { + # string parent = 1 [(google.api.resource_reference) = { + # child_type: "logging.googleapis.com/LogEntry" + # }; + # } + class ResourceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/apphub_service.rb b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/apphub_service.rb new file mode 100644 index 000000000000..794c708929cd --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/apphub_service.rb @@ -0,0 +1,786 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + # Request for LookupServiceProjectAttachment. + # @!attribute [rw] name + # @return [::String] + # Required. Service project ID and location to lookup service project + # attachment for. Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + class LookupServiceProjectAttachmentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for LookupServiceProjectAttachment. + # @!attribute [rw] service_project_attachment + # @return [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # Service project attachment for a project if exists, empty otherwise. + class LookupServiceProjectAttachmentResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListServiceProjectAttachments. + # @!attribute [rw] parent + # @return [::String] + # Required. Host project ID and location to list service project attachments. + # Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filtering results. + # @!attribute [rw] order_by + # @return [::String] + # Optional. Hint for how to order the results. + class ListServiceProjectAttachmentsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListServiceProjectAttachments. + # @!attribute [rw] service_project_attachments + # @return [::Array<::Google::Cloud::AppHub::V1::ServiceProjectAttachment>] + # List of service project attachments. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results the server should return. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListServiceProjectAttachmentsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for CreateServiceProjectAttachment. + # @!attribute [rw] parent + # @return [::String] + # Required. Host project ID and location to which service project is being + # attached. Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + # @!attribute [rw] service_project_attachment_id + # @return [::String] + # Required. The service project attachment identifier must contain the + # project id of the service project specified in the + # service_project_attachment.service_project field. + # @!attribute [rw] service_project_attachment + # @return [::Google::Cloud::AppHub::V1::ServiceProjectAttachment] + # Required. The resource being created. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class CreateServiceProjectAttachmentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetServiceProjectAttachment. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the service project attachment to + # retrieve. Expected format: + # `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`. + class GetServiceProjectAttachmentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DeleteServiceProjectAttachment. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the service project attachment to delete. + # Expected format: + # `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class DeleteServiceProjectAttachmentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DetachServiceProjectAttachment. + # @!attribute [rw] name + # @return [::String] + # Required. Service project id and location to detach from a host project. + # Only global location is supported. Expected format: + # `projects/{project}/locations/{location}`. + class DetachServiceProjectAttachmentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for DetachServiceProjectAttachment. + class DetachServiceProjectAttachmentResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListServices. + # @!attribute [rw] parent + # @return [::String] + # Required. Fully qualified name of the parent Application to list Services + # for. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filtering results + # @!attribute [rw] order_by + # @return [::String] + # Optional. Hint for how to order the results + class ListServicesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListServices. + # @!attribute [rw] services + # @return [::Array<::Google::Cloud::AppHub::V1::Service>] + # List of Services. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results the server should return. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListServicesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListDiscoveredServices. + # @!attribute [rw] parent + # @return [::String] + # Required. Project and location to list Discovered Services on. + # Expected format: `projects/{project}/locations/{location}`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filtering results. + # @!attribute [rw] order_by + # @return [::String] + # Optional. Hint for how to order the results. + class ListDiscoveredServicesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListDiscoveredServices. + # @!attribute [rw] discovered_services + # @return [::Array<::Google::Cloud::AppHub::V1::DiscoveredService>] + # List of Discovered Services. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results the server should return. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListDiscoveredServicesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for CreateService. + # @!attribute [rw] parent + # @return [::String] + # Required. Fully qualified name of the parent Application to create the + # Service in. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @!attribute [rw] service_id + # @return [::String] + # Required. The Service identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @!attribute [rw] service + # @return [::Google::Cloud::AppHub::V1::Service] + # Required. The resource being created. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class CreateServiceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetService. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Service to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}/services/{service}`. + class GetServiceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetDiscoveredService. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Discovered Service to fetch. + # Expected format: + # `projects/{project}/locations/{location}/discoveredServices/{discoveredService}`. + class GetDiscoveredServiceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for LookupDiscoveredService. + # @!attribute [rw] parent + # @return [::String] + # Required. Host project ID and location to lookup Discovered Service in. + # Expected format: `projects/{project}/locations/{location}`. + # @!attribute [rw] uri + # @return [::String] + # Required. Resource URI to find DiscoveredService for. + # Accepts both project number and project ID and does translation when + # needed. + class LookupDiscoveredServiceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for LookupDiscoveredService. + # @!attribute [rw] discovered_service + # @return [::Google::Cloud::AppHub::V1::DiscoveredService] + # Discovered Service if exists, empty otherwise. + class LookupDiscoveredServiceResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for UpdateService. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Required. Field mask is used to specify the fields to be overwritten in the + # Service resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @!attribute [rw] service + # @return [::Google::Cloud::AppHub::V1::Service] + # Required. The resource being updated. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class UpdateServiceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DeleteService. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Service to delete from an + # Application. Expected format: + # `projects/{project}/locations/{location}/applications/{application}/services/{service}`. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class DeleteServiceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListApplications. + # @!attribute [rw] parent + # @return [::String] + # Required. Project and location to list Applications on. + # Expected format: `projects/{project}/locations/{location}`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filtering results. + # @!attribute [rw] order_by + # @return [::String] + # Optional. Hint for how to order the results. + class ListApplicationsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListApplications. + # @!attribute [rw] applications + # @return [::Array<::Google::Cloud::AppHub::V1::Application>] + # List of Applications. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results the server should return. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListApplicationsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for CreateApplication. + # @!attribute [rw] parent + # @return [::String] + # Required. Project and location to create Application in. + # Expected format: `projects/{project}/locations/{location}`. + # @!attribute [rw] application_id + # @return [::String] + # Required. The Application identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @!attribute [rw] application + # @return [::Google::Cloud::AppHub::V1::Application] + # Required. The resource being created + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class CreateApplicationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetApplication. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Application to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + class GetApplicationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for UpdateApplication. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Required. Field mask is used to specify the fields to be overwritten in the + # Application resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @!attribute [rw] application + # @return [::Google::Cloud::AppHub::V1::Application] + # Required. The resource being updated. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class UpdateApplicationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DeleteApplication. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Application to delete. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class DeleteApplicationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListWorkloads. + # @!attribute [rw] parent + # @return [::String] + # Required. Fully qualified name of the parent Application to list Workloads + # for. Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filtering results. + # @!attribute [rw] order_by + # @return [::String] + # Optional. Hint for how to order the results. + class ListWorkloadsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListWorkloads. + # @!attribute [rw] workloads + # @return [::Array<::Google::Cloud::AppHub::V1::Workload>] + # List of Workloads. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results the server should return. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListWorkloadsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListDiscoveredWorkloads. + # @!attribute [rw] parent + # @return [::String] + # Required. Project and location to list Discovered Workloads on. + # Expected format: `projects/{project}/locations/{location}`. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. Server may return fewer items than + # requested. If unspecified, server will pick an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filtering results. + # @!attribute [rw] order_by + # @return [::String] + # Optional. Hint for how to order the results. + class ListDiscoveredWorkloadsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListDiscoveredWorkloads. + # @!attribute [rw] discovered_workloads + # @return [::Array<::Google::Cloud::AppHub::V1::DiscoveredWorkload>] + # List of Discovered Workloads. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results the server should return. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListDiscoveredWorkloadsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for CreateWorkload. + # @!attribute [rw] parent + # @return [::String] + # Required. Fully qualified name of the Application to create Workload in. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}`. + # @!attribute [rw] workload_id + # @return [::String] + # Required. The Workload identifier. + # Must contain only lowercase letters, numbers + # or hyphens, with the first character a letter, the last a letter or a + # number, and a 63 character maximum. + # @!attribute [rw] workload + # @return [::Google::Cloud::AppHub::V1::Workload] + # Required. The resource being created. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class CreateWorkloadRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetWorkload. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Workload to fetch. + # Expected format: + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`. + class GetWorkloadRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetDiscoveredWorkload. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Discovered Workload to fetch. + # Expected format: + # `projects/{project}/locations/{location}/discoveredWorkloads/{discoveredWorkload}`. + class GetDiscoveredWorkloadRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for LookupDiscoveredWorkload. + # @!attribute [rw] parent + # @return [::String] + # Required. Host project ID and location to lookup Discovered Workload in. + # Expected format: `projects/{project}/locations/{location}`. + # @!attribute [rw] uri + # @return [::String] + # Required. Resource URI to find Discovered Workload for. + # Accepts both project number and project ID and does translation when + # needed. + class LookupDiscoveredWorkloadRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for LookupDiscoveredWorkload. + # @!attribute [rw] discovered_workload + # @return [::Google::Cloud::AppHub::V1::DiscoveredWorkload] + # Discovered Workload if exists, empty otherwise. + class LookupDiscoveredWorkloadResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for UpdateWorkload. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Required. Field mask is used to specify the fields to be overwritten in the + # Workload resource by the update. + # The fields specified in the update_mask are relative to the resource, not + # the full request. + # The API changes the values of the fields as specified in the update_mask. + # The API ignores the values of all fields not covered by the update_mask. + # You can also unset a field by not specifying it in the updated message, but + # adding the field to the mask. This clears whatever value the field + # previously had. + # @!attribute [rw] workload + # @return [::Google::Cloud::AppHub::V1::Workload] + # Required. The resource being updated. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes since the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class UpdateWorkloadRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DeleteWorkload. + # @!attribute [rw] name + # @return [::String] + # Required. Fully qualified name of the Workload to delete from an + # Application. Expected format: + # `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`. + # @!attribute [rw] request_id + # @return [::String] + # Optional. An optional request ID to identify requests. Specify a unique + # request ID so that if you must retry your request, the server will know to + # ignore the request if it has already been completed. The server will + # guarantee that for at least 60 minutes after the first request. + # + # For example, consider a situation where you make an initial request and the + # request times out. If you make the request again with the same request + # ID, the server can check if original operation with the same request ID + # was received, and if so, will ignore the second request. This prevents + # clients from accidentally creating duplicate commitments. + # + # The request ID must be a valid UUID with the exception that zero UUID is + # not supported (00000000-0000-0000-0000-000000000000). + class DeleteWorkloadRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents the metadata of the long-running operation. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time the operation was created. + # @!attribute [r] end_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time the operation finished running. + # @!attribute [r] target + # @return [::String] + # Output only. Server-defined resource path for the target of the operation. + # @!attribute [r] verb + # @return [::String] + # Output only. Name of the verb executed by the operation. + # @!attribute [r] status_message + # @return [::String] + # Output only. Human-readable status of the operation, if any. + # @!attribute [r] requested_cancellation + # @return [::Boolean] + # Output only. Identifies whether the user has requested cancellation + # of the operation. Operations that have been cancelled successfully + # have [Operation.error][] value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of 1, corresponding to + # `Code.CANCELLED`. + # @!attribute [r] api_version + # @return [::String] + # Output only. API version used to start the operation. + class OperationMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/application.rb b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/application.rb new file mode 100644 index 000000000000..facf8b03304e --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/application.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + # Application defines the governance boundary for App Hub Entities that + # perform a logical end-to-end business function. + # App Hub supports application level IAM permission to align with governance + # requirements. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of an Application. Format: + # "projects/\\{host-project-id}/locations/\\{location}/applications/\\{application-id}" + # @!attribute [rw] display_name + # @return [::String] + # Optional. User-defined name for the Application. + # Can have a maximum length of 63 characters. + # @!attribute [rw] description + # @return [::String] + # Optional. User-defined description of an Application. + # Can have a maximum length of 2048 characters. + # @!attribute [rw] attributes + # @return [::Google::Cloud::AppHub::V1::Attributes] + # Optional. Consumer provided attributes. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Create time. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Update time. + # @!attribute [rw] scope + # @return [::Google::Cloud::AppHub::V1::Scope] + # Required. Immutable. Defines what data can be included into this + # Application. Limits which Services and Workloads can be registered. + # @!attribute [r] uid + # @return [::String] + # Output only. A universally unique identifier (in UUID4 format) for the + # `Application`. + # @!attribute [r] state + # @return [::Google::Cloud::AppHub::V1::Application::State] + # Output only. Application state. + class Application + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Application state. + module State + # Unspecified state. + STATE_UNSPECIFIED = 0 + + # The Application is being created. + CREATING = 1 + + # The Application is ready to register Services and Workloads. + ACTIVE = 2 + + # The Application is being deleted. + DELETING = 3 + end + end + + # Scope of an application. + # @!attribute [rw] type + # @return [::Google::Cloud::AppHub::V1::Scope::Type] + # Required. Scope Type. + class Scope + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Scope Type. + module Type + # Unspecified type. + TYPE_UNSPECIFIED = 0 + + # Regional type. + REGIONAL = 1 + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/attributes.rb b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/attributes.rb new file mode 100644 index 000000000000..3f3e255555ca --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/attributes.rb @@ -0,0 +1,115 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + # Consumer provided attributes. + # @!attribute [rw] criticality + # @return [::Google::Cloud::AppHub::V1::Criticality] + # Optional. User-defined criticality information. + # @!attribute [rw] environment + # @return [::Google::Cloud::AppHub::V1::Environment] + # Optional. User-defined environment information. + # @!attribute [rw] developer_owners + # @return [::Array<::Google::Cloud::AppHub::V1::ContactInfo>] + # Optional. Developer team that owns development and coding. + # @!attribute [rw] operator_owners + # @return [::Array<::Google::Cloud::AppHub::V1::ContactInfo>] + # Optional. Operator team that ensures runtime and operations. + # @!attribute [rw] business_owners + # @return [::Array<::Google::Cloud::AppHub::V1::ContactInfo>] + # Optional. Business team that ensures user needs are met and value is + # delivered + class Attributes + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Criticality of the Application, Service, or Workload + # @!attribute [rw] type + # @return [::Google::Cloud::AppHub::V1::Criticality::Type] + # Required. Criticality Type. + class Criticality + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Criticality Type. + module Type + # Unspecified type. + TYPE_UNSPECIFIED = 0 + + # Mission critical service, application or workload. + MISSION_CRITICAL = 1 + + # High impact. + HIGH = 2 + + # Medium impact. + MEDIUM = 3 + + # Low impact. + LOW = 4 + end + end + + # Environment of the Application, Service, or Workload + # @!attribute [rw] type + # @return [::Google::Cloud::AppHub::V1::Environment::Type] + # Required. Environment Type. + class Environment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Environment Type. + module Type + # Unspecified type. + TYPE_UNSPECIFIED = 0 + + # Production environment. + PRODUCTION = 1 + + # Staging environment. + STAGING = 2 + + # Test environment. + TEST = 3 + + # Development environment. + DEVELOPMENT = 4 + end + end + + # Contact information of stakeholders. + # @!attribute [rw] display_name + # @return [::String] + # Optional. Contact's name. + # Can have a maximum length of 63 characters. + # @!attribute [rw] email + # @return [::String] + # Required. Email address of the contacts. + class ContactInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/service.rb b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/service.rb new file mode 100644 index 000000000000..37ff16a9dab0 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/service.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + # Service is an App Hub data model that contains a discovered service, which + # represents a network/api interface that exposes some functionality to clients + # for consumption over the network. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of a Service. Format: + # "projects/\\{host-project-id}/locations/\\{location}/applications/\\{application-id}/services/\\{service-id}" + # @!attribute [rw] display_name + # @return [::String] + # Optional. User-defined name for the Service. + # Can have a maximum length of 63 characters. + # @!attribute [rw] description + # @return [::String] + # Optional. User-defined description of a Service. + # Can have a maximum length of 2048 characters. + # @!attribute [r] service_reference + # @return [::Google::Cloud::AppHub::V1::ServiceReference] + # Output only. Reference to an underlying networking resource that can + # comprise a Service. These are immutable. + # @!attribute [r] service_properties + # @return [::Google::Cloud::AppHub::V1::ServiceProperties] + # Output only. Properties of an underlying compute resource that can comprise + # a Service. These are immutable. + # @!attribute [rw] attributes + # @return [::Google::Cloud::AppHub::V1::Attributes] + # Optional. Consumer provided attributes. + # @!attribute [rw] discovered_service + # @return [::String] + # Required. Immutable. The resource name of the original discovered service. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Create time. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Update time. + # @!attribute [r] uid + # @return [::String] + # Output only. A universally unique identifier (UUID) for the `Service` in + # the UUID4 format. + # @!attribute [r] state + # @return [::Google::Cloud::AppHub::V1::Service::State] + # Output only. Service state. + class Service + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Service state. + module State + # Unspecified state. + STATE_UNSPECIFIED = 0 + + # The service is being created. + CREATING = 1 + + # The service is ready. + ACTIVE = 2 + + # The service is being deleted. + DELETING = 3 + + # The underlying networking resources have been deleted. + DETACHED = 4 + end + end + + # Reference to an underlying networking resource that can comprise a Service. + # @!attribute [r] uri + # @return [::String] + # Output only. The underlying resource URI (For example, URI of Forwarding + # Rule, URL Map, and Backend Service). + class ServiceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Properties of an underlying cloud resource that can comprise a Service. + # @!attribute [r] gcp_project + # @return [::String] + # Output only. The service project identifier that the underlying cloud + # resource resides in. + # @!attribute [r] location + # @return [::String] + # Output only. The location that the underlying resource resides in, for + # example, us-west1. + # @!attribute [r] zone + # @return [::String] + # Output only. The location that the underlying resource resides in if it is + # zonal, for example, us-west1-a). + class ServiceProperties + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # DiscoveredService is a network/api interface that exposes some functionality + # to clients for consumption over the network. A discovered service can be + # registered to a App Hub service. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of the discovered service. Format: + # "projects/\\{host-project-id}/locations/\\{location}/discoveredServices/\\{uuid}"" + # @!attribute [r] service_reference + # @return [::Google::Cloud::AppHub::V1::ServiceReference] + # Output only. Reference to an underlying networking resource that can + # comprise a Service. These are immutable. + # @!attribute [r] service_properties + # @return [::Google::Cloud::AppHub::V1::ServiceProperties] + # Output only. Properties of an underlying compute resource that can comprise + # a Service. These are immutable. + class DiscoveredService + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/service_project_attachment.rb b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/service_project_attachment.rb new file mode 100644 index 000000000000..e5781e56cd2d --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/service_project_attachment.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + # ServiceProjectAttachment represents an attachment from a service project to a + # host project. Service projects contain the underlying cloud + # infrastructure resources, and expose these resources to the host project + # through a ServiceProjectAttachment. With the attachments, the host project + # can provide an aggregated view of resources across all service projects. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of a ServiceProjectAttachment. Format: + # "projects/\\{host-project-id}/locations/global/serviceProjectAttachments/\\{service-project-id}." + # @!attribute [rw] service_project + # @return [::String] + # Required. Immutable. Service project name in the format: "projects/abc" or + # "projects/123". As input, project name with either project id or number are + # accepted. As output, this field will contain project number. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Create time. + # @!attribute [r] uid + # @return [::String] + # Output only. A globally unique identifier (in UUID4 format) for the + # `ServiceProjectAttachment`. + # @!attribute [r] state + # @return [::Google::Cloud::AppHub::V1::ServiceProjectAttachment::State] + # Output only. ServiceProjectAttachment state. + class ServiceProjectAttachment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # ServiceProjectAttachment state. + module State + # Unspecified state. + STATE_UNSPECIFIED = 0 + + # The ServiceProjectAttachment is being created. + CREATING = 1 + + # The ServiceProjectAttachment is ready. + # This means Services and Workloads under the corresponding + # ServiceProjectAttachment is ready for registration. + ACTIVE = 2 + + # The ServiceProjectAttachment is being deleted. + DELETING = 3 + end + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/workload.rb b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/workload.rb new file mode 100644 index 000000000000..bd70905040c5 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/cloud/apphub/v1/workload.rb @@ -0,0 +1,140 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module AppHub + module V1 + # Workload is an App Hub data model that contains a discovered workload, which + # represents a binary deployment (such as managed instance groups (MIGs) and + # GKE deployments) that performs the smallest logical subset of business + # functionality. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of the Workload. Format: + # "projects/\\{host-project-id}/locations/\\{location}/applications/\\{application-id}/workloads/\\{workload-id}" + # @!attribute [rw] display_name + # @return [::String] + # Optional. User-defined name for the Workload. + # Can have a maximum length of 63 characters. + # @!attribute [rw] description + # @return [::String] + # Optional. User-defined description of a Workload. + # Can have a maximum length of 2048 characters. + # @!attribute [r] workload_reference + # @return [::Google::Cloud::AppHub::V1::WorkloadReference] + # Output only. Reference of an underlying compute resource represented by the + # Workload. These are immutable. + # @!attribute [r] workload_properties + # @return [::Google::Cloud::AppHub::V1::WorkloadProperties] + # Output only. Properties of an underlying compute resource represented by + # the Workload. These are immutable. + # @!attribute [rw] discovered_workload + # @return [::String] + # Required. Immutable. The resource name of the original discovered workload. + # @!attribute [rw] attributes + # @return [::Google::Cloud::AppHub::V1::Attributes] + # Optional. Consumer provided attributes. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Create time. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Update time. + # @!attribute [r] uid + # @return [::String] + # Output only. A universally unique identifier (UUID) for the `Workload` in + # the UUID4 format. + # @!attribute [r] state + # @return [::Google::Cloud::AppHub::V1::Workload::State] + # Output only. Workload state. + class Workload + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Workload state. + module State + # Unspecified state. + STATE_UNSPECIFIED = 0 + + # The Workload is being created. + CREATING = 1 + + # The Workload is ready. + ACTIVE = 2 + + # The Workload is being deleted. + DELETING = 3 + + # The underlying compute resources have been deleted. + DETACHED = 4 + end + end + + # Reference of an underlying compute resource represented by the Workload. + # @!attribute [r] uri + # @return [::String] + # Output only. The underlying compute resource uri. + class WorkloadReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Properties of an underlying compute resource represented by the Workload. + # @!attribute [r] gcp_project + # @return [::String] + # Output only. The service project identifier that the underlying cloud + # resource resides in. Empty for non cloud resources. + # @!attribute [r] location + # @return [::String] + # Output only. The location that the underlying compute resource resides in + # (e.g us-west1). + # @!attribute [r] zone + # @return [::String] + # Output only. The location that the underlying compute resource resides in + # if it is zonal (e.g us-west1-a). + class WorkloadProperties + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # DiscoveredWorkload is a binary deployment (such as managed instance groups + # (MIGs) and GKE deployments) that performs the smallest logical subset of + # business functionality. A discovered workload can be registered to an App Hub + # Workload. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of the discovered workload. Format: + # "projects/\\{host-project-id}/locations/\\{location}/discoveredWorkloads/\\{uuid}" + # @!attribute [r] workload_reference + # @return [::Google::Cloud::AppHub::V1::WorkloadReference] + # Output only. Reference of an underlying compute resource represented by the + # Workload. These are immutable. + # @!attribute [r] workload_properties + # @return [::Google::Cloud::AppHub::V1::WorkloadProperties] + # Output only. Properties of an underlying compute resource represented by + # the Workload. These are immutable. + class DiscoveredWorkload + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/longrunning/operations.rb b/google-cloud-app_hub-v1/proto_docs/google/longrunning/operations.rb new file mode 100644 index 000000000000..54b83fb82b7d --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/longrunning/operations.rb @@ -0,0 +1,164 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Longrunning + # This resource represents a long-running operation that is the result of a + # network API call. + # @!attribute [rw] name + # @return [::String] + # The server-assigned name, which is only unique within the same service that + # originally returns it. If you use the default HTTP mapping, the + # `name` should be a resource name ending with `operations/{unique_id}`. + # @!attribute [rw] metadata + # @return [::Google::Protobuf::Any] + # Service-specific metadata associated with the operation. It typically + # contains progress information and common metadata such as create time. + # Some services might not provide such metadata. Any method that returns a + # long-running operation should document the metadata type, if any. + # @!attribute [rw] done + # @return [::Boolean] + # If the value is `false`, it means the operation is still in progress. + # If `true`, the operation is completed, and either `error` or `response` is + # available. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # The error result of the operation in case of failure or cancellation. + # @!attribute [rw] response + # @return [::Google::Protobuf::Any] + # The normal response of the operation in case of success. If the original + # method returns no data on success, such as `Delete`, the response is + # `google.protobuf.Empty`. If the original method is standard + # `Get`/`Create`/`Update`, the response should be the resource. For other + # methods, the response should have the type `XxxResponse`, where `Xxx` + # is the original method name. For example, if the original method name + # is `TakeSnapshot()`, the inferred response type is + # `TakeSnapshotResponse`. + class Operation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for Operations.GetOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource. + class GetOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for Operations.ListOperations. + # @!attribute [rw] name + # @return [::String] + # The name of the operation's parent resource. + # @!attribute [rw] filter + # @return [::String] + # The standard list filter. + # @!attribute [rw] page_size + # @return [::Integer] + # The standard list page size. + # @!attribute [rw] page_token + # @return [::String] + # The standard list page token. + class ListOperationsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response message for Operations.ListOperations. + # @!attribute [rw] operations + # @return [::Array<::Google::Longrunning::Operation>] + # A list of operations that matches the specified filter in the request. + # @!attribute [rw] next_page_token + # @return [::String] + # The standard List next-page token. + class ListOperationsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for Operations.CancelOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to be cancelled. + class CancelOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for Operations.DeleteOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to be deleted. + class DeleteOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for Operations.WaitOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to wait on. + # @!attribute [rw] timeout + # @return [::Google::Protobuf::Duration] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + class WaitOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A message representing the message types used by a long-running operation. + # + # Example: + # + # rpc LongRunningRecognize(LongRunningRecognizeRequest) + # returns (google.longrunning.Operation) { + # option (google.longrunning.operation_info) = { + # response_type: "LongRunningRecognizeResponse" + # metadata_type: "LongRunningRecognizeMetadata" + # }; + # } + # @!attribute [rw] response_type + # @return [::String] + # Required. The message name of the primary return type for this + # long-running operation. + # This type will be used to deserialize the LRO's response. + # + # If the response is in a different package from the rpc, a fully-qualified + # message name must be used (e.g. `google.protobuf.Struct`). + # + # Note: Altering this value constitutes a breaking change. + # @!attribute [rw] metadata_type + # @return [::String] + # Required. The message name of the metadata type for this long-running + # operation. + # + # If the response is in a different package from the rpc, a fully-qualified + # message name must be used (e.g. `google.protobuf.Struct`). + # + # Note: Altering this value constitutes a breaking change. + class OperationInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/protobuf/any.rb b/google-cloud-app_hub-v1/proto_docs/google/protobuf/any.rb new file mode 100644 index 000000000000..fb4d6862eac9 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/protobuf/any.rb @@ -0,0 +1,145 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `Any` contains an arbitrary serialized protocol buffer message along with a + # URL that describes the type of the serialized message. + # + # Protobuf library provides support to pack/unpack Any values in the form + # of utility functions or additional generated methods of the Any type. + # + # Example 1: Pack and unpack a message in C++. + # + # Foo foo = ...; + # Any any; + # any.PackFrom(foo); + # ... + # if (any.UnpackTo(&foo)) { + # ... + # } + # + # Example 2: Pack and unpack a message in Java. + # + # Foo foo = ...; + # Any any = Any.pack(foo); + # ... + # if (any.is(Foo.class)) { + # foo = any.unpack(Foo.class); + # } + # // or ... + # if (any.isSameTypeAs(Foo.getDefaultInstance())) { + # foo = any.unpack(Foo.getDefaultInstance()); + # } + # + # Example 3: Pack and unpack a message in Python. + # + # foo = Foo(...) + # any = Any() + # any.Pack(foo) + # ... + # if any.Is(Foo.DESCRIPTOR): + # any.Unpack(foo) + # ... + # + # Example 4: Pack and unpack a message in Go + # + # foo := &pb.Foo{...} + # any, err := anypb.New(foo) + # if err != nil { + # ... + # } + # ... + # foo := &pb.Foo{} + # if err := any.UnmarshalTo(foo); err != nil { + # ... + # } + # + # The pack methods provided by protobuf library will by default use + # 'type.googleapis.com/full.type.name' as the type URL and the unpack + # methods only use the fully qualified type name after the last '/' + # in the type URL, for example "foo.bar.com/x/y.z" will yield type + # name "y.z". + # + # JSON + # ==== + # The JSON representation of an `Any` value uses the regular + # representation of the deserialized, embedded message, with an + # additional field `@type` which contains the type URL. Example: + # + # package google.profile; + # message Person { + # string first_name = 1; + # string last_name = 2; + # } + # + # { + # "@type": "type.googleapis.com/google.profile.Person", + # "firstName": , + # "lastName": + # } + # + # If the embedded message type is well-known and has a custom JSON + # representation, that representation will be embedded adding a field + # `value` which holds the custom JSON in addition to the `@type` + # field. Example (for message [google.protobuf.Duration][]): + # + # { + # "@type": "type.googleapis.com/google.protobuf.Duration", + # "value": "1.212s" + # } + # @!attribute [rw] type_url + # @return [::String] + # A URL/resource name that uniquely identifies the type of the serialized + # protocol buffer message. This string must contain at least + # one "/" character. The last segment of the URL's path must represent + # the fully qualified name of the type (as in + # `path/google.protobuf.Duration`). The name should be in a canonical form + # (e.g., leading "." is not accepted). + # + # In practice, teams usually precompile into the binary all types that they + # expect it to use in the context of Any. However, for URLs which use the + # scheme `http`, `https`, or no scheme, one can optionally set up a type + # server that maps type URLs to message definitions as follows: + # + # * If no scheme is provided, `https` is assumed. + # * An HTTP GET on the URL must yield a [google.protobuf.Type][] + # value in binary format, or produce an error. + # * Applications are allowed to cache lookup results based on the + # URL, or have them precompiled into a binary to avoid any + # lookup. Therefore, binary compatibility needs to be preserved + # on changes to types. (Use versioned type names to manage + # breaking changes.) + # + # Note: this functionality is not currently available in the official + # protobuf release, and it is not used for type URLs beginning with + # type.googleapis.com. As of May 2023, there are no widely used type server + # implementations and no plans to implement one. + # + # Schemes other than `http`, `https` (or the empty scheme) might be + # used with implementation specific semantics. + # @!attribute [rw] value + # @return [::String] + # Must be a valid serialized protocol buffer of the above specified type. + class Any + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/protobuf/duration.rb b/google-cloud-app_hub-v1/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..b5731a824060 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Duration represents a signed, fixed-length span of time represented + # as a count of seconds and fractions of seconds at nanosecond + # resolution. It is independent of any calendar and concepts like "day" + # or "month". It is related to Timestamp in that the difference between + # two Timestamp values is a Duration and it can be added or subtracted + # from a Timestamp. Range is approximately +-10,000 years. + # + # # Examples + # + # Example 1: Compute Duration from two Timestamps in pseudo code. + # + # Timestamp start = ...; + # Timestamp end = ...; + # Duration duration = ...; + # + # duration.seconds = end.seconds - start.seconds; + # duration.nanos = end.nanos - start.nanos; + # + # if (duration.seconds < 0 && duration.nanos > 0) { + # duration.seconds += 1; + # duration.nanos -= 1000000000; + # } else if (duration.seconds > 0 && duration.nanos < 0) { + # duration.seconds -= 1; + # duration.nanos += 1000000000; + # } + # + # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + # + # Timestamp start = ...; + # Duration duration = ...; + # Timestamp end = ...; + # + # end.seconds = start.seconds + duration.seconds; + # end.nanos = start.nanos + duration.nanos; + # + # if (end.nanos < 0) { + # end.seconds -= 1; + # end.nanos += 1000000000; + # } else if (end.nanos >= 1000000000) { + # end.seconds += 1; + # end.nanos -= 1000000000; + # } + # + # Example 3: Compute Duration from datetime.timedelta in Python. + # + # td = datetime.timedelta(days=3, minutes=10) + # duration = Duration() + # duration.FromTimedelta(td) + # + # # JSON Mapping + # + # In JSON format, the Duration type is encoded as a string rather than an + # object, where the string ends in the suffix "s" (indicating seconds) and + # is preceded by the number of seconds, with nanoseconds expressed as + # fractional seconds. For example, 3 seconds with 0 nanoseconds should be + # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + # microsecond should be expressed in JSON format as "3.000001s". + # @!attribute [rw] seconds + # @return [::Integer] + # Signed seconds of the span of time. Must be from -315,576,000,000 + # to +315,576,000,000 inclusive. Note: these bounds are computed from: + # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + # @!attribute [rw] nanos + # @return [::Integer] + # Signed fractions of a second at nanosecond resolution of the span + # of time. Durations less than one second are represented with a 0 + # `seconds` field and a positive or negative `nanos` field. For durations + # of one second or more, a non-zero value for the `nanos` field must be + # of the same sign as the `seconds` field. Must be from -999,999,999 + # to +999,999,999 inclusive. + class Duration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/protobuf/empty.rb b/google-cloud-app_hub-v1/proto_docs/google/protobuf/empty.rb new file mode 100644 index 000000000000..8c6b19d52e3d --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/protobuf/empty.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A generic empty message that you can re-use to avoid defining duplicated + # empty messages in your APIs. A typical example is to use it as the request + # or the response type of an API method. For instance: + # + # service Foo { + # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + # } + class Empty + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/protobuf/field_mask.rb b/google-cloud-app_hub-v1/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..8e7abcf8f052 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `FieldMask` represents a set of symbolic field paths, for example: + # + # paths: "f.a" + # paths: "f.b.d" + # + # Here `f` represents a field in some root message, `a` and `b` + # fields in the message found in `f`, and `d` a field found in the + # message in `f.b`. + # + # Field masks are used to specify a subset of fields that should be + # returned by a get operation or modified by an update operation. + # Field masks also have a custom JSON encoding (see below). + # + # # Field Masks in Projections + # + # When used in the context of a projection, a response message or + # sub-message is filtered by the API to only contain those fields as + # specified in the mask. For example, if the mask in the previous + # example is applied to a response message as follows: + # + # f { + # a : 22 + # b { + # d : 1 + # x : 2 + # } + # y : 13 + # } + # z: 8 + # + # The result will not contain specific values for fields x,y and z + # (their value will be set to the default, and omitted in proto text + # output): + # + # + # f { + # a : 22 + # b { + # d : 1 + # } + # } + # + # A repeated field is not allowed except at the last position of a + # paths string. + # + # If a FieldMask object is not present in a get operation, the + # operation applies to all fields (as if a FieldMask of all fields + # had been specified). + # + # Note that a field mask does not necessarily apply to the + # top-level response message. In case of a REST get operation, the + # field mask applies directly to the response, but in case of a REST + # list operation, the mask instead applies to each individual message + # in the returned resource list. In case of a REST custom method, + # other definitions may be used. Where the mask applies will be + # clearly documented together with its declaration in the API. In + # any case, the effect on the returned resource/resources is required + # behavior for APIs. + # + # # Field Masks in Update Operations + # + # A field mask in update operations specifies which fields of the + # targeted resource are going to be updated. The API is required + # to only change the values of the fields as specified in the mask + # and leave the others untouched. If a resource is passed in to + # describe the updated values, the API ignores the values of all + # fields not covered by the mask. + # + # If a repeated field is specified for an update operation, new values will + # be appended to the existing repeated field in the target resource. Note that + # a repeated field is only allowed in the last position of a `paths` string. + # + # If a sub-message is specified in the last position of the field mask for an + # update operation, then new value will be merged into the existing sub-message + # in the target resource. + # + # For example, given the target message: + # + # f { + # b { + # d: 1 + # x: 2 + # } + # c: [1] + # } + # + # And an update message: + # + # f { + # b { + # d: 10 + # } + # c: [2] + # } + # + # then if the field mask is: + # + # paths: ["f.b", "f.c"] + # + # then the result will be: + # + # f { + # b { + # d: 10 + # x: 2 + # } + # c: [1, 2] + # } + # + # An implementation may provide options to override this default behavior for + # repeated and message fields. + # + # In order to reset a field's value to the default, the field must + # be in the mask and set to the default value in the provided resource. + # Hence, in order to reset all fields of a resource, provide a default + # instance of the resource and set all fields in the mask, or do + # not provide a mask as described below. + # + # If a field mask is not present on update, the operation applies to + # all fields (as if a field mask of all fields has been specified). + # Note that in the presence of schema evolution, this may mean that + # fields the client does not know and has therefore not filled into + # the request will be reset to their default. If this is unwanted + # behavior, a specific service may require a client to always specify + # a field mask, producing an error if not. + # + # As with get operations, the location of the resource which + # describes the updated values in the request message depends on the + # operation kind. In any case, the effect of the field mask is + # required to be honored by the API. + # + # ## Considerations for HTTP REST + # + # The HTTP kind of an update operation which uses a field mask must + # be set to PATCH instead of PUT in order to satisfy HTTP semantics + # (PUT must only be used for full updates). + # + # # JSON Encoding of Field Masks + # + # In JSON, a field mask is encoded as a single string where paths are + # separated by a comma. Fields name in each path are converted + # to/from lower-camel naming conventions. + # + # As an example, consider the following message declarations: + # + # message Profile { + # User user = 1; + # Photo photo = 2; + # } + # message User { + # string display_name = 1; + # string address = 2; + # } + # + # In proto a field mask for `Profile` may look as such: + # + # mask { + # paths: "user.display_name" + # paths: "photo" + # } + # + # In JSON, the same mask is represented as below: + # + # { + # mask: "user.displayName,photo" + # } + # + # # Field Masks and Oneof Fields + # + # Field masks treat fields in oneofs just as regular fields. Consider the + # following message: + # + # message SampleMessage { + # oneof test_oneof { + # string name = 4; + # SubMessage sub_message = 9; + # } + # } + # + # The field mask can be: + # + # mask { + # paths: "name" + # } + # + # Or: + # + # mask { + # paths: "sub_message" + # } + # + # Note that oneof type names ("test_oneof" in this case) cannot be used in + # paths. + # + # ## Field Mask Verification + # + # The implementation of any API method which has a FieldMask type field in the + # request should verify the included field paths, and return an + # `INVALID_ARGUMENT` error if any path is unmappable. + # @!attribute [rw] paths + # @return [::Array<::String>] + # The set of field mask paths. + class FieldMask + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/protobuf/timestamp.rb b/google-cloud-app_hub-v1/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..4ac9c4801a3f --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/protobuf/timestamp.rb @@ -0,0 +1,127 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Timestamp represents a point in time independent of any time zone or local + # calendar, encoded as a count of seconds and fractions of seconds at + # nanosecond resolution. The count is relative to an epoch at UTC midnight on + # January 1, 1970, in the proleptic Gregorian calendar which extends the + # Gregorian calendar backwards to year one. + # + # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + # second table is needed for interpretation, using a [24-hour linear + # smear](https://developers.google.com/time/smear). + # + # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + # restricting to that range, we ensure that we can convert to and from [RFC + # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + # + # # Examples + # + # Example 1: Compute Timestamp from POSIX `time()`. + # + # Timestamp timestamp; + # timestamp.set_seconds(time(NULL)); + # timestamp.set_nanos(0); + # + # Example 2: Compute Timestamp from POSIX `gettimeofday()`. + # + # struct timeval tv; + # gettimeofday(&tv, NULL); + # + # Timestamp timestamp; + # timestamp.set_seconds(tv.tv_sec); + # timestamp.set_nanos(tv.tv_usec * 1000); + # + # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + # + # FILETIME ft; + # GetSystemTimeAsFileTime(&ft); + # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + # + # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + # Timestamp timestamp; + # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + # + # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + # + # long millis = System.currentTimeMillis(); + # + # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + # .setNanos((int) ((millis % 1000) * 1000000)).build(); + # + # Example 5: Compute Timestamp from Java `Instant.now()`. + # + # Instant now = Instant.now(); + # + # Timestamp timestamp = + # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + # .setNanos(now.getNano()).build(); + # + # Example 6: Compute Timestamp from current time in Python. + # + # timestamp = Timestamp() + # timestamp.GetCurrentTime() + # + # # JSON Mapping + # + # In JSON format, the Timestamp type is encoded as a string in the + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" + # where \\{year} is always expressed using four digits while \\{month}, \\{day}, + # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional + # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + # is required. A proto3 JSON serializer should always use UTC (as indicated by + # "Z") when printing the Timestamp type and a proto3 JSON parser should be + # able to accept both UTC and other timezones (as indicated by an offset). + # + # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + # 01:30 UTC on January 15, 2017. + # + # In JavaScript, one can convert a Date object to this format using the + # standard + # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + # method. In Python, a standard `datetime.datetime` object can be converted + # to this format using + # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + # the Joda Time's [`ISODateTimeFormat.dateTime()`]( + # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + # ) to obtain a formatter capable of generating timestamps in this format. + # @!attribute [rw] seconds + # @return [::Integer] + # Represents seconds of UTC time since Unix epoch + # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + # 9999-12-31T23:59:59Z inclusive. + # @!attribute [rw] nanos + # @return [::Integer] + # Non-negative fractions of a second at nanosecond resolution. Negative + # second values with fractions must still have non-negative nanos values + # that count forward in time. Must be from 0 to 999,999,999 + # inclusive. + class Timestamp + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/rpc/status.rb b/google-cloud-app_hub-v1/proto_docs/google/rpc/status.rb new file mode 100644 index 000000000000..09acc69b6125 --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/rpc/status.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Rpc + # The `Status` type defines a logical error model that is suitable for + # different programming environments, including REST APIs and RPC APIs. It is + # used by [gRPC](https://github.com/grpc). Each `Status` message contains + # three pieces of data: error code, error message, and error details. + # + # You can find out more about this error model and how to work with it in the + # [API Design Guide](https://cloud.google.com/apis/design/errors). + # @!attribute [rw] code + # @return [::Integer] + # The status code, which should be an enum value of + # [google.rpc.Code][google.rpc.Code]. + # @!attribute [rw] message + # @return [::String] + # A developer-facing error message, which should be in English. Any + # user-facing error message should be localized and sent in the + # {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized + # by the client. + # @!attribute [rw] details + # @return [::Array<::Google::Protobuf::Any>] + # A list of messages that carry the error details. There is a common set of + # message types for APIs to use. + class Status + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/proto_docs/google/type/expr.rb b/google-cloud-app_hub-v1/proto_docs/google/type/expr.rb new file mode 100644 index 000000000000..41c8c3a565cc --- /dev/null +++ b/google-cloud-app_hub-v1/proto_docs/google/type/expr.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Type + # Represents a textual expression in the Common Expression Language (CEL) + # syntax. CEL is a C-like expression language. The syntax and semantics of CEL + # are documented at https://github.com/google/cel-spec. + # + # Example (Comparison): + # + # title: "Summary size limit" + # description: "Determines if a summary is less than 100 chars" + # expression: "document.summary.size() < 100" + # + # Example (Equality): + # + # title: "Requestor is owner" + # description: "Determines if requestor is the document owner" + # expression: "document.owner == request.auth.claims.email" + # + # Example (Logic): + # + # title: "Public documents" + # description: "Determine whether the document should be publicly visible" + # expression: "document.type != 'private' && document.type != 'internal'" + # + # Example (Data Manipulation): + # + # title: "Notification string" + # description: "Create a notification string with a timestamp." + # expression: "'New message received at ' + string(document.create_time)" + # + # The exact variables and functions that may be referenced within an expression + # are determined by the service that evaluates it. See the service + # documentation for additional information. + # @!attribute [rw] expression + # @return [::String] + # Textual representation of an expression in Common Expression Language + # syntax. + # @!attribute [rw] title + # @return [::String] + # Optional. Title for the expression, i.e. a short string describing + # its purpose. This can be used e.g. in UIs which allow to enter the + # expression. + # @!attribute [rw] description + # @return [::String] + # Optional. Description of the expression. This is a longer text which + # describes the expression, e.g. when hovered over it in a UI. + # @!attribute [rw] location + # @return [::String] + # Optional. String indicating the location of the expression for error + # reporting, e.g. a file name and a position in the file. + class Expr + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-app_hub-v1/snippets/Gemfile b/google-cloud-app_hub-v1/snippets/Gemfile new file mode 100644 index 000000000000..1f684e56e1e4 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +source "https://rubygems.org" + +if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" + gem "google-cloud-app_hub-v1", path: "../" +else + gem "google-cloud-app_hub-v1" +end + +group :test do + gem "google-style", "~> 1.26.1" + gem "minitest", "~> 5.16" + gem "minitest-focus", "~> 1.1" + gem "minitest-hooks", "~> 1.5" +end diff --git a/google-cloud-app_hub-v1/snippets/app_hub/create_application.rb b/google-cloud-app_hub-v1/snippets/app_hub/create_application.rb new file mode 100644 index 000000000000..c7f442a1162e --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/create_application.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_CreateApplication_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the create_application call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#create_application. +# +def create_application + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::CreateApplicationRequest.new + + # Call the create_application method. + result = client.create_application request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_CreateApplication_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/create_service.rb b/google-cloud-app_hub-v1/snippets/app_hub/create_service.rb new file mode 100644 index 000000000000..1d4acc13e6a0 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/create_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_CreateService_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the create_service call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#create_service. +# +def create_service + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::CreateServiceRequest.new + + # Call the create_service method. + result = client.create_service request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_CreateService_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/create_service_project_attachment.rb b/google-cloud-app_hub-v1/snippets/app_hub/create_service_project_attachment.rb new file mode 100644 index 000000000000..3610396405aa --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/create_service_project_attachment.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_CreateServiceProjectAttachment_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the create_service_project_attachment call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#create_service_project_attachment. +# +def create_service_project_attachment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new + + # Call the create_service_project_attachment method. + result = client.create_service_project_attachment request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_CreateServiceProjectAttachment_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/create_workload.rb b/google-cloud-app_hub-v1/snippets/app_hub/create_workload.rb new file mode 100644 index 000000000000..43bd138498ea --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/create_workload.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_CreateWorkload_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the create_workload call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#create_workload. +# +def create_workload + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::CreateWorkloadRequest.new + + # Call the create_workload method. + result = client.create_workload request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_CreateWorkload_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/delete_application.rb b/google-cloud-app_hub-v1/snippets/app_hub/delete_application.rb new file mode 100644 index 000000000000..d7de8dbcca77 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/delete_application.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_DeleteApplication_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the delete_application call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#delete_application. +# +def delete_application + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::DeleteApplicationRequest.new + + # Call the delete_application method. + result = client.delete_application request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_DeleteApplication_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/delete_service.rb b/google-cloud-app_hub-v1/snippets/app_hub/delete_service.rb new file mode 100644 index 000000000000..2f6fc39f41c0 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/delete_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_DeleteService_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the delete_service call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#delete_service. +# +def delete_service + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::DeleteServiceRequest.new + + # Call the delete_service method. + result = client.delete_service request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_DeleteService_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/delete_service_project_attachment.rb b/google-cloud-app_hub-v1/snippets/app_hub/delete_service_project_attachment.rb new file mode 100644 index 000000000000..5889f97c3de5 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/delete_service_project_attachment.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_DeleteServiceProjectAttachment_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the delete_service_project_attachment call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#delete_service_project_attachment. +# +def delete_service_project_attachment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new + + # Call the delete_service_project_attachment method. + result = client.delete_service_project_attachment request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_DeleteServiceProjectAttachment_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/delete_workload.rb b/google-cloud-app_hub-v1/snippets/app_hub/delete_workload.rb new file mode 100644 index 000000000000..7289a3bd0878 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/delete_workload.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_DeleteWorkload_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the delete_workload call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#delete_workload. +# +def delete_workload + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new + + # Call the delete_workload method. + result = client.delete_workload request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_DeleteWorkload_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/detach_service_project_attachment.rb b/google-cloud-app_hub-v1/snippets/app_hub/detach_service_project_attachment.rb new file mode 100644 index 000000000000..ee321b26034f --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/detach_service_project_attachment.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_DetachServiceProjectAttachment_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the detach_service_project_attachment call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#detach_service_project_attachment. +# +def detach_service_project_attachment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new + + # Call the detach_service_project_attachment method. + result = client.detach_service_project_attachment request + + # The returned object is of type Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse. + p result +end +# [END apphub_v1_generated_AppHub_DetachServiceProjectAttachment_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/get_application.rb b/google-cloud-app_hub-v1/snippets/app_hub/get_application.rb new file mode 100644 index 000000000000..4b5da07f05dd --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/get_application.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_GetApplication_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the get_application call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#get_application. +# +def get_application + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::GetApplicationRequest.new + + # Call the get_application method. + result = client.get_application request + + # The returned object is of type Google::Cloud::AppHub::V1::Application. + p result +end +# [END apphub_v1_generated_AppHub_GetApplication_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/get_discovered_service.rb b/google-cloud-app_hub-v1/snippets/app_hub/get_discovered_service.rb new file mode 100644 index 000000000000..e82f7caabfbd --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/get_discovered_service.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_GetDiscoveredService_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the get_discovered_service call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#get_discovered_service. +# +def get_discovered_service + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new + + # Call the get_discovered_service method. + result = client.get_discovered_service request + + # The returned object is of type Google::Cloud::AppHub::V1::DiscoveredService. + p result +end +# [END apphub_v1_generated_AppHub_GetDiscoveredService_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/get_discovered_workload.rb b/google-cloud-app_hub-v1/snippets/app_hub/get_discovered_workload.rb new file mode 100644 index 000000000000..f8e97936d318 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/get_discovered_workload.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_GetDiscoveredWorkload_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the get_discovered_workload call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#get_discovered_workload. +# +def get_discovered_workload + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new + + # Call the get_discovered_workload method. + result = client.get_discovered_workload request + + # The returned object is of type Google::Cloud::AppHub::V1::DiscoveredWorkload. + p result +end +# [END apphub_v1_generated_AppHub_GetDiscoveredWorkload_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/get_service.rb b/google-cloud-app_hub-v1/snippets/app_hub/get_service.rb new file mode 100644 index 000000000000..60bdafadb106 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/get_service.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_GetService_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the get_service call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#get_service. +# +def get_service + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::GetServiceRequest.new + + # Call the get_service method. + result = client.get_service request + + # The returned object is of type Google::Cloud::AppHub::V1::Service. + p result +end +# [END apphub_v1_generated_AppHub_GetService_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/get_service_project_attachment.rb b/google-cloud-app_hub-v1/snippets/app_hub/get_service_project_attachment.rb new file mode 100644 index 000000000000..d51f445d02fd --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/get_service_project_attachment.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_GetServiceProjectAttachment_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the get_service_project_attachment call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#get_service_project_attachment. +# +def get_service_project_attachment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new + + # Call the get_service_project_attachment method. + result = client.get_service_project_attachment request + + # The returned object is of type Google::Cloud::AppHub::V1::ServiceProjectAttachment. + p result +end +# [END apphub_v1_generated_AppHub_GetServiceProjectAttachment_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/get_workload.rb b/google-cloud-app_hub-v1/snippets/app_hub/get_workload.rb new file mode 100644 index 000000000000..84fb2037fa7b --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/get_workload.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_GetWorkload_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the get_workload call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#get_workload. +# +def get_workload + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::GetWorkloadRequest.new + + # Call the get_workload method. + result = client.get_workload request + + # The returned object is of type Google::Cloud::AppHub::V1::Workload. + p result +end +# [END apphub_v1_generated_AppHub_GetWorkload_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/list_applications.rb b/google-cloud-app_hub-v1/snippets/app_hub/list_applications.rb new file mode 100644 index 000000000000..c9f04d30430e --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/list_applications.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_ListApplications_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the list_applications call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#list_applications. +# +def list_applications + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::ListApplicationsRequest.new + + # Call the list_applications method. + result = client.list_applications request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::AppHub::V1::Application. + p item + end +end +# [END apphub_v1_generated_AppHub_ListApplications_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/list_discovered_services.rb b/google-cloud-app_hub-v1/snippets/app_hub/list_discovered_services.rb new file mode 100644 index 000000000000..a42e2021dbe9 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/list_discovered_services.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_ListDiscoveredServices_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the list_discovered_services call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#list_discovered_services. +# +def list_discovered_services + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new + + # Call the list_discovered_services method. + result = client.list_discovered_services request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::AppHub::V1::DiscoveredService. + p item + end +end +# [END apphub_v1_generated_AppHub_ListDiscoveredServices_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/list_discovered_workloads.rb b/google-cloud-app_hub-v1/snippets/app_hub/list_discovered_workloads.rb new file mode 100644 index 000000000000..8c6f87c64be4 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/list_discovered_workloads.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_ListDiscoveredWorkloads_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the list_discovered_workloads call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#list_discovered_workloads. +# +def list_discovered_workloads + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new + + # Call the list_discovered_workloads method. + result = client.list_discovered_workloads request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::AppHub::V1::DiscoveredWorkload. + p item + end +end +# [END apphub_v1_generated_AppHub_ListDiscoveredWorkloads_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/list_service_project_attachments.rb b/google-cloud-app_hub-v1/snippets/app_hub/list_service_project_attachments.rb new file mode 100644 index 000000000000..0c1bee0f81ec --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/list_service_project_attachments.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_ListServiceProjectAttachments_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the list_service_project_attachments call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#list_service_project_attachments. +# +def list_service_project_attachments + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new + + # Call the list_service_project_attachments method. + result = client.list_service_project_attachments request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::AppHub::V1::ServiceProjectAttachment. + p item + end +end +# [END apphub_v1_generated_AppHub_ListServiceProjectAttachments_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/list_services.rb b/google-cloud-app_hub-v1/snippets/app_hub/list_services.rb new file mode 100644 index 000000000000..b6fa8a953a66 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/list_services.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_ListServices_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the list_services call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#list_services. +# +def list_services + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::ListServicesRequest.new + + # Call the list_services method. + result = client.list_services request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::AppHub::V1::Service. + p item + end +end +# [END apphub_v1_generated_AppHub_ListServices_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/list_workloads.rb b/google-cloud-app_hub-v1/snippets/app_hub/list_workloads.rb new file mode 100644 index 000000000000..2247a713eb0d --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/list_workloads.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_ListWorkloads_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the list_workloads call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#list_workloads. +# +def list_workloads + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::ListWorkloadsRequest.new + + # Call the list_workloads method. + result = client.list_workloads request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::AppHub::V1::Workload. + p item + end +end +# [END apphub_v1_generated_AppHub_ListWorkloads_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/lookup_discovered_service.rb b/google-cloud-app_hub-v1/snippets/app_hub/lookup_discovered_service.rb new file mode 100644 index 000000000000..2aa48506f274 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/lookup_discovered_service.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_LookupDiscoveredService_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the lookup_discovered_service call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#lookup_discovered_service. +# +def lookup_discovered_service + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new + + # Call the lookup_discovered_service method. + result = client.lookup_discovered_service request + + # The returned object is of type Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse. + p result +end +# [END apphub_v1_generated_AppHub_LookupDiscoveredService_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/lookup_discovered_workload.rb b/google-cloud-app_hub-v1/snippets/app_hub/lookup_discovered_workload.rb new file mode 100644 index 000000000000..b56481df5aa8 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/lookup_discovered_workload.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_LookupDiscoveredWorkload_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the lookup_discovered_workload call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#lookup_discovered_workload. +# +def lookup_discovered_workload + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new + + # Call the lookup_discovered_workload method. + result = client.lookup_discovered_workload request + + # The returned object is of type Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse. + p result +end +# [END apphub_v1_generated_AppHub_LookupDiscoveredWorkload_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/lookup_service_project_attachment.rb b/google-cloud-app_hub-v1/snippets/app_hub/lookup_service_project_attachment.rb new file mode 100644 index 000000000000..6f88b3a14446 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/lookup_service_project_attachment.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_LookupServiceProjectAttachment_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the lookup_service_project_attachment call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#lookup_service_project_attachment. +# +def lookup_service_project_attachment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new + + # Call the lookup_service_project_attachment method. + result = client.lookup_service_project_attachment request + + # The returned object is of type Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse. + p result +end +# [END apphub_v1_generated_AppHub_LookupServiceProjectAttachment_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/update_application.rb b/google-cloud-app_hub-v1/snippets/app_hub/update_application.rb new file mode 100644 index 000000000000..2368fd9baad3 --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/update_application.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_UpdateApplication_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the update_application call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#update_application. +# +def update_application + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::UpdateApplicationRequest.new + + # Call the update_application method. + result = client.update_application request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_UpdateApplication_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/update_service.rb b/google-cloud-app_hub-v1/snippets/app_hub/update_service.rb new file mode 100644 index 000000000000..88027fbae17e --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/update_service.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_UpdateService_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the update_service call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#update_service. +# +def update_service + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::UpdateServiceRequest.new + + # Call the update_service method. + result = client.update_service request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_UpdateService_sync] diff --git a/google-cloud-app_hub-v1/snippets/app_hub/update_workload.rb b/google-cloud-app_hub-v1/snippets/app_hub/update_workload.rb new file mode 100644 index 000000000000..866e6271bc4b --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/app_hub/update_workload.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START apphub_v1_generated_AppHub_UpdateWorkload_sync] +require "google/cloud/app_hub/v1" + +## +# Snippet for the update_workload call in the AppHub service +# +# 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/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::AppHub::V1::AppHub::Client#update_workload. +# +def update_workload + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::AppHub::V1::AppHub::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new + + # Call the update_workload method. + result = client.update_workload request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END apphub_v1_generated_AppHub_UpdateWorkload_sync] diff --git a/google-cloud-app_hub-v1/snippets/snippet_metadata_google.cloud.apphub.v1.json b/google-cloud-app_hub-v1/snippets/snippet_metadata_google.cloud.apphub.v1.json new file mode 100644 index 000000000000..43c82a87d67c --- /dev/null +++ b/google-cloud-app_hub-v1/snippets/snippet_metadata_google.cloud.apphub.v1.json @@ -0,0 +1,1095 @@ +{ + "client_library": { + "name": "google-cloud-app_hub-v1", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.cloud.apphub.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "region_tag": "apphub_v1_generated_AppHub_LookupServiceProjectAttachment_sync", + "title": "Snippet for the lookup_service_project_attachment call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#lookup_service_project_attachment.", + "file": "app_hub/lookup_service_project_attachment.rb", + "language": "RUBY", + "client_method": { + "short_name": "lookup_service_project_attachment", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#lookup_service_project_attachment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "LookupServiceProjectAttachment", + "full_name": "google.cloud.apphub.v1.AppHub.LookupServiceProjectAttachment", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_ListServiceProjectAttachments_sync", + "title": "Snippet for the list_service_project_attachments call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#list_service_project_attachments.", + "file": "app_hub/list_service_project_attachments.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_service_project_attachments", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#list_service_project_attachments", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "ListServiceProjectAttachments", + "full_name": "google.cloud.apphub.v1.AppHub.ListServiceProjectAttachments", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_CreateServiceProjectAttachment_sync", + "title": "Snippet for the create_service_project_attachment call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#create_service_project_attachment.", + "file": "app_hub/create_service_project_attachment.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_service_project_attachment", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#create_service_project_attachment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "CreateServiceProjectAttachment", + "full_name": "google.cloud.apphub.v1.AppHub.CreateServiceProjectAttachment", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_GetServiceProjectAttachment_sync", + "title": "Snippet for the get_service_project_attachment call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#get_service_project_attachment.", + "file": "app_hub/get_service_project_attachment.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_service_project_attachment", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#get_service_project_attachment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ServiceProjectAttachment", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "GetServiceProjectAttachment", + "full_name": "google.cloud.apphub.v1.AppHub.GetServiceProjectAttachment", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_DeleteServiceProjectAttachment_sync", + "title": "Snippet for the delete_service_project_attachment call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#delete_service_project_attachment.", + "file": "app_hub/delete_service_project_attachment.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_service_project_attachment", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#delete_service_project_attachment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "DeleteServiceProjectAttachment", + "full_name": "google.cloud.apphub.v1.AppHub.DeleteServiceProjectAttachment", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_DetachServiceProjectAttachment_sync", + "title": "Snippet for the detach_service_project_attachment call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#detach_service_project_attachment.", + "file": "app_hub/detach_service_project_attachment.rb", + "language": "RUBY", + "client_method": { + "short_name": "detach_service_project_attachment", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#detach_service_project_attachment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "DetachServiceProjectAttachment", + "full_name": "google.cloud.apphub.v1.AppHub.DetachServiceProjectAttachment", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_ListDiscoveredServices_sync", + "title": "Snippet for the list_discovered_services call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#list_discovered_services.", + "file": "app_hub/list_discovered_services.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_discovered_services", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#list_discovered_services", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "ListDiscoveredServices", + "full_name": "google.cloud.apphub.v1.AppHub.ListDiscoveredServices", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_GetDiscoveredService_sync", + "title": "Snippet for the get_discovered_service call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#get_discovered_service.", + "file": "app_hub/get_discovered_service.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_discovered_service", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#get_discovered_service", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::DiscoveredService", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "GetDiscoveredService", + "full_name": "google.cloud.apphub.v1.AppHub.GetDiscoveredService", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_LookupDiscoveredService_sync", + "title": "Snippet for the lookup_discovered_service call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#lookup_discovered_service.", + "file": "app_hub/lookup_discovered_service.rb", + "language": "RUBY", + "client_method": { + "short_name": "lookup_discovered_service", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#lookup_discovered_service", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "LookupDiscoveredService", + "full_name": "google.cloud.apphub.v1.AppHub.LookupDiscoveredService", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_ListServices_sync", + "title": "Snippet for the list_services call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#list_services.", + "file": "app_hub/list_services.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_services", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#list_services", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::ListServicesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ListServicesResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "ListServices", + "full_name": "google.cloud.apphub.v1.AppHub.ListServices", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_CreateService_sync", + "title": "Snippet for the create_service call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#create_service.", + "file": "app_hub/create_service.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_service", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#create_service", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::CreateServiceRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "CreateService", + "full_name": "google.cloud.apphub.v1.AppHub.CreateService", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_GetService_sync", + "title": "Snippet for the get_service call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#get_service.", + "file": "app_hub/get_service.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_service", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#get_service", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::GetServiceRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::Service", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "GetService", + "full_name": "google.cloud.apphub.v1.AppHub.GetService", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_UpdateService_sync", + "title": "Snippet for the update_service call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#update_service.", + "file": "app_hub/update_service.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_service", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#update_service", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::UpdateServiceRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "UpdateService", + "full_name": "google.cloud.apphub.v1.AppHub.UpdateService", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_DeleteService_sync", + "title": "Snippet for the delete_service call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#delete_service.", + "file": "app_hub/delete_service.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_service", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#delete_service", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::DeleteServiceRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "DeleteService", + "full_name": "google.cloud.apphub.v1.AppHub.DeleteService", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_ListDiscoveredWorkloads_sync", + "title": "Snippet for the list_discovered_workloads call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#list_discovered_workloads.", + "file": "app_hub/list_discovered_workloads.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_discovered_workloads", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#list_discovered_workloads", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "ListDiscoveredWorkloads", + "full_name": "google.cloud.apphub.v1.AppHub.ListDiscoveredWorkloads", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_GetDiscoveredWorkload_sync", + "title": "Snippet for the get_discovered_workload call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#get_discovered_workload.", + "file": "app_hub/get_discovered_workload.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_discovered_workload", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#get_discovered_workload", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::DiscoveredWorkload", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "GetDiscoveredWorkload", + "full_name": "google.cloud.apphub.v1.AppHub.GetDiscoveredWorkload", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_LookupDiscoveredWorkload_sync", + "title": "Snippet for the lookup_discovered_workload call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#lookup_discovered_workload.", + "file": "app_hub/lookup_discovered_workload.rb", + "language": "RUBY", + "client_method": { + "short_name": "lookup_discovered_workload", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#lookup_discovered_workload", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "LookupDiscoveredWorkload", + "full_name": "google.cloud.apphub.v1.AppHub.LookupDiscoveredWorkload", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_ListWorkloads_sync", + "title": "Snippet for the list_workloads call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#list_workloads.", + "file": "app_hub/list_workloads.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_workloads", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#list_workloads", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::ListWorkloadsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ListWorkloadsResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "ListWorkloads", + "full_name": "google.cloud.apphub.v1.AppHub.ListWorkloads", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_CreateWorkload_sync", + "title": "Snippet for the create_workload call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#create_workload.", + "file": "app_hub/create_workload.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_workload", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#create_workload", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::CreateWorkloadRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "CreateWorkload", + "full_name": "google.cloud.apphub.v1.AppHub.CreateWorkload", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_GetWorkload_sync", + "title": "Snippet for the get_workload call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#get_workload.", + "file": "app_hub/get_workload.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_workload", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#get_workload", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::GetWorkloadRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::Workload", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "GetWorkload", + "full_name": "google.cloud.apphub.v1.AppHub.GetWorkload", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_UpdateWorkload_sync", + "title": "Snippet for the update_workload call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#update_workload.", + "file": "app_hub/update_workload.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_workload", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#update_workload", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::UpdateWorkloadRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "UpdateWorkload", + "full_name": "google.cloud.apphub.v1.AppHub.UpdateWorkload", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_DeleteWorkload_sync", + "title": "Snippet for the delete_workload call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#delete_workload.", + "file": "app_hub/delete_workload.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_workload", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#delete_workload", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::DeleteWorkloadRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "DeleteWorkload", + "full_name": "google.cloud.apphub.v1.AppHub.DeleteWorkload", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_ListApplications_sync", + "title": "Snippet for the list_applications call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#list_applications.", + "file": "app_hub/list_applications.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_applications", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#list_applications", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::ListApplicationsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::ListApplicationsResponse", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "ListApplications", + "full_name": "google.cloud.apphub.v1.AppHub.ListApplications", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_CreateApplication_sync", + "title": "Snippet for the create_application call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#create_application.", + "file": "app_hub/create_application.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_application", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#create_application", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::CreateApplicationRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "CreateApplication", + "full_name": "google.cloud.apphub.v1.AppHub.CreateApplication", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_GetApplication_sync", + "title": "Snippet for the get_application call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#get_application.", + "file": "app_hub/get_application.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_application", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#get_application", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::GetApplicationRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::AppHub::V1::Application", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "GetApplication", + "full_name": "google.cloud.apphub.v1.AppHub.GetApplication", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_UpdateApplication_sync", + "title": "Snippet for the update_application call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#update_application.", + "file": "app_hub/update_application.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_application", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#update_application", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::UpdateApplicationRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "UpdateApplication", + "full_name": "google.cloud.apphub.v1.AppHub.UpdateApplication", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "apphub_v1_generated_AppHub_DeleteApplication_sync", + "title": "Snippet for the delete_application call in the AppHub service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::AppHub::V1::AppHub::Client#delete_application.", + "file": "app_hub/delete_application.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_application", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client#delete_application", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::AppHub::V1::DeleteApplicationRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AppHub::Client", + "full_name": "::Google::Cloud::AppHub::V1::AppHub::Client" + }, + "method": { + "short_name": "DeleteApplication", + "full_name": "google.cloud.apphub.v1.AppHub.DeleteApplication", + "service": { + "short_name": "AppHub", + "full_name": "google.cloud.apphub.v1.AppHub" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_operations_test.rb b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_operations_test.rb new file mode 100644 index 000000000000..fac58405cdbf --- /dev/null +++ b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_operations_test.rb @@ -0,0 +1,389 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/apphub/v1/apphub_service_pb" +require "google/cloud/apphub/v1/apphub_service_services_pb" +require "google/cloud/app_hub/v1/app_hub" + +class ::Google::Cloud::AppHub::V1::AppHub::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + yield @response, @operation if block_given? + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::AppHub::V1::AppHub::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::AppHub::V1::AppHub::Operations::Configuration, config + end +end diff --git a/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_paths_test.rb b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_paths_test.rb new file mode 100644 index 000000000000..40101cd100d5 --- /dev/null +++ b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_paths_test.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/app_hub/v1/app_hub" + +class ::Google::Cloud::AppHub::V1::AppHub::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_application_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.application_path project: "value0", location: "value1", application: "value2" + assert_equal "projects/value0/locations/value1/applications/value2", path + end + end + + def test_discovered_service_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.discovered_service_path project: "value0", location: "value1", discovered_service: "value2" + assert_equal "projects/value0/locations/value1/discoveredServices/value2", path + end + end + + def test_discovered_workload_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.discovered_workload_path project: "value0", location: "value1", discovered_workload: "value2" + assert_equal "projects/value0/locations/value1/discoveredWorkloads/value2", path + end + end + + def test_location_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.location_path project: "value0", location: "value1" + assert_equal "projects/value0/locations/value1", path + end + end + + def test_project_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.project_path project: "value0" + assert_equal "projects/value0", path + end + end + + def test_service_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.service_path project: "value0", location: "value1", application: "value2", service: "value3" + assert_equal "projects/value0/locations/value1/applications/value2/services/value3", path + end + end + + def test_service_project_attachment_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.service_project_attachment_path project: "value0", location: "value1", service_project_attachment: "value2" + assert_equal "projects/value0/locations/value1/serviceProjectAttachments/value2", path + end + end + + def test_workload_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.workload_path project: "value0", location: "value1", application: "value2", workload: "value3" + assert_equal "projects/value0/locations/value1/applications/value2/workloads/value3", path + end + end +end diff --git a/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_rest_test.rb b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_rest_test.rb new file mode 100644 index 000000000000..90c596bd5c41 --- /dev/null +++ b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_rest_test.rb @@ -0,0 +1,1597 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/apphub/v1/apphub_service_pb" +require "google/cloud/app_hub/v1/app_hub/rest" + + +class ::Google::Cloud::AppHub::V1::AppHub::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {} + make_http_request :get, uri: uri, body: nil, params: params, options: options + end + + def make_delete_request uri:, params: {}, options: {} + make_http_request :delete, uri: uri, body: nil, params: params, options: options + end + + def make_post_request uri:, body: nil, params: {}, options: {} + make_http_request :post, uri: uri, body: body, params: params, options: options + end + + def make_patch_request uri:, body:, params: {}, options: {} + make_http_request :patch, uri: uri, body: body, params: params, options: options + end + + def make_put_request uri:, body:, params: {}, options: {} + make_http_request :put, uri: uri, body: body, params: params, options: options + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_lookup_service_project_attachment + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + lookup_service_project_attachment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_lookup_service_project_attachment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, lookup_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.lookup_service_project_attachment({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.lookup_service_project_attachment name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.lookup_service_project_attachment ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.lookup_service_project_attachment({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.lookup_service_project_attachment(::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, lookup_service_project_attachment_client_stub.call_count + end + end + end + + def test_list_service_project_attachments + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_service_project_attachments_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_list_service_project_attachments_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_service_project_attachments_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_service_project_attachments({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_service_project_attachments parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_service_project_attachments ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_service_project_attachments({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_service_project_attachments(::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_service_project_attachments_client_stub.call_count + end + end + end + + def test_create_service_project_attachment + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + service_project_attachment_id = "hello world" + service_project_attachment = {} + request_id = "hello world" + + create_service_project_attachment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_create_service_project_attachment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_service_project_attachment({ parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_service_project_attachment parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_service_project_attachment ::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new(parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_service_project_attachment({ parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_service_project_attachment(::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new(parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_service_project_attachment_client_stub.call_count + end + end + end + + def test_get_service_project_attachment + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ServiceProjectAttachment.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_service_project_attachment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_get_service_project_attachment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_service_project_attachment({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_service_project_attachment name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_service_project_attachment ::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_service_project_attachment({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_service_project_attachment(::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_service_project_attachment_client_stub.call_count + end + end + end + + def test_delete_service_project_attachment + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_service_project_attachment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_delete_service_project_attachment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_service_project_attachment({ name: name, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_service_project_attachment name: name, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_service_project_attachment ::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new(name: name, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_service_project_attachment({ name: name, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_service_project_attachment(::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new(name: name, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_service_project_attachment_client_stub.call_count + end + end + end + + def test_detach_service_project_attachment + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + detach_service_project_attachment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_detach_service_project_attachment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, detach_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.detach_service_project_attachment({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.detach_service_project_attachment name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.detach_service_project_attachment ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.detach_service_project_attachment({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.detach_service_project_attachment(::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, detach_service_project_attachment_client_stub.call_count + end + end + end + + def test_list_discovered_services + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_discovered_services_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_list_discovered_services_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_discovered_services_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_discovered_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_discovered_services parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_discovered_services ::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_discovered_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_discovered_services(::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_discovered_services_client_stub.call_count + end + end + end + + def test_get_discovered_service + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::DiscoveredService.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_discovered_service_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_get_discovered_service_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_discovered_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_discovered_service({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_discovered_service name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_discovered_service ::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_discovered_service({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_discovered_service(::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_discovered_service_client_stub.call_count + end + end + end + + def test_lookup_discovered_service + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + uri = "hello world" + + lookup_discovered_service_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_lookup_discovered_service_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, lookup_discovered_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.lookup_discovered_service({ parent: parent, uri: uri }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.lookup_discovered_service parent: parent, uri: uri do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.lookup_discovered_service ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new(parent: parent, uri: uri) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.lookup_discovered_service({ parent: parent, uri: uri }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.lookup_discovered_service(::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new(parent: parent, uri: uri), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, lookup_discovered_service_client_stub.call_count + end + end + end + + def test_list_services + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ListServicesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_services_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_list_services_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_services_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_services parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_services ::Google::Cloud::AppHub::V1::ListServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_services(::Google::Cloud::AppHub::V1::ListServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_services_client_stub.call_count + end + end + end + + def test_create_service + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + service_id = "hello world" + service = {} + request_id = "hello world" + + create_service_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_create_service_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_service({ parent: parent, service_id: service_id, service: service, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_service parent: parent, service_id: service_id, service: service, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_service ::Google::Cloud::AppHub::V1::CreateServiceRequest.new(parent: parent, service_id: service_id, service: service, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_service({ parent: parent, service_id: service_id, service: service, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_service(::Google::Cloud::AppHub::V1::CreateServiceRequest.new(parent: parent, service_id: service_id, service: service, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_service_client_stub.call_count + end + end + end + + def test_get_service + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::Service.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_service_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_get_service_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_service({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_service name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_service ::Google::Cloud::AppHub::V1::GetServiceRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_service({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_service(::Google::Cloud::AppHub::V1::GetServiceRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_service_client_stub.call_count + end + end + end + + def test_update_service + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + update_mask = {} + service = {} + request_id = "hello world" + + update_service_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_update_service_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_service({ update_mask: update_mask, service: service, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_service update_mask: update_mask, service: service, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_service ::Google::Cloud::AppHub::V1::UpdateServiceRequest.new(update_mask: update_mask, service: service, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_service({ update_mask: update_mask, service: service, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_service(::Google::Cloud::AppHub::V1::UpdateServiceRequest.new(update_mask: update_mask, service: service, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_service_client_stub.call_count + end + end + end + + def test_delete_service + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_service_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_delete_service_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_service({ name: name, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_service name: name, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_service ::Google::Cloud::AppHub::V1::DeleteServiceRequest.new(name: name, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_service({ name: name, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_service(::Google::Cloud::AppHub::V1::DeleteServiceRequest.new(name: name, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_service_client_stub.call_count + end + end + end + + def test_list_discovered_workloads + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_discovered_workloads_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_list_discovered_workloads_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_discovered_workloads_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_discovered_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_discovered_workloads parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_discovered_workloads ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_discovered_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_discovered_workloads(::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_discovered_workloads_client_stub.call_count + end + end + end + + def test_get_discovered_workload + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::DiscoveredWorkload.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_discovered_workload_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_get_discovered_workload_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_discovered_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_discovered_workload({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_discovered_workload name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_discovered_workload ::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_discovered_workload({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_discovered_workload(::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_discovered_workload_client_stub.call_count + end + end + end + + def test_lookup_discovered_workload + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + uri = "hello world" + + lookup_discovered_workload_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_lookup_discovered_workload_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, lookup_discovered_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.lookup_discovered_workload({ parent: parent, uri: uri }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.lookup_discovered_workload parent: parent, uri: uri do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.lookup_discovered_workload ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new(parent: parent, uri: uri) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.lookup_discovered_workload({ parent: parent, uri: uri }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.lookup_discovered_workload(::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new(parent: parent, uri: uri), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, lookup_discovered_workload_client_stub.call_count + end + end + end + + def test_list_workloads + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ListWorkloadsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_workloads_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_list_workloads_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_workloads_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_workloads parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_workloads ::Google::Cloud::AppHub::V1::ListWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_workloads(::Google::Cloud::AppHub::V1::ListWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_workloads_client_stub.call_count + end + end + end + + def test_create_workload + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + workload_id = "hello world" + workload = {} + request_id = "hello world" + + create_workload_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_create_workload_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_workload({ parent: parent, workload_id: workload_id, workload: workload, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_workload parent: parent, workload_id: workload_id, workload: workload, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_workload ::Google::Cloud::AppHub::V1::CreateWorkloadRequest.new(parent: parent, workload_id: workload_id, workload: workload, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_workload({ parent: parent, workload_id: workload_id, workload: workload, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_workload(::Google::Cloud::AppHub::V1::CreateWorkloadRequest.new(parent: parent, workload_id: workload_id, workload: workload, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_workload_client_stub.call_count + end + end + end + + def test_get_workload + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::Workload.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_workload_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_get_workload_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_workload({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_workload name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_workload ::Google::Cloud::AppHub::V1::GetWorkloadRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_workload({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_workload(::Google::Cloud::AppHub::V1::GetWorkloadRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_workload_client_stub.call_count + end + end + end + + def test_update_workload + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + update_mask = {} + workload = {} + request_id = "hello world" + + update_workload_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_update_workload_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_workload({ update_mask: update_mask, workload: workload, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_workload update_mask: update_mask, workload: workload, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_workload ::Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new(update_mask: update_mask, workload: workload, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_workload({ update_mask: update_mask, workload: workload, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_workload(::Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new(update_mask: update_mask, workload: workload, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_workload_client_stub.call_count + end + end + end + + def test_delete_workload + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_workload_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_delete_workload_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_workload({ name: name, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_workload name: name, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_workload ::Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new(name: name, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_workload({ name: name, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_workload(::Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new(name: name, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_workload_client_stub.call_count + end + end + end + + def test_list_applications + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::ListApplicationsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_applications_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_list_applications_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_applications_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_applications({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_applications parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_applications ::Google::Cloud::AppHub::V1::ListApplicationsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_applications({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_applications(::Google::Cloud::AppHub::V1::ListApplicationsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_applications_client_stub.call_count + end + end + end + + def test_create_application + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + application_id = "hello world" + application = {} + request_id = "hello world" + + create_application_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_create_application_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_application({ parent: parent, application_id: application_id, application: application, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_application parent: parent, application_id: application_id, application: application, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_application ::Google::Cloud::AppHub::V1::CreateApplicationRequest.new(parent: parent, application_id: application_id, application: application, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_application({ parent: parent, application_id: application_id, application: application, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_application(::Google::Cloud::AppHub::V1::CreateApplicationRequest.new(parent: parent, application_id: application_id, application: application, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_application_client_stub.call_count + end + end + end + + def test_get_application + # Create test objects. + client_result = ::Google::Cloud::AppHub::V1::Application.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_application_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_get_application_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_application({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_application name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_application ::Google::Cloud::AppHub::V1::GetApplicationRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_application({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_application(::Google::Cloud::AppHub::V1::GetApplicationRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_application_client_stub.call_count + end + end + end + + def test_update_application + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + update_mask = {} + application = {} + request_id = "hello world" + + update_application_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_update_application_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_application({ update_mask: update_mask, application: application, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_application update_mask: update_mask, application: application, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_application ::Google::Cloud::AppHub::V1::UpdateApplicationRequest.new(update_mask: update_mask, application: application, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_application({ update_mask: update_mask, application: application, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_application(::Google::Cloud::AppHub::V1::UpdateApplicationRequest.new(update_mask: update_mask, application: application, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_application_client_stub.call_count + end + end + end + + def test_delete_application + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_application_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::AppHub::V1::AppHub::Rest::ServiceStub.stub :transcode_delete_application_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_application({ name: name, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_application name: name, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_application ::Google::Cloud::AppHub::V1::DeleteApplicationRequest.new(name: name, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_application({ name: name, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_application(::Google::Cloud::AppHub::V1::DeleteApplicationRequest.new(name: name, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_application_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::AppHub::V1::AppHub::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::AppHub::V1::AppHub::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_test.rb b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_test.rb new file mode 100644 index 000000000000..bf0eb7344a7e --- /dev/null +++ b/google-cloud-app_hub-v1/test/google/cloud/app_hub/v1/app_hub_test.rb @@ -0,0 +1,1837 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/apphub/v1/apphub_service_pb" +require "google/cloud/apphub/v1/apphub_service_services_pb" +require "google/cloud/app_hub/v1/app_hub" + +class ::Google::Cloud::AppHub::V1::AppHub::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + yield @response, @operation if block_given? + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + + def test_lookup_service_project_attachment + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + lookup_service_project_attachment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :lookup_service_project_attachment, name + assert_kind_of ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, lookup_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.lookup_service_project_attachment({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.lookup_service_project_attachment name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.lookup_service_project_attachment ::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.lookup_service_project_attachment({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.lookup_service_project_attachment(::Google::Cloud::AppHub::V1::LookupServiceProjectAttachmentRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, lookup_service_project_attachment_client_stub.call_rpc_count + end + end + + def test_list_service_project_attachments + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_service_project_attachments_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_service_project_attachments, name + assert_kind_of ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_service_project_attachments_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_service_project_attachments({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_service_project_attachments parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_service_project_attachments ::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_service_project_attachments({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_service_project_attachments(::Google::Cloud::AppHub::V1::ListServiceProjectAttachmentsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_service_project_attachments_client_stub.call_rpc_count + end + end + + def test_create_service_project_attachment + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + service_project_attachment_id = "hello world" + service_project_attachment = {} + request_id = "hello world" + + create_service_project_attachment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_service_project_attachment, name + assert_kind_of ::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["service_project_attachment_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::ServiceProjectAttachment), request["service_project_attachment"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_service_project_attachment({ parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_service_project_attachment parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_service_project_attachment ::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new(parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_service_project_attachment({ parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_service_project_attachment(::Google::Cloud::AppHub::V1::CreateServiceProjectAttachmentRequest.new(parent: parent, service_project_attachment_id: service_project_attachment_id, service_project_attachment: service_project_attachment, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_service_project_attachment_client_stub.call_rpc_count + end + end + + def test_get_service_project_attachment + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ServiceProjectAttachment.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_service_project_attachment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_service_project_attachment, name + assert_kind_of ::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_service_project_attachment({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_service_project_attachment name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_service_project_attachment ::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_service_project_attachment({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_service_project_attachment(::Google::Cloud::AppHub::V1::GetServiceProjectAttachmentRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_service_project_attachment_client_stub.call_rpc_count + end + end + + def test_delete_service_project_attachment + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_service_project_attachment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_service_project_attachment, name + assert_kind_of ::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_service_project_attachment({ name: name, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_service_project_attachment name: name, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_service_project_attachment ::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new(name: name, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_service_project_attachment({ name: name, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_service_project_attachment(::Google::Cloud::AppHub::V1::DeleteServiceProjectAttachmentRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_service_project_attachment_client_stub.call_rpc_count + end + end + + def test_detach_service_project_attachment + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + detach_service_project_attachment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :detach_service_project_attachment, name + assert_kind_of ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, detach_service_project_attachment_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.detach_service_project_attachment({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.detach_service_project_attachment name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.detach_service_project_attachment ::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.detach_service_project_attachment({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.detach_service_project_attachment(::Google::Cloud::AppHub::V1::DetachServiceProjectAttachmentRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, detach_service_project_attachment_client_stub.call_rpc_count + end + end + + def test_list_discovered_services + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ListDiscoveredServicesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_discovered_services_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_discovered_services, name + assert_kind_of ::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_discovered_services_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_discovered_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_discovered_services parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_discovered_services ::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_discovered_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_discovered_services(::Google::Cloud::AppHub::V1::ListDiscoveredServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_discovered_services_client_stub.call_rpc_count + end + end + + def test_get_discovered_service + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::DiscoveredService.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_discovered_service_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_discovered_service, name + assert_kind_of ::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_discovered_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_discovered_service({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_discovered_service name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_discovered_service ::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_discovered_service({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_discovered_service(::Google::Cloud::AppHub::V1::GetDiscoveredServiceRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_discovered_service_client_stub.call_rpc_count + end + end + + def test_lookup_discovered_service + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + uri = "hello world" + + lookup_discovered_service_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :lookup_discovered_service, name + assert_kind_of ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["uri"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, lookup_discovered_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.lookup_discovered_service({ parent: parent, uri: uri }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.lookup_discovered_service parent: parent, uri: uri do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.lookup_discovered_service ::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new(parent: parent, uri: uri) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.lookup_discovered_service({ parent: parent, uri: uri }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.lookup_discovered_service(::Google::Cloud::AppHub::V1::LookupDiscoveredServiceRequest.new(parent: parent, uri: uri), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, lookup_discovered_service_client_stub.call_rpc_count + end + end + + def test_list_services + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ListServicesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_services_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_services, name + assert_kind_of ::Google::Cloud::AppHub::V1::ListServicesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_services_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_services parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_services ::Google::Cloud::AppHub::V1::ListServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_services({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_services(::Google::Cloud::AppHub::V1::ListServicesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_services_client_stub.call_rpc_count + end + end + + def test_create_service + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + service_id = "hello world" + service = {} + request_id = "hello world" + + create_service_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_service, name + assert_kind_of ::Google::Cloud::AppHub::V1::CreateServiceRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["service_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::Service), request["service"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_service({ parent: parent, service_id: service_id, service: service, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_service parent: parent, service_id: service_id, service: service, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_service ::Google::Cloud::AppHub::V1::CreateServiceRequest.new(parent: parent, service_id: service_id, service: service, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_service({ parent: parent, service_id: service_id, service: service, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_service(::Google::Cloud::AppHub::V1::CreateServiceRequest.new(parent: parent, service_id: service_id, service: service, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_service_client_stub.call_rpc_count + end + end + + def test_get_service + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::Service.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_service_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_service, name + assert_kind_of ::Google::Cloud::AppHub::V1::GetServiceRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_service({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_service name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_service ::Google::Cloud::AppHub::V1::GetServiceRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_service({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_service(::Google::Cloud::AppHub::V1::GetServiceRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_service_client_stub.call_rpc_count + end + end + + def test_update_service + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + update_mask = {} + service = {} + request_id = "hello world" + + update_service_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_service, name + assert_kind_of ::Google::Cloud::AppHub::V1::UpdateServiceRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::Service), request["service"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_service({ update_mask: update_mask, service: service, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_service update_mask: update_mask, service: service, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_service ::Google::Cloud::AppHub::V1::UpdateServiceRequest.new(update_mask: update_mask, service: service, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_service({ update_mask: update_mask, service: service, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_service(::Google::Cloud::AppHub::V1::UpdateServiceRequest.new(update_mask: update_mask, service: service, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_service_client_stub.call_rpc_count + end + end + + def test_delete_service + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_service_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_service, name + assert_kind_of ::Google::Cloud::AppHub::V1::DeleteServiceRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_service_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_service({ name: name, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_service name: name, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_service ::Google::Cloud::AppHub::V1::DeleteServiceRequest.new(name: name, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_service({ name: name, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_service(::Google::Cloud::AppHub::V1::DeleteServiceRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_service_client_stub.call_rpc_count + end + end + + def test_list_discovered_workloads + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_discovered_workloads_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_discovered_workloads, name + assert_kind_of ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_discovered_workloads_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_discovered_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_discovered_workloads parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_discovered_workloads ::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_discovered_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_discovered_workloads(::Google::Cloud::AppHub::V1::ListDiscoveredWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_discovered_workloads_client_stub.call_rpc_count + end + end + + def test_get_discovered_workload + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::DiscoveredWorkload.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_discovered_workload_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_discovered_workload, name + assert_kind_of ::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_discovered_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_discovered_workload({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_discovered_workload name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_discovered_workload ::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_discovered_workload({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_discovered_workload(::Google::Cloud::AppHub::V1::GetDiscoveredWorkloadRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_discovered_workload_client_stub.call_rpc_count + end + end + + def test_lookup_discovered_workload + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + uri = "hello world" + + lookup_discovered_workload_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :lookup_discovered_workload, name + assert_kind_of ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["uri"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, lookup_discovered_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.lookup_discovered_workload({ parent: parent, uri: uri }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.lookup_discovered_workload parent: parent, uri: uri do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.lookup_discovered_workload ::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new(parent: parent, uri: uri) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.lookup_discovered_workload({ parent: parent, uri: uri }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.lookup_discovered_workload(::Google::Cloud::AppHub::V1::LookupDiscoveredWorkloadRequest.new(parent: parent, uri: uri), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, lookup_discovered_workload_client_stub.call_rpc_count + end + end + + def test_list_workloads + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ListWorkloadsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_workloads_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_workloads, name + assert_kind_of ::Google::Cloud::AppHub::V1::ListWorkloadsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_workloads_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_workloads parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_workloads ::Google::Cloud::AppHub::V1::ListWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_workloads({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_workloads(::Google::Cloud::AppHub::V1::ListWorkloadsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_workloads_client_stub.call_rpc_count + end + end + + def test_create_workload + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + workload_id = "hello world" + workload = {} + request_id = "hello world" + + create_workload_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_workload, name + assert_kind_of ::Google::Cloud::AppHub::V1::CreateWorkloadRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["workload_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::Workload), request["workload"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_workload({ parent: parent, workload_id: workload_id, workload: workload, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_workload parent: parent, workload_id: workload_id, workload: workload, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_workload ::Google::Cloud::AppHub::V1::CreateWorkloadRequest.new(parent: parent, workload_id: workload_id, workload: workload, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_workload({ parent: parent, workload_id: workload_id, workload: workload, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_workload(::Google::Cloud::AppHub::V1::CreateWorkloadRequest.new(parent: parent, workload_id: workload_id, workload: workload, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_workload_client_stub.call_rpc_count + end + end + + def test_get_workload + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::Workload.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_workload_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_workload, name + assert_kind_of ::Google::Cloud::AppHub::V1::GetWorkloadRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_workload({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_workload name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_workload ::Google::Cloud::AppHub::V1::GetWorkloadRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_workload({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_workload(::Google::Cloud::AppHub::V1::GetWorkloadRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_workload_client_stub.call_rpc_count + end + end + + def test_update_workload + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + update_mask = {} + workload = {} + request_id = "hello world" + + update_workload_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_workload, name + assert_kind_of ::Google::Cloud::AppHub::V1::UpdateWorkloadRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::Workload), request["workload"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_workload({ update_mask: update_mask, workload: workload, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_workload update_mask: update_mask, workload: workload, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_workload ::Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new(update_mask: update_mask, workload: workload, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_workload({ update_mask: update_mask, workload: workload, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_workload(::Google::Cloud::AppHub::V1::UpdateWorkloadRequest.new(update_mask: update_mask, workload: workload, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_workload_client_stub.call_rpc_count + end + end + + def test_delete_workload + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_workload_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_workload, name + assert_kind_of ::Google::Cloud::AppHub::V1::DeleteWorkloadRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_workload_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_workload({ name: name, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_workload name: name, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_workload ::Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new(name: name, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_workload({ name: name, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_workload(::Google::Cloud::AppHub::V1::DeleteWorkloadRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_workload_client_stub.call_rpc_count + end + end + + def test_list_applications + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::ListApplicationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + order_by = "hello world" + + list_applications_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_applications, name + assert_kind_of ::Google::Cloud::AppHub::V1::ListApplicationsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_applications_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_applications({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_applications parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_applications ::Google::Cloud::AppHub::V1::ListApplicationsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_applications({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_applications(::Google::Cloud::AppHub::V1::ListApplicationsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_applications_client_stub.call_rpc_count + end + end + + def test_create_application + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + application_id = "hello world" + application = {} + request_id = "hello world" + + create_application_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_application, name + assert_kind_of ::Google::Cloud::AppHub::V1::CreateApplicationRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["application_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::Application), request["application"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_application({ parent: parent, application_id: application_id, application: application, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_application parent: parent, application_id: application_id, application: application, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_application ::Google::Cloud::AppHub::V1::CreateApplicationRequest.new(parent: parent, application_id: application_id, application: application, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_application({ parent: parent, application_id: application_id, application: application, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_application(::Google::Cloud::AppHub::V1::CreateApplicationRequest.new(parent: parent, application_id: application_id, application: application, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_application_client_stub.call_rpc_count + end + end + + def test_get_application + # Create GRPC objects. + grpc_response = ::Google::Cloud::AppHub::V1::Application.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_application_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_application, name + assert_kind_of ::Google::Cloud::AppHub::V1::GetApplicationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_application({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_application name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_application ::Google::Cloud::AppHub::V1::GetApplicationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_application({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_application(::Google::Cloud::AppHub::V1::GetApplicationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_application_client_stub.call_rpc_count + end + end + + def test_update_application + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + update_mask = {} + application = {} + request_id = "hello world" + + update_application_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_application, name + assert_kind_of ::Google::Cloud::AppHub::V1::UpdateApplicationRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AppHub::V1::Application), request["application"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_application({ update_mask: update_mask, application: application, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_application update_mask: update_mask, application: application, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_application ::Google::Cloud::AppHub::V1::UpdateApplicationRequest.new(update_mask: update_mask, application: application, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_application({ update_mask: update_mask, application: application, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_application(::Google::Cloud::AppHub::V1::UpdateApplicationRequest.new(update_mask: update_mask, application: application, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_application_client_stub.call_rpc_count + end + end + + def test_delete_application + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_application_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_application, name + assert_kind_of ::Google::Cloud::AppHub::V1::DeleteApplicationRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_application_client_stub do + # Create client + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_application({ name: name, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_application name: name, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_application ::Google::Cloud::AppHub::V1::DeleteApplicationRequest.new(name: name, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_application({ name: name, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_application(::Google::Cloud::AppHub::V1::DeleteApplicationRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_application_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::AppHub::V1::AppHub::Client::Configuration, config + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::AppHub::V1::AppHub::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::AppHub::V1::AppHub::Operations, client.operations_client + end +end diff --git a/google-cloud-app_hub-v1/test/helper.rb b/google-cloud-app_hub-v1/test/helper.rb new file mode 100644 index 000000000000..48407bca7edb --- /dev/null +++ b/google-cloud-app_hub-v1/test/helper.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "minitest/autorun" +require "minitest/focus" +require "minitest/rg" + +require "grpc" + +require "ostruct" diff --git a/release-please-config.json b/release-please-config.json index e9df462daa63..2ac454302987 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -127,6 +127,10 @@ "component": "google-cloud-app_engine-v1", "version_file": "lib/google/cloud/app_engine/v1/version.rb" }, + "google-cloud-app_hub-v1": { + "component": "google-cloud-app_hub-v1", + "version_file": "lib/google/cloud/app_hub/v1/version.rb" + }, "google-cloud-artifact_registry": { "component": "google-cloud-artifact_registry", "version_file": "lib/google/cloud/artifact_registry/version.rb"