google-cloud-resource_settings-v1 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +2 -2
- data/lib/google/cloud/resource_settings/v1/resource_settings_service/client.rb +4 -6
- data/lib/google/cloud/resource_settings/v1/resource_settings_service/rest/client.rb +542 -0
- data/lib/google/cloud/resource_settings/v1/resource_settings_service/rest/service_stub.rb +270 -0
- data/lib/google/cloud/resource_settings/v1/resource_settings_service/rest.rb +63 -0
- data/lib/google/cloud/resource_settings/v1/resource_settings_service.rb +7 -1
- data/lib/google/cloud/resource_settings/v1/rest.rb +37 -0
- data/lib/google/cloud/resource_settings/v1/version.rb +1 -1
- data/lib/google/cloud/resource_settings/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +17 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353f5e1d9e3ad0f953a7ef98e3a354645ad1d0a2e3f5328616886ef382f1d2a3
|
4
|
+
data.tar.gz: b521ee804f47110cc9a826ec634aa99c342eb0b841b40363209980379b5b5ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca0d6bef40b8a0537a54a9a9d3f89bbbccf469ae84c34a9edd9cb748ac3df000e29b5c09480d47e090db3968faf4b5f035c26e1aff5e07c19d7dffd4dfe0a93
|
7
|
+
data.tar.gz: b2c1276e5a75dcf0c94941e8adc2703942a0cb79803ba863153702fa45f5b28bf0a6a7490b11a6e65be9ee402255e086a4d880dac1f4304207d773512bdef80a
|
data/AUTHENTICATION.md
CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
|
|
114
114
|
To configure your system for this, simply:
|
115
115
|
|
116
116
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
117
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
118
118
|
3. Write code as if already authenticated.
|
119
119
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ruby Client for the Resource Settings V1 API
|
2
2
|
|
3
|
-
API
|
3
|
+
The Resource Settings API allows users to control and modify the behavior of their GCP resources (e.g., VM, firewall, Project, etc.) across the Cloud Resource Hierarchy.
|
4
4
|
|
5
5
|
You can use Resource Settings to centrally configure settings for your Google Cloud projects, folders, and organization. These settings are inherited by their descendants in the resource hierarchy. Each setting is created and managed by Google.
|
6
6
|
|
@@ -46,7 +46,7 @@ for general usage information.
|
|
46
46
|
## Enabling Logging
|
47
47
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
50
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
51
51
|
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)
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
@@ -223,13 +223,11 @@ module Google
|
|
223
223
|
# # Call the list_settings method.
|
224
224
|
# result = client.list_settings request
|
225
225
|
#
|
226
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
227
|
-
# #
|
228
|
-
#
|
229
|
-
# # methods are also available for managing paging directly.
|
230
|
-
# result.each do |response|
|
226
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
227
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
228
|
+
# result.each do |item|
|
231
229
|
# # Each element is of type ::Google::Cloud::ResourceSettings::V1::Setting.
|
232
|
-
# p
|
230
|
+
# p item
|
233
231
|
# end
|
234
232
|
#
|
235
233
|
def list_settings request, options = nil
|
@@ -0,0 +1,542 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/resourcesettings/v1/resource_settings_pb"
|
21
|
+
require "google/cloud/resource_settings/v1/resource_settings_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module ResourceSettings
|
26
|
+
module V1
|
27
|
+
module ResourceSettingsService
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the ResourceSettingsService service.
|
31
|
+
#
|
32
|
+
# An interface to interact with resource settings and setting values throughout
|
33
|
+
# the resource hierarchy.
|
34
|
+
#
|
35
|
+
# Services may surface a number of settings for users to control how their
|
36
|
+
# resources behave. Values of settings applied on a given Cloud resource are
|
37
|
+
# evaluated hierarchically and inherited by all descendants of that resource.
|
38
|
+
#
|
39
|
+
# For all requests, returns a `google.rpc.Status` with
|
40
|
+
# `google.rpc.Code.PERMISSION_DENIED` if the IAM check fails or the `parent`
|
41
|
+
# resource is not in a Cloud Organization.
|
42
|
+
# For all requests, returns a `google.rpc.Status` with
|
43
|
+
# `google.rpc.Code.INVALID_ARGUMENT` if the request is malformed.
|
44
|
+
#
|
45
|
+
class Client
|
46
|
+
include Paths
|
47
|
+
|
48
|
+
# @private
|
49
|
+
attr_reader :resource_settings_service_stub
|
50
|
+
|
51
|
+
##
|
52
|
+
# Configure the ResourceSettingsService Client class.
|
53
|
+
#
|
54
|
+
# See {::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client::Configuration}
|
55
|
+
# for a description of the configuration fields.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
#
|
59
|
+
# # Modify the configuration for all ResourceSettingsService clients
|
60
|
+
# ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client.configure do |config|
|
61
|
+
# config.timeout = 10.0
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# @yield [config] Configure the Client client.
|
65
|
+
# @yieldparam config [Client::Configuration]
|
66
|
+
#
|
67
|
+
# @return [Client::Configuration]
|
68
|
+
#
|
69
|
+
def self.configure
|
70
|
+
@configure ||= begin
|
71
|
+
namespace = ["Google", "Cloud", "ResourceSettings", "V1"]
|
72
|
+
parent_config = while namespace.any?
|
73
|
+
parent_name = namespace.join "::"
|
74
|
+
parent_const = const_get parent_name
|
75
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
76
|
+
namespace.pop
|
77
|
+
end
|
78
|
+
default_config = Client::Configuration.new parent_config
|
79
|
+
|
80
|
+
default_config.rpcs.list_settings.timeout = 60.0
|
81
|
+
default_config.rpcs.list_settings.retry_policy = {
|
82
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config.rpcs.get_setting.timeout = 60.0
|
86
|
+
default_config.rpcs.get_setting.retry_policy = {
|
87
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
88
|
+
}
|
89
|
+
|
90
|
+
default_config.rpcs.update_setting.timeout = 60.0
|
91
|
+
default_config.rpcs.update_setting.retry_policy = {
|
92
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
93
|
+
}
|
94
|
+
|
95
|
+
default_config
|
96
|
+
end
|
97
|
+
yield @configure if block_given?
|
98
|
+
@configure
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Configure the ResourceSettingsService Client instance.
|
103
|
+
#
|
104
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
105
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
106
|
+
# should be made on {Client.configure}.
|
107
|
+
#
|
108
|
+
# See {::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client::Configuration}
|
109
|
+
# for a description of the configuration fields.
|
110
|
+
#
|
111
|
+
# @yield [config] Configure the Client client.
|
112
|
+
# @yieldparam config [Client::Configuration]
|
113
|
+
#
|
114
|
+
# @return [Client::Configuration]
|
115
|
+
#
|
116
|
+
def configure
|
117
|
+
yield @config if block_given?
|
118
|
+
@config
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Create a new ResourceSettingsService REST client object.
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
#
|
126
|
+
# # Create a client using the default configuration
|
127
|
+
# client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client.new
|
128
|
+
#
|
129
|
+
# # Create a client using a custom configuration
|
130
|
+
# client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client.new do |config|
|
131
|
+
# config.timeout = 10.0
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# @yield [config] Configure the ResourceSettingsService client.
|
135
|
+
# @yieldparam config [Client::Configuration]
|
136
|
+
#
|
137
|
+
def initialize
|
138
|
+
# Create the configuration object
|
139
|
+
@config = Configuration.new Client.configure
|
140
|
+
|
141
|
+
# Yield the configuration if needed
|
142
|
+
yield @config if block_given?
|
143
|
+
|
144
|
+
# Create credentials
|
145
|
+
credentials = @config.credentials
|
146
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
147
|
+
# but only if the default endpoint does not have a region prefix.
|
148
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
149
|
+
!@config.endpoint.split(".").first.include?("-")
|
150
|
+
credentials ||= Credentials.default scope: @config.scope,
|
151
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
152
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
153
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
154
|
+
end
|
155
|
+
|
156
|
+
@quota_project_id = @config.quota_project
|
157
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
158
|
+
|
159
|
+
@resource_settings_service_stub = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
160
|
+
end
|
161
|
+
|
162
|
+
# Service calls
|
163
|
+
|
164
|
+
##
|
165
|
+
# Lists all the settings that are available on the Cloud resource `parent`.
|
166
|
+
#
|
167
|
+
# @overload list_settings(request, options = nil)
|
168
|
+
# Pass arguments to `list_settings` via a request object, either of type
|
169
|
+
# {::Google::Cloud::ResourceSettings::V1::ListSettingsRequest} or an equivalent Hash.
|
170
|
+
#
|
171
|
+
# @param request [::Google::Cloud::ResourceSettings::V1::ListSettingsRequest, ::Hash]
|
172
|
+
# A request object representing the call parameters. Required. To specify no
|
173
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
174
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
175
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
176
|
+
#
|
177
|
+
# @overload list_settings(parent: nil, page_size: nil, page_token: nil, view: nil)
|
178
|
+
# Pass arguments to `list_settings` via keyword arguments. Note that at
|
179
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
180
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
181
|
+
#
|
182
|
+
# @param parent [::String]
|
183
|
+
# Required. The Cloud resource that parents the setting. Must be in one of the
|
184
|
+
# following forms:
|
185
|
+
#
|
186
|
+
# * `projects/{project_number}`
|
187
|
+
# * `projects/{project_id}`
|
188
|
+
# * `folders/{folder_id}`
|
189
|
+
# * `organizations/{organization_id}`
|
190
|
+
# @param page_size [::Integer]
|
191
|
+
# Unused. The size of the page to be returned.
|
192
|
+
# @param page_token [::String]
|
193
|
+
# Unused. A page token used to retrieve the next page.
|
194
|
+
# @param view [::Google::Cloud::ResourceSettings::V1::SettingView]
|
195
|
+
# The SettingView for this request.
|
196
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
197
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>]
|
198
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
199
|
+
#
|
200
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>]
|
201
|
+
#
|
202
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
203
|
+
def list_settings request, options = nil
|
204
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
205
|
+
|
206
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceSettings::V1::ListSettingsRequest
|
207
|
+
|
208
|
+
# Converts hash and nil to an options object
|
209
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
210
|
+
|
211
|
+
# Customize the options with defaults
|
212
|
+
call_metadata = @config.rpcs.list_settings.metadata.to_h
|
213
|
+
|
214
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
215
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
216
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
217
|
+
gapic_version: ::Google::Cloud::ResourceSettings::V1::VERSION,
|
218
|
+
transports_version_send: [:rest]
|
219
|
+
|
220
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
221
|
+
|
222
|
+
options.apply_defaults timeout: @config.rpcs.list_settings.timeout,
|
223
|
+
metadata: call_metadata,
|
224
|
+
retry_policy: @config.rpcs.list_settings.retry_policy
|
225
|
+
|
226
|
+
options.apply_defaults timeout: @config.timeout,
|
227
|
+
metadata: @config.metadata,
|
228
|
+
retry_policy: @config.retry_policy
|
229
|
+
|
230
|
+
@resource_settings_service_stub.list_settings request, options do |result, operation|
|
231
|
+
result = ::Gapic::Rest::PagedEnumerable.new @resource_settings_service_stub, :list_settings, "settings", request, result, options
|
232
|
+
yield result, operation if block_given?
|
233
|
+
return result
|
234
|
+
end
|
235
|
+
rescue ::Gapic::Rest::Error => e
|
236
|
+
raise ::Google::Cloud::Error.from_error(e)
|
237
|
+
end
|
238
|
+
|
239
|
+
##
|
240
|
+
# Gets a setting.
|
241
|
+
#
|
242
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
243
|
+
# setting does not exist.
|
244
|
+
#
|
245
|
+
# @overload get_setting(request, options = nil)
|
246
|
+
# Pass arguments to `get_setting` via a request object, either of type
|
247
|
+
# {::Google::Cloud::ResourceSettings::V1::GetSettingRequest} or an equivalent Hash.
|
248
|
+
#
|
249
|
+
# @param request [::Google::Cloud::ResourceSettings::V1::GetSettingRequest, ::Hash]
|
250
|
+
# A request object representing the call parameters. Required. To specify no
|
251
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
252
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
253
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
254
|
+
#
|
255
|
+
# @overload get_setting(name: nil, view: nil)
|
256
|
+
# Pass arguments to `get_setting` via keyword arguments. Note that at
|
257
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
258
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
259
|
+
#
|
260
|
+
# @param name [::String]
|
261
|
+
# Required. The name of the setting to get. See {::Google::Cloud::ResourceSettings::V1::Setting Setting} for naming
|
262
|
+
# requirements.
|
263
|
+
# @param view [::Google::Cloud::ResourceSettings::V1::SettingView]
|
264
|
+
# The SettingView for this request.
|
265
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
266
|
+
# @yieldparam result [::Google::Cloud::ResourceSettings::V1::Setting]
|
267
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
268
|
+
#
|
269
|
+
# @return [::Google::Cloud::ResourceSettings::V1::Setting]
|
270
|
+
#
|
271
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
272
|
+
def get_setting request, options = nil
|
273
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
274
|
+
|
275
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceSettings::V1::GetSettingRequest
|
276
|
+
|
277
|
+
# Converts hash and nil to an options object
|
278
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
279
|
+
|
280
|
+
# Customize the options with defaults
|
281
|
+
call_metadata = @config.rpcs.get_setting.metadata.to_h
|
282
|
+
|
283
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
284
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
285
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
286
|
+
gapic_version: ::Google::Cloud::ResourceSettings::V1::VERSION,
|
287
|
+
transports_version_send: [:rest]
|
288
|
+
|
289
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
290
|
+
|
291
|
+
options.apply_defaults timeout: @config.rpcs.get_setting.timeout,
|
292
|
+
metadata: call_metadata,
|
293
|
+
retry_policy: @config.rpcs.get_setting.retry_policy
|
294
|
+
|
295
|
+
options.apply_defaults timeout: @config.timeout,
|
296
|
+
metadata: @config.metadata,
|
297
|
+
retry_policy: @config.retry_policy
|
298
|
+
|
299
|
+
@resource_settings_service_stub.get_setting request, options do |result, operation|
|
300
|
+
yield result, operation if block_given?
|
301
|
+
return result
|
302
|
+
end
|
303
|
+
rescue ::Gapic::Rest::Error => e
|
304
|
+
raise ::Google::Cloud::Error.from_error(e)
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# Updates a setting.
|
309
|
+
#
|
310
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
311
|
+
# setting does not exist.
|
312
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if
|
313
|
+
# the setting is flagged as read only.
|
314
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
|
315
|
+
# supplied in the request does not match the persisted etag of the setting
|
316
|
+
# value.
|
317
|
+
#
|
318
|
+
# On success, the response will contain only `name`, `local_value` and
|
319
|
+
# `etag`. The `metadata` and `effective_value` cannot be updated through
|
320
|
+
# this API.
|
321
|
+
#
|
322
|
+
# Note: the supplied setting will perform a full overwrite of the
|
323
|
+
# `local_value` field.
|
324
|
+
#
|
325
|
+
# @overload update_setting(request, options = nil)
|
326
|
+
# Pass arguments to `update_setting` via a request object, either of type
|
327
|
+
# {::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest} or an equivalent Hash.
|
328
|
+
#
|
329
|
+
# @param request [::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest, ::Hash]
|
330
|
+
# A request object representing the call parameters. Required. To specify no
|
331
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
332
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
333
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
334
|
+
#
|
335
|
+
# @overload update_setting(setting: nil)
|
336
|
+
# Pass arguments to `update_setting` via keyword arguments. Note that at
|
337
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
338
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
339
|
+
#
|
340
|
+
# @param setting [::Google::Cloud::ResourceSettings::V1::Setting, ::Hash]
|
341
|
+
# Required. The setting to update. See {::Google::Cloud::ResourceSettings::V1::Setting Setting} for field requirements.
|
342
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
343
|
+
# @yieldparam result [::Google::Cloud::ResourceSettings::V1::Setting]
|
344
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
345
|
+
#
|
346
|
+
# @return [::Google::Cloud::ResourceSettings::V1::Setting]
|
347
|
+
#
|
348
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
349
|
+
def update_setting request, options = nil
|
350
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
351
|
+
|
352
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest
|
353
|
+
|
354
|
+
# Converts hash and nil to an options object
|
355
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
356
|
+
|
357
|
+
# Customize the options with defaults
|
358
|
+
call_metadata = @config.rpcs.update_setting.metadata.to_h
|
359
|
+
|
360
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
361
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
362
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
363
|
+
gapic_version: ::Google::Cloud::ResourceSettings::V1::VERSION,
|
364
|
+
transports_version_send: [:rest]
|
365
|
+
|
366
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
367
|
+
|
368
|
+
options.apply_defaults timeout: @config.rpcs.update_setting.timeout,
|
369
|
+
metadata: call_metadata,
|
370
|
+
retry_policy: @config.rpcs.update_setting.retry_policy
|
371
|
+
|
372
|
+
options.apply_defaults timeout: @config.timeout,
|
373
|
+
metadata: @config.metadata,
|
374
|
+
retry_policy: @config.retry_policy
|
375
|
+
|
376
|
+
@resource_settings_service_stub.update_setting request, options do |result, operation|
|
377
|
+
yield result, operation if block_given?
|
378
|
+
return result
|
379
|
+
end
|
380
|
+
rescue ::Gapic::Rest::Error => e
|
381
|
+
raise ::Google::Cloud::Error.from_error(e)
|
382
|
+
end
|
383
|
+
|
384
|
+
##
|
385
|
+
# Configuration class for the ResourceSettingsService REST API.
|
386
|
+
#
|
387
|
+
# This class represents the configuration for ResourceSettingsService REST,
|
388
|
+
# providing control over timeouts, retry behavior, logging, transport
|
389
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
390
|
+
# applied individually to specific RPCs. See
|
391
|
+
# {::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client::Configuration::Rpcs}
|
392
|
+
# for a list of RPCs that can be configured independently.
|
393
|
+
#
|
394
|
+
# Configuration can be applied globally to all clients, or to a single client
|
395
|
+
# on construction.
|
396
|
+
#
|
397
|
+
# @example
|
398
|
+
#
|
399
|
+
# # Modify the global config, setting the timeout for
|
400
|
+
# # list_settings to 20 seconds,
|
401
|
+
# # and all remaining timeouts to 10 seconds.
|
402
|
+
# ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client.configure do |config|
|
403
|
+
# config.timeout = 10.0
|
404
|
+
# config.rpcs.list_settings.timeout = 20.0
|
405
|
+
# end
|
406
|
+
#
|
407
|
+
# # Apply the above configuration only to a new client.
|
408
|
+
# client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Rest::Client.new do |config|
|
409
|
+
# config.timeout = 10.0
|
410
|
+
# config.rpcs.list_settings.timeout = 20.0
|
411
|
+
# end
|
412
|
+
#
|
413
|
+
# @!attribute [rw] endpoint
|
414
|
+
# The hostname or hostname:port of the service endpoint.
|
415
|
+
# Defaults to `"resourcesettings.googleapis.com"`.
|
416
|
+
# @return [::String]
|
417
|
+
# @!attribute [rw] credentials
|
418
|
+
# Credentials to send with calls. You may provide any of the following types:
|
419
|
+
# * (`String`) The path to a service account key file in JSON format
|
420
|
+
# * (`Hash`) A service account key as a Hash
|
421
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
422
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
423
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
424
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
425
|
+
# * (`nil`) indicating no credentials
|
426
|
+
# @return [::Object]
|
427
|
+
# @!attribute [rw] scope
|
428
|
+
# The OAuth scopes
|
429
|
+
# @return [::Array<::String>]
|
430
|
+
# @!attribute [rw] lib_name
|
431
|
+
# The library name as recorded in instrumentation and logging
|
432
|
+
# @return [::String]
|
433
|
+
# @!attribute [rw] lib_version
|
434
|
+
# The library version as recorded in instrumentation and logging
|
435
|
+
# @return [::String]
|
436
|
+
# @!attribute [rw] timeout
|
437
|
+
# The call timeout in seconds.
|
438
|
+
# @return [::Numeric]
|
439
|
+
# @!attribute [rw] metadata
|
440
|
+
# Additional headers to be sent with the call.
|
441
|
+
# @return [::Hash{::Symbol=>::String}]
|
442
|
+
# @!attribute [rw] retry_policy
|
443
|
+
# The retry policy. The value is a hash with the following keys:
|
444
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
445
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
446
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
447
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
448
|
+
# trigger a retry.
|
449
|
+
# @return [::Hash]
|
450
|
+
# @!attribute [rw] quota_project
|
451
|
+
# A separate project against which to charge quota.
|
452
|
+
# @return [::String]
|
453
|
+
#
|
454
|
+
class Configuration
|
455
|
+
extend ::Gapic::Config
|
456
|
+
|
457
|
+
config_attr :endpoint, "resourcesettings.googleapis.com", ::String
|
458
|
+
config_attr :credentials, nil do |value|
|
459
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
460
|
+
allowed.any? { |klass| klass === value }
|
461
|
+
end
|
462
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
463
|
+
config_attr :lib_name, nil, ::String, nil
|
464
|
+
config_attr :lib_version, nil, ::String, nil
|
465
|
+
config_attr :timeout, nil, ::Numeric, nil
|
466
|
+
config_attr :metadata, nil, ::Hash, nil
|
467
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
468
|
+
config_attr :quota_project, nil, ::String, nil
|
469
|
+
|
470
|
+
# @private
|
471
|
+
def initialize parent_config = nil
|
472
|
+
@parent_config = parent_config unless parent_config.nil?
|
473
|
+
|
474
|
+
yield self if block_given?
|
475
|
+
end
|
476
|
+
|
477
|
+
##
|
478
|
+
# Configurations for individual RPCs
|
479
|
+
# @return [Rpcs]
|
480
|
+
#
|
481
|
+
def rpcs
|
482
|
+
@rpcs ||= begin
|
483
|
+
parent_rpcs = nil
|
484
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
485
|
+
Rpcs.new parent_rpcs
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
##
|
490
|
+
# Configuration RPC class for the ResourceSettingsService API.
|
491
|
+
#
|
492
|
+
# Includes fields providing the configuration for each RPC in this service.
|
493
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
494
|
+
# the following configuration fields:
|
495
|
+
#
|
496
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
497
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
498
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
499
|
+
# include the following keys:
|
500
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
501
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
502
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
503
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
504
|
+
# trigger a retry.
|
505
|
+
#
|
506
|
+
class Rpcs
|
507
|
+
##
|
508
|
+
# RPC-specific configuration for `list_settings`
|
509
|
+
# @return [::Gapic::Config::Method]
|
510
|
+
#
|
511
|
+
attr_reader :list_settings
|
512
|
+
##
|
513
|
+
# RPC-specific configuration for `get_setting`
|
514
|
+
# @return [::Gapic::Config::Method]
|
515
|
+
#
|
516
|
+
attr_reader :get_setting
|
517
|
+
##
|
518
|
+
# RPC-specific configuration for `update_setting`
|
519
|
+
# @return [::Gapic::Config::Method]
|
520
|
+
#
|
521
|
+
attr_reader :update_setting
|
522
|
+
|
523
|
+
# @private
|
524
|
+
def initialize parent_rpcs = nil
|
525
|
+
list_settings_config = parent_rpcs.list_settings if parent_rpcs.respond_to? :list_settings
|
526
|
+
@list_settings = ::Gapic::Config::Method.new list_settings_config
|
527
|
+
get_setting_config = parent_rpcs.get_setting if parent_rpcs.respond_to? :get_setting
|
528
|
+
@get_setting = ::Gapic::Config::Method.new get_setting_config
|
529
|
+
update_setting_config = parent_rpcs.update_setting if parent_rpcs.respond_to? :update_setting
|
530
|
+
@update_setting = ::Gapic::Config::Method.new update_setting_config
|
531
|
+
|
532
|
+
yield self if block_given?
|
533
|
+
end
|
534
|
+
end
|
535
|
+
end
|
536
|
+
end
|
537
|
+
end
|
538
|
+
end
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|