google-cloud-resource_manager 0.39.0 → 1.0.0

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.
@@ -1,4 +1,6 @@
1
- # Copyright 2015 Google LLC
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
4
6
  # you may not use this file except in compliance with the License.
@@ -12,110 +14,570 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # Require this file early so that the version constant gets defined before
20
+ # requiring "google/cloud". This is because google-cloud-core will load the
21
+ # entrypoint (gem name) file, which in turn re-requires this file (hence
22
+ # causing a require cycle) unless the version constant is already defined.
23
+ require "google/cloud/resource_manager/version"
15
24
 
16
- require "google-cloud-resource_manager"
17
- require "google/cloud/resource_manager/manager"
25
+ require "googleauth"
26
+ gem "google-cloud-core"
27
+ require "google/cloud" unless defined? ::Google::Cloud.new
18
28
  require "google/cloud/config"
19
- require "google/cloud/env"
29
+
30
+ # Set the default configuration
31
+ ::Google::Cloud.configure.add_config! :resource_manager do |config|
32
+ config.add_field! :endpoint, nil, match: ::String
33
+ config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
34
+ config.add_field! :scope, nil, match: [::Array, ::String]
35
+ config.add_field! :lib_name, nil, match: ::String
36
+ config.add_field! :lib_version, nil, match: ::String
37
+ config.add_field! :interceptors, nil, match: ::Array
38
+ config.add_field! :timeout, nil, match: ::Numeric
39
+ config.add_field! :metadata, nil, match: ::Hash
40
+ config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
41
+ config.add_field! :quota_project, nil, match: ::String
42
+ config.add_field! :universe_domain, nil, match: ::String
43
+ end
20
44
 
21
45
  module Google
22
46
  module Cloud
23
- ##
24
- # # Google Cloud Resource Manager
25
- #
26
- # The Resource Manager API provides methods that you can use to
27
- # programmatically manage your projects in the Google Cloud Platform.
28
- #
29
- # See {file:OVERVIEW.md Resource Manager Overview}.
30
- #
31
47
  module ResourceManager
32
48
  ##
