Module: Google::Cloud::DiscoveryEngine::V1::ControlService::Paths

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

Overview

Path helper methods for the ControlService API.

Instance Method Summary collapse

Instance Method Details

#control_path(project: , location: , data_store: , control: ) ⇒ ::String #control_path(project: , location: , collection: , data_store: , control: ) ⇒ ::String #control_path(project: , location: , collection: , engine: , control: ) ⇒ ::String

Create a fully-qualified Control resource string.

Overloads:

  • #control_path(project: , location: , data_store: , control: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}

    Parameters:

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

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • collection (String) (defaults to: )
    • data_store (String) (defaults to: )
    • control (String) (defaults to: )
  • #control_path(project: , location: , collection: , engine: , control: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control}

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/google/cloud/discovery_engine/v1/control_service/paths.rb', line 63

def control_path **args
  resources = {
    "control:data_store:location:project" => (proc do |project:, location:, data_store:, control:|
      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}/controls/#{control}"
    end),
    "collection:control:data_store:location:project" => (proc do |project:, location:, collection:, data_store:, control:|
      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}/controls/#{control}"
    end),
    "collection:control:engine:location:project" => (proc do |project:, location:, collection:, engine:, control:|
      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}/controls/#{control}"
    end)
  }

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

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

Create a fully-qualified DataStore resource string.

Overloads:

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

    The resource will be in the following format:

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

    Parameters:

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

    The resource will be in the following format:

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

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/google/cloud/discovery_engine/v1/control_service/paths.rb', line 118

def data_store_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}"
    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}"
    end)
  }

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

#engine_path(project:, location:, collection:, engine:) ⇒ ::String

Create a fully-qualified Engine resource string.

The resource will be in the following format:

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

Parameters:

  • project (String)
  • location (String)
  • collection (String)
  • engine (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


153
154
155
156
157
158
159
# File 'lib/google/cloud/discovery_engine/v1/control_service/paths.rb', line 153

def engine_path project:, location:, collection:, engine:
  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}/engines/#{engine}"
end