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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
NotFoundError is a 404 from the legacy API.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string