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

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
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

#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)


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

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

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

#node_group_path(project:, region:, cluster:, node_group:) ⇒ ::String

Create a fully-qualified NodeGroup resource string.

The resource will be in the following format:

projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{node_group}

Parameters:

  • project (String)
  • region (String)
  • cluster (String)
  • node_group (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


57
58
59
60
61
62
63
# File 'lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb', line 57

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

  "projects/#{project}/regions/#{region}/clusters/#{cluster}/nodeGroups/#{node_group}"
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)


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

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)


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

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)


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

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