Module: Google::Cloud::ApigeeRegistry::V1::Registry::Paths

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

Overview

Path helper methods for the Registry API.

Instance Method Summary collapse

Instance Method Details

#api_deployment_path(project:, location:, api:, deployment:) ⇒ ::String

Create a fully-qualified ApiDeployment resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}

Parameters:

  • project (String)
  • location (String)
  • api (String)
  • deployment (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


59
60
61
62
63
64
65
# File 'lib/google/cloud/apigee_registry/v1/registry/paths.rb', line 59

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

  "projects/#{project}/locations/#{location}/apis/#{api}/deployments/#{deployment}"
end

#api_path(project:, location:, api:) ⇒ ::String

Create a fully-qualified Api resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/apis/{api}

Parameters:

  • project (String)
  • location (String)
  • api (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


39
40
41
42
43
44
# File 'lib/google/cloud/apigee_registry/v1/registry/paths.rb', line 39

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

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

#api_spec_path(project:, location:, api:, version:, spec:) ⇒ ::String

Create a fully-qualified ApiSpec resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}

Parameters:

  • project (String)
  • location (String)
  • api (String)
  • version (String)
  • spec (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


81
82
83
84
85
86
87
88
# File 'lib/google/cloud/apigee_registry/v1/registry/paths.rb', line 81

def api_spec_path project:, location:, api:, version:, spec:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "api cannot contain /" if api.to_s.include? "/"
  raise ::ArgumentError, "version cannot contain /" if version.to_s.include? "/"

  "projects/#{project}/locations/#{location}/apis/#{api}/versions/#{version}/specs/#{spec}"
end

#api_version_path(project:, location:, api:, version:) ⇒ ::String

Create a fully-qualified ApiVersion resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/apis/{api}/versions/{version}

Parameters:

  • project (String)
  • location (String)
  • api (String)
  • version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


103
104
105
106
107
108
109
# File 'lib/google/cloud/apigee_registry/v1/registry/paths.rb', line 103

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

  "projects/#{project}/locations/#{location}/apis/#{api}/versions/#{version}"
end

#artifact_path(project: , location: , artifact: ) ⇒ ::String #artifact_path(project: , location: , api: , artifact: ) ⇒ ::String #artifact_path(project: , location: , api: , version: , artifact: ) ⇒ ::String #artifact_path(project: , location: , api: , version: , spec: , artifact: ) ⇒ ::String #artifact_path(project: , location: , api: , deployment: , artifact: ) ⇒ ::String

Create a fully-qualified Artifact resource string.

Overloads:

  • #artifact_path(project: , location: , artifact: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/artifacts/{artifact}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • artifact (String) (defaults to: )
  • #artifact_path(project: , location: , api: , artifact: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • api (String) (defaults to: )
    • artifact (String) (defaults to: )
  • #artifact_path(project: , location: , api: , version: , artifact: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • api (String) (defaults to: )
    • version (String) (defaults to: )
    • artifact (String) (defaults to: )
  • #artifact_path(project: , location: , api: , version: , spec: , artifact: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • api (String) (defaults to: )
    • version (String) (defaults to: )
    • spec (String) (defaults to: )
    • artifact (String) (defaults to: )
  • #artifact_path(project: , location: , api: , deployment: , artifact: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • api (String) (defaults to: )
    • deployment (String) (defaults to: )
    • artifact (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/google/cloud/apigee_registry/v1/registry/paths.rb', line 168

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

      "projects/#{project}/locations/#{location}/artifacts/#{artifact}"
    end),
    "api:artifact:location:project" => (proc do |project:, location:, api:, artifact:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "api cannot contain /" if api.to_s.include? "/"

      "projects/#{project}/locations/#{location}/apis/#{api}/artifacts/#{artifact}"
    end),
    "api:artifact:location:project:version" => (proc do |project:, location:, api:, version:, artifact:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "api cannot contain /" if api.to_s.include? "/"
      raise ::ArgumentError, "version cannot contain /" if version.to_s.include? "/"

      "projects/#{project}/locations/#{location}/apis/#{api}/versions/#{version}/artifacts/#{artifact}"
    end),
    "api:artifact:location:project:spec:version" => (proc do |project:, location:, api:, version:, spec:, artifact:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "api cannot contain /" if api.to_s.include? "/"
      raise ::ArgumentError, "version cannot contain /" if version.to_s.include? "/"
      raise ::ArgumentError, "spec cannot contain /" if spec.to_s.include? "/"

      "projects/#{project}/locations/#{location}/apis/#{api}/versions/#{version}/specs/#{spec}/artifacts/#{artifact}"
    end),
    "api:artifact:deployment:location:project" => (proc do |project:, location:, api:, deployment:, artifact:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "api cannot contain /" if api.to_s.include? "/"
      raise ::ArgumentError, "deployment cannot contain /" if deployment.to_s.include? "/"

      "projects/#{project}/locations/#{location}/apis/#{api}/deployments/#{deployment}/artifacts/#{artifact}"
    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)


226
227
228
229
230
# File 'lib/google/cloud/apigee_registry/v1/registry/paths.rb', line 226

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

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