Module: Google::Cloud::Kms::V1::Autokey::Paths

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

Overview

Path helper methods for the Autokey API.

Instance Method Summary collapse

Instance Method Details

#crypto_key_path(project:, location:, key_ring:, crypto_key:) ⇒ ::String

Create a fully-qualified CryptoKey resource string.

The resource will be in the following format:

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

Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


40
41
42
43
44
45
46
# File 'lib/google/cloud/kms/v1/autokey/paths.rb', line 40

def crypto_key_path 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}"
end

#key_handle_path(project:, location:, key_handle:) ⇒ ::String

Create a fully-qualified KeyHandle resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/keyHandles/{key_handle}

Parameters:

  • project (String)
  • location (String)
  • key_handle (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


60
61
62
63
64
65
# File 'lib/google/cloud/kms/v1/autokey/paths.rb', line 60

def key_handle_path project:, location:, key_handle:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/keyHandles/#{key_handle}"
end

#location_path(project:, location:) ⇒ ::String

Create a fully-qualified Location resource string.

The resource will be in the following format:

projects/{project}/locations/{location}

Parameters:

  • project (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


78
79
80
81
82
# File 'lib/google/cloud/kms/v1/autokey/paths.rb', line 78

def location_path project:, location:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/locations/#{location}"
end