Module: Google::Cloud::DiscoveryEngine::V1::SearchService::Paths

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

Overview

Path helper methods for the SearchService API.

Instance Method Summary collapse

Instance Method Details

#branch_path(project: , location: , data_store: , branch: ) ⇒ ::String #branch_path(project: , location: , collection: , data_store: , branch: ) ⇒ ::String

Create a fully-qualified Branch resource string.

Overloads:

  • #branch_path(project: , location: , data_store: , branch: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • data_store (String) (defaults to: )
    • branch (String) (defaults to: )
  • #branch_path(project: , location: , collection: , data_store: , branch: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • collection (String) (defaults to: )
    • data_store (String) (defaults to: )
    • branch (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/google/cloud/discovery_engine/v1/search_service/paths.rb', line 52

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

      "projects/#{project}/locations/#{location}/dataStores/#{data_store}/branches/#{branch}"
    end),
    "branch:collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:, branch:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
      raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"

      "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/branches/#{branch}"
    end)
  }

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

#serving_config_path(project: , location: , data_store: , serving_config: ) ⇒ ::String #serving_config_path(project: , location: , collection: , data_store: , serving_config: ) ⇒ ::String #serving_config_path(project: , location: , collection: , engine: , serving_config: ) ⇒ ::String

Create a fully-qualified ServingConfig resource string.

Overloads:

  • #serving_config_path(project: , location: , data_store: , serving_config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • data_store (String) (defaults to: )
    • serving_config (String) (defaults to: )
  • #serving_config_path(project: , location: , collection: , data_store: , serving_config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • collection (String) (defaults to: )
    • data_store (String) (defaults to: )
    • serving_config (String) (defaults to: )
  • #serving_config_path(project: , location: , collection: , engine: , serving_config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • collection (String) (defaults to: )
    • engine (String) (defaults to: )
    • serving_config (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/google/cloud/discovery_engine/v1/search_service/paths.rb', line 112

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

      "projects/#{project}/locations/#{location}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
    end),
    "collection:data_store:location:project:serving_config" => (proc do |project:, location:, collection:, data_store:, serving_config:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
      raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"

      "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
    end),
    "collection:engine:location:project:serving_config" => (proc do |project:, location:, collection:, engine:, serving_config:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
      raise ::ArgumentError, "engine cannot contain /" if engine.to_s.include? "/"

      "projects/#{project}/locations/#{location}/collections/#{collection}/engines/#{engine}/servingConfigs/#{serving_config}"
    end)
  }

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