33
- # Creates a new `Project` instance connected to the Resource Manager
34
- # service. Each call creates a new connection.
35
- #
36
- # For more information on connecting to Google Cloud see the
37
- # {file:AUTHENTICATION.md Authentication Guide}.
38
- #
39
- # @param [String, Hash, Google::Auth::Credentials] credentials The path to
40
- # the keyfile as a String, the contents of the keyfile as a Hash, or a
41
- # Google::Auth::Credentials object. (See {ResourceManager::Credentials})
42
- # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
43
- # the set of resources and operations that the connection can access.
44
- # See [Using OAuth 2.0 to Access Google
45
- # APIs](https://developers.google.com/identity/protocols/OAuth2).
46
- #
47
- # The default scope is:
48
- #
49
- # * `https://www.googleapis.com/auth/cloud-platform`
50
- # @param [Integer] retries Number of times to retry requests on server
51
- # error. The default value is `3`. Optional.
52
- # @param [Integer] timeout Default timeout to use in requests. Optional.
53
- # @param [String] endpoint Override of the endpoint host name. Optional.
54
- # If the param is nil, uses the default endpoint.
55
- # @param [String] keyfile Alias for the `credentials` argument.
56
- # Deprecated.
57
- #
58
- # @return [Google::Cloud::ResourceManager::Manager]
59
- #
60
- # @example
61
- # require "google/cloud/resource_manager"
62
- #
63
- # resource_manager = Google::Cloud::ResourceManager.new
64
- # resource_manager.projects.each do |project|
65
- # puts projects.project_id
66
- # end
67
- #
68
- def self.new credentials: nil, scope: nil, retries: nil, timeout: nil,
69
- endpoint: nil, keyfile: nil
70
- scope ||= configure.scope
71
- retries ||= configure.retries
72
- timeout ||= configure.timeout
73
- endpoint ||= configure.endpoint
74
- credentials ||= keyfile
75
- credentials ||= default_credentials scope: scope
76
- unless credentials.is_a? Google::Auth::Credentials
77
- credentials = ResourceManager::Credentials.new credentials,
78
- scope: scope
49
+ # Create a new client object for Folders.
50
+ #
51
+ # By default, this returns an instance of
52
+ # [Google::Cloud::ResourceManager::V3::Folders::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-Folders-Client)
53
+ # for a gRPC client for version V3 of the API.
54
+ # However, you can specify a different API version by passing it in the
55
+ # `version` parameter. If the Folders service is
56
+ # supported by that API version, and the corresponding gem is available, the
57
+ # appropriate versioned client will be returned.
58
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
59
+ # the `transport` parameter.
60
+ #
61
+ # Raises an exception if the currently installed versioned client gem for the
62
+ # given API version does not support the given transport of the Folders service.
63
+ # You can determine whether the method will succeed by calling
64
+ # {Google::Cloud::ResourceManager.folders_available?}.
65
+ #
66
+ # ## About Folders
67
+ #
68
+ # Manages Cloud Platform folder resources.
69
+ # Folders can be used to organize the resources under an
70
+ # organization and to control the policies applied to groups of resources.
71
+ #
72
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
73
+ # Defaults to `:v3`.
74
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
75
+ # @return [::Object] A client object for the specified version.
76
+ #
77
+ def self.folders version: :v3, transport: :grpc, &block
78
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
79
+
80
+ package_name = Google::Cloud::ResourceManager
81
+ .constants
82
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
83
+ .first
84
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:Folders)
85
+ service_module = service_module.const_get(:Rest) if transport == :rest
86
+ service_module.const_get(:Client).new(&block)
87
+ end
88
+
89
+ ##
90
+ # Determines whether the Folders service is supported by the current client.
91
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.folders}.
92
+ # If false, that method will raise an exception. This could happen if the given
93
+ # API version does not exist or does not support the Folders service,
94
+ # or if the versioned client gem needs an update to support the Folders service.
95
+ #
96
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
97
+ # Defaults to `:v3`.
98
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
99
+ # @return [boolean] Whether the service is available.
100
+ #
101
+ def self.folders_available? version: :v3, transport: :grpc
102
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
103
+ package_name = Google::Cloud::ResourceManager
104
+ .constants
105
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
106
+ .first
107
+ return false unless package_name
108
+ service_module = Google::Cloud::ResourceManager.const_get package_name
109
+ return false unless service_module.const_defined? :Folders
110
+ service_module = service_module.const_get :Folders
111
+ if transport == :rest
112
+ return false unless service_module.const_defined? :Rest
113
+ service_module = service_module.const_get :Rest
114
+ end
115
+ service_module.const_defined? :Client
116
+ rescue ::LoadError
117
+ false
118
+ end
119
+
120
+ ##
121
+ # Create a new client object for Organizations.
122
+ #
123
+ # By default, this returns an instance of
124
+ # [Google::Cloud::ResourceManager::V3::Organizations::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-Organizations-Client)
125
+ # for a gRPC client for version V3 of the API.
126
+ # However, you can specify a different API version by passing it in the
127
+ # `version` parameter. If the Organizations service is
128
+ # supported by that API version, and the corresponding gem is available, the
129
+ # appropriate versioned client will be returned.
130
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
131
+ # the `transport` parameter.
132
+ #
133
+ # Raises an exception if the currently installed versioned client gem for the
134
+ # given API version does not support the given transport of the Organizations service.
135
+ # You can determine whether the method will succeed by calling
136
+ # {Google::Cloud::ResourceManager.organizations_available?}.
137
+ #
138
+ # ## About Organizations
139
+ #
140
+ # Allows users to manage their organization resources.
141
+ #
142
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
143
+ # Defaults to `:v3`.
144
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
145
+ # @return [::Object] A client object for the specified version.
146
+ #
147
+ def self.organizations version: :v3, transport: :grpc, &block
148
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
149
+
150
+ package_name = Google::Cloud::ResourceManager
151
+ .constants
152
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
153
+ .first
154
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:Organizations)
155
+ service_module = service_module.const_get(:Rest) if transport == :rest
156
+ service_module.const_get(:Client).new(&block)
157
+ end
158
+
159
+ ##
160
+ # Determines whether the Organizations service is supported by the current client.
161
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.organizations}.
162
+ # If false, that method will raise an exception. This could happen if the given
163
+ # API version does not exist or does not support the Organizations service,
164
+ # or if the versioned client gem needs an update to support the Organizations service.
165
+ #
166
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
167
+ # Defaults to `:v3`.
168
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
169
+ # @return [boolean] Whether the service is available.
170
+ #
171
+ def self.organizations_available? version: :v3, transport: :grpc
172
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
173
+ package_name = Google::Cloud::ResourceManager
174
+ .constants
175
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
176
+ .first
177
+ return false unless package_name
178
+ service_module = Google::Cloud::ResourceManager.const_get package_name
179
+ return false unless service_module.const_defined? :Organizations
180
+ service_module = service_module.const_get :Organizations
181
+ if transport == :rest
182
+ return false unless service_module.const_defined? :Rest
183
+ service_module = service_module.const_get :Rest
79
184
  end
