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

#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) (defaults to: )
    • location (String) (defaults to: )
    • key_ring (String) (defaults to: )
    • crypto_key (String) (defaults to: )
  • #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) (defaults to: )
    • location (String) (defaults to: )
    • key_ring (String) (defaults to: )
    • crypto_key (String) (defaults to: )
    • crypto_key_version (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/google/cloud/kms/inventory/v1/key_tracking_service/paths.rb', line 67

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