Module: Google::Cloud::AIPlatform::V1::GenAiTuningService::Paths

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

Overview

Path helper methods for the GenAiTuningService API.

Instance Method Summary collapse

Instance Method Details

#context_path(project:, location:, metadata_store:, context:) ⇒ ::String

Create a fully-qualified Context resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}

Parameters:

  • project (String)
  • location (String)
  • metadata_store (String)
  • context (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

  "projects/#{project}/locations/#{location}/metadataStores/#{}/contexts/#{context}"
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)


71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/paths.rb', line 71

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

#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)


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

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

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

#model_path(project:, location:, model:) ⇒ ::String

Create a fully-qualified Model resource string.

The resource will be in the following format:

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

Parameters:

  • project (String)
  • location (String)
  • model (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

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

#pipeline_job_path(project:, location:, pipeline_job:) ⇒ ::String

Create a fully-qualified PipelineJob resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}

Parameters:

  • project (String)
  • location (String)
  • pipeline_job (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


141
142
143
144
145
146
# File 'lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/paths.rb', line 141

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

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

#tuning_job_path(project:, location:, tuning_job:) ⇒ ::String

Create a fully-qualified TuningJob resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/tuningJobs/{tuning_job}

Parameters:

  • project (String)
  • location (String)
  • tuning_job (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


160
161
162
163
164
165
# File 'lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/paths.rb', line 160

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

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