185
+ service_module.const_defined? :Client
186
+ rescue ::LoadError
187
+ false
188
+ end
189
+
190
+ ##
191
+ # Create a new client object for Projects.
192
+ #
193
+ # By default, this returns an instance of
194
+ # [Google::Cloud::ResourceManager::V3::Projects::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-Projects-Client)
195
+ # for a gRPC client for version V3 of the API.
196
+ # However, you can specify a different API version by passing it in the
197
+ # `version` parameter. If the Projects service is
198
+ # supported by that API version, and the corresponding gem is available, the
199
+ # appropriate versioned client will be returned.
200
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
201
+ # the `transport` parameter.
202
+ #
203
+ # Raises an exception if the currently installed versioned client gem for the
204
+ # given API version does not support the given transport of the Projects service.
205
+ # You can determine whether the method will succeed by calling
206
+ # {Google::Cloud::ResourceManager.projects_available?}.
207
+ #
208
+ # ## About Projects
209
+ #
210
+ # Manages Google Cloud Projects.
211
+ #
212
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
213
+ # Defaults to `:v3`.
214
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
215
+ # @return [::Object] A client object for the specified version.
216
+ #
217
+ def self.projects version: :v3, transport: :grpc, &block
218
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
219
+
220
+ package_name = Google::Cloud::ResourceManager
221
+ .constants
222
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
223
+ .first
224
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:Projects)
225
+ service_module = service_module.const_get(:Rest) if transport == :rest
226
+ service_module.const_get(:Client).new(&block)
227
+ end
80
228
 
81
- ResourceManager::Manager.new(
82
- ResourceManager::Service.new(
83
- credentials, retries: retries, timeout: timeout, host: endpoint, quota_project: configure.quota_project
84
- )
85
- )
229
+ ##
230
+ # Determines whether the Projects service is supported by the current client.
231
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.projects}.
232
+ # If false, that method will raise an exception. This could happen if the given
233
+ # API version does not exist or does not support the Projects service,
234
+ # or if the versioned client gem needs an update to support the Projects service.
235
+ #
236
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
237
+ # Defaults to `:v3`.
238
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
239
+ # @return [boolean] Whether the service is available.
240
+ #
241
+ def self.projects_available? version: :v3, transport: :grpc
242
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
243
+ package_name = Google::Cloud::ResourceManager
244
+ .constants
245
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
246
+ .first
247
+ return false unless package_name
248
+ service_module = Google::Cloud::ResourceManager.const_get package_name
249
+ return false unless service_module.const_defined? :Projects
250
+ service_module = service_module.const_get :Projects
251
+ if transport == :rest
252
+ return false unless service_module.const_defined? :Rest
253
+ service_module = service_module.const_get :Rest
254
+ end
255
+ service_module.const_defined? :Client
256
+ rescue ::LoadError
257
+ false
86
258
  end
87
259
 
88
260
  ##
89
- # Configure the Google Cloud Resource Manager library.
261
+ # Create a new client object for TagBindings.
90
262
  #
91
- # The following Resource Manager configuration parameters are supported:
263
+ # By default, this returns an instance of
264
+ # [Google::Cloud::ResourceManager::V3::TagBindings::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-TagBindings-Client)
265
+ # for a gRPC client for version V3 of the API.
266
+ # However, you can specify a different API version by passing it in the
267
+ # `version` parameter. If the TagBindings service is
268
+ # supported by that API version, and the corresponding gem is available, the
269
+ # appropriate versioned client will be returned.
270
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
271
+ # the `transport` parameter.
92
272
  #
