Module: Google::Iam

Defined in:
lib/google/iam.rb,
lib/google/iam/client/version.rb

Defined Under Namespace

Modules: Client

Class Method Summary collapse

Class Method Details

.policies(version: :v2, &block) ⇒ Policies::Client

Create a new client object for Policies.

By default, this returns an instance of Google::Iam::V2::Policies::Client for version V2 of the API. However, you can specify specify a different API version by passing it in the version parameter. If the Policies service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned.

About Policies

An interface for managing Identity and Access Management (IAM) policies.

Parameters:

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

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

Returns:

  • (Policies::Client)

    A client object for the specified version.



48
49
50
51
52
53
54
55
56
57
# File 'lib/google/iam.rb', line 48

def self.policies version: :v2, &block
  require "google/iam/#{version.to_s.downcase}"

  package_name = Google::Iam
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  package_module = Google::Iam.const_get package_name
  package_module.const_get(:Policies).const_get(:Client).new(&block)
end