Module: Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/dataproc/v1beta2/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/v1beta2/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/v1beta2/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/v1beta2/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

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


102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/google/cloud/dataproc/v1beta2/workflow_template_service/paths.rb', line 102

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