google-cloud-resource_manager-v3 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/resource_manager/v3/folders/client.rb +47 -35
  4. data/lib/google/cloud/resource_manager/v3/folders/operations.rb +2 -2
  5. data/lib/google/cloud/resource_manager/v3/folders/rest/client.rb +47 -35
  6. data/lib/google/cloud/resource_manager/v3/folders/rest/operations.rb +2 -2
  7. data/lib/google/cloud/resource_manager/v3/organizations/client.rb +12 -10
  8. data/lib/google/cloud/resource_manager/v3/organizations/rest/client.rb +12 -10
  9. data/lib/google/cloud/resource_manager/v3/projects/client.rb +53 -54
  10. data/lib/google/cloud/resource_manager/v3/projects/operations.rb +2 -2
  11. data/lib/google/cloud/resource_manager/v3/projects/rest/client.rb +53 -54
  12. data/lib/google/cloud/resource_manager/v3/projects/rest/operations.rb +2 -2
  13. data/lib/google/cloud/resource_manager/v3/rest.rb +1 -0
  14. data/lib/google/cloud/resource_manager/v3/tag_bindings/client.rb +115 -17
  15. data/lib/google/cloud/resource_manager/v3/tag_bindings/operations.rb +2 -2
  16. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/client.rb +96 -17
  17. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/operations.rb +2 -2
  18. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest/service_stub.rb +57 -0
  19. data/lib/google/cloud/resource_manager/v3/tag_bindings/rest.rb +1 -1
  20. data/lib/google/cloud/resource_manager/v3/tag_bindings.rb +1 -1
  21. data/lib/google/cloud/resource_manager/v3/tag_holds/client.rb +640 -0
  22. data/lib/google/cloud/resource_manager/v3/tag_holds/credentials.rb +52 -0
  23. data/lib/google/cloud/resource_manager/v3/tag_holds/operations.rb +768 -0
  24. data/lib/google/cloud/resource_manager/v3/tag_holds/paths.rb +64 -0
  25. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/client.rb +533 -0
  26. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/operations.rb +793 -0
  27. data/lib/google/cloud/resource_manager/v3/tag_holds/rest/service_stub.rb +226 -0
  28. data/lib/google/cloud/resource_manager/v3/tag_holds/rest.rb +57 -0
  29. data/lib/google/cloud/resource_manager/v3/tag_holds.rb +60 -0
  30. data/lib/google/cloud/resource_manager/v3/tag_keys/client.rb +114 -24
  31. data/lib/google/cloud/resource_manager/v3/tag_keys/operations.rb +2 -2
  32. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/client.rb +99 -24
  33. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/operations.rb +2 -2
  34. data/lib/google/cloud/resource_manager/v3/tag_keys/rest/service_stub.rb +57 -0
  35. data/lib/google/cloud/resource_manager/v3/tag_values/client.rb +123 -29
  36. data/lib/google/cloud/resource_manager/v3/tag_values/operations.rb +2 -2
  37. data/lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb +108 -29
  38. data/lib/google/cloud/resource_manager/v3/tag_values/rest/operations.rb +2 -2
  39. data/lib/google/cloud/resource_manager/v3/tag_values/rest/service_stub.rb +57 -0
  40. data/lib/google/cloud/resource_manager/v3/version.rb +1 -1
  41. data/lib/google/cloud/resource_manager/v3.rb +1 -0
  42. data/lib/google/cloud/resourcemanager/v3/folders_services_pb.rb +23 -17
  43. data/lib/google/cloud/resourcemanager/v3/projects_services_pb.rb +16 -13
  44. data/lib/google/cloud/resourcemanager/v3/tag_bindings_pb.rb +22 -0
  45. data/lib/google/cloud/resourcemanager/v3/tag_bindings_services_pb.rb +7 -5
  46. data/lib/google/cloud/resourcemanager/v3/tag_holds_pb.rb +63 -0
  47. data/lib/google/cloud/resourcemanager/v3/tag_holds_services_pb.rb +54 -0
  48. data/lib/google/cloud/resourcemanager/v3/tag_keys_pb.rb +11 -0
  49. data/lib/google/cloud/resourcemanager/v3/tag_keys_services_pb.rb +6 -2
  50. data/lib/google/cloud/resourcemanager/v3/tag_values_pb.rb +4 -0
  51. data/lib/google/cloud/resourcemanager/v3/tag_values_services_pb.rb +7 -4
  52. data/proto_docs/google/api/client.rb +67 -4
  53. data/proto_docs/google/cloud/resourcemanager/v3/folders.rb +25 -19
  54. data/proto_docs/google/cloud/resourcemanager/v3/organizations.rb +13 -11
  55. data/proto_docs/google/cloud/resourcemanager/v3/projects.rb +41 -45
  56. data/proto_docs/google/cloud/resourcemanager/v3/tag_bindings.rb +104 -15
  57. data/proto_docs/google/cloud/resourcemanager/v3/tag_holds.rb +161 -0
  58. data/proto_docs/google/cloud/resourcemanager/v3/tag_keys.rb +93 -27
  59. data/proto_docs/google/cloud/resourcemanager/v3/tag_values.rb +52 -29
  60. data/proto_docs/google/iam/v1/policy.rb +8 -4
  61. metadata +14 -2
