diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.gitignore b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.repo-metadata.json b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.repo-metadata.json new file mode 100644 index 000000000000..bb5cc865dee4 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "api_id": "bigquerydatapolicy.googleapis.com", + "api_shortname": "bigquerydatapolicy", + "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-bigquery-data_policies-v1/latest", + "distribution_name": "google-cloud-bigquery-data_policies-v1", + "is_cloud": true, + "language": "ruby", + "name": "bigquerydatapolicy", + "name_pretty": "BigQuery Data Policy Service V1 API", + "product_documentation": "https://cloud.google.com/bigquery/docs", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "The Data Policy Service provides APIs for managing the BigQuery label-policy bindings. Note that google-cloud-bigquery-data_policies-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-bigquery-data_policies instead. See the readme for more details.", + "ruby-cloud-product-url": "https://cloud.google.com/bigquery/docs", + "library_type": "GAPIC_AUTO" +} diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.rubocop.yml b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.rubocop.yml new file mode 100644 index 000000000000..44bd142b9ba7 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-cloud-bigquery-data_policies-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-bigquery-data_policies-v1.rb" diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.yardopts b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.yardopts new file mode 100644 index 000000000000..31aca60843a9 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="BigQuery Data Policy Service V1 API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/AUTHENTICATION.md b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/AUTHENTICATION.md new file mode 100644 index 000000000000..b06dfcf901be --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/AUTHENTICATION.md @@ -0,0 +1,149 @@ +# Authentication + +In general, the google-cloud-bigquery-data_policies-v1 library uses +[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) +credentials to connect to Google Cloud services. When running within +[Google Cloud Platform environments](#google-cloud-platform-environments) the +credentials will be discovered automatically. When running on other +environments, the Service Account credentials can be specified by providing the +path to the +[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) +for the account (or the JSON itself) in +[environment variables](#environment-variables). Additionally, Cloud SDK +credentials can also be discovered automatically, but this is only recommended +during development. + +## Quickstart + +1. [Create a service account and credentials](#creating-a-service-account). +2. Set the [environment variable](#environment-variables). + +```sh +export GOOGLE_CLOUD_CREDENTIALS=path/to/keyfile.json +``` + +3. Initialize the client. + +```ruby +require "google/cloud/bigquery/data_policies/v1" + +client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new +``` + +## Credential Lookup + +The google-cloud-bigquery-data_policies-v1 library aims to make authentication +as simple as possible, and provides several mechanisms to configure your system +without requiring **Service Account Credentials** directly in code. + +**Credentials** are discovered in the following order: + +1. Specify credentials in method arguments +2. Specify credentials in configuration +3. Discover credentials path in environment variables +4. Discover credentials JSON in environment variables +5. Discover credentials file in the Cloud SDK's path +6. Discover GCP credentials + +### 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 discovered automatically. +Code should be written as if already authenticated. + +### Environment Variables + +The **Credentials JSON** can be placed in environment variables instead of +declaring them directly in code. Each service has its own environment variable, +allowing for different service accounts to be used for different services. (See +the READMEs for the individual service gems for details.) The path to the +**Credentials JSON** file can be stored in the environment variable, or the +**Credentials JSON** itself can be stored for environments such as Docker +containers where writing files is difficult or not encouraged. + +The environment variables that google-cloud-bigquery-data_policies-v1 +checks for credentials are configured on the service Credentials class (such as +{::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Credentials}): + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/cloud/bigquery/data_policies/v1" + +ENV["GOOGLE_CLOUD_CREDENTIALS"] = "path/to/keyfile.json" + +client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new +``` + +### Configuration + +The path to the **Credentials JSON** file can be configured instead of storing +it in an environment variable. Either on an individual client initialization: + +```ruby +require "google/cloud/bigquery/data_policies/v1" + +client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = "path/to/keyfile.json" +end +``` + +Or globally for all clients: + +```ruby +require "google/cloud/bigquery/data_policies/v1" + +::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.configure do |config| + config.credentials = "path/to/keyfile.json" +end + +client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new +``` + +### Cloud SDK + +This option allows for an easy way to authenticate during development. If +credentials are not provided in code or in environment variables, then Cloud SDK +credentials are discovered. + +To configure your system for this, simply: + +1. [Download and install the Cloud SDK](https://cloud.google.com/sdk) +2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login` +3. Write code as if already authenticated. + +**NOTE:** This is _not_ recommended for running in production. The Cloud SDK +*should* only be used during development. + +## Creating a Service Account + +Google Cloud requires **Service Account Credentials** to +connect to the APIs. You will use the **JSON key file** to +connect to most services with google-cloud-bigquery-data_policies-v1. + +If you are not running this client within +[Google Cloud Platform environments](#google-cloud-platform-environments), you +need a Google Developers service account. + +1. Visit the [Google Cloud Console](https://console.cloud.google.com/project). +2. Create a new project or click on an existing project. +3. Activate the menu in the upper left and select **APIs & Services**. From + here, you will enable the APIs that your application requires. + + *Note: You may need to enable billing in order to use these services.* + +4. Select **Credentials** from the side navigation. + + Find the "Create credentials" drop down near the top of the page, and select + "Service account" to be guided through downloading a new JSON key file. + + If you want to re-use an existing service account, you can easily generate a + new key file. Just select the account you wish to re-use, click the pencil + tool on the right side to edit the service account, select the **Keys** tab, + and then select **Add Key**. + + The key file you download will be used by this library to authenticate API + requests and should be stored in a secure location. diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/CHANGELOG.md b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/Gemfile b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/Gemfile new file mode 100644 index 000000000000..b4e2a20bb606 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gemspec diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/LICENSE.md b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/README.md b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/README.md new file mode 100644 index 000000000000..0037d79e79ac --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/README.md @@ -0,0 +1,144 @@ +# Ruby Client for the BigQuery Data Policy Service V1 API + +Allows users to manage BigQuery data policies. + +The Data Policy Service provides APIs for managing the BigQuery label-policy bindings. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the BigQuery Data Policy Service V1 API. Most users should consider using +the main client gem, +[google-cloud-bigquery-data_policies](https://rubygems.org/gems/google-cloud-bigquery-data_policies). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-cloud-bigquery-data_policies-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/bigquerydatapolicy.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/cloud/bigquery/data_policies/v1" + +client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new +request = ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new # (request fields as keyword arguments...) +response = client.create_data_policy request +``` + +View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-bigquery-data_policies-v1/latest) +for class and method documentation. + +See also the [Product Documentation](https://cloud.google.com/bigquery/docs) +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.6+. + +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-bigquery-data_policies`, +and lower-level _versioned_ client libraries with names such as +`google-cloud-bigquery-data_policies-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-bigquery-data_policies`. +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-bigquery-data_policies-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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/Rakefile b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/Rakefile new file mode 100644 index 000000000000..41e07f7f8912 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/Rakefile @@ -0,0 +1,201 @@ +# frozen_string_literal: true + +# Copyright 2023 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 + +namespace :test do + desc "Runs tests with coverage." + task :coverage do + require "simplecov" + SimpleCov.start do + command_name "google-cloud-bigquery-data_policies-v1" + track_files "lib/**/*.rb" + add_filter "test/" + end + + Rake::Task[:test].invoke + end +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 + +namespace :smoke_test do + desc "Runs smoke tests with coverage." + task :coverage do + require "simplecov" + SimpleCov.start do + command_name "google-cloud-bigquery-data_policies-v1" + track_files "lib/**/*.rb" + add_filter "test/" + end + + Rake::Task[:smoke_test].invoke + end +end + +# Acceptance tests +desc "Run the google-cloud-bigquery-data_policies-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/bigquery/data_policies/v1/data_policy_service/credentials" + ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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-bigquery-data_policies-v1 gem has no acceptance tests." + end + end + + desc "Run acceptance tests with coverage." + task :coverage do + 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-bigquery-data_policies-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-bigquery-data_policies-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-bigquery-data_policies-v1 gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-cloud-bigquery-data_policies-v1" + header "google-cloud-bigquery-data_policies-v1 rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-cloud-bigquery-data_policies-v1 yard", "*" + Rake::Task[:yard].invoke + header "google-cloud-bigquery-data_policies-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-bigquery-data_policies-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-bigquery-data_policies-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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/gapic_metadata.json b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/gapic_metadata.json new file mode 100644 index 000000000000..8058dfc06b6d --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/gapic_metadata.json @@ -0,0 +1,63 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.cloud.bigquery.datapolicies.v1", + "libraryPackage": "::Google::Cloud::Bigquery::DataPolicies::V1", + "services": { + "DataPolicyService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client", + "rpcs": { + "CreateDataPolicy": { + "methods": [ + "create_data_policy" + ] + }, + "UpdateDataPolicy": { + "methods": [ + "update_data_policy" + ] + }, + "RenameDataPolicy": { + "methods": [ + "rename_data_policy" + ] + }, + "DeleteDataPolicy": { + "methods": [ + "delete_data_policy" + ] + }, + "GetDataPolicy": { + "methods": [ + "get_data_policy" + ] + }, + "ListDataPolicies": { + "methods": [ + "list_data_policies" + ] + }, + "GetIamPolicy": { + "methods": [ + "get_iam_policy" + ] + }, + "SetIamPolicy": { + "methods": [ + "set_iam_policy" + ] + }, + "TestIamPermissions": { + "methods": [ + "test_iam_permissions" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/google-cloud-bigquery-data_policies-v1.gemspec b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/google-cloud-bigquery-data_policies-v1.gemspec new file mode 100644 index 000000000000..2dc1eccc7592 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/google-cloud-bigquery-data_policies-v1.gemspec @@ -0,0 +1,38 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/cloud/bigquery/data_policies/v1/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-cloud-bigquery-data_policies-v1" + gem.version = Google::Cloud::Bigquery::DataPolicies::V1::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "The Data Policy Service provides APIs for managing the BigQuery label-policy bindings. Note that google-cloud-bigquery-data_policies-v1 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-bigquery-data_policies instead. See the readme for more details." + gem.summary = "Allows users to manage BigQuery data policies." + 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.6" + + gem.add_dependency "gapic-common", ">= 0.19.1", "< 2.a" + gem.add_dependency "google-cloud-errors", "~> 1.0" + gem.add_dependency "grpc-google-iam-v1", "~> 1.1" + + gem.add_development_dependency "google-style", "~> 1.26.3" + gem.add_development_dependency "minitest", "~> 5.16" + gem.add_development_dependency "minitest-focus", "~> 1.1" + gem.add_development_dependency "minitest-rg", "~> 5.2" + gem.add_development_dependency "rake", ">= 13.0" + gem.add_development_dependency "redcarpet", "~> 3.0" + gem.add_development_dependency "simplecov", "~> 0.18" + gem.add_development_dependency "yard", "~> 0.9" +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google-cloud-bigquery-data_policies-v1.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google-cloud-bigquery-data_policies-v1.rb new file mode 100644 index 000000000000..2c892fbab353 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google-cloud-bigquery-data_policies-v1.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/data_policies/v1" diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1.rb new file mode 100644 index 000000000000..094c98e2d5ae --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/data_policies/v1/data_policy_service" +require "google/cloud/bigquery/data_policies/v1/version" + +module Google + module Cloud + module Bigquery + module DataPolicies + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/cloud/bigquery/data_policies/v1" + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/cloud/bigquery/data_policies/v1" + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new + # + module V1 + end + end + end + end +end + +helper_path = ::File.join __dir__, "v1", "_helpers.rb" +require "google/cloud/bigquery/data_policies/v1/_helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service.rb new file mode 100644 index 000000000000..1741876decd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/data_policies/v1/version" + +require "google/cloud/bigquery/data_policies/v1/data_policy_service/credentials" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/paths" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/client" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest" + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + ## + # Data Policy Service provides APIs for managing the label-policy bindings. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/bigquery/data_policies/v1/data_policy_service" + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest" + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new + # + module DataPolicyService + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "data_policy_service", "helpers.rb" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/client.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/client.rb new file mode 100644 index 000000000000..daeba1f74e84 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/client.rb @@ -0,0 +1,1237 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/datapolicies/v1/datapolicy_pb" + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + module DataPolicyService + ## + # Client for the DataPolicyService service. + # + # Data Policy Service provides APIs for managing the label-policy bindings. + # + class Client + include Paths + + # @private + attr_reader :data_policy_service_stub + + ## + # Configure the DataPolicyService Client class. + # + # See {::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all DataPolicyService clients + # ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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", "Bigquery", "DataPolicies", "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.create_data_policy.timeout = 60.0 + default_config.rpcs.create_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_data_policy.timeout = 60.0 + default_config.rpcs.update_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.rename_data_policy.timeout = 60.0 + default_config.rpcs.rename_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.delete_data_policy.timeout = 60.0 + default_config.rpcs.delete_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_data_policy.timeout = 60.0 + default_config.rpcs.get_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_data_policies.timeout = 60.0 + default_config.rpcs.list_data_policies.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_iam_policy.timeout = 60.0 + default_config.rpcs.get_iam_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.set_iam_policy.timeout = 60.0 + default_config.rpcs.set_iam_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.test_iam_permissions.timeout = 60.0 + default_config.rpcs.test_iam_permissions.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the DataPolicyService 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::Bigquery::DataPolicies::V1::DataPolicyService::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 + + ## + # Create a new DataPolicyService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the DataPolicyService 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/bigquery/datapolicies/v1/datapolicy_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 == 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 + + @data_policy_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + channel_args: @config.channel_args, + interceptors: @config.interceptors + ) + end + + # Service calls + + ## + # Creates a new data policy under a project with the given `dataPolicyId` + # (used as the display name), policy tag, and data policy type. + # + # @overload create_data_policy(request, options = nil) + # Pass arguments to `create_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest, ::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_data_policy(parent: nil, data_policy: nil) + # Pass arguments to `create_data_policy` 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. Resource name of the project that the data policy will belong to. + # The format is `projects/{project_number}/locations/{location_id}`. + # @param data_policy [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy, ::Hash] + # Required. The data policy to create. The `name` field does not need to be + # provided for the data policy creation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new + # + # # Call the create_data_policy method. + # result = client.create_data_policy request + # + # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + # p result + # + def create_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :create_data_policy, 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 the metadata for an existing data policy. The target data policy + # can be specified by the resource name. + # + # @overload update_data_policy(request, options = nil) + # Pass arguments to `update_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest, ::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_data_policy(data_policy: nil, update_mask: nil) + # Pass arguments to `update_data_policy` 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 data_policy [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy, ::Hash] + # Required. Update the data policy's metadata. + # + # The target data policy is determined by the `name` field. + # Other fields are updated to the specified values based on the field masks. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # The update mask applies to the resource. For the `FieldMask` definition, + # see + # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + # If not set, defaults to all of the fields that are allowed to update. + # + # Updates to the `name` and `dataPolicyId` fields are not allowed. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new + # + # # Call the update_data_policy method. + # result = client.update_data_policy request + # + # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + # p result + # + def update_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.data_policy&.name + header_params["data_policy.name"] = request.data_policy.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_data_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :update_data_policy, 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 + + ## + # Renames the id (display name) of the specified data policy. + # + # @overload rename_data_policy(request, options = nil) + # Pass arguments to `rename_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest, ::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 rename_data_policy(name: nil, new_data_policy_id: nil) + # Pass arguments to `rename_data_policy` 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. Resource name of the data policy to rename. The format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}` + # @param new_data_policy_id [::String] + # Required. The new data policy id. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new + # + # # Call the rename_data_policy method. + # result = client.rename_data_policy request + # + # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + # p result + # + def rename_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest + + # 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.rename_data_policy.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::Bigquery::DataPolicies::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.rename_data_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.rename_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :rename_data_policy, 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 the data policy specified by its resource name. + # + # @overload delete_data_policy(request, options = nil) + # Pass arguments to `delete_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest, ::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_data_policy(name: nil) + # Pass arguments to `delete_data_policy` 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. Resource name of the data policy to delete. Format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + # + # @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/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.new + # + # # Call the delete_data_policy method. + # result = client.delete_data_policy request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :delete_data_policy, 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 + + ## + # Gets the data policy specified by its resource name. + # + # @overload get_data_policy(request, options = nil) + # Pass arguments to `get_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest, ::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_data_policy(name: nil) + # Pass arguments to `get_data_policy` 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. Resource name of the requested data policy. Format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.new + # + # # Call the get_data_policy method. + # result = client.get_data_policy request + # + # # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + # p result + # + def get_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :get_data_policy, 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 + + ## + # List all of the data policies in the specified parent project. + # + # @overload list_data_policies(request, options = nil) + # Pass arguments to `list_data_policies` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest, ::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_data_policies(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_data_policies` 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. Resource name of the project for which to list data policies. + # Format is `projects/{project_number}/locations/{location_id}`. + # @param page_size [::Integer] + # The maximum number of data policies to return. Must be a value between 1 + # and 1000. + # If not set, defaults to 50. + # @param page_token [::String] + # The `nextPageToken` value returned from a previous list request, if any. If + # not set, defaults to an empty string. + # @param filter [::String] + # Filters the data policies by policy tags that they + # are associated with. Currently filter only supports + # "policy_tag" based filtering and OR based predicates. Sample + # filter can be "policy_tag: + # projects/1/locations/us/taxonomies/2/policyTags/3". + # You may also use wildcard such as "policy_tag: + # projects/1/locations/us/taxonomies/2*". Please note that OR predicates + # cannot be used with wildcard filters. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new + # + # # Call the list_data_policies method. + # result = client.list_data_policies 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::Bigquery::DataPolicies::V1::DataPolicy. + # p item + # end + # + def list_data_policies request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest + + # 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_data_policies.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::Bigquery::DataPolicies::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_data_policies.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_data_policies.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :list_data_policies, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @data_policy_service_stub, :list_data_policies, 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 the IAM policy for the specified data policy. + # + # @overload get_iam_policy(request, options = nil) + # Pass arguments to `get_iam_policy` via a request object, either of type + # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::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_iam_policy(resource: nil, options: nil) + # Pass arguments to `get_iam_policy` 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 resource [::String] + # REQUIRED: The resource for which the policy is being requested. + # See the operation documentation for the appropriate value for this field. + # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash] + # OPTIONAL: A `GetPolicyOptions` object for specifying options to + # `GetIamPolicy`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Iam::V1::Policy] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Iam::V1::Policy] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Iam::V1::GetIamPolicyRequest.new + # + # # Call the get_iam_policy method. + # result = client.get_iam_policy request + # + # # The returned object is of type Google::Iam::V1::Policy. + # p result + # + def get_iam_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest + + # 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_iam_policy.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::Bigquery::DataPolicies::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.resource + header_params["resource"] = request.resource + 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_iam_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_iam_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :get_iam_policy, 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 + + ## + # Sets the IAM policy for the specified data policy. + # + # @overload set_iam_policy(request, options = nil) + # Pass arguments to `set_iam_policy` via a request object, either of type + # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::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 set_iam_policy(resource: nil, policy: nil, update_mask: nil) + # Pass arguments to `set_iam_policy` 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 resource [::String] + # REQUIRED: The resource for which the policy is being specified. + # See the operation documentation for the appropriate value for this field. + # @param policy [::Google::Iam::V1::Policy, ::Hash] + # REQUIRED: The complete policy to be applied to the `resource`. The size of + # the policy is limited to a few 10s of KB. An empty policy is a + # valid policy but certain Cloud Platform services (such as Projects) + # might reject them. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + # the fields in the mask will be modified. If no mask is provided, the + # following default mask is used: + # + # `paths: "bindings, etag"` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Iam::V1::Policy] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Iam::V1::Policy] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Iam::V1::SetIamPolicyRequest.new + # + # # Call the set_iam_policy method. + # result = client.set_iam_policy request + # + # # The returned object is of type Google::Iam::V1::Policy. + # p result + # + def set_iam_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest + + # 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.set_iam_policy.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::Bigquery::DataPolicies::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.resource + header_params["resource"] = request.resource + 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.set_iam_policy.timeout, + metadata: metadata, + retry_policy: @config.rpcs.set_iam_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :set_iam_policy, 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 + + ## + # Returns the caller's permission on the specified data policy resource. + # + # @overload test_iam_permissions(request, options = nil) + # Pass arguments to `test_iam_permissions` via a request object, either of type + # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash. + # + # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::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 test_iam_permissions(resource: nil, permissions: nil) + # Pass arguments to `test_iam_permissions` 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 resource [::String] + # REQUIRED: The resource for which the policy detail is being requested. + # See the operation documentation for the appropriate value for this field. + # @param permissions [::Array<::String>] + # The set of permissions to check for the `resource`. Permissions with + # wildcards (such as '*' or 'storage.*') are not allowed. For more + # information see + # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Iam::V1::TestIamPermissionsResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/bigquery/data_policies/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Iam::V1::TestIamPermissionsRequest.new + # + # # Call the test_iam_permissions method. + # result = client.test_iam_permissions request + # + # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse. + # p result + # + def test_iam_permissions request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest + + # 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.test_iam_permissions.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::Bigquery::DataPolicies::V1::VERSION + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.resource + header_params["resource"] = request.resource + 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.test_iam_permissions.timeout, + metadata: metadata, + retry_policy: @config.rpcs.test_iam_permissions.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.call_rpc :test_iam_permissions, 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 + + ## + # Configuration class for the DataPolicyService API. + # + # This class represents the configuration for DataPolicyService, + # 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::Bigquery::DataPolicies::V1::DataPolicyService::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 + # # create_data_policy to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_data_policy.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_data_policy.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # The hostname or hostname:port of the service endpoint. + # Defaults to `"bigquerydatapolicy.googleapis.com"`. + # @return [::String] + # @!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] + # + class Configuration + extend ::Gapic::Config + + DEFAULT_ENDPOINT = "bigquerydatapolicy.googleapis.com" + + config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 + + # @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 DataPolicyService 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 `create_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :create_data_policy + ## + # RPC-specific configuration for `update_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :update_data_policy + ## + # RPC-specific configuration for `rename_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :rename_data_policy + ## + # RPC-specific configuration for `delete_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_data_policy + ## + # RPC-specific configuration for `get_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :get_data_policy + ## + # RPC-specific configuration for `list_data_policies` + # @return [::Gapic::Config::Method] + # + attr_reader :list_data_policies + ## + # RPC-specific configuration for `get_iam_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :get_iam_policy + ## + # RPC-specific configuration for `set_iam_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :set_iam_policy + ## + # RPC-specific configuration for `test_iam_permissions` + # @return [::Gapic::Config::Method] + # + attr_reader :test_iam_permissions + + # @private + def initialize parent_rpcs = nil + create_data_policy_config = parent_rpcs.create_data_policy if parent_rpcs.respond_to? :create_data_policy + @create_data_policy = ::Gapic::Config::Method.new create_data_policy_config + update_data_policy_config = parent_rpcs.update_data_policy if parent_rpcs.respond_to? :update_data_policy + @update_data_policy = ::Gapic::Config::Method.new update_data_policy_config + rename_data_policy_config = parent_rpcs.rename_data_policy if parent_rpcs.respond_to? :rename_data_policy + @rename_data_policy = ::Gapic::Config::Method.new rename_data_policy_config + delete_data_policy_config = parent_rpcs.delete_data_policy if parent_rpcs.respond_to? :delete_data_policy + @delete_data_policy = ::Gapic::Config::Method.new delete_data_policy_config + get_data_policy_config = parent_rpcs.get_data_policy if parent_rpcs.respond_to? :get_data_policy + @get_data_policy = ::Gapic::Config::Method.new get_data_policy_config + list_data_policies_config = parent_rpcs.list_data_policies if parent_rpcs.respond_to? :list_data_policies + @list_data_policies = ::Gapic::Config::Method.new list_data_policies_config + get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy + @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config + set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy + @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config + test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions + @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/credentials.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/credentials.rb new file mode 100644 index 000000000000..b72b74bd84cb --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/credentials.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Bigquery + module DataPolicies + module V1 + module DataPolicyService + # Credentials for the DataPolicyService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/bigquery", + "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 +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/paths.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/paths.rb new file mode 100644 index 000000000000..8e49e6ae68a4 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/paths.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Bigquery + module DataPolicies + module V1 + module DataPolicyService + # Path helper methods for the DataPolicyService API. + module Paths + ## + # Create a fully-qualified DataPolicy resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/dataPolicies/{data_policy}` + # + # @param project [String] + # @param location [String] + # @param data_policy [String] + # + # @return [::String] + def data_policy_path project:, location:, data_policy: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/dataPolicies/#{data_policy}" + 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 + + extend self + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest.rb new file mode 100644 index 000000000000..048aa84647eb --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/data_policies/v1/version" + +require "google/cloud/bigquery/data_policies/v1/data_policy_service/credentials" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/paths" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest/client" + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + ## + # Data Policy Service provides APIs for managing the label-policy bindings. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest" + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new + # + module DataPolicyService + # Client for the REST transport + module Rest + end + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest/client.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest/client.rb new file mode 100644 index 000000000000..662acad3be75 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest/client.rb @@ -0,0 +1,1006 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/datapolicies/v1/datapolicy_pb" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest/service_stub" + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + module DataPolicyService + module Rest + ## + # REST client for the DataPolicyService service. + # + # Data Policy Service provides APIs for managing the label-policy bindings. + # + class Client + include Paths + + # @private + attr_reader :data_policy_service_stub + + ## + # Configure the DataPolicyService Client class. + # + # See {::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all DataPolicyService clients + # ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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", "Bigquery", "DataPolicies", "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.create_data_policy.timeout = 60.0 + default_config.rpcs.create_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_data_policy.timeout = 60.0 + default_config.rpcs.update_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.rename_data_policy.timeout = 60.0 + default_config.rpcs.rename_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.delete_data_policy.timeout = 60.0 + default_config.rpcs.delete_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_data_policy.timeout = 60.0 + default_config.rpcs.get_data_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_data_policies.timeout = 60.0 + default_config.rpcs.list_data_policies.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_iam_policy.timeout = 60.0 + default_config.rpcs.get_iam_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.set_iam_policy.timeout = 60.0 + default_config.rpcs.set_iam_policy.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.test_iam_permissions.timeout = 60.0 + default_config.rpcs.test_iam_permissions.retry_policy = { + initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the DataPolicyService 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::Bigquery::DataPolicies::V1::DataPolicyService::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 + + ## + # Create a new DataPolicyService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the DataPolicyService 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 == 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 + + @data_policy_service_stub = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials + end + + # Service calls + + ## + # Creates a new data policy under a project with the given `dataPolicyId` + # (used as the display name), policy tag, and data policy type. + # + # @overload create_data_policy(request, options = nil) + # Pass arguments to `create_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest, ::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_data_policy(parent: nil, data_policy: nil) + # Pass arguments to `create_data_policy` 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. Resource name of the project that the data policy will belong to. + # The format is `projects/{project_number}/locations/{location_id}`. + # @param data_policy [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy, ::Hash] + # Required. The data policy to create. The `name` field does not need to be + # provided for the data policy creation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def create_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.create_data_policy 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 the metadata for an existing data policy. The target data policy + # can be specified by the resource name. + # + # @overload update_data_policy(request, options = nil) + # Pass arguments to `update_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest, ::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_data_policy(data_policy: nil, update_mask: nil) + # Pass arguments to `update_data_policy` 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 data_policy [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy, ::Hash] + # Required. Update the data policy's metadata. + # + # The target data policy is determined by the `name` field. + # Other fields are updated to the specified values based on the field masks. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # The update mask applies to the resource. For the `FieldMask` definition, + # see + # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + # If not set, defaults to all of the fields that are allowed to update. + # + # Updates to the `name` and `dataPolicyId` fields are not allowed. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def update_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.update_data_policy 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 + + ## + # Renames the id (display name) of the specified data policy. + # + # @overload rename_data_policy(request, options = nil) + # Pass arguments to `rename_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest, ::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 rename_data_policy(name: nil, new_data_policy_id: nil) + # Pass arguments to `rename_data_policy` 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. Resource name of the data policy to rename. The format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}` + # @param new_data_policy_id [::String] + # Required. The new data policy id. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def rename_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest + + # 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.rename_data_policy.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::Bigquery::DataPolicies::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.rename_data_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.rename_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.rename_data_policy 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 the data policy specified by its resource name. + # + # @overload delete_data_policy(request, options = nil) + # Pass arguments to `delete_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest, ::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_data_policy(name: nil) + # Pass arguments to `delete_data_policy` 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. Resource name of the data policy to delete. Format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + # @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. + def delete_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.delete_data_policy 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 the data policy specified by its resource name. + # + # @overload get_data_policy(request, options = nil) + # Pass arguments to `get_data_policy` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest, ::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_data_policy(name: nil) + # Pass arguments to `get_data_policy` 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. Resource name of the requested data policy. Format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def get_data_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest + + # 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_data_policy.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::Bigquery::DataPolicies::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_data_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_data_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.get_data_policy 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 + + ## + # List all of the data policies in the specified parent project. + # + # @overload list_data_policies(request, options = nil) + # Pass arguments to `list_data_policies` via a request object, either of type + # {::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest, ::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_data_policies(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_data_policies` 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. Resource name of the project for which to list data policies. + # Format is `projects/{project_number}/locations/{location_id}`. + # @param page_size [::Integer] + # The maximum number of data policies to return. Must be a value between 1 + # and 1000. + # If not set, defaults to 50. + # @param page_token [::String] + # The `nextPageToken` value returned from a previous list request, if any. If + # not set, defaults to an empty string. + # @param filter [::String] + # Filters the data policies by policy tags that they + # are associated with. Currently filter only supports + # "policy_tag" based filtering and OR based predicates. Sample + # filter can be "policy_tag: + # projects/1/locations/us/taxonomies/2/policyTags/3". + # You may also use wildcard such as "policy_tag: + # projects/1/locations/us/taxonomies/2*". Please note that OR predicates + # cannot be used with wildcard filters. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def list_data_policies request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest + + # 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_data_policies.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::Bigquery::DataPolicies::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_data_policies.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_data_policies.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.list_data_policies request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @data_policy_service_stub, :list_data_policies, "data_policies", 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 IAM policy for the specified data policy. + # + # @overload get_iam_policy(request, options = nil) + # Pass arguments to `get_iam_policy` via a request object, either of type + # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::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_iam_policy(resource: nil, options: nil) + # Pass arguments to `get_iam_policy` 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 resource [::String] + # REQUIRED: The resource for which the policy is being requested. + # See the operation documentation for the appropriate value for this field. + # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash] + # OPTIONAL: A `GetPolicyOptions` object for specifying options to + # `GetIamPolicy`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Iam::V1::Policy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Iam::V1::Policy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def get_iam_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest + + # 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_iam_policy.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::Bigquery::DataPolicies::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_iam_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_iam_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.get_iam_policy 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 + + ## + # Sets the IAM policy for the specified data policy. + # + # @overload set_iam_policy(request, options = nil) + # Pass arguments to `set_iam_policy` via a request object, either of type + # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::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 set_iam_policy(resource: nil, policy: nil, update_mask: nil) + # Pass arguments to `set_iam_policy` 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 resource [::String] + # REQUIRED: The resource for which the policy is being specified. + # See the operation documentation for the appropriate value for this field. + # @param policy [::Google::Iam::V1::Policy, ::Hash] + # REQUIRED: The complete policy to be applied to the `resource`. The size of + # the policy is limited to a few 10s of KB. An empty policy is a + # valid policy but certain Cloud Platform services (such as Projects) + # might reject them. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + # the fields in the mask will be modified. If no mask is provided, the + # following default mask is used: + # + # `paths: "bindings, etag"` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Iam::V1::Policy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Iam::V1::Policy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def set_iam_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest + + # 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.set_iam_policy.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::Bigquery::DataPolicies::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.set_iam_policy.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.set_iam_policy.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.set_iam_policy 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 + + ## + # Returns the caller's permission on the specified data policy resource. + # + # @overload test_iam_permissions(request, options = nil) + # Pass arguments to `test_iam_permissions` via a request object, either of type + # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash. + # + # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::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 test_iam_permissions(resource: nil, permissions: nil) + # Pass arguments to `test_iam_permissions` 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 resource [::String] + # REQUIRED: The resource for which the policy detail is being requested. + # See the operation documentation for the appropriate value for this field. + # @param permissions [::Array<::String>] + # The set of permissions to check for the `resource`. Permissions with + # wildcards (such as '*' or 'storage.*') are not allowed. For more + # information see + # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Iam::V1::TestIamPermissionsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def test_iam_permissions request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest + + # 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.test_iam_permissions.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::Bigquery::DataPolicies::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.test_iam_permissions.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.test_iam_permissions.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @data_policy_service_stub.test_iam_permissions 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 DataPolicyService REST API. + # + # This class represents the configuration for DataPolicyService 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::Bigquery::DataPolicies::V1::DataPolicyService::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 + # # create_data_policy to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_data_policy.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_data_policy.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # The hostname or hostname:port of the service endpoint. + # Defaults to `"bigquerydatapolicy.googleapis.com"`. + # @return [::String] + # @!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] + # + class Configuration + extend ::Gapic::Config + + DEFAULT_ENDPOINT = "bigquerydatapolicy.googleapis.com" + + config_attr :endpoint, DEFAULT_ENDPOINT, ::String + 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 + + # @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 DataPolicyService 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 `create_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :create_data_policy + ## + # RPC-specific configuration for `update_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :update_data_policy + ## + # RPC-specific configuration for `rename_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :rename_data_policy + ## + # RPC-specific configuration for `delete_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_data_policy + ## + # RPC-specific configuration for `get_data_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :get_data_policy + ## + # RPC-specific configuration for `list_data_policies` + # @return [::Gapic::Config::Method] + # + attr_reader :list_data_policies + ## + # RPC-specific configuration for `get_iam_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :get_iam_policy + ## + # RPC-specific configuration for `set_iam_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :set_iam_policy + ## + # RPC-specific configuration for `test_iam_permissions` + # @return [::Gapic::Config::Method] + # + attr_reader :test_iam_permissions + + # @private + def initialize parent_rpcs = nil + create_data_policy_config = parent_rpcs.create_data_policy if parent_rpcs.respond_to? :create_data_policy + @create_data_policy = ::Gapic::Config::Method.new create_data_policy_config + update_data_policy_config = parent_rpcs.update_data_policy if parent_rpcs.respond_to? :update_data_policy + @update_data_policy = ::Gapic::Config::Method.new update_data_policy_config + rename_data_policy_config = parent_rpcs.rename_data_policy if parent_rpcs.respond_to? :rename_data_policy + @rename_data_policy = ::Gapic::Config::Method.new rename_data_policy_config + delete_data_policy_config = parent_rpcs.delete_data_policy if parent_rpcs.respond_to? :delete_data_policy + @delete_data_policy = ::Gapic::Config::Method.new delete_data_policy_config + get_data_policy_config = parent_rpcs.get_data_policy if parent_rpcs.respond_to? :get_data_policy + @get_data_policy = ::Gapic::Config::Method.new get_data_policy_config + list_data_policies_config = parent_rpcs.list_data_policies if parent_rpcs.respond_to? :list_data_policies + @list_data_policies = ::Gapic::Config::Method.new list_data_policies_config + get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy + @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config + set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy + @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config + test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions + @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest/service_stub.rb new file mode 100644 index 000000000000..9a35a750a69d --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/data_policy_service/rest/service_stub.rb @@ -0,0 +1,587 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/datapolicies/v1/datapolicy_pb" + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + module DataPolicyService + module Rest + ## + # REST service stub for the DataPolicyService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + def initialize endpoint:, 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, credentials: credentials, + numeric_enums: true, + raise_faraday_errors: false + end + + ## + # Baseline implementation for the create_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest] + # 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::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # A result object deserialized from the server's reply + def create_data_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_data_policy_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::Bigquery::DataPolicies::V1::DataPolicy.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the update_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest] + # 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::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # A result object deserialized from the server's reply + def update_data_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_data_policy_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::Bigquery::DataPolicies::V1::DataPolicy.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the rename_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest] + # 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::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # A result object deserialized from the server's reply + def rename_data_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_rename_data_policy_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::Bigquery::DataPolicies::V1::DataPolicy.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the delete_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest] + # 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_data_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_data_policy_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 get_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest] + # 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::Bigquery::DataPolicies::V1::DataPolicy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # A result object deserialized from the server's reply + def get_data_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_data_policy_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::Bigquery::DataPolicies::V1::DataPolicy.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the list_data_policies REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest] + # 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::Bigquery::DataPolicies::V1::ListDataPoliciesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesResponse] + # A result object deserialized from the server's reply + def list_data_policies request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_data_policies_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::Bigquery::DataPolicies::V1::ListDataPoliciesResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the get_iam_policy REST call + # + # @param request_pb [::Google::Iam::V1::GetIamPolicyRequest] + # 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::Iam::V1::Policy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Iam::V1::Policy] + # A result object deserialized from the server's reply + def get_iam_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_iam_policy_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::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the set_iam_policy REST call + # + # @param request_pb [::Google::Iam::V1::SetIamPolicyRequest] + # 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::Iam::V1::Policy] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Iam::V1::Policy] + # A result object deserialized from the server's reply + def set_iam_policy request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_set_iam_policy_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::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # Baseline implementation for the test_iam_permissions REST call + # + # @param request_pb [::Google::Iam::V1::TestIamPermissionsRequest] + # 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::Iam::V1::TestIamPermissionsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Iam::V1::TestIamPermissionsResponse] + # A result object deserialized from the server's reply + def test_iam_permissions request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_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::Iam::V1::TestIamPermissionsResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + + ## + # @private + # + # GRPC transcoding helper method for the create_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest] + # 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_data_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/dataPolicies", + body: "data_policy", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest] + # 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_data_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{data_policy.name}", + body: "data_policy", + matches: [ + ["data_policy.name", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the rename_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_rename_data_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:rename", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest] + # 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_data_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_data_policy REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest] + # 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_data_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_data_policies REST call + # + # @param request_pb [::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest] + # 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_data_policies_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/dataPolicies", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_iam_policy REST call + # + # @param request_pb [::Google::Iam::V1::GetIamPolicyRequest] + # 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_iam_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{resource}:getIamPolicy", + body: "*", + matches: [ + ["resource", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the set_iam_policy REST call + # + # @param request_pb [::Google::Iam::V1::SetIamPolicyRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_set_iam_policy_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{resource}:setIamPolicy", + body: "*", + matches: [ + ["resource", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the test_iam_permissions REST call + # + # @param request_pb [::Google::Iam::V1::TestIamPermissionsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_test_iam_permissions_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{resource}:testIamPermissions", + body: "*", + matches: [ + ["resource", %r{^projects/[^/]+/locations/[^/]+/dataPolicies/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/rest.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/rest.rb new file mode 100644 index 000000000000..37ea3a0438a0 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/rest.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/data_policies/v1/data_policy_service/rest" +require "google/cloud/bigquery/data_policies/v1/version" + +module Google + module Cloud + module Bigquery + module DataPolicies + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/cloud/bigquery/data_policies/v1/rest" + # client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new + # + module V1 + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/version.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/version.rb new file mode 100644 index 000000000000..1e44f0a2b7ce --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/data_policies/v1/version.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Bigquery + module DataPolicies + module V1 + VERSION = "0.0.1" + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/datapolicies/v1/datapolicy_pb.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/datapolicies/v1/datapolicy_pb.rb new file mode 100644 index 000000000000..198c6aa75a2c --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/datapolicies/v1/datapolicy_pb.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/bigquery/datapolicies/v1/datapolicy.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/iam/v1/iam_policy_pb' +require 'google/iam/v1/policy_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n6google/cloud/bigquery/datapolicies/v1/datapolicy.proto\x12%google.cloud.bigquery.datapolicies.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\xac\x01\n\x17\x43reateDataPolicyRequest\x12\x44\n\x06parent\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\x12,bigquerydatapolicy.googleapis.com/DataPolicy\x12K\n\x0b\x64\x61ta_policy\x18\x02 \x01(\x0b\x32\x31.google.cloud.bigquery.datapolicies.v1.DataPolicyB\x03\xe0\x41\x02\"\x97\x01\n\x17UpdateDataPolicyRequest\x12K\n\x0b\x64\x61ta_policy\x18\x01 \x01(\x0b\x32\x31.google.cloud.bigquery.datapolicies.v1.DataPolicyB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"M\n\x17RenameDataPolicyRequest\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1f\n\x12new_data_policy_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\"]\n\x17\x44\x65leteDataPolicyRequest\x12\x42\n\x04name\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\n,bigquerydatapolicy.googleapis.com/DataPolicy\"Z\n\x14GetDataPolicyRequest\x12\x42\n\x04name\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\n,bigquerydatapolicy.googleapis.com/DataPolicy\"\x96\x01\n\x17ListDataPoliciesRequest\x12\x44\n\x06parent\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\x12,bigquerydatapolicy.googleapis.com/DataPolicy\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x04 \x01(\t\"}\n\x18ListDataPoliciesResponse\x12H\n\rdata_policies\x18\x01 \x03(\x0b\x32\x31.google.cloud.bigquery.datapolicies.v1.DataPolicy\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x84\x04\n\nDataPolicy\x12\x14\n\npolicy_tag\x18\x04 \x01(\tH\x00\x12W\n\x13\x64\x61ta_masking_policy\x18\x05 \x01(\x0b\x32\x38.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicyH\x01\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12Z\n\x10\x64\x61ta_policy_type\x18\x02 \x01(\x0e\x32@.google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType\x12\x16\n\x0e\x64\x61ta_policy_id\x18\x03 \x01(\t\"m\n\x0e\x44\x61taPolicyType\x12 \n\x1c\x44\x41TA_POLICY_TYPE_UNSPECIFIED\x10\x00\x12 \n\x1c\x43OLUMN_LEVEL_SECURITY_POLICY\x10\x03\x12\x17\n\x13\x44\x41TA_MASKING_POLICY\x10\x02:u\xea\x41r\n,bigquerydatapolicy.googleapis.com/DataPolicy\x12\x42projects/{project}/locations/{location}/dataPolicies/{data_policy}B\x10\n\x0ematching_labelB\x08\n\x06policy\"\xea\x02\n\x11\x44\x61taMaskingPolicy\x12n\n\x15predefined_expression\x18\x01 \x01(\x0e\x32M.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpressionH\x00\"\xce\x01\n\x14PredefinedExpression\x12%\n!PREDEFINED_EXPRESSION_UNSPECIFIED\x10\x00\x12\n\n\x06SHA256\x10\x03\x12\x0f\n\x0b\x41LWAYS_NULL\x10\x05\x12\x19\n\x15\x44\x45\x46\x41ULT_MASKING_VALUE\x10\x07\x12\x18\n\x14LAST_FOUR_CHARACTERS\x10\t\x12\x19\n\x15\x46IRST_FOUR_CHARACTERS\x10\n\x12\x0e\n\nEMAIL_MASK\x10\x0c\x12\x12\n\x0e\x44\x41TE_YEAR_MASK\x10\rB\x14\n\x12masking_expression2\x90\x0f\n\x11\x44\x61taPolicyService\x12\xe1\x01\n\x10\x43reateDataPolicy\x12>.google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest\x1a\x31.google.cloud.bigquery.datapolicies.v1.DataPolicy\"Z\x82\xd3\xe4\x93\x02?\"0/v1/{parent=projects/*/locations/*}/dataPolicies:\x0b\x64\x61ta_policy\xda\x41\x12parent,data_policy\x12\xf2\x01\n\x10UpdateDataPolicy\x12>.google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest\x1a\x31.google.cloud.bigquery.datapolicies.v1.DataPolicy\"k\x82\xd3\xe4\x93\x02K2.google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest\x1a\x31.google.cloud.bigquery.datapolicies.v1.DataPolicy\"\\\x82\xd3\xe4\x93\x02<\"7/v1/{name=projects/*/locations/*/dataPolicies/*}:rename:\x01*\xda\x41\x17name,new_data_policy_id\x12\xab\x01\n\x10\x44\x65leteDataPolicy\x12>.google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest\x1a\x16.google.protobuf.Empty\"?\x82\xd3\xe4\x93\x02\x32*0/v1/{name=projects/*/locations/*/dataPolicies/*}\xda\x41\x04name\x12\xc0\x01\n\rGetDataPolicy\x12;.google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest\x1a\x31.google.cloud.bigquery.datapolicies.v1.DataPolicy\"?\x82\xd3\xe4\x93\x02\x32\x12\x30/v1/{name=projects/*/locations/*/dataPolicies/*}\xda\x41\x04name\x12\xd6\x01\n\x10ListDataPolicies\x12>.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest\x1a?.google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse\"A\x82\xd3\xe4\x93\x02\x32\x12\x30/v1/{parent=projects/*/locations/*}/dataPolicies\xda\x41\x06parent\x12\x97\x01\n\x0cGetIamPolicy\x12\".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy\"L\x82\xd3\xe4\x93\x02\x46\"A/v1/{resource=projects/*/locations/*/dataPolicies/*}:getIamPolicy:\x01*\x12\x97\x01\n\x0cSetIamPolicy\x12\".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy\"L\x82\xd3\xe4\x93\x02\x46\"A/v1/{resource=projects/*/locations/*/dataPolicies/*}:setIamPolicy:\x01*\x12\xbd\x01\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse\"R\x82\xd3\xe4\x93\x02L\"G/v1/{resource=projects/*/locations/*/dataPolicies/*}:testIamPermissions:\x01*\x1a~\xca\x41!bigquerydatapolicy.googleapis.com\xd2\x41Whttps://www.googleapis.com/auth/bigquery,https://www.googleapis.com/auth/cloud-platformB\x89\x02\n)com.google.cloud.bigquery.datapolicies.v1B\x0f\x44\x61taPolicyProtoP\x01ZMcloud.google.com/go/bigquery/datapolicies/apiv1/datapoliciespb;datapoliciespb\xaa\x02%Google.Cloud.BigQuery.DataPolicies.V1\xca\x02%Google\\Cloud\\BigQuery\\DataPolicies\\V1\xea\x02)Google::Cloud::Bigquery::DataPolicies::V1b\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool + +begin + pool.add_serialized_file(descriptor_data) +rescue TypeError => e + # Compatibility code: will be removed in the next major version. + require 'google/protobuf/descriptor_pb' + parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) + parsed.clear_dependency + serialized = parsed.class.encode(parsed) + file = pool.add_serialized_file(serialized) + warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" + imports = [ + ["google.protobuf.FieldMask", "google/protobuf/field_mask.proto"], + ] + imports.each do |type_name, expected_filename| + import_file = pool.lookup(type_name).file_descriptor + if import_file.name != expected_filename + warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" + end + end + warn "Each proto file must use a consistent fully-qualified name." + warn "This will become an error in the next major version." +end + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + CreateDataPolicyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.CreateDataPolicyRequest").msgclass + UpdateDataPolicyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.UpdateDataPolicyRequest").msgclass + RenameDataPolicyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.RenameDataPolicyRequest").msgclass + DeleteDataPolicyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.DeleteDataPolicyRequest").msgclass + GetDataPolicyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.GetDataPolicyRequest").msgclass + ListDataPoliciesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.ListDataPoliciesRequest").msgclass + ListDataPoliciesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.ListDataPoliciesResponse").msgclass + DataPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.DataPolicy").msgclass + DataPolicy::DataPolicyType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.DataPolicy.DataPolicyType").enummodule + DataMaskingPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy").msgclass + DataMaskingPolicy::PredefinedExpression = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression").enummodule + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/datapolicies/v1/datapolicy_services_pb.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/datapolicies/v1/datapolicy_services_pb.rb new file mode 100644 index 000000000000..110946832b86 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/lib/google/cloud/bigquery/datapolicies/v1/datapolicy_services_pb.rb @@ -0,0 +1,65 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/bigquery/datapolicies/v1/datapolicy.proto for package 'Google.Cloud.Bigquery.DataPolicies.V1' +# Original file comments: +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/bigquery/datapolicies/v1/datapolicy_pb' + +module Google + module Cloud + module Bigquery + module DataPolicies + module V1 + module DataPolicyService + # Data Policy Service provides APIs for managing the label-policy bindings. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.bigquery.datapolicies.v1.DataPolicyService' + + # Creates a new data policy under a project with the given `dataPolicyId` + # (used as the display name), policy tag, and data policy type. + rpc :CreateDataPolicy, ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest, ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy + # Updates the metadata for an existing data policy. The target data policy + # can be specified by the resource name. + rpc :UpdateDataPolicy, ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest, ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy + # Renames the id (display name) of the specified data policy. + rpc :RenameDataPolicy, ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest, ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy + # Deletes the data policy specified by its resource name. + rpc :DeleteDataPolicy, ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest, ::Google::Protobuf::Empty + # Gets the data policy specified by its resource name. + rpc :GetDataPolicy, ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest, ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy + # List all of the data policies in the specified parent project. + rpc :ListDataPolicies, ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest, ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesResponse + # Gets the IAM policy for the specified data policy. + rpc :GetIamPolicy, ::Google::Iam::V1::GetIamPolicyRequest, ::Google::Iam::V1::Policy + # Sets the IAM policy for the specified data policy. + rpc :SetIamPolicy, ::Google::Iam::V1::SetIamPolicyRequest, ::Google::Iam::V1::Policy + # Returns the caller's permission on the specified data policy resource. + rpc :TestIamPermissions, ::Google::Iam::V1::TestIamPermissionsRequest, ::Google::Iam::V1::TestIamPermissionsResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/README.md b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/README.md new file mode 100644 index 000000000000..62ba9a3872ea --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/README.md @@ -0,0 +1,4 @@ +# BigQuery Data Policy Service V1 Protocol Buffer Documentation + +These files are for the YARD documentation of the generated protobuf files. +They are not intended to be required or loaded at runtime. diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/client.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/client.rb new file mode 100644 index 000000000000..77056d6d22a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/client.rb @@ -0,0 +1,381 @@ +# frozen_string_literal: true + +# Copyright 2023 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 + # Required information for every language. + # @!attribute [rw] reference_docs_uri + # @return [::String] + # Link to automatically generated reference documentation. Example: + # https://cloud.google.com/nodejs/docs/reference/asset/latest + # @!attribute [rw] destinations + # @return [::Array<::Google::Api::ClientLibraryDestination>] + # 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 + 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 + 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/field_behavior.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..ca8d9e343c83 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2023 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 + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/launch_stage.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..173c5c85f5dc --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2023 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/resource.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..522e181c4702 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/api/resource.rb @@ -0,0 +1,222 @@ +# frozen_string_literal: true + +# Copyright 2023 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/cloud/bigquery/datapolicies/v1/datapolicy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/cloud/bigquery/datapolicies/v1/datapolicy.rb new file mode 100644 index 000000000000..c37a6d2ea72f --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/cloud/bigquery/datapolicies/v1/datapolicy.rb @@ -0,0 +1,260 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Bigquery + module DataPolicies + module V1 + # Request message for the CreateDataPolicy method. + # @!attribute [rw] parent + # @return [::String] + # Required. Resource name of the project that the data policy will belong to. + # The format is `projects/{project_number}/locations/{location_id}`. + # @!attribute [rw] data_policy + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # Required. The data policy to create. The `name` field does not need to be + # provided for the data policy creation. + class CreateDataPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for the UpdateDataPolicy method. + # @!attribute [rw] data_policy + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy] + # Required. Update the data policy's metadata. + # + # The target data policy is determined by the `name` field. + # Other fields are updated to the specified values based on the field masks. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # The update mask applies to the resource. For the `FieldMask` definition, + # see + # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + # If not set, defaults to all of the fields that are allowed to update. + # + # Updates to the `name` and `dataPolicyId` fields are not allowed. + class UpdateDataPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the RenameDataPolicy method. + # @!attribute [rw] name + # @return [::String] + # Required. Resource name of the data policy to rename. The format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}` + # @!attribute [rw] new_data_policy_id + # @return [::String] + # Required. The new data policy id. + class RenameDataPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the DeleteDataPolicy method. + # @!attribute [rw] name + # @return [::String] + # Required. Resource name of the data policy to delete. Format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + class DeleteDataPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the GetDataPolicy method. + # @!attribute [rw] name + # @return [::String] + # Required. Resource name of the requested data policy. Format is + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + class GetDataPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the ListDataPolicies method. + # @!attribute [rw] parent + # @return [::String] + # Required. Resource name of the project for which to list data policies. + # Format is `projects/{project_number}/locations/{location_id}`. + # @!attribute [rw] page_size + # @return [::Integer] + # The maximum number of data policies to return. Must be a value between 1 + # and 1000. + # If not set, defaults to 50. + # @!attribute [rw] page_token + # @return [::String] + # The `nextPageToken` value returned from a previous list request, if any. If + # not set, defaults to an empty string. + # @!attribute [rw] filter + # @return [::String] + # Filters the data policies by policy tags that they + # are associated with. Currently filter only supports + # "policy_tag" based filtering and OR based predicates. Sample + # filter can be "policy_tag: + # projects/1/locations/us/taxonomies/2/policyTags/3". + # You may also use wildcard such as "policy_tag: + # projects/1/locations/us/taxonomies/2*". Please note that OR predicates + # cannot be used with wildcard filters. + class ListDataPoliciesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for the ListDataPolicies method. + # @!attribute [rw] data_policies + # @return [::Array<::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy>] + # Data policies that belong to the requested project. + # @!attribute [rw] next_page_token + # @return [::String] + # Token used to retrieve the next page of results, or empty if there are no + # more results. + class ListDataPoliciesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents the label-policy binding. + # @!attribute [rw] policy_tag + # @return [::String] + # Policy tag resource name, in the format of + # `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`. + # @!attribute [rw] data_masking_policy + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataMaskingPolicy] + # The data masking policy that specifies the data masking rule to use. + # @!attribute [r] name + # @return [::String] + # Output only. Resource name of this data policy, in the format of + # `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. + # @!attribute [rw] data_policy_type + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy::DataPolicyType] + # Type of data policy. + # @!attribute [rw] data_policy_id + # @return [::String] + # User-assigned (human readable) ID of the data policy that needs to be + # unique within a project. Used as \\{data_policy_id} in part of the resource + # name. + class DataPolicy + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A list of supported data policy types. + module DataPolicyType + # Default value for the data policy type. This should not be used. + DATA_POLICY_TYPE_UNSPECIFIED = 0 + + # Used to create a data policy for column-level security, without data + # masking. + COLUMN_LEVEL_SECURITY_POLICY = 3 + + # Used to create a data policy for data masking. + DATA_MASKING_POLICY = 2 + end + end + + # The data masking policy that is used to specify data masking rule. + # @!attribute [rw] predefined_expression + # @return [::Google::Cloud::Bigquery::DataPolicies::V1::DataMaskingPolicy::PredefinedExpression] + # A predefined masking expression. + class DataMaskingPolicy + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The available masking rules. Learn more here: + # https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. + module PredefinedExpression + # Default, unspecified predefined expression. No masking will take place + # since no expression is specified. + PREDEFINED_EXPRESSION_UNSPECIFIED = 0 + + # Masking expression to replace data with SHA-256 hash. + SHA256 = 3 + + # Masking expression to replace data with NULLs. + ALWAYS_NULL = 5 + + # Masking expression to replace data with their default masking values. + # The default masking values for each type listed as below: + # + # * STRING: "" + # * BYTES: b'' + # * INTEGER: 0 + # * FLOAT: 0.0 + # * NUMERIC: 0 + # * BOOLEAN: FALSE + # * TIMESTAMP: 1970-01-01 00:00:00 UTC + # * DATE: 1970-01-01 + # * TIME: 00:00:00 + # * DATETIME: 1970-01-01T00:00:00 + # * GEOGRAPHY: POINT(0 0) + # * BIGNUMERIC: 0 + # * ARRAY: [] + # * STRUCT: NOT_APPLICABLE + # * JSON: NULL + DEFAULT_MASKING_VALUE = 7 + + # Masking expression shows the last four characters of text. + # The masking behavior is as follows: + # + # * If text length > 4 characters: Replace text with XXXXX, append last + # four characters of original text. + # * If text length <= 4 characters: Apply SHA-256 hash. + LAST_FOUR_CHARACTERS = 9 + + # Masking expression shows the first four characters of text. + # The masking behavior is as follows: + # + # * If text length > 4 characters: Replace text with XXXXX, prepend first + # four characters of original text. + # * If text length <= 4 characters: Apply SHA-256 hash. + FIRST_FOUR_CHARACTERS = 10 + + # Masking expression for email addresses. + # The masking behavior is as follows: + # + # * Syntax-valid email address: Replace username with XXXXX. For example, + # cloudysanfrancisco@gmail.com becomes XXXXX@gmail.com. + # * Syntax-invalid email address: Apply SHA-256 hash. + # + # For more information, see [Email + # mask](https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options). + EMAIL_MASK = 12 + + # Masking expression to only show the year of `Date`, + # `DateTime` and `TimeStamp`. For example, with the + # year 2076: + # + # * DATE : 2076-01-01 + # * DATETIME : 2076-01-01T00:00:00 + # * TIMESTAMP : 2076-01-01 00:00:00 UTC + # + # Truncation occurs according to the UTC time zone. To change this, adjust + # the default time zone using the `time_zone` system variable. + # For more information, see the System + # variables reference. + DATE_YEAR_MASK = 13 + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/iam_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/iam_policy.rb new file mode 100644 index 000000000000..b1995c4fd769 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/iam_policy.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Iam + module V1 + # Request message for `SetIamPolicy` method. + # @!attribute [rw] resource + # @return [::String] + # REQUIRED: The resource for which the policy is being specified. + # See the operation documentation for the appropriate value for this field. + # @!attribute [rw] policy + # @return [::Google::Iam::V1::Policy] + # REQUIRED: The complete policy to be applied to the `resource`. The size of + # the policy is limited to a few 10s of KB. An empty policy is a + # valid policy but certain Cloud Platform services (such as Projects) + # might reject them. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + # the fields in the mask will be modified. If no mask is provided, the + # following default mask is used: + # + # `paths: "bindings, etag"` + class SetIamPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for `GetIamPolicy` method. + # @!attribute [rw] resource + # @return [::String] + # REQUIRED: The resource for which the policy is being requested. + # See the operation documentation for the appropriate value for this field. + # @!attribute [rw] options + # @return [::Google::Iam::V1::GetPolicyOptions] + # OPTIONAL: A `GetPolicyOptions` object for specifying options to + # `GetIamPolicy`. + class GetIamPolicyRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for `TestIamPermissions` method. + # @!attribute [rw] resource + # @return [::String] + # REQUIRED: The resource for which the policy detail is being requested. + # See the operation documentation for the appropriate value for this field. + # @!attribute [rw] permissions + # @return [::Array<::String>] + # The set of permissions to check for the `resource`. Permissions with + # wildcards (such as '*' or 'storage.*') are not allowed. For more + # information see + # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + class TestIamPermissionsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for `TestIamPermissions` method. + # @!attribute [rw] permissions + # @return [::Array<::String>] + # A subset of `TestPermissionsRequest.permissions` that the caller is + # allowed. + class TestIamPermissionsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/options.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/options.rb new file mode 100644 index 000000000000..e1403ee228d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/options.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Iam + module V1 + # Encapsulates settings provided to GetIamPolicy. + # @!attribute [rw] requested_policy_version + # @return [::Integer] + # Optional. The maximum policy version that will be used to format the + # policy. + # + # Valid values are 0, 1, and 3. Requests specifying an invalid value will be + # rejected. + # + # Requests for policies with any conditional role bindings must specify + # version 3. Policies with no conditional role bindings may specify any valid + # value or leave the field unset. + # + # The policy in the response might use the policy version that you specified, + # or it might use a lower policy version. For example, if you specify version + # 3, but the policy has no conditional role bindings, the response uses + # version 1. + # + # To learn which resources support conditions in their IAM policies, see the + # [IAM + # documentation](https://cloud.google.com/iam/help/conditions/resource-policies). + class GetPolicyOptions + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/policy.rb new file mode 100644 index 000000000000..751130dab8db --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/iam/v1/policy.rb @@ -0,0 +1,426 @@ +# frozen_string_literal: true + +# Copyright 2023 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 Iam + module V1 + # An Identity and Access Management (IAM) policy, which specifies access + # controls for Google Cloud resources. + # + # + # A `Policy` is a collection of `bindings`. A `binding` binds one or more + # `members`, or principals, to a single `role`. Principals can be user + # accounts, service accounts, Google groups, and domains (such as G Suite). A + # `role` is a named list of permissions; each `role` can be an IAM predefined + # role or a user-created custom role. + # + # For some types of Google Cloud resources, a `binding` can also specify a + # `condition`, which is a logical expression that allows access to a resource + # only if the expression evaluates to `true`. A condition can add constraints + # based on attributes of the request, the resource, or both. To learn which + # resources support conditions in their IAM policies, see the + # [IAM + # documentation](https://cloud.google.com/iam/help/conditions/resource-policies). + # + # **JSON example:** + # + # ``` + # { + # "bindings": [ + # { + # "role": "roles/resourcemanager.organizationAdmin", + # "members": [ + # "user:mike@example.com", + # "group:admins@example.com", + # "domain:google.com", + # "serviceAccount:my-project-id@appspot.gserviceaccount.com" + # ] + # }, + # { + # "role": "roles/resourcemanager.organizationViewer", + # "members": [ + # "user:eve@example.com" + # ], + # "condition": { + # "title": "expirable access", + # "description": "Does not grant access after Sep 2020", + # "expression": "request.time < + # timestamp('2020-10-01T00:00:00.000Z')", + # } + # } + # ], + # "etag": "BwWWja0YfJA=", + # "version": 3 + # } + # ``` + # + # **YAML example:** + # + # ``` + # bindings: + # - members: + # - user:mike@example.com + # - group:admins@example.com + # - domain:google.com + # - serviceAccount:my-project-id@appspot.gserviceaccount.com + # role: roles/resourcemanager.organizationAdmin + # - members: + # - user:eve@example.com + # role: roles/resourcemanager.organizationViewer + # condition: + # title: expirable access + # description: Does not grant access after Sep 2020 + # expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + # etag: BwWWja0YfJA= + # version: 3 + # ``` + # + # For a description of IAM and its features, see the + # [IAM documentation](https://cloud.google.com/iam/docs/). + # @!attribute [rw] version + # @return [::Integer] + # Specifies the format of the policy. + # + # Valid values are `0`, `1`, and `3`. Requests that specify an invalid value + # are rejected. + # + # Any operation that affects conditional role bindings must specify version + # `3`. This requirement applies to the following operations: + # + # * Getting a policy that includes a conditional role binding + # * Adding a conditional role binding to a policy + # * Changing a conditional role binding in a policy + # * Removing any role binding, with or without a condition, from a policy + # that includes conditions + # + # **Important:** If you use IAM Conditions, you must include the `etag` field + # whenever you call `setIamPolicy`. If you omit this field, then IAM allows + # you to overwrite a version `3` policy with a version `1` policy, and all of + # the conditions in the version `3` policy are lost. + # + # If a policy does not include any conditions, operations on that policy may + # specify any valid version or leave the field unset. + # + # To learn which resources support conditions in their IAM policies, see the + # [IAM + # documentation](https://cloud.google.com/iam/help/conditions/resource-policies). + # @!attribute [rw] bindings + # @return [::Array<::Google::Iam::V1::Binding>] + # Associates a list of `members`, or principals, with a `role`. Optionally, + # may specify a `condition` that determines how and when the `bindings` are + # applied. Each of the `bindings` must contain at least one principal. + # + # The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 + # of these principals can be Google groups. Each occurrence of a principal + # counts towards these limits. For example, if the `bindings` grant 50 + # different roles to `user:alice@example.com`, and not to any other + # principal, then you can add another 1,450 principals to the `bindings` in + # the `Policy`. + # @!attribute [rw] audit_configs + # @return [::Array<::Google::Iam::V1::AuditConfig>] + # Specifies cloud audit logging configuration for this policy. + # @!attribute [rw] etag + # @return [::String] + # `etag` is used for optimistic concurrency control as a way to help + # prevent simultaneous updates of a policy from overwriting each other. + # It is strongly suggested that systems make use of the `etag` in the + # read-modify-write cycle to perform policy updates in order to avoid race + # conditions: An `etag` is returned in the response to `getIamPolicy`, and + # systems are expected to put that etag in the request to `setIamPolicy` to + # ensure that their change will be applied to the same version of the policy. + # + # **Important:** If you use IAM Conditions, you must include the `etag` field + # whenever you call `setIamPolicy`. If you omit this field, then IAM allows + # you to overwrite a version `3` policy with a version `1` policy, and all of + # the conditions in the version `3` policy are lost. + class Policy + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Associates `members`, or principals, with a `role`. + # @!attribute [rw] role + # @return [::String] + # Role that is assigned to the list of `members`, or principals. + # For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + # @!attribute [rw] members + # @return [::Array<::String>] + # Specifies the principals requesting access for a Google Cloud resource. + # `members` can have the following values: + # + # * `allUsers`: A special identifier that represents anyone who is + # on the internet; with or without a Google account. + # + # * `allAuthenticatedUsers`: A special identifier that represents anyone + # who is authenticated with a Google account or a service account. + # + # * `user:{emailid}`: An email address that represents a specific Google + # account. For example, `alice@example.com` . + # + # + # * `serviceAccount:{emailid}`: An email address that represents a service + # account. For example, `my-other-app@appspot.gserviceaccount.com`. + # + # * `group:{emailid}`: An email address that represents a Google group. + # For example, `admins@example.com`. + # + # * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique + # identifier) representing a user that has been recently deleted. For + # example, `alice@example.com?uid=123456789012345678901`. If the user is + # recovered, this value reverts to `user:{emailid}` and the recovered user + # retains the role in the binding. + # + # * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus + # unique identifier) representing a service account that has been recently + # deleted. For example, + # `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. + # If the service account is undeleted, this value reverts to + # `serviceAccount:{emailid}` and the undeleted service account retains the + # role in the binding. + # + # * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique + # identifier) representing a Google group that has been recently + # deleted. For example, `admins@example.com?uid=123456789012345678901`. If + # the group is recovered, this value reverts to `group:{emailid}` and the + # recovered group retains the role in the binding. + # + # + # * `domain:{domain}`: The G Suite domain (primary) that represents all the + # users of that domain. For example, `google.com` or `example.com`. + # @!attribute [rw] condition + # @return [::Google::Type::Expr] + # The condition that is associated with this binding. + # + # If the condition evaluates to `true`, then this binding applies to the + # current request. + # + # If the condition evaluates to `false`, then this binding does not apply to + # the current request. However, a different role binding might grant the same + # role to one or more of the principals in this binding. + # + # To learn which resources support conditions in their IAM policies, see the + # [IAM + # documentation](https://cloud.google.com/iam/help/conditions/resource-policies). + class Binding + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Specifies the audit configuration for a service. + # The configuration determines which permission types are logged, and what + # identities, if any, are exempted from logging. + # An AuditConfig must have one or more AuditLogConfigs. + # + # If there are AuditConfigs for both `allServices` and a specific service, + # the union of the two AuditConfigs is used for that service: the log_types + # specified in each AuditConfig are enabled, and the exempted_members in each + # AuditLogConfig are exempted. + # + # Example Policy with multiple AuditConfigs: + # + # { + # "audit_configs": [ + # { + # "service": "allServices", + # "audit_log_configs": [ + # { + # "log_type": "DATA_READ", + # "exempted_members": [ + # "user:jose@example.com" + # ] + # }, + # { + # "log_type": "DATA_WRITE" + # }, + # { + # "log_type": "ADMIN_READ" + # } + # ] + # }, + # { + # "service": "sampleservice.googleapis.com", + # "audit_log_configs": [ + # { + # "log_type": "DATA_READ" + # }, + # { + # "log_type": "DATA_WRITE", + # "exempted_members": [ + # "user:aliya@example.com" + # ] + # } + # ] + # } + # ] + # } + # + # For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ + # logging. It also exempts `jose@example.com` from DATA_READ logging, and + # `aliya@example.com` from DATA_WRITE logging. + # @!attribute [rw] service + # @return [::String] + # Specifies a service that will be enabled for audit logging. + # For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + # `allServices` is a special value that covers all services. + # @!attribute [rw] audit_log_configs + # @return [::Array<::Google::Iam::V1::AuditLogConfig>] + # The configuration for logging of each type of permission. + class AuditConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Provides the configuration for logging a type of permissions. + # Example: + # + # { + # "audit_log_configs": [ + # { + # "log_type": "DATA_READ", + # "exempted_members": [ + # "user:jose@example.com" + # ] + # }, + # { + # "log_type": "DATA_WRITE" + # } + # ] + # } + # + # This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting + # jose@example.com from DATA_READ logging. + # @!attribute [rw] log_type + # @return [::Google::Iam::V1::AuditLogConfig::LogType] + # The log type that this config enables. + # @!attribute [rw] exempted_members + # @return [::Array<::String>] + # Specifies the identities that do not cause logging for this type of + # permission. + # Follows the same format of + # {::Google::Iam::V1::Binding#members Binding.members}. + class AuditLogConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The list of valid permission types for which logging can be configured. + # Admin writes are always logged, and are not configurable. + module LogType + # Default case. Should never be this. + LOG_TYPE_UNSPECIFIED = 0 + + # Admin reads. Example: CloudIAM getIamPolicy + ADMIN_READ = 1 + + # Data writes. Example: CloudSQL Users create + DATA_WRITE = 2 + + # Data reads. Example: CloudSQL Users list + DATA_READ = 3 + end + end + + # The difference delta between two policies. + # @!attribute [rw] binding_deltas + # @return [::Array<::Google::Iam::V1::BindingDelta>] + # The delta for Bindings between two policies. + # @!attribute [rw] audit_config_deltas + # @return [::Array<::Google::Iam::V1::AuditConfigDelta>] + # The delta for AuditConfigs between two policies. + class PolicyDelta + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # One delta entry for Binding. Each individual change (only one member in each + # entry) to a binding will be a separate entry. + # @!attribute [rw] action + # @return [::Google::Iam::V1::BindingDelta::Action] + # The action that was performed on a Binding. + # Required + # @!attribute [rw] role + # @return [::String] + # Role that is assigned to `members`. + # For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + # Required + # @!attribute [rw] member + # @return [::String] + # A single identity requesting access for a Google Cloud resource. + # Follows the same format of Binding.members. + # Required + # @!attribute [rw] condition + # @return [::Google::Type::Expr] + # The condition that is associated with this binding. + class BindingDelta + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The type of action performed on a Binding in a policy. + module Action + # Unspecified. + ACTION_UNSPECIFIED = 0 + + # Addition of a Binding. + ADD = 1 + + # Removal of a Binding. + REMOVE = 2 + end + end + + # One delta entry for AuditConfig. Each individual change (only one + # exempted_member in each entry) to a AuditConfig will be a separate entry. + # @!attribute [rw] action + # @return [::Google::Iam::V1::AuditConfigDelta::Action] + # The action that was performed on an audit configuration in a policy. + # Required + # @!attribute [rw] service + # @return [::String] + # Specifies a service that was configured for Cloud Audit Logging. + # For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + # `allServices` is a special value that covers all services. + # Required + # @!attribute [rw] exempted_member + # @return [::String] + # A single identity that is exempted from "data access" audit + # logging for the `service` specified above. + # Follows the same format of Binding.members. + # @!attribute [rw] log_type + # @return [::String] + # Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always + # enabled, and cannot be configured. + # Required + class AuditConfigDelta + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The type of action performed on an audit configuration in a policy. + module Action + # Unspecified. + ACTION_UNSPECIFIED = 0 + + # Addition of an audit configuration. + ADD = 1 + + # Removal of an audit configuration. + REMOVE = 2 + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/duration.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..b4a53d0ac67f --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2023 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/empty.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/empty.rb new file mode 100644 index 000000000000..4c0ad96e8eb9 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/empty.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Copyright 2023 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/field_mask.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..c437e42a7581 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# frozen_string_literal: true + +# Copyright 2023 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/type/expr.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/type/expr.rb new file mode 100644 index 000000000000..a9f8fd727691 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/proto_docs/google/type/expr.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Copyright 2023 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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/Gemfile b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/Gemfile new file mode 100644 index 000000000000..45f8c1a0d189 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2023 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-bigquery-data_policies-v1", path: "../" +else + gem "google-cloud-bigquery-data_policies-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/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/create_data_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/create_data_policy.rb new file mode 100644 index 000000000000..e16699bacdaa --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/create_data_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_CreateDataPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the create_data_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#create_data_policy. +# It may require modification in order to execute successfully. +# +def create_data_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new + + # Call the create_data_policy method. + result = client.create_data_policy request + + # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_CreateDataPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/delete_data_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/delete_data_policy.rb new file mode 100644 index 000000000000..beabd20227bc --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/delete_data_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_DeleteDataPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the delete_data_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#delete_data_policy. +# It may require modification in order to execute successfully. +# +def delete_data_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.new + + # Call the delete_data_policy method. + result = client.delete_data_policy request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_DeleteDataPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/get_data_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/get_data_policy.rb new file mode 100644 index 000000000000..82e8b386065a --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/get_data_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_GetDataPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the get_data_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#get_data_policy. +# It may require modification in order to execute successfully. +# +def get_data_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.new + + # Call the get_data_policy method. + result = client.get_data_policy request + + # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_GetDataPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/get_iam_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/get_iam_policy.rb new file mode 100644 index 000000000000..deb16ed585fb --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/get_iam_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_GetIamPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the get_iam_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#get_iam_policy. +# It may require modification in order to execute successfully. +# +def get_iam_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Iam::V1::GetIamPolicyRequest.new + + # Call the get_iam_policy method. + result = client.get_iam_policy request + + # The returned object is of type Google::Iam::V1::Policy. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_GetIamPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/list_data_policies.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/list_data_policies.rb new file mode 100644 index 000000000000..c1e63d9ab0d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/list_data_policies.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_ListDataPolicies_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the list_data_policies call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#list_data_policies. +# It may require modification in order to execute successfully. +# +def list_data_policies + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new + + # Call the list_data_policies method. + result = client.list_data_policies 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::Bigquery::DataPolicies::V1::DataPolicy. + p item + end +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_ListDataPolicies_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/rename_data_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/rename_data_policy.rb new file mode 100644 index 000000000000..89ea71a9ee99 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/rename_data_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_RenameDataPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the rename_data_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#rename_data_policy. +# It may require modification in order to execute successfully. +# +def rename_data_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new + + # Call the rename_data_policy method. + result = client.rename_data_policy request + + # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_RenameDataPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/set_iam_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/set_iam_policy.rb new file mode 100644 index 000000000000..9db7239332f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/set_iam_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_SetIamPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the set_iam_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#set_iam_policy. +# It may require modification in order to execute successfully. +# +def set_iam_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Iam::V1::SetIamPolicyRequest.new + + # Call the set_iam_policy method. + result = client.set_iam_policy request + + # The returned object is of type Google::Iam::V1::Policy. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_SetIamPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/test_iam_permissions.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/test_iam_permissions.rb new file mode 100644 index 000000000000..7580a0067bec --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/test_iam_permissions.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_TestIamPermissions_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the test_iam_permissions call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#test_iam_permissions. +# It may require modification in order to execute successfully. +# +def test_iam_permissions + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Iam::V1::TestIamPermissionsRequest.new + + # Call the test_iam_permissions method. + result = client.test_iam_permissions request + + # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_TestIamPermissions_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/update_data_policy.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/update_data_policy.rb new file mode 100644 index 000000000000..8f6c18e8d351 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/data_policy_service/update_data_policy.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright 2023 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 bigquerydatapolicy_v1_generated_DataPolicyService_UpdateDataPolicy_sync] +require "google/cloud/bigquery/data_policies/v1" + +## +# Snippet for the update_data_policy call in the DataPolicyService service +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#update_data_policy. +# It may require modification in order to execute successfully. +# +def update_data_policy + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new + + # Call the update_data_policy method. + result = client.update_data_policy request + + # The returned object is of type Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy. + p result +end +# [END bigquerydatapolicy_v1_generated_DataPolicyService_UpdateDataPolicy_sync] diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/snippet_metadata_google.cloud.bigquery.datapolicies.v1.json b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/snippet_metadata_google.cloud.bigquery.datapolicies.v1.json new file mode 100644 index 000000000000..6c3076e6fceb --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/snippets/snippet_metadata_google.cloud.bigquery.datapolicies.v1.json @@ -0,0 +1,375 @@ +{ + "client_library": { + "name": "google-cloud-bigquery-data_policies-v1", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.cloud.bigquery.datapolicies.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_CreateDataPolicy_sync", + "title": "Snippet for the create_data_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#create_data_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/create_data_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_data_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#create_data_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "CreateDataPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.CreateDataPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_UpdateDataPolicy_sync", + "title": "Snippet for the update_data_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#update_data_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/update_data_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_data_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#update_data_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "UpdateDataPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.UpdateDataPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_RenameDataPolicy_sync", + "title": "Snippet for the rename_data_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#rename_data_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/rename_data_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "rename_data_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#rename_data_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "RenameDataPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.RenameDataPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_DeleteDataPolicy_sync", + "title": "Snippet for the delete_data_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#delete_data_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/delete_data_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_data_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#delete_data_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "DeleteDataPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.DeleteDataPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_GetDataPolicy_sync", + "title": "Snippet for the get_data_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#get_data_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/get_data_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_data_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#get_data_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "GetDataPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.GetDataPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_ListDataPolicies_sync", + "title": "Snippet for the list_data_policies call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#list_data_policies. It may require modification in order to execute successfully.", + "file": "data_policy_service/list_data_policies.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_data_policies", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#list_data_policies", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesResponse", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "ListDataPolicies", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.ListDataPolicies", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 45, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_GetIamPolicy_sync", + "title": "Snippet for the get_iam_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#get_iam_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/get_iam_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_iam_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#get_iam_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Iam::V1::GetIamPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Iam::V1::Policy", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "GetIamPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.GetIamPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_SetIamPolicy_sync", + "title": "Snippet for the set_iam_policy call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#set_iam_policy. It may require modification in order to execute successfully.", + "file": "data_policy_service/set_iam_policy.rb", + "language": "RUBY", + "client_method": { + "short_name": "set_iam_policy", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#set_iam_policy", + "async": false, + "parameters": [ + { + "type": "::Google::Iam::V1::SetIamPolicyRequest", + "name": "request" + } + ], + "result_type": "::Google::Iam::V1::Policy", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "SetIamPolicy", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.SetIamPolicy", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + }, + { + "region_tag": "bigquerydatapolicy_v1_generated_DataPolicyService_TestIamPermissions_sync", + "title": "Snippet for the test_iam_permissions call in the DataPolicyService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#test_iam_permissions. It may require modification in order to execute successfully.", + "file": "data_policy_service/test_iam_permissions.rb", + "language": "RUBY", + "client_method": { + "short_name": "test_iam_permissions", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client#test_iam_permissions", + "async": false, + "parameters": [ + { + "type": "::Google::Iam::V1::TestIamPermissionsRequest", + "name": "request" + } + ], + "result_type": "::Google::Iam::V1::TestIamPermissionsResponse", + "client": { + "short_name": "DataPolicyService::Client", + "full_name": "::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client" + }, + "method": { + "short_name": "TestIamPermissions", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService.TestIamPermissions", + "service": { + "short_name": "DataPolicyService", + "full_name": "google.cloud.bigquery.datapolicies.v1.DataPolicyService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 41, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_paths_test.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_paths_test.rb new file mode 100644 index 000000000000..692164377346 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_paths_test.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/data_policies/v1/data_policy_service" + +class ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::ClientPathsTest < Minitest::Test + def test_data_policy_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, nil do + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.data_policy_path project: "value0", location: "value1", data_policy: "value2" + assert_equal "projects/value0/locations/value1/dataPolicies/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, nil do + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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 +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_rest_test.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_rest_test.rb new file mode 100644 index 000000000000..34c3d8dc394b --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_rest_test.rb @@ -0,0 +1,578 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/datapolicies/v1/datapolicy_pb" +require "google/cloud/bigquery/data_policies/v1/data_policy_service/rest" + + +class ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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 + end + + def test_create_data_policy + # Create test objects. + client_result = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + data_policy = {} + + create_data_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_create_data_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_data_policy({ parent: parent, data_policy: data_policy }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_data_policy parent: parent, data_policy: data_policy do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new(parent: parent, data_policy: data_policy) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_data_policy({ parent: parent, data_policy: data_policy }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new(parent: parent, data_policy: data_policy), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_data_policy_client_stub.call_count + end + end + end + + def test_update_data_policy + # Create test objects. + client_result = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + data_policy = {} + update_mask = {} + + update_data_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_update_data_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_data_policy({ data_policy: data_policy, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_data_policy data_policy: data_policy, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new(data_policy: data_policy, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_data_policy({ data_policy: data_policy, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new(data_policy: data_policy, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_data_policy_client_stub.call_count + end + end + end + + def test_rename_data_policy + # Create test objects. + client_result = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + new_data_policy_id = "hello world" + + rename_data_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_rename_data_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, rename_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.rename_data_policy({ name: name, new_data_policy_id: new_data_policy_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.rename_data_policy name: name, new_data_policy_id: new_data_policy_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.rename_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new(name: name, new_data_policy_id: new_data_policy_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.rename_data_policy({ name: name, new_data_policy_id: new_data_policy_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.rename_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new(name: name, new_data_policy_id: new_data_policy_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, rename_data_policy_client_stub.call_count + end + end + end + + def test_delete_data_policy + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_data_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_delete_data_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_data_policy({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_data_policy name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_data_policy({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_data_policy_client_stub.call_count + end + end + end + + def test_get_data_policy + # Create test objects. + client_result = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_data_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_get_data_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_data_policy({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_data_policy name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_data_policy({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_data_policy_client_stub.call_count + end + end + end + + def test_list_data_policies + # Create test objects. + client_result = ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesResponse.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" + + list_data_policies_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_list_data_policies_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_data_policies_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_data_policies({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_data_policies parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_data_policies ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_data_policies({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_data_policies(::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_data_policies_client_stub.call_count + end + end + end + + def test_get_iam_policy + # Create test objects. + client_result = ::Google::Iam::V1::Policy.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + resource = "hello world" + options = {} + + get_iam_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_get_iam_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_iam_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_iam_policy({ resource: resource, options: options }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_iam_policy resource: resource, options: options do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_iam_policy ::Google::Iam::V1::GetIamPolicyRequest.new(resource: resource, options: options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_iam_policy({ resource: resource, options: options }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_iam_policy(::Google::Iam::V1::GetIamPolicyRequest.new(resource: resource, options: options), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_iam_policy_client_stub.call_count + end + end + end + + def test_set_iam_policy + # Create test objects. + client_result = ::Google::Iam::V1::Policy.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + resource = "hello world" + policy = {} + update_mask = {} + + set_iam_policy_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_set_iam_policy_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, set_iam_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.set_iam_policy({ resource: resource, policy: policy, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.set_iam_policy resource: resource, policy: policy, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.set_iam_policy ::Google::Iam::V1::SetIamPolicyRequest.new(resource: resource, policy: policy, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.set_iam_policy({ resource: resource, policy: policy, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.set_iam_policy(::Google::Iam::V1::SetIamPolicyRequest.new(resource: resource, policy: policy, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, set_iam_policy_client_stub.call_count + end + end + end + + def test_test_iam_permissions + # Create test objects. + client_result = ::Google::Iam::V1::TestIamPermissionsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + resource = "hello world" + permissions = ["hello world"] + + test_iam_permissions_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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::ServiceStub.stub :transcode_test_iam_permissions_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, test_iam_permissions_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.test_iam_permissions({ resource: resource, permissions: permissions }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.test_iam_permissions resource: resource, permissions: permissions do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.test_iam_permissions ::Google::Iam::V1::TestIamPermissionsRequest.new(resource: resource, permissions: permissions) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.test_iam_permissions({ resource: resource, permissions: permissions }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.test_iam_permissions(::Google::Iam::V1::TestIamPermissionsRequest.new(resource: resource, permissions: permissions), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, test_iam_permissions_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + Gapic::Rest::ClientStub.stub :new, nil do + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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::Bigquery::DataPolicies::V1::DataPolicyService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_test.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_test.rb new file mode 100644 index 000000000000..7831d97570fd --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/google/cloud/bigquery/data_policies/v1/data_policy_service_test.rb @@ -0,0 +1,614 @@ +# frozen_string_literal: true + +# Copyright 2023 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/bigquery/datapolicies/v1/datapolicy_pb" +require "google/cloud/bigquery/datapolicies/v1/datapolicy_services_pb" +require "google/cloud/bigquery/data_policies/v1/data_policy_service" + +class ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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 + end + + def test_create_data_policy + # Create GRPC objects. + grpc_response = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.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" + data_policy = {} + + create_data_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_data_policy, name + assert_kind_of ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy), request["data_policy"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_data_policy({ parent: parent, data_policy: data_policy }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_data_policy parent: parent, data_policy: data_policy do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new(parent: parent, data_policy: data_policy) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_data_policy({ parent: parent, data_policy: data_policy }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::CreateDataPolicyRequest.new(parent: parent, data_policy: data_policy), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_data_policy_client_stub.call_rpc_count + end + end + + def test_update_data_policy + # Create GRPC objects. + grpc_response = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.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. + data_policy = {} + update_mask = {} + + update_data_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_data_policy, name + assert_kind_of ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy), request["data_policy"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_data_policy({ data_policy: data_policy, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_data_policy data_policy: data_policy, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new(data_policy: data_policy, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_data_policy({ data_policy: data_policy, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::UpdateDataPolicyRequest.new(data_policy: data_policy, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_data_policy_client_stub.call_rpc_count + end + end + + def test_rename_data_policy + # Create GRPC objects. + grpc_response = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.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" + new_data_policy_id = "hello world" + + rename_data_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :rename_data_policy, name + assert_kind_of ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["new_data_policy_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, rename_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.rename_data_policy({ name: name, new_data_policy_id: new_data_policy_id }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.rename_data_policy name: name, new_data_policy_id: new_data_policy_id do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.rename_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new(name: name, new_data_policy_id: new_data_policy_id) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.rename_data_policy({ name: name, new_data_policy_id: new_data_policy_id }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.rename_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::RenameDataPolicyRequest.new(name: name, new_data_policy_id: new_data_policy_id), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, rename_data_policy_client_stub.call_rpc_count + end + end + + def test_delete_data_policy + # 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_data_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_data_policy, name + assert_kind_of ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_data_policy({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_data_policy name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_data_policy({ 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_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::DeleteDataPolicyRequest.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_data_policy_client_stub.call_rpc_count + end + end + + def test_get_data_policy + # Create GRPC objects. + grpc_response = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicy.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_data_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_data_policy, name + assert_kind_of ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_data_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_data_policy({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_data_policy name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_data_policy ::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_data_policy({ 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_data_policy(::Google::Cloud::Bigquery::DataPolicies::V1::GetDataPolicyRequest.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_data_policy_client_stub.call_rpc_count + end + end + + def test_list_data_policies + # Create GRPC objects. + grpc_response = ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesResponse.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" + + list_data_policies_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_data_policies, name + assert_kind_of ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest, 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"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_data_policies_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_data_policies({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) 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_data_policies parent: parent, page_size: page_size, page_token: page_token, filter: filter 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_data_policies ::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) 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_data_policies({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, 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_data_policies(::Google::Cloud::Bigquery::DataPolicies::V1::ListDataPoliciesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), 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_data_policies_client_stub.call_rpc_count + end + end + + def test_get_iam_policy + # Create GRPC objects. + grpc_response = ::Google::Iam::V1::Policy.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. + resource = "hello world" + options = {} + + get_iam_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_iam_policy, name + assert_kind_of ::Google::Iam::V1::GetIamPolicyRequest, request + assert_equal "hello world", request["resource"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Iam::V1::GetPolicyOptions), request["options"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_iam_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_iam_policy({ resource: resource, options: options }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_iam_policy resource: resource, options: options do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_iam_policy ::Google::Iam::V1::GetIamPolicyRequest.new(resource: resource, options: options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_iam_policy({ resource: resource, options: options }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_iam_policy(::Google::Iam::V1::GetIamPolicyRequest.new(resource: resource, options: options), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_iam_policy_client_stub.call_rpc_count + end + end + + def test_set_iam_policy + # Create GRPC objects. + grpc_response = ::Google::Iam::V1::Policy.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. + resource = "hello world" + policy = {} + update_mask = {} + + set_iam_policy_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :set_iam_policy, name + assert_kind_of ::Google::Iam::V1::SetIamPolicyRequest, request + assert_equal "hello world", request["resource"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Iam::V1::Policy), request["policy"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, set_iam_policy_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.set_iam_policy({ resource: resource, policy: policy, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.set_iam_policy resource: resource, policy: policy, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.set_iam_policy ::Google::Iam::V1::SetIamPolicyRequest.new(resource: resource, policy: policy, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.set_iam_policy({ resource: resource, policy: policy, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.set_iam_policy(::Google::Iam::V1::SetIamPolicyRequest.new(resource: resource, policy: policy, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, set_iam_policy_client_stub.call_rpc_count + end + end + + def test_test_iam_permissions + # Create GRPC objects. + grpc_response = ::Google::Iam::V1::TestIamPermissionsResponse.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. + resource = "hello world" + permissions = ["hello world"] + + test_iam_permissions_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :test_iam_permissions, name + assert_kind_of ::Google::Iam::V1::TestIamPermissionsRequest, request + assert_equal "hello world", request["resource"] + assert_equal ["hello world"], request["permissions"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, test_iam_permissions_client_stub do + # Create client + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.test_iam_permissions({ resource: resource, permissions: permissions }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.test_iam_permissions resource: resource, permissions: permissions do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.test_iam_permissions ::Google::Iam::V1::TestIamPermissionsRequest.new(resource: resource, permissions: permissions) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.test_iam_permissions({ resource: resource, permissions: permissions }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.test_iam_permissions(::Google::Iam::V1::TestIamPermissionsRequest.new(resource: resource, permissions: permissions), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, test_iam_permissions_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 + Gapic::ServiceStub.stub :new, nil do + client = ::Google::Cloud::Bigquery::DataPolicies::V1::DataPolicyService::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::Bigquery::DataPolicies::V1::DataPolicyService::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/helper.rb b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/helper.rb new file mode 100644 index 000000000000..b5db6a24f8e9 --- /dev/null +++ b/owl-bot-staging/google-cloud-bigquery-data_policies-v1/test/helper.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Copyright 2023 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 "simplecov" + +require "minitest/autorun" +require "minitest/focus" +require "minitest/rg"