Module: Google::Cloud::AccessApproval::V1::AccessApproval::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/access_approval/v1/access_approval/paths.rb

Overview

Path helper methods for the AccessApproval API.

Instance Method Summary collapse

Instance Method Details

#access_approval_settings_path(project: ) ⇒ ::String #access_approval_settings_path(folder: ) ⇒ ::String #access_approval_settings_path(organization: ) ⇒ ::String

Create a fully-qualified AccessApprovalSettings resource string.

Overloads:

  • #access_approval_settings_path(project: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/accessApprovalSettings

    Parameters:

    • project (String) (defaults to: )
  • #access_approval_settings_path(folder: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/accessApprovalSettings

    Parameters:

    • folder (String) (defaults to: )
  • #access_approval_settings_path(organization: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/accessApprovalSettings

    Parameters:

    • organization (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/google/cloud/access_approval/v1/access_approval/paths.rb', line 52

def access_approval_settings_path **args
  resources = {
    "project" => (proc do |project:|
      "projects/#{project}/accessApprovalSettings"
    end),
    "folder" => (proc do |folder:|
      "folders/#{folder}/accessApprovalSettings"
    end),
    "organization" => (proc do |organization:|
      "organizations/#{organization}/accessApprovalSettings"
    end)
  }

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

#approval_request_path(project: , approval_request: ) ⇒ ::String #approval_request_path(folder: , approval_request: ) ⇒ ::String #approval_request_path(organization: , approval_request: ) ⇒ ::String

Create a fully-qualified ApprovalRequest resource string.

Overloads:

  • #approval_request_path(project: , approval_request: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/approvalRequests/{approval_request}

    Parameters:

    • project (String) (defaults to: )
    • approval_request (String) (defaults to: )
  • #approval_request_path(folder: , approval_request: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/approvalRequests/{approval_request}

    Parameters:

    • folder (String) (defaults to: )
    • approval_request (String) (defaults to: )
  • #approval_request_path(organization: , approval_request: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/approvalRequests/{approval_request}

    Parameters:

    • organization (String) (defaults to: )
    • approval_request (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/google/cloud/access_approval/v1/access_approval/paths.rb', line 98

def approval_request_path **args
  resources = {
    "approval_request:project" => (proc do |project:, approval_request:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

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

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

      "organizations/#{organization}/approvalRequests/#{approval_request}"
    end)
  }

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

#folder_path(folder:) ⇒ ::String

Create a fully-qualified Folder resource string.

The resource will be in the following format:

folders/{folder}

Parameters:

  • folder (String)

Returns:

  • (::String)


132
133
134
# File 'lib/google/cloud/access_approval/v1/access_approval/paths.rb', line 132

def folder_path folder:
  "folders/#{folder}"
end

#organization_path(organization:) ⇒ ::String

Create a fully-qualified Organization resource string.

The resource will be in the following format:

organizations/{organization}

Parameters:

  • organization (String)

Returns:

  • (::String)


146
147
148
# File 'lib/google/cloud/access_approval/v1/access_approval/paths.rb', line 146

def organization_path organization:
  "organizations/#{organization}"
end

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


160
161
162
# File 'lib/google/cloud/access_approval/v1/access_approval/paths.rb', line 160

def project_path project:
  "projects/#{project}"
end