Module: Google::Cloud::ServiceDirectory::V1::LookupService::Paths

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

Overview

Path helper methods for the LookupService API.

Instance Method Summary collapse

Instance Method Details

#service_path(project:, location:, namespace:, service:) ⇒ ::String

Create a fully-qualified Service resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}

Parameters:

  • project (String)
  • location (String)
  • namespace (String)
  • service (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

  "projects/#{project}/locations/#{location}/namespaces/#{namespace}/services/#{service}"
end