Module: Google::Cloud::Tpu::V1::Tpu::Paths

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

Overview

Path helper methods for the Tpu API.

Instance Method Summary collapse

Instance Method Details

#accelerator_type_path(project:, location:, accelerator_type:) ⇒ ::String

Create a fully-qualified AcceleratorType resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}

Parameters:

  • project (String)
  • location (String)
  • accelerator_type (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

  "projects/#{project}/locations/#{location}/acceleratorTypes/#{accelerator_type}"
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)


57
58
59
60
61
# File 'lib/google/cloud/tpu/v1/tpu/paths.rb', line 57

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

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

#node_path(project:, location:, node:) ⇒ ::String

Create a fully-qualified Node resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/nodes/{node}

Parameters:

  • project (String)
  • location (String)
  • node (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


75
76
77
78
79
80
# File 'lib/google/cloud/tpu/v1/tpu/paths.rb', line 75

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

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

#tensor_flow_version_path(project:, location:, tensor_flow_version:) ⇒ ::String

Create a fully-qualified TensorFlowVersion resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}

Parameters:

  • project (String)
  • location (String)
  • tensor_flow_version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


94
95
96
97
98
99
# File 'lib/google/cloud/tpu/v1/tpu/paths.rb', line 94

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

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