93
- # * `credentials` - (String, Hash, Google::Auth::Credentials) The path to
94
- # the keyfile as a String, the contents of the keyfile as a Hash, or a
95
- # Google::Auth::Credentials object. (See {ResourceManager::Credentials})
96
- # (The parameter `keyfile` is also available but deprecated.)
97
- # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
98
- # the set of resources and operations that the connection can access.
99
- # * `retries` - (Integer) Number of times to retry requests on server
100
- # error.
101
- # * `timeout` - (Integer) Default timeout to use in requests.
273
+ # Raises an exception if the currently installed versioned client gem for the
274
+ # given API version does not support the given transport of the TagBindings service.
275
+ # You can determine whether the method will succeed by calling
276
+ # {Google::Cloud::ResourceManager.tag_bindings_available?}.
102
277
  #
103
- # @return [Google::Cloud::Config] The configuration object the
104
- # Google::Cloud::ResourceManager library uses.
278
+ # ## About TagBindings
105
279
  #
106
- def self.configure
107
- yield Google::Cloud.configure.resource_manager if block_given?
280
+ # Allow users to create and manage TagBindings between TagValues and
281
+ # different Google Cloud resources throughout the GCP resource hierarchy.
282
+ #
283
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
284
+ # Defaults to `:v3`.
285
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
286
+ # @return [::Object] A client object for the specified version.
287
+ #
288
+ def self.tag_bindings version: :v3, transport: :grpc, &block
289
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
108
290
 
109
- Google::Cloud.configure.resource_manager
291
+ package_name = Google::Cloud::ResourceManager
292
+ .constants
293
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
294
+ .first
295
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagBindings)
296
+ service_module = service_module.const_get(:Rest) if transport == :rest
297
+ service_module.const_get(:Client).new(&block)
110
298
  end
111
299
 
112
300
  ##
