Module: Google::Cloud::DiscoveryEngine::V1::DocumentService::Paths

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

Overview

Path helper methods for the DocumentService 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/document_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

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

Create a fully-qualified Document resource string.

Overloads:

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

    The resource will be in the following format:

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

    Parameters:

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

    The resource will be in the following format:

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

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/google/cloud/discovery_engine/v1/document_service/paths.rb', line 103

def document_path **args
  resources = {
    "branch:data_store:document:location:project" => (proc do |project:, location:, data_store:, branch:, document:|
      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? "/"
      raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/"

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

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

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

#fhir_resource_path(project:, location:, dataset:, fhir_store:, resource_type:, fhir_resource_id:) ⇒ ::String

Create a fully-qualified FhirResource resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}/fhir/{resource_type}/{fhir_resource_id}

Parameters:

  • project (String)
  • location (String)
  • dataset (String)
  • fhir_store (String)
  • resource_type (String)
  • fhir_resource_id (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


144
145
146
147
148
149
150
151
152
# File 'lib/google/cloud/discovery_engine/v1/document_service/paths.rb', line 144

def fhir_resource_path project:, location:, dataset:, fhir_store:, resource_type:, fhir_resource_id:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
  raise ::ArgumentError, "fhir_store cannot contain /" if fhir_store.to_s.include? "/"
  raise ::ArgumentError, "resource_type cannot contain /" if resource_type.to_s.include? "/"

  "projects/#{project}/locations/#{location}/datasets/#{dataset}/fhirStores/#{fhir_store}/fhir/#{resource_type}/#{fhir_resource_id}"
end

#fhir_store_path(project:, location:, dataset:, fhir_store:) ⇒ ::String

Create a fully-qualified FhirStore resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}

Parameters:

  • project (String)
  • location (String)
  • dataset (String)
  • fhir_store (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


167
168
169
170
171
172
173
# File 'lib/google/cloud/discovery_engine/v1/document_service/paths.rb', line 167

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

  "projects/#{project}/locations/#{location}/datasets/#{dataset}/fhirStores/#{fhir_store}"
end