Module: Google::Cloud::ResourceManager

Defined in:
lib/google/cloud/resource_manager.rb,
lib/google/cloud/resource_manager/version.rb

Constant Summary collapse

VERSION =
"1.2.0"

Class Method Summary collapse

Class Method Details

.configure {|::Google::Cloud.configure.resource_manager| ... } ⇒ ::Google::Cloud::Config

Configure the google-cloud-resource_manager library.

The following configuration parameters are supported:

  • credentials (type: String, Hash, Google::Auth::Credentials) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.
  • lib_name (type: String) - The library name as recorded in instrumentation and logging.
  • lib_version (type: String) - The library version as recorded in instrumentation and logging.
  • interceptors (type: Array<GRPC::ClientInterceptor>) - An array of interceptors that are run before calls are executed.
  • timeout (type: Numeric) - Default timeout in seconds.
  • metadata (type: Hash{Symbol=>String}) - Additional headers to be sent with the call.
  • retry_policy (type: Hash) - The retry policy. The value is a hash with the following keys:
    • :initial_delay (type: Numeric) - The initial delay in seconds.
    • :max_delay (type: Numeric) - The max delay in seconds.
    • :multiplier (type: Numeric) - The incremental backoff multiplier.
    • :jitter (type: Numeric) - The jitter in seconds. Default: 1.0.
    • :retry_codes (type: Array<String>) - The error codes that should trigger a retry.

Yields:

Returns:

  • (::Google::Cloud::Config)

    The default configuration used by this library



574
575
576
577
578
# File 'lib/google/cloud/resource_manager.rb', line 574

def self.configure
  yield ::Google::Cloud.configure.resource_manager if block_given?

  ::Google::Cloud.configure.resource_manager
end

.folders(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Folders.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::Folders::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the Folders service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Folders service. You can determine whether the method will succeed by calling folders_available?.

About Folders

Manages Cloud Platform folder resources. Folders can be used to organize the resources under an organization and to control the policies applied to groups of resources.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/google/cloud/resource_manager.rb', line 77

def self.folders version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:Folders)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.folders_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the Folders service is supported by the current client. If true, you can retrieve a client object by calling folders. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Folders service, or if the versioned client gem needs an update to support the Folders service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/google/cloud/resource_manager.rb', line 101

def self.folders_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :Folders
  service_module = service_module.const_get :Folders
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.organizations(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Organizations.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::Organizations::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the Organizations service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Organizations service. You can determine whether the method will succeed by calling organizations_available?.

About Organizations

Allows users to manage their organization resources.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/google/cloud/resource_manager.rb', line 147

def self.organizations version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:Organizations)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.organizations_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the Organizations service is supported by the current client. If true, you can retrieve a client object by calling organizations. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Organizations service, or if the versioned client gem needs an update to support the Organizations service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/google/cloud/resource_manager.rb', line 171

def self.organizations_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :Organizations
  service_module = service_module.const_get :Organizations
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.projects(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Projects.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::Projects::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the Projects service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Projects service. You can determine whether the method will succeed by calling projects_available?.

About Projects

Manages Google Cloud Projects.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



217
218
219
220
221
222
223
224
225
226
227
# File 'lib/google/cloud/resource_manager.rb', line 217

def self.projects version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:Projects)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.projects_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the Projects service is supported by the current client. If true, you can retrieve a client object by calling projects. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Projects service, or if the versioned client gem needs an update to support the Projects service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/google/cloud/resource_manager.rb', line 241

def self.projects_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :Projects
  service_module = service_module.const_get :Projects
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.tag_bindings(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for TagBindings.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::TagBindings::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the TagBindings service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the TagBindings service. You can determine whether the method will succeed by calling tag_bindings_available?.

About TagBindings

Allow users to create and manage TagBindings between TagValues and different Google Cloud resources throughout the GCP resource hierarchy.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



288
289
290
291
292
293
294
295
296
297
298
# File 'lib/google/cloud/resource_manager.rb', line 288

def self.tag_bindings version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagBindings)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.tag_bindings_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the TagBindings service is supported by the current client. If true, you can retrieve a client object by calling tag_bindings. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the TagBindings service, or if the versioned client gem needs an update to support the TagBindings service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/google/cloud/resource_manager.rb', line 312

def self.tag_bindings_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :TagBindings
  service_module = service_module.const_get :TagBindings
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.tag_holds(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for TagHolds.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::TagHolds::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the TagHolds service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the TagHolds service. You can determine whether the method will succeed by calling tag_holds_available?.

About TagHolds

Allow users to create and manage TagHolds for TagValues. TagHolds represent the use of a Tag Value that is not captured by TagBindings but should still block TagValue deletion (such as a reference in a policy condition). This service provides isolated failure domains by cloud location so that TagHolds can be managed in the same location as their usage.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



362
363
364
365
366
367
368
369
370
371
372
# File 'lib/google/cloud/resource_manager.rb', line 362

def self.tag_holds version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagHolds)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.tag_holds_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the TagHolds service is supported by the current client. If true, you can retrieve a client object by calling tag_holds. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the TagHolds service, or if the versioned client gem needs an update to support the TagHolds service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/google/cloud/resource_manager.rb', line 386

def self.tag_holds_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :TagHolds
  service_module = service_module.const_get :TagHolds
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.tag_keys(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for TagKeys.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::TagKeys::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the TagKeys service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the TagKeys service. You can determine whether the method will succeed by calling tag_keys_available?.

About TagKeys

Allow users to create and manage tag keys.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



432
433
434
435
436
437
438
439
440
441
442
# File 'lib/google/cloud/resource_manager.rb', line 432

def self.tag_keys version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagKeys)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.tag_keys_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the TagKeys service is supported by the current client. If true, you can retrieve a client object by calling tag_keys. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the TagKeys service, or if the versioned client gem needs an update to support the TagKeys service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/google/cloud/resource_manager.rb', line 456

def self.tag_keys_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :TagKeys
  service_module = service_module.const_get :TagKeys
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.tag_values(version: :v3, transport: :grpc, &block) ⇒ ::Object

Create a new client object for TagValues.

By default, this returns an instance of Google::Cloud::ResourceManager::V3::TagValues::Client for a gRPC client for version V3 of the API. However, you can specify a different API version by passing it in the version parameter. If the TagValues service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the TagValues service. You can determine whether the method will succeed by calling tag_values_available?.

About TagValues

Allow users to create and manage tag values.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



502
503
504
505
506
507
508
509
510
511
512
# File 'lib/google/cloud/resource_manager.rb', line 502

def self.tag_values version: :v3, transport: :grpc, &block
  require "google/cloud/resource_manager/#{version.to_s.downcase}"

  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::ResourceManager.const_get(package_name).const_get(:TagValues)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.tag_values_available?(version: :v3, transport: :grpc) ⇒ boolean

Determines whether the TagValues service is supported by the current client. If true, you can retrieve a client object by calling tag_values. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the TagValues service, or if the versioned client gem needs an update to support the TagValues service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v3)

    The API version to connect to. Optional. Defaults to :v3.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/google/cloud/resource_manager.rb', line 526

def self.tag_values_available? version: :v3, transport: :grpc
  require "google/cloud/resource_manager/#{version.to_s.downcase}"
  package_name = Google::Cloud::ResourceManager
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::ResourceManager.const_get package_name
  return false unless service_module.const_defined? :TagValues
  service_module = service_module.const_get :TagValues
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end