Module: Google::Cloud::Kms::V1::KeyManagementService::Paths

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

Overview

Path helper methods for the KeyManagementService 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/key_management_service/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

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

Create a fully-qualified CryptoKeyVersion resource string.

The resource will be in the following format:

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

Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


62
63
64
65
66
67
68
69
# File 'lib/google/cloud/kms/v1/key_management_service/paths.rb', line 62

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

#import_job_path(project:, location:, key_ring:, import_job:) ⇒ ::String

Create a fully-qualified ImportJob resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}

Parameters:

  • project (String)
  • location (String)
  • key_ring (String)
  • import_job (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


84
85
86
87
88
89
90
# File 'lib/google/cloud/kms/v1/key_management_service/paths.rb', line 84

def import_job_path project:, location:, key_ring:, import_job:
  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}/importJobs/#{import_job}"
end

#key_ring_path(project:, location:, key_ring:) ⇒ ::String

Create a fully-qualified KeyRing resource string.

The resource will be in the following format:

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

Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


104
105
106
107
108
109
# File 'lib/google/cloud/kms/v1/key_management_service/paths.rb', line 104

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

  "projects/#{project}/locations/#{location}/keyRings/#{key_ring}"
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)


122
123
124
125
126
# File 'lib/google/cloud/kms/v1/key_management_service/paths.rb', line 122

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

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