Module: Google::Cloud::Dataproc::V1::WorkflowTemplateService::Paths

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

Overview

Path helper methods for the WorkflowTemplateService API.

Instance Method Summary collapse

Instance Method Details

#cluster_path(project:, location:, cluster:) ⇒ ::String

Create a fully-qualified Cluster resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/clusters/{cluster}

Parameters:

  • project (String)
  • location (String)
  • cluster (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

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

  "projects/#{project}/locations/#{location}/clusters/#{cluster}"
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/dataproc/v1/workflow_template_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

#region_path(project:, region:) ⇒ ::String

Create a fully-qualified Region resource string.

The resource will be in the following format:

projects/{project}/regions/{region}

Parameters:

  • project (String)
  • region (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


74
75
76
77
78
# File 'lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb', line 74

def region_path project:, region:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/regions/#{region}"
end

#service_path(project:, location:, service:) ⇒ ::String

Create a fully-qualified Service resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/services/{service}

Parameters:

  • project (String)
  • location (String)
  • service (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


92
93
94
95
96
97
# File 'lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb', line 92

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

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

#workflow_template_path(project: , region: , workflow_template: ) ⇒ ::String #workflow_template_path(project: , location: , workflow_template: ) ⇒ ::String

Create a fully-qualified WorkflowTemplate resource string.

Overloads:

  • #workflow_template_path(project: , region: , workflow_template: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/regions/{region}/workflowTemplates/{workflow_template}

    Parameters:

    • project (String) (defaults to: )
    • region (String) (defaults to: )
    • workflow_template (String) (defaults to: )
  • #workflow_template_path(project: , location: , workflow_template: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/workflowTemplates/{workflow_template}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • workflow_template (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb', line 121

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

      "projects/#{project}/regions/#{region}/workflowTemplates/#{workflow_template}"
    end),
    "location:project:workflow_template" => (proc do |project:, location:, workflow_template:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/workflowTemplates/#{workflow_template}"
    end)
  }

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