@@ -0,0 +1,64 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module ResourceManager
23
+ module V3
24
+ module TagHolds
25
+ # Path helper methods for the TagHolds API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified TagHold resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `tagValues/{tag_value}/tagHolds/{tag_hold}`
33
+ #
34
+ # @param tag_value [String]
35
+ # @param tag_hold [String]
36
+ #
37
+ # @return [::String]
38
+ def tag_hold_path tag_value:, tag_hold:
39
+ raise ::ArgumentError, "tag_value cannot contain /" if tag_value.to_s.include? "/"
40
+
41
+ "tagValues/#{tag_value}/tagHolds/#{tag_hold}"
42
+ end
43
+
44
+ ##
45
+ # Create a fully-qualified TagValue resource string.
46
+ #
47
+ # The resource will be in the following format:
48
+ #
49
+ # `tagValues/{tag_value}`
50
+ #
51
+ # @param tag_value [String]
52
+ #
53
+ # @return [::String]
54
+ def tag_value_path tag_value:
55
+ "tagValues/#{tag_value}"
56
+ end
57
+
58
+ extend self
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,533 @@
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/resourcemanager/v3/tag_holds_pb"
21
+ require "google/cloud/resource_manager/v3/tag_holds/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ResourceManager
26
+ module V3
27
+ module TagHolds
28
+ module Rest
29
+ ##
30
+ # REST client for the TagHolds service.
31
+ #
32
+ # Allow users to create and manage TagHolds for TagValues. TagHolds represent
33
+ # the use of a Tag Value that is not captured by TagBindings but
34
+ # should still block TagValue deletion (such as a reference in a policy
35
+ # condition). This service provides isolated failure domains by cloud location
36
+ # so that TagHolds can be managed in the same location as their usage.
37
+ #
38
+ class Client
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :tag_holds_stub
43
+
44
+ ##
45
+ # Configure the TagHolds Client class.
46
+ #
47
+ # See {::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all TagHolds clients
53
+ # ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Cloud", "ResourceManager", "V3"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the TagHolds Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # Create a new TagHolds REST client object.
101
+ #
102
+ # @example
103
+ #
104
+ # # Create a client using the default configuration
105
+ # client = ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client.new
106
+ #
107
+ # # Create a client using a custom configuration
108
+ # client = ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client.new do |config|
109
+ # config.timeout = 10.0
110
+ # end
111
+ #
112
+ # @yield [config] Configure the TagHolds client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ def initialize
116
+ # Create the configuration object
117
+ @config = Configuration.new Client.configure
118
+
119
+ # Yield the configuration if needed
120
+ yield @config if block_given?
121
+
122
+ # Create credentials
123
+ credentials = @config.credentials
124
+ # Use self-signed JWT if the endpoint is unchanged from default,
125
+ # but only if the default endpoint does not have a region prefix.
126
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
127
+ !@config.endpoint.split(".").first.include?("-")
128
+ credentials ||= Credentials.default scope: @config.scope,
129
+ enable_self_signed_jwt: enable_self_signed_jwt
130
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
131
+ credentials = Credentials.new credentials, scope: @config.scope
132
+ end
133
+
134
+ @quota_project_id = @config.quota_project
135
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
136
+
137
+ @operations_client = ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Operations.new do |config|
138
+ config.credentials = credentials
139
+ config.quota_project = @quota_project_id
140
+ config.endpoint = @config.endpoint
141
+ end
142
+
143
+ @tag_holds_stub = ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
144
+ end
145
+
146
+ ##
147
+ # Get the associated client for long-running operations.
148
+ #
149
+ # @return [::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Operations]
150
+ #
151
+ attr_reader :operations_client
152
+
153
+ # Service calls
154
+
155
+ ##
156
+ # Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same
157
+ # resource and origin exists under the same TagValue.
158
+ #
159
+ # @overload create_tag_hold(request, options = nil)
160
+ # Pass arguments to `create_tag_hold` via a request object, either of type
161
+ # {::Google::Cloud::ResourceManager::V3::CreateTagHoldRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::ResourceManager::V3::CreateTagHoldRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
168
+ #
169
+ # @overload create_tag_hold(parent: nil, tag_hold: nil, validate_only: nil)
170
+ # Pass arguments to `create_tag_hold` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param parent [::String]
175
+ # Required. The resource name of the TagHold's parent TagValue. Must be of
176
+ # the form: `tagValues/{tag-value-id}`.
177
+ # @param tag_hold [::Google::Cloud::ResourceManager::V3::TagHold, ::Hash]
178
+ # Required. The TagHold to be created.
179
+ # @param validate_only [::Boolean]
180
+ # Optional. Set to true to perform the validations necessary for creating the
181
+ # resource, but not actually perform the action.
182
+ # @yield [result, operation] Access the result along with the TransportOperation object
183
+ # @yieldparam result [::Gapic::Operation]
184
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
185
+ #
186
+ # @return [::Gapic::Operation]
187
+ #
188
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
189
+ def create_tag_hold request, options = nil
190
+ raise ::ArgumentError, "request must be provided" if request.nil?
191
+
192
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::CreateTagHoldRequest
193
+
194
+ # Converts hash and nil to an options object
195
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
196
+
197
+ # Customize the options with defaults
198
+ call_metadata = @config.rpcs.create_tag_hold.metadata.to_h
199
+
200
+ # Set x-goog-api-client and x-goog-user-project headers
201
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
202
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
203
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
204
+ transports_version_send: [:rest]
205
+
206
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
207
+
208
+ options.apply_defaults timeout: @config.rpcs.create_tag_hold.timeout,
209
+ metadata: call_metadata,
210
+ retry_policy: @config.rpcs.create_tag_hold.retry_policy
211
+
212
+ options.apply_defaults timeout: @config.timeout,
213
+ metadata: @config.metadata,
214
+ retry_policy: @config.retry_policy
215
+
216
+ @tag_holds_stub.create_tag_hold request, options do |result, operation|
217
+ result = ::Gapic::Operation.new result, @operations_client, options: options
218
+ yield result, operation if block_given?
219
+ return result
220
+ end
221
+ rescue ::Gapic::Rest::Error => e
222
+ raise ::Google::Cloud::Error.from_error(e)
223
+ end
224
+
225
+ ##
226
+ # Deletes a TagHold.
227
+ #
228
+ # @overload delete_tag_hold(request, options = nil)
229
+ # Pass arguments to `delete_tag_hold` via a request object, either of type
230
+ # {::Google::Cloud::ResourceManager::V3::DeleteTagHoldRequest} or an equivalent Hash.
231
+ #
232
+ # @param request [::Google::Cloud::ResourceManager::V3::DeleteTagHoldRequest, ::Hash]
233
+ # A request object representing the call parameters. Required. To specify no
234
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
235
+ # @param options [::Gapic::CallOptions, ::Hash]
236
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
237
+ #
238
+ # @overload delete_tag_hold(name: nil, validate_only: nil)
239
+ # Pass arguments to `delete_tag_hold` via keyword arguments. Note that at
240
+ # least one keyword argument is required. To specify no parameters, or to keep all
241
+ # the default parameter values, pass an empty Hash as a request object (see above).
242
+ #
243
+ # @param name [::String]
244
+ # Required. The resource name of the TagHold to delete. Must be of the form:
245
+ # `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`.
246
+ # @param validate_only [::Boolean]
247
+ # Optional. Set to true to perform the validations necessary for deleting the
248
+ # resource, but not actually perform the action.
249
+ # @yield [result, operation] Access the result along with the TransportOperation object
250
+ # @yieldparam result [::Gapic::Operation]
251
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
252
+ #
253
+ # @return [::Gapic::Operation]
254
+ #
255
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
256
+ def delete_tag_hold request, options = nil
257
+ raise ::ArgumentError, "request must be provided" if request.nil?
258
+
259
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::DeleteTagHoldRequest
260
+
261
+ # Converts hash and nil to an options object
262
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
263
+
264
+ # Customize the options with defaults
265
+ call_metadata = @config.rpcs.delete_tag_hold.metadata.to_h
266
+
267
+ # Set x-goog-api-client and x-goog-user-project headers
268
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
269
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
270
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
271
+ transports_version_send: [:rest]
272
+
273
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
274
+
275
+ options.apply_defaults timeout: @config.rpcs.delete_tag_hold.timeout,
276
+ metadata: call_metadata,
277
+ retry_policy: @config.rpcs.delete_tag_hold.retry_policy
278
+
279
+ options.apply_defaults timeout: @config.timeout,
280
+ metadata: @config.metadata,
281
+ retry_policy: @config.retry_policy
282
+
283
+ @tag_holds_stub.delete_tag_hold request, options do |result, operation|
284
+ result = ::Gapic::Operation.new result, @operations_client, options: options
285
+ yield result, operation if block_given?
286
+ return result
287
+ end
288
+ rescue ::Gapic::Rest::Error => e
289
+ raise ::Google::Cloud::Error.from_error(e)
290
+ end
291
+
292
+ ##
293
+ # Lists TagHolds under a TagValue.
294
+ #
295
+ # @overload list_tag_holds(request, options = nil)
296
+ # Pass arguments to `list_tag_holds` via a request object, either of type
297
+ # {::Google::Cloud::ResourceManager::V3::ListTagHoldsRequest} or an equivalent Hash.
298
+ #
299
+ # @param request [::Google::Cloud::ResourceManager::V3::ListTagHoldsRequest, ::Hash]
300
+ # A request object representing the call parameters. Required. To specify no
301
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
302
+ # @param options [::Gapic::CallOptions, ::Hash]
303
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
304
+ #
305
+ # @overload list_tag_holds(parent: nil, page_size: nil, page_token: nil, filter: nil)
306
+ # Pass arguments to `list_tag_holds` via keyword arguments. Note that at
307
+ # least one keyword argument is required. To specify no parameters, or to keep all
308
+ # the default parameter values, pass an empty Hash as a request object (see above).
309
+ #
310
+ # @param parent [::String]
311
+ # Required. The resource name of the parent TagValue. Must be of the form:
312
+ # `tagValues/{tag-value-id}`.
313
+ # @param page_size [::Integer]
314
+ # Optional. The maximum number of TagHolds to return in the response. The
315
+ # server allows a maximum of 300 TagHolds to return. If unspecified, the
316
+ # server will use 100 as the default.
317
+ # @param page_token [::String]
318
+ # Optional. A pagination token returned from a previous call to
319
+ # `ListTagHolds` that indicates where this listing should continue from.
320
+ # @param filter [::String]
321
+ # Optional. Criteria used to select a subset of TagHolds parented by the
322
+ # TagValue to return. This field follows the syntax defined by aip.dev/160;
323
+ # the `holder` and `origin` fields are supported for filtering. Currently
324
+ # only `AND` syntax is supported. Some example queries are:
325
+ #
326
+ # * `holder =
327
+ # //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group`
328
+ # * `origin = 35678234`
329
+ # * `holder =
330
+ # //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group
331
+ # AND origin = 35678234`
332
+ # @yield [result, operation] Access the result along with the TransportOperation object
333
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagHold>]
334
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
335
+ #
336
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagHold>]
337
+ #
338
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
339
+ def list_tag_holds request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::ListTagHoldsRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ call_metadata = @config.rpcs.list_tag_holds.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION,
354
+ transports_version_send: [:rest]
355
+
356
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
357
+
358
+ options.apply_defaults timeout: @config.rpcs.list_tag_holds.timeout,
359
+ metadata: call_metadata,
360
+ retry_policy: @config.rpcs.list_tag_holds.retry_policy
361
+
362
+ options.apply_defaults timeout: @config.timeout,
363
+ metadata: @config.metadata,
364
+ retry_policy: @config.retry_policy
365
+
366
+ @tag_holds_stub.list_tag_holds request, options do |result, operation|
367
+ result = ::Gapic::Rest::PagedEnumerable.new @tag_holds_stub, :list_tag_holds, "tag_holds", request, result, options
368
+ yield result, operation if block_given?
369
+ return result
370
+ end
371
+ rescue ::Gapic::Rest::Error => e
372
+ raise ::Google::Cloud::Error.from_error(e)
373
+ end
374
+
375
+ ##
376
+ # Configuration class for the TagHolds REST API.
377
+ #
378
+ # This class represents the configuration for TagHolds REST,
379
+ # providing control over timeouts, retry behavior, logging, transport
380
+ # parameters, and other low-level controls. Certain parameters can also be
381
+ # applied individually to specific RPCs. See
382
+ # {::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client::Configuration::Rpcs}
383
+ # for a list of RPCs that can be configured independently.
384
+ #
385
+ # Configuration can be applied globally to all clients, or to a single client
386
+ # on construction.
387
+ #
388
+ # @example
389
+ #
390
+ # # Modify the global config, setting the timeout for
391
+ # # create_tag_hold to 20 seconds,
392
+ # # and all remaining timeouts to 10 seconds.
393
+ # ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client.configure do |config|
394
+ # config.timeout = 10.0
395
+ # config.rpcs.create_tag_hold.timeout = 20.0
396
+ # end
397
+ #
398
+ # # Apply the above configuration only to a new client.
399
+ # client = ::Google::Cloud::ResourceManager::V3::TagHolds::Rest::Client.new do |config|
400
+ # config.timeout = 10.0
401
+ # config.rpcs.create_tag_hold.timeout = 20.0
402
+ # end
403
+ #
404
+ # @!attribute [rw] endpoint
405
+ # The hostname or hostname:port of the service endpoint.
406
+ # Defaults to `"cloudresourcemanager.googleapis.com"`.
407
+ # @return [::String]
408
+ # @!attribute [rw] credentials
409
+ # Credentials to send with calls. You may provide any of the following types:
410
+ # * (`String`) The path to a service account key file in JSON format
411
+ # * (`Hash`) A service account key as a Hash
412
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
413
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
414
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
415
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
416
+ # * (`nil`) indicating no credentials
417
+ # @return [::Object]
418
+ # @!attribute [rw] scope
419
+ # The OAuth scopes
420
+ # @return [::Array<::String>]
421
+ # @!attribute [rw] lib_name
422
+ # The library name as recorded in instrumentation and logging
423
+ # @return [::String]
424
+ # @!attribute [rw] lib_version
425
+ # The library version as recorded in instrumentation and logging
426
+ # @return [::String]
427
+ # @!attribute [rw] timeout
428
+ # The call timeout in seconds.
429
+ # @return [::Numeric]
430
+ # @!attribute [rw] metadata
431
+ # Additional headers to be sent with the call.
432
+ # @return [::Hash{::Symbol=>::String}]
433
+ # @!attribute [rw] retry_policy
434
+ # The retry policy. The value is a hash with the following keys:
435
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
436
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
437
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
438
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
439
+ # trigger a retry.
440
+ # @return [::Hash]
441
+ # @!attribute [rw] quota_project
442
+ # A separate project against which to charge quota.
443
+ # @return [::String]
444
+ #
445
+ class Configuration
446
+ extend ::Gapic::Config
447
+
448
+ config_attr :endpoint, "cloudresourcemanager.googleapis.com", ::String
449
+ config_attr :credentials, nil do |value|
450
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
451
+ allowed.any? { |klass| klass === value }
452
+ end
453
+ config_attr :scope, nil, ::String, ::Array, nil
454
+ config_attr :lib_name, nil, ::String, nil
455
+ config_attr :lib_version, nil, ::String, nil
456
+ config_attr :timeout, nil, ::Numeric, nil
457
+ config_attr :metadata, nil, ::Hash, nil
458
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
459
+ config_attr :quota_project, nil, ::String, nil
460
+
461
+ # @private
462
+ def initialize parent_config = nil
463
+ @parent_config = parent_config unless parent_config.nil?
464
+
465
+ yield self if block_given?
466
+ end
467
+
468
+ ##
469
+ # Configurations for individual RPCs
470
+ # @return [Rpcs]
471
+ #
472
+ def rpcs
473
+ @rpcs ||= begin
474
+ parent_rpcs = nil
475
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
476
+ Rpcs.new parent_rpcs
477
+ end
478
+ end
479
+
480
+ ##
481
+ # Configuration RPC class for the TagHolds API.
482
+ #
483
+ # Includes fields providing the configuration for each RPC in this service.
484
+ # Each configuration object is of type `Gapic::Config::Method` and includes
485
+ # the following configuration fields:
486
+ #
487
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
488
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
489
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
490
+ # include the following keys:
491
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
492
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
493
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
494
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
495
+ # trigger a retry.
496
+ #
497
+ class Rpcs
498
+ ##
499
+ # RPC-specific configuration for `create_tag_hold`
500
+ # @return [::Gapic::Config::Method]
501
+ #
502
+ attr_reader :create_tag_hold
503
+ ##
504
+ # RPC-specific configuration for `delete_tag_hold`
505
+ # @return [::Gapic::Config::Method]
506
+ #
507
+ attr_reader :delete_tag_hold
508
+ ##
509
+ # RPC-specific configuration for `list_tag_holds`
510
+ # @return [::Gapic::Config::Method]
511
+ #
512
+ attr_reader :list_tag_holds
513
+
514
+ # @private
515
+ def initialize parent_rpcs = nil
516
+ create_tag_hold_config = parent_rpcs.create_tag_hold if parent_rpcs.respond_to? :create_tag_hold
517
+ @create_tag_hold = ::Gapic::Config::Method.new create_tag_hold_config
518
+ delete_tag_hold_config = parent_rpcs.delete_tag_hold if parent_rpcs.respond_to? :delete_tag_hold
519
+ @delete_tag_hold = ::Gapic::Config::Method.new delete_tag_hold_config
520
+ list_tag_holds_config = parent_rpcs.list_tag_holds if parent_rpcs.respond_to? :list_tag_holds
521
+ @list_tag_holds = ::Gapic::Config::Method.new list_tag_holds_config
522
+
523
+ yield self if block_given?
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end
531
+ end
532
+ end
533
+ end