113
- # @private Default credentials.
114
- def self.default_credentials scope: nil
115
- Google::Cloud.configure.resource_manager.credentials ||
116
- Google::Cloud.configure.credentials ||
117
- ResourceManager::Credentials.default(scope: scope)
301
+ # Determines whether the TagBindings service is supported by the current client.
302
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.tag_bindings}.
303
+ # If false, that method will raise an exception. This could happen if the given
304
+ # API version does not exist or does not support the TagBindings service,
305
+ # or if the versioned client gem needs an update to support the TagBindings service.
306
+ #
307
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
308
+ # Defaults to `:v3`.
309
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
310
+ # @return [boolean] Whether the service is available.
311
+ #
312
+ def self.tag_bindings_available? version: :v3, transport: :grpc
313
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
314
+ package_name = Google::Cloud::ResourceManager
315
+ .constants
316
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
317
+ .first
318
+ return false unless package_name
319
+ service_module = Google::Cloud::ResourceManager.const_get package_name
320
+ return false unless service_module.const_defined? :TagBindings
321
+ service_module = service_module.const_get :TagBindings
322
+ if transport == :rest
323
+ return false unless service_module.const_defined? :Rest
324
+ service_module = service_module.const_get :Rest
325
+ end
326
+ service_module.const_defined? :Client
327
+ rescue ::LoadError
328
+ false
329
+ end
330
+
331
+ ##
332
+ # Create a new client object for TagHolds.
333
+ #
334
+ # By default, this returns an instance of
335
+ # [Google::Cloud::ResourceManager::V3::TagHolds::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-TagHolds-Client)
336
+ # for a gRPC client for version V3 of the API.
337
+ # However, you can specify a different API version by passing it in the
338
+ # `version` parameter. If the TagHolds service is
339
+ # supported by that API version, and the corresponding gem is available, the
340
+ # appropriate versioned client will be returned.
341
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
342
+ # the `transport` parameter.
343
+ #
344
+ # Raises an exception if the currently installed versioned client gem for the
345
+ # given API version does not support the given transport of the TagHolds service.
346
+ # You can determine whether the method will succeed by calling
347
+ # {Google::Cloud::ResourceManager.tag_holds_available?}.
348
+ #
349
+ # ## About TagHolds
350
+ #
351
+ # Allow users to create and manage TagHolds for TagValues. TagHolds represent
352
+ # the use of a Tag Value that is not captured by TagBindings but
353
+ # should still block TagValue deletion (such as a reference in a policy
354
+ # condition). This service provides isolated failure domains by cloud location
355
+ # so that TagHolds can be managed in the same location as their usage.
356
+ #
357
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
358
+ # Defaults to `:v3`.
359
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
360
+ # @return [::Object] A client object for the specified version.
361
+ #
362
+ def self.tag_holds version: :v3, transport: :grpc, &block
363
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
364
+
365
+ package_name = Google::Cloud::ResourceManager
366
+ .constants
367
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
368
+ .first
369
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagHolds)
370
+ service_module = service_module.const_get(:Rest) if transport == :rest
371
+ service_module.const_get(:Client).new(&block)
372
+ end
373
+
374
+ ##
375
+ # Determines whether the TagHolds service is supported by the current client.
376
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.tag_holds}.
377
+ # If false, that method will raise an exception. This could happen if the given
378
+ # API version does not exist or does not support the TagHolds service,
379
+ # or if the versioned client gem needs an update to support the TagHolds service.
380
+ #
381
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
382
+ # Defaults to `:v3`.
383
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
384
+ # @return [boolean] Whether the service is available.
385
+ #
386
+ def self.tag_holds_available? version: :v3, transport: :grpc
387
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
388
+ package_name = Google::Cloud::ResourceManager
389
+ .constants
390
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
391
+ .first
392
+ return false unless package_name
393
+ service_module = Google::Cloud::ResourceManager.const_get package_name
394
+ return false unless service_module.const_defined? :TagHolds
395
+ service_module = service_module.const_get :TagHolds
396
+ if transport == :rest
397
+ return false unless service_module.const_defined? :Rest
398
+ service_module = service_module.const_get :Rest
399
+ end
400
+ service_module.const_defined? :Client
401
+ rescue ::LoadError
402
+ false
403
+ end
404
+
405
+ ##
406
+ # Create a new client object for TagKeys.
407
+ #
408
+ # By default, this returns an instance of
409
+ # [Google::Cloud::ResourceManager::V3::TagKeys::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-TagKeys-Client)
410
+ # for a gRPC client for version V3 of the API.
411
+ # However, you can specify a different API version by passing it in the
412
+ # `version` parameter. If the TagKeys service is
413
+ # supported by that API version, and the corresponding gem is available, the
414
+ # appropriate versioned client will be returned.
415
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
416
+ # the `transport` parameter.
417
+ #
418
+ # Raises an exception if the currently installed versioned client gem for the
419
+ # given API version does not support the given transport of the TagKeys service.
420
+ # You can determine whether the method will succeed by calling
421
+ # {Google::Cloud::ResourceManager.tag_keys_available?}.
422
+ #
423
+ # ## About TagKeys
424
+ #
425
+ # Allow users to create and manage tag keys.
426
+ #
427
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
428
+ # Defaults to `:v3`.
429
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
430
+ # @return [::Object] A client object for the specified version.
431
+ #
432
+ def self.tag_keys version: :v3, transport: :grpc, &block
433
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
434
+
435
+ package_name = Google::Cloud::ResourceManager
436
+ .constants
437
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
438
+ .first
439
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagKeys)
440
+ service_module = service_module.const_get(:Rest) if transport == :rest
441
+ service_module.const_get(:Client).new(&block)
442
+ end
443
+
444
+ ##
445
+ # Determines whether the TagKeys service is supported by the current client.
446
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.tag_keys}.
447
+ # If false, that method will raise an exception. This could happen if the given
448
+ # API version does not exist or does not support the TagKeys service,
449
+ # or if the versioned client gem needs an update to support the TagKeys service.
450
+ #
451
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
452
+ # Defaults to `:v3`.
453
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
454
+ # @return [boolean] Whether the service is available.
455
+ #
456
+ def self.tag_keys_available? version: :v3, transport: :grpc
457
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
458
+ package_name = Google::Cloud::ResourceManager
459
+ .constants
460
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
461
+ .first
462
+ return false unless package_name
463
+ service_module = Google::Cloud::ResourceManager.const_get package_name
464
+ return false unless service_module.const_defined? :TagKeys
465
+ service_module = service_module.const_get :TagKeys
466
+ if transport == :rest
467
+ return false unless service_module.const_defined? :Rest
468
+ service_module = service_module.const_get :Rest
469
+ end
470
+ service_module.const_defined? :Client
471
+ rescue ::LoadError
472
+ false
473
+ end
474
+
475
+ ##
476
+ # Create a new client object for TagValues.
477
+ #
478
+ # By default, this returns an instance of
479
+ # [Google::Cloud::ResourceManager::V3::TagValues::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-resource_manager-v3/latest/Google-Cloud-ResourceManager-V3-TagValues-Client)
480
+ # for a gRPC client for version V3 of the API.
481
+ # However, you can specify a different API version by passing it in the
482
+ # `version` parameter. If the TagValues service is
483
+ # supported by that API version, and the corresponding gem is available, the
484
+ # appropriate versioned client will be returned.
485
+ # You can also specify a different transport by passing `:rest` or `:grpc` in
486
+ # the `transport` parameter.
487
+ #
488
+ # Raises an exception if the currently installed versioned client gem for the
489
+ # given API version does not support the given transport of the TagValues service.
490
+ # You can determine whether the method will succeed by calling
491
+ # {Google::Cloud::ResourceManager.tag_values_available?}.
492
+ #
493
+ # ## About TagValues
494
+ #
495
+ # Allow users to create and manage tag values.
496
+ #
497
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
498
+ # Defaults to `:v3`.
499
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
500
+ # @return [::Object] A client object for the specified version.
501
+ #
502
+ def self.tag_values version: :v3, transport: :grpc, &block
503
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
504
+
505
+ package_name = Google::Cloud::ResourceManager
506
+ .constants
507
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
508
+ .first
509
+ service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagValues)
510
+ service_module = service_module.const_get(:Rest) if transport == :rest
511
+ service_module.const_get(:Client).new(&block)
512
+ end
513
+
514
+ ##
515
+ # Determines whether the TagValues service is supported by the current client.
516
+ # If true, you can retrieve a client object by calling {Google::Cloud::ResourceManager.tag_values}.
517
+ # If false, that method will raise an exception. This could happen if the given
518
+ # API version does not exist or does not support the TagValues service,
519
+ # or if the versioned client gem needs an update to support the TagValues service.
520
+ #
521
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
522
+ # Defaults to `:v3`.
523
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
524
+ # @return [boolean] Whether the service is available.
525
+ #
526
+ def self.tag_values_available? version: :v3, transport: :grpc
527
+ require "google/cloud/resource_manager/#{version.to_s.downcase}"
528
+ package_name = Google::Cloud::ResourceManager
529
+ .constants
530
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
531
+ .first
532
+ return false unless package_name
533
+ service_module = Google::Cloud::ResourceManager.const_get package_name
534
+ return false unless service_module.const_defined? :TagValues
535
+ service_module = service_module.const_get :TagValues
536
+ if transport == :rest
537
+ return false unless service_module.const_defined? :Rest
538
+ service_module = service_module.const_get :Rest
539
+ end
540
+ service_module.const_defined? :Client
541
+ rescue ::LoadError
542
+ false
543
+ end
544
+
545
+ ##
546
+ # Configure the google-cloud-resource_manager library.
547
+ #
548
+ # The following configuration parameters are supported:
549
+ #
550
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
551
+ # The path to the keyfile as a String, the contents of the keyfile as a
552
+ # Hash, or a Google::Auth::Credentials object.
553
+ # * `lib_name` (*type:* `String`) -
554
+ # The library name as recorded in instrumentation and logging.
555
+ # * `lib_version` (*type:* `String`) -
556
+ # The library version as recorded in instrumentation and logging.
557
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
558
+ # An array of interceptors that are run before calls are executed.
559
+ # * `timeout` (*type:* `Numeric`) -
560
+ # Default timeout in seconds.
561
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
562
+ # Additional headers to be sent with the call.
563
+ # * `retry_policy` (*type:* `Hash`) -
564
+ # The retry policy. The value is a hash with the following keys:
565
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
566
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
567
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
568
+ # * `:retry_codes` (*type:* `Array<String>`) -
569
+ # The error codes that should trigger a retry.
570
+ #
571
+ # @return [::Google::Cloud::Config] The default configuration used by this library
572
+ #
573
+ def self.configure
574
+ yield ::Google::Cloud.configure.resource_manager if block_given?
575
+
576
+ ::Google::Cloud.configure.resource_manager
118
577
  end
119
578
  end
120
579
  end
121
580
  end
581
+
582
+ helper_path = ::File.join __dir__, "resource_manager", "helpers.rb"
583
+ require "google/cloud/resource_manager/helpers" if ::File.file? helper_path