Module: Google::Cloud::AIPlatform::V1::PredictionService::Paths

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

Overview

Path helper methods for the PredictionService API.

Instance Method Summary collapse

Instance Method Details

#cached_content_path(project:, location:, cached_content:) ⇒ ::String

Create a fully-qualified CachedContent resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/cachedContents/{cached_content}

Parameters:

  • project (String)
  • location (String)
  • cached_content (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


39
40
41
42
43
44
# File 'lib/google/cloud/ai_platform/v1/prediction_service/paths.rb', line 39

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

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

#endpoint_path(project: , location: , endpoint: ) ⇒ ::String #endpoint_path(project: , location: , publisher: , model: ) ⇒ ::String

Create a fully-qualified Endpoint resource string.

Overloads:

  • #endpoint_path(project: , location: , endpoint: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/endpoints/{endpoint}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • endpoint (String) (defaults to: )
  • #endpoint_path(project: , location: , publisher: , model: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/publishers/{publisher}/models/{model}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • publisher (String) (defaults to: )
    • model (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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/ai_platform/v1/prediction_service/paths.rb', line 69

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

      "projects/#{project}/locations/#{location}/endpoints/#{endpoint}"
    end),
    "location:model:project:publisher" => (proc do |project:, location:, publisher:, model:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "publisher cannot contain /" if publisher.to_s.include? "/"

      "projects/#{project}/locations/#{location}/publishers/#{publisher}/models/#{model}"
    end)
  }

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

#rag_corpus_path(project:, location:, rag_corpus:) ⇒ ::String

Create a fully-qualified RagCorpus resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/ragCorpora/{rag_corpus}

Parameters:

  • project (String)
  • location (String)
  • rag_corpus (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


103
104
105
106
107
108
# File 'lib/google/cloud/ai_platform/v1/prediction_service/paths.rb', line 103

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

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

#template_path(project:, location:, template:) ⇒ ::String

Create a fully-qualified Template resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/templates/{template}

Parameters:

  • project (String)
  • location (String)
  • template (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


122
123
124
125
126
127
# File 'lib/google/cloud/ai_platform/v1/prediction_service/paths.rb', line 122

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

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