renderapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package renderapi talks to Render's v1 API: a service's environment, and the deploys that restart it.

Render is not enveloped like Cloudflare — a failure is an HTTP status with a JSON message — so the two transports stay separate rather than sharing an abstraction that fits neither.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TokenFromCLI

func TokenFromCLI() string

TokenFromCLI reads ~/.render/cli.yaml. The value is returned, never logged.

Types

type Client

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

func New

func New(baseURL, token string) *Client

func (*Client) Deploy

func (c *Client) Deploy(ctx context.Context, serviceID, image string) (string, error)

Deploy triggers a deploy, optionally of a specific image.

func (*Client) DeployStatus

func (c *Client) DeployStatus(ctx context.Context, serviceID, deployID string) (DeployStatus, error)

func (*Client) EnvVars

func (c *Client) EnvVars(ctx context.Context, serviceID string) (map[string]string, error)

EnvVars returns the service's whole environment, keyed by name.

The values come back too — Render's API does not redact them — so callers must compare and discard rather than print. Nothing in upkeep renders a value from this map.

func (*Client) Service

func (c *Client) Service(ctx context.Context, serviceID string) (Service, error)

func (*Client) SetEnvVar

func (c *Client) SetEnvVar(ctx context.Context, serviceID, key, value string) error

SetEnvVar adds or updates one variable, leaving every other one alone.

Render also offers a whole-environment PUT. upkeep does not use it: one wrong call there wipes the variables the platform set itself, and a tool that can silently delete DATABASE_URL is not one to trust with a production service.

func (*Client) String

func (c *Client) String() string

String redacts the token so that printing a Client cannot leak it.

type DeployStatus

type DeployStatus struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

DeployStatus is where a deploy got to. Render reports several distinct failures and they are worth keeping apart: a build that never compiled and a deploy that could not start are different problems.

func (DeployStatus) Failed

func (d DeployStatus) Failed() bool

Failed reports the statuses a deploy never leaves.

func (DeployStatus) Live

func (d DeployStatus) Live() bool

Live reports the one status that means the new code is serving traffic.

type EnvVar

type EnvVar struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

EnvVar is one variable as Render reports it.

type Error

type Error struct {
	Status   int
	Message  string
	Endpoint string
}

func (*Error) Error

func (e *Error) Error() string

type Service

type Service struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

Service is the subset upkeep reads.

Jump to

Keyboard shortcuts

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