legacy

package
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package legacy is a hand-written client for the Runpod GraphQL endpoint, used only by the Terraform provider's deprecated compatibility shims. Nothing in it is generated, and it is not wired onto the root client: v2 API work goes through runpod.New and the packages under lib/.

It exists because REST v2 has no route yet for what those shims carry: the machine resource and data sources. The provider holds the queries for the other 1.x fields itself and sends them through Query. Nothing belongs here that is not a 1.x behaviour REST v2 has no field for. It sends raw GraphQL documents; the caller owns the query text and the shape it reads back.

Deprecated: each use is removed as REST v2 carries the same fields, and the package goes with the last of them.

Index

Constants

View Source
const (
	// DefaultGraphQLURL is the production GraphQL endpoint.
	DefaultGraphQLURL = "https://api.runpod.io/graphql"

	// DefaultUserAgent identifies this package in the GraphQL host's access
	// logs, following the v2 SDK's own scheme.
	DefaultUserAgent = "runpod-go-sdk/v2 legacy"
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err is, or wraps, a 404.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to the GraphQL API with a bearer key.

func New

func New(cfg Config) (*Client, error)

New builds a Client from cfg. An empty APIKey is an error rather than a deferred 401, matching runpod.New in the v2 SDK.

func (*Client) GraphQLURL

func (c *Client) GraphQLURL() string

GraphQLURL reports the resolved GraphQL endpoint, for error messages that need to say which host was called.

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, variables map[string]any) (map[string]any, error)

Query posts a GraphQL document and returns its top-level "data" object. GraphQL reports field errors with HTTP 200 and an "errors" array, so those come back as a Go error too — a caller never has to inspect the envelope.

type Config

type Config struct {
	APIKey     string
	GraphQLURL string
	HTTPClient *http.Client

	// UserAgent overrides DefaultUserAgent. A consumer that has its own
	// attribution on the API side passes it here — the Terraform provider
	// sends the value its 1.x releases sent followed by its v2 requests'
	// value, so filters on the 1.x value still match and the shim requests
	// are attributed to the same client as the v2 ones.
	UserAgent string
}

Config is the client's input. An empty GraphQLURL falls back to the production default; a nil HTTPClient gets the same retrying client shape the v2 SDK builds (see transport.Retry: idempotent requests retry on 429 and 5xx, POST only on 429).

type NotFoundError

type NotFoundError struct {
	Path   string
	Detail string
}

NotFoundError is a 404 from the legacy API.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL