Module: Google::Cloud::Batch::V1::BatchService::Paths

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

Overview

Path helper methods for the BatchService API.

Instance Method Summary collapse

Instance Method Details

#job_path(project:, location:, job:) ⇒ ::String

Create a fully-qualified Job resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/jobs/{job}

Parameters:

  • project (String)
  • location (String)
  • job (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

  "projects/#{project}/locations/#{location}/jobs/#{job}"
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/batch/v1/batch_service/paths.rb', line 57

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

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

#task_group_path(project:, location:, job:, task_group:) ⇒ ::String

Create a fully-qualified TaskGroup resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}

Parameters:

  • project (String)
  • location (String)
  • job (String)
  • task_group (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


99
100
101
102
103
104
105
# File 'lib/google/cloud/batch/v1/batch_service/paths.rb', line 99

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

  "projects/#{project}/locations/#{location}/jobs/#{job}/taskGroups/#{task_group}"
end

#task_path(project:, location:, job:, task_group:, task:) ⇒ ::String

Create a fully-qualified Task resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}/tasks/{task}

Parameters:

  • project (String)
  • location (String)
  • job (String)
  • task_group (String)
  • task (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


77
78
79
80
81
82
83
84
# File 'lib/google/cloud/batch/v1/batch_service/paths.rb', line 77

def task_path project:, location:, job:, task_group:, task:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "job cannot contain /" if job.to_s.include? "/"
  raise ::ArgumentError, "task_group cannot contain /" if task_group.to_s.include? "/"

  "projects/#{project}/locations/#{location}/jobs/#{job}/taskGroups/#{task_group}/tasks/#{task}"
end