module Google::Cloud::OrgPolicy::V2::OrgPolicy::Paths

Path helper methods for the OrgPolicy API.

Public Instance Methods

folder_path(folder: "folders/ click to toggle source

Create a fully-qualified Folder resource string.

The resource will be in the following format:

`folders/{folder}`

@param folder [String]

@return [::String]

# File lib/google/cloud/org_policy/v2/org_policy/paths.rb, line 37
def folder_path folder:
  "folders/#{folder}"
end
organization_path(organization: "organizations/ click to toggle source

Create a fully-qualified Organization resource string.

The resource will be in the following format:

`organizations/{organization}`

@param organization [String]

@return [::String]

# File lib/google/cloud/org_policy/v2/org_policy/paths.rb, line 51
def organization_path organization:
  "organizations/#{organization}"
end
policy_path(**args) click to toggle source

Create a fully-qualified Policy resource string.

@overload policy_path(project:, policy:)

The resource will be in the following format:

`projects/{project}/policies/{policy}`

@param project [String]
@param policy [String]

@overload policy_path(folder:, policy:)

The resource will be in the following format:

`folders/{folder}/policies/{policy}`

@param folder [String]
@param policy [String]

@overload policy_path(organization:, policy:)

The resource will be in the following format:

`organizations/{organization}/policies/{policy}`

@param organization [String]
@param policy [String]

@return [::String]

# File lib/google/cloud/org_policy/v2/org_policy/paths.rb, line 83
def policy_path **args
  resources = {
    "policy:project" => (proc do |project:, policy:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/policies/#{policy}"
    end),
    "folder:policy" => (proc do |folder:, policy:|
      raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"

      "folders/#{folder}/policies/#{policy}"
    end),
    "organization:policy" => (proc do |organization:, policy:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"

      "organizations/#{organization}/policies/#{policy}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end
project_path(project: "projects/ click to toggle source

Create a fully-qualified Project resource string.

The resource will be in the following format:

`projects/{project}`

@param project [String]

@return [::String]

# File lib/google/cloud/org_policy/v2/org_policy/paths.rb, line 117
def project_path project:
  "projects/#{project}"
end