Module: Google::Cloud::BinaryAuthorization::V1beta1::SystemPolicy::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/binary_authorization/v1beta1/system_policy/paths.rb

Overview

Path helper methods for the SystemPolicy API.

Instance Method Summary collapse

Instance Method Details

#policy_path(project: ) ⇒ ::String #policy_path(location: ) ⇒ ::String

Create a fully-qualified Policy resource string.

Overloads:

  • #policy_path(project: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/policy

    Parameters:

    • project (String) (defaults to: )
  • #policy_path(location: ) ⇒ ::String

    The resource will be in the following format:

    locations/{location}/policy

    Parameters:

    • location (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/google/cloud/binary_authorization/v1beta1/system_policy/paths.rb', line 45

def policy_path **args
  resources = {
    "project" => (proc do |project:|
      "projects/#{project}/policy"
    end),
    "location" => (proc do |location:|
      "locations/#{location}/policy"
    end)
  }

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