Module: Google::Cloud::ApiRegistry::V1beta::CloudApiRegistry::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/api_registry/v1beta/cloud_api_registry/paths.rb

Overview

Path helper methods for the CloudApiRegistry 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/api_registry/v1beta/cloud_api_registry/paths.rb', line 38

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

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

#mcp_server_path(project:, location:, api_namespace:, mcp_server:) ⇒ ::String #mcp_server_path(project:, location:, mcp_server:) ⇒ ::String

Create a fully-qualified McpServer resource string.

Overloads:

  • #mcp_server_path(project:, location:, api_namespace:, mcp_server:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apiNamespaces/{api_namespace}/mcpServers/{mcp_server}

    Parameters:

    • project (String)
    • location (String)
    • api_namespace (String)
    • mcp_server (String)
  • #mcp_server_path(project:, location:, mcp_server:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/mcpServers/{mcp_server}

    Parameters:

    • project (String)
    • location (String)
    • mcp_server (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/google/cloud/api_registry/v1beta/cloud_api_registry/paths.rb', line 67

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

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

      "projects/#{project}/locations/#{location}/mcpServers/#{mcp_server}"
    end)
  }

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

#mcp_tool_path(project:, location:, api_namespace:, mcp_server:, mcp_tool:) ⇒ ::String #mcp_tool_path(project:, location:, mcp_server:, mcp_tool:) ⇒ ::String

Create a fully-qualified McpTool resource string.

Overloads:

  • #mcp_tool_path(project:, location:, api_namespace:, mcp_server:, mcp_tool:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apiNamespaces/{api_namespace}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}

    Parameters:

    • project (String)
    • location (String)
    • api_namespace (String)
    • mcp_server (String)
    • mcp_tool (String)
  • #mcp_tool_path(project:, location:, mcp_server:, mcp_tool:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}

    Parameters:

    • project (String)
    • location (String)
    • mcp_server (String)
    • mcp_tool (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/google/cloud/api_registry/v1beta/cloud_api_registry/paths.rb', line 114

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

      "projects/#{project}/locations/#{location}/apiNamespaces/#{api_namespace}/mcpServers/#{mcp_server}/mcpTools/#{mcp_tool}"
    end),
    "location:mcp_server:mcp_tool:project" => (proc do |project:, location:, mcp_server:, mcp_tool:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "mcp_server cannot contain /" if mcp_server.to_s.include? "/"

      "projects/#{project}/locations/#{location}/mcpServers/#{mcp_server}/mcpTools/#{mcp_tool}"
    end)
  }

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