Module: Google::Iam::V3beta::AccessPolicies::Paths

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

Overview

Path helper methods for the AccessPolicies API.

Instance Method Summary collapse

Instance Method Details

#access_policy_path(organization:, location:, access_policy:) ⇒ ::String #access_policy_path(folder:, location:, access_policy:) ⇒ ::String #access_policy_path(project:, location:, access_policy:) ⇒ ::String

Create a fully-qualified AccessPolicy resource string.

Overloads:

  • #access_policy_path(organization:, location:, access_policy:) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/locations/{location}/accessPolicies/{access_policy}

    Parameters:

    • organization (String)
    • location (String)
    • access_policy (String)
  • #access_policy_path(folder:, location:, access_policy:) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/locations/{location}/accessPolicies/{access_policy}

    Parameters:

    • folder (String)
    • location (String)
    • access_policy (String)
  • #access_policy_path(project:, location:, access_policy:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/accessPolicies/{access_policy}

    Parameters:

    • project (String)
    • location (String)
    • access_policy (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/google/iam/v3beta/access_policies/paths.rb', line 57

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

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

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

      "projects/#{project}/locations/#{location}/accessPolicies/#{access_policy}"
    end)
  }

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

#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)


95
96
97
98
99
# File 'lib/google/iam/v3beta/access_policies/paths.rb', line 95

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)


112
113
114
115
116
# File 'lib/google/iam/v3beta/access_policies/paths.rb', line 112

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)


129
130
131
132
133
# File 'lib/google/iam/v3beta/access_policies/paths.rb', line 129

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

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