Module: Google::Cloud::DiscoveryEngine::V1::SiteSearchEngineService::Paths

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

Overview

Path helper methods for the SiteSearchEngineService API.

Instance Method Summary collapse

Instance Method Details

#site_search_engine_path(project: , location: , data_store: ) ⇒ ::String #site_search_engine_path(project: , location: , collection: , data_store: ) ⇒ ::String

Create a fully-qualified SiteSearchEngine resource string.

Overloads:

  • #site_search_engine_path(project: , location: , data_store: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine

    Parameters:

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

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

      "projects/#{project}/locations/#{location}/dataStores/#{data_store}/siteSearchEngine"
    end),
    "collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:|
      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? "/"

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

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

#target_site_path(project: , location: , data_store: , target_site: ) ⇒ ::String #target_site_path(project: , location: , collection: , data_store: , target_site: ) ⇒ ::String

Create a fully-qualified TargetSite resource string.

Overloads:

  • #target_site_path(project: , location: , data_store: , target_site: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • data_store (String) (defaults to: )
    • target_site (String) (defaults to: )
  • #target_site_path(project: , location: , collection: , data_store: , target_site: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/google/cloud/discovery_engine/v1/site_search_engine_service/paths.rb', line 97

def target_site_path **args
  resources = {
    "data_store:location:project:target_site" => (proc do |project:, location:, data_store:, target_site:|
      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}/siteSearchEngine/targetSites/#{target_site}"
    end),
    "collection:data_store:location:project:target_site" => (proc do |project:, location:, collection:, data_store:, target_site:|
      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}/siteSearchEngine/targetSites/#{target_site}"
    end)
  }

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