Module: Google::Cloud::AIPlatform::V1::MigrationService::Paths

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

Overview

Path helper methods for the MigrationService API.

Instance Method Summary collapse

Instance Method Details

#annotated_dataset_path(project:, dataset:, annotated_dataset:) ⇒ ::String

Create a fully-qualified AnnotatedDataset resource string.

The resource will be in the following format:

projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}

Parameters:

  • project (String)
  • dataset (String)
  • annotated_dataset (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


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

def annotated_dataset_path project:, dataset:, annotated_dataset:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"

  "projects/#{project}/datasets/#{dataset}/annotatedDatasets/#{annotated_dataset}"
end

#dataset_path(project: , location: , dataset: ) ⇒ ::String #dataset_path(project: , dataset: ) ⇒ ::String

Create a fully-qualified Dataset resource string.

Overloads:

  • #dataset_path(project: , location: , dataset: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/datasets/{dataset}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • dataset (String) (defaults to: )
  • #dataset_path(project: , dataset: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/datasets/{dataset}

    Parameters:

    • project (String) (defaults to: )
    • dataset (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/google/cloud/ai_platform/v1/migration_service/paths.rb', line 67

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

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

      "projects/#{project}/datasets/#{dataset}"
    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)


98
99
100
101
102
# File 'lib/google/cloud/ai_platform/v1/migration_service/paths.rb', line 98

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

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

#model_path(project:, location:, model:) ⇒ ::String

Create a fully-qualified Model resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/models/{model}

Parameters:

  • project (String)
  • location (String)
  • model (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


116
117
118
119
120
121
# File 'lib/google/cloud/ai_platform/v1/migration_service/paths.rb', line 116

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

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

#version_path(project:, model:, version:) ⇒ ::String

Create a fully-qualified Version resource string.

The resource will be in the following format:

projects/{project}/models/{model}/versions/{version}

Parameters:

  • project (String)
  • model (String)
  • version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


135
136
137
138
139
140
# File 'lib/google/cloud/ai_platform/v1/migration_service/paths.rb', line 135

def version_path project:, model:, version:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "model cannot contain /" if model.to_s.include? "/"

  "projects/#{project}/models/#{model}/versions/#{version}"
end