Module: Google::Cloud::Bigquery::DataTransfer::V1::DataTransferService::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/bigquery/data_transfer/v1/data_transfer_service/paths.rb

Overview

Path helper methods for the DataTransferService API.

Instance Method Summary collapse

Instance Method Details

#data_source_path(project: , data_source: ) ⇒ ::String #data_source_path(project: , location: , data_source: ) ⇒ ::String

Create a fully-qualified DataSource resource string.

Overloads:

  • #data_source_path(project: , data_source: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/dataSources/{data_source}

    Parameters:

    • project (String) (defaults to: )
    • data_source (String) (defaults to: )
  • #data_source_path(project: , location: , data_source: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/dataSources/{data_source}

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/google/cloud/bigquery/data_transfer/v1/data_transfer_service/paths.rb', line 49

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

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

      "projects/#{project}/locations/#{location}/dataSources/#{data_source}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
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)


80
81
82
83
84
# File 'lib/google/cloud/bigquery/data_transfer/v1/data_transfer_service/paths.rb', line 80

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

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

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


96
97
98
# File 'lib/google/cloud/bigquery/data_transfer/v1/data_transfer_service/paths.rb', line 96

def project_path project:
  "projects/#{project}"
end

#run_path(project: , transfer_config: , run: ) ⇒ ::String #run_path(project: , location: , transfer_config: , run: ) ⇒ ::String

Create a fully-qualified Run resource string.

Overloads:

  • #run_path(project: , transfer_config: , run: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/transferConfigs/{transfer_config}/runs/{run}

    Parameters:

    • project (String) (defaults to: )
    • transfer_config (String) (defaults to: )
    • run (String) (defaults to: )
  • #run_path(project: , location: , transfer_config: , run: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/transferConfigs/{transfer_config}/runs/{run}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • transfer_config (String) (defaults to: )
    • run (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
143
# File 'lib/google/cloud/bigquery/data_transfer/v1/data_transfer_service/paths.rb', line 123

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

      "projects/#{project}/transferConfigs/#{transfer_config}/runs/#{run}"
    end),
    "location:project:run:transfer_config" => (proc do |project:, location:, transfer_config:, run:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "transfer_config cannot contain /" if transfer_config.to_s.include? "/"

      "projects/#{project}/locations/#{location}/transferConfigs/#{transfer_config}/runs/#{run}"
    end)
  }

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

#transfer_config_path(project: , transfer_config: ) ⇒ ::String #transfer_config_path(project: , location: , transfer_config: ) ⇒ ::String

Create a fully-qualified TransferConfig resource string.

Overloads:

  • #transfer_config_path(project: , transfer_config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/transferConfigs/{transfer_config}

    Parameters:

    • project (String) (defaults to: )
    • transfer_config (String) (defaults to: )
  • #transfer_config_path(project: , location: , transfer_config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/transferConfigs/{transfer_config}

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/google/cloud/bigquery/data_transfer/v1/data_transfer_service/paths.rb', line 166

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

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

      "projects/#{project}/locations/#{location}/transferConfigs/#{transfer_config}"
    end)
  }

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