Module: Google::Cloud::Kms::Inventory::V1::KeyTrackingService::Paths

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

Overview

Path helper methods for the KeyTrackingService API.

Instance Method Summary collapse

Instance Method Details

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


38
39
40
# File 'lib/google/cloud/kms/inventory/v1/key_tracking_service/paths.rb', line 38

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)


52
53
54
# File 'lib/google/cloud/kms/inventory/v1/key_tracking_service/paths.rb', line 52

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

#protected_resources_summary_path(project:, location:, key_ring:, crypto_key:) ⇒ ::String #protected_resources_summary_path(project:, location:, key_ring:, crypto_key:, crypto_key_version:) ⇒ ::String

Create a fully-qualified ProtectedResourcesSummary resource string.

Overloads:

  • #protected_resources_summary_path(project:, location:, key_ring:, crypto_key:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/protectedResourcesSummary

    Parameters:

    • project (String)
    • location (String)
    • key_ring (String)
    • crypto_key (String)
  • #protected_resources_summary_path(project:, location:, key_ring:, crypto_key:, crypto_key_version:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/protectedResourcesSummary

    Parameters:

    • project (String)
    • location (String)
    • key_ring (String)
    • crypto_key (String)
    • crypto_key_version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/google/cloud/kms/inventory/v1/key_tracking_service/paths.rb', line 81

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

      "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}/protectedResourcesSummary"
    end),
    "crypto_key:crypto_key_version:key_ring:location:project" => (proc do |project:, location:, key_ring:, crypto_key:, crypto_key_version:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
      raise ::ArgumentError, "crypto_key cannot contain /" if crypto_key.to_s.include? "/"

      "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}/cryptoKeyVersions/#{crypto_key_version}/protectedResourcesSummary"
    end)
  }

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