Module: Google::Iam::V3beta::PolicyBindings::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/iam/v3beta/policy_bindings/paths.rb

Overview

Path helper methods for the PolicyBindings API.

Instance Method Summary collapse

Instance Method Details

#folder_location_path(folder:, location:) ⇒ ::String

Create a fully-qualified FolderLocation resource string.

The resource will be in the following format:

folders/{folder}/locations/{location}

Parameters:

  • folder (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


37
38
39
40
41
# File 'lib/google/iam/v3beta/policy_bindings/paths.rb', line 37

def folder_location_path folder:, location:
  raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"

  "folders/#{folder}/locations/#{location}"
end

#location_path(project:, location:) ⇒ ::String

Create a fully-qualified Location resource string.

The resource will be in the following format:

projects/{project}/locations/{location}

Parameters:

  • project (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


54
55
56
57
58
# File 'lib/google/iam/v3beta/policy_bindings/paths.rb', line 54

def location_path project:, location:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/locations/#{location}"
end

#organization_location_path(organization:, location:) ⇒ ::String

Create a fully-qualified OrganizationLocation resource string.

The resource will be in the following format:

organizations/{organization}/locations/{location}

Parameters:

  • organization (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


71
72
73
74
75
# File 'lib/google/iam/v3beta/policy_bindings/paths.rb', line 71

def organization_location_path organization:, location:
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"

  "organizations/#{organization}/locations/#{location}"
end

#policy_binding_path(organization: , location: , policy_binding: ) ⇒ ::String #policy_binding_path(folder: , location: , policy_binding: ) ⇒ ::String #policy_binding_path(project: , location: , policy_binding: ) ⇒ ::String

Create a fully-qualified PolicyBinding resource string.

Overloads:

  • #policy_binding_path(organization: , location: , policy_binding: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/locations/{location}/policyBindings/{policy_binding}

    Parameters:

    • organization (String) (defaults to: )
    • location (String) (defaults to: )
    • policy_binding (String) (defaults to: )
  • #policy_binding_path(folder: , location: , policy_binding: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/locations/{location}/policyBindings/{policy_binding}

    Parameters:

    • folder (String) (defaults to: )
    • location (String) (defaults to: )
    • policy_binding (String) (defaults to: )
  • #policy_binding_path(project: , location: , policy_binding: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/policyBindings/{policy_binding}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • policy_binding (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/google/iam/v3beta/policy_bindings/paths.rb', line 108

def policy_binding_path **args
  resources = {
    "location:organization:policy_binding" => (proc do |organization:, location:, policy_binding:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "organizations/#{organization}/locations/#{location}/policyBindings/#{policy_binding}"
    end),
    "folder:location:policy_binding" => (proc do |folder:, location:, policy_binding:|
      raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "folders/#{folder}/locations/#{location}/policyBindings/#{policy_binding}"
    end),
    "location:policy_binding:project" => (proc do |project:, location:, policy_binding:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/policyBindings/#{policy_binding}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end