pantech

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 20 Imported by: 0

README

pantech-go

CI Go Reference

The official Go SDK for the Pantech Dynamics public API: instances, VPC networks, firewalls, public IPs, load balancers, volumes, snapshots, managed databases, managed Kubernetes, SSH keys, webhooks, billing, usage, and moving from another cloud.

  • Every operation in the public API has a typed method, except agent sessions, which answer only AI apps connected through Pantech's MCP server.
  • Writes carry an Idempotency-Key that is reused when a request is retried, so a retry never makes a change twice.
  • Errors are typed (*pantech.Error) with the API's stable problem code.
  • Lists are Go 1.23 iterators; asynchronous changes have waiting helpers.
  • No dependencies outside the standard library.

Install

go get github.com/Pantech-Dynamics/pantech-go

Go 1.23 or newer.

Quickstart

package main

import (
	"context"
	"fmt"
	"log"

	pantech "github.com/Pantech-Dynamics/pantech-go"
)

func main() {
	c, err := pantech.NewClient() // reads PANTECH_API_KEY
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	for vm, err := range c.Instances.All(ctx, nil) {
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(vm.ID, vm.Name, vm.ObservedState)
	}
}

More in examples/: creating an instance, listing everything, following an operation, a webhook receiver, and moving from AWS.

Authentication

Create an API key in the console under Organization › API keys. A read key can call every GET; a write key can also create, change and delete.

c, err := pantech.NewClient(
	pantech.WithAPIKey(os.Getenv("PANTECH_API_KEY")), // the default source
	pantech.WithBaseURL("https://api.pantechdynamics.com/public/v1"), // or PANTECH_API_URL
)
Option What it does
WithAPIKey(key) The PAN_… key. Default: $PANTECH_API_KEY.
WithBaseURL(url) Base URL including /public/v1. Default: $PANTECH_API_URL, then production.
WithHTTPClient(h) Your *http.Client. Its Timeout bounds each attempt (default 90 s).
WithUserAgent(ua) Replaces the pantech-go/<version> User-Agent.
WithMaxRetries(n) Retries after the first try. Default 3; 0 turns them off.
WithHeader(k, v) A header on every request.

The key is sent only in the Authorization: Bearer header. The SDK never logs it, and printing a Client does not show it. c.Me.Get(ctx) describes the key; c.Me.Revoke(ctx) revokes it.

Services

c.Instances, c.Networks, c.Subnets, c.FirewallRules, c.PublicIPs, c.PortForwardingRules, c.SecurityGroups, c.LoadBalancers, c.Volumes, c.Snapshots, c.Databases, c.Kubernetes, c.SSHKeys, c.Webhooks, c.Migrate, c.Operations, c.Catalog (regions, plans, images, disk offerings, database engines, Kubernetes versions, price estimates), c.Billing (credit, receipts, usage) and c.Me.

Request types follow the API's field names. Optional fields are pointers, and a nil field is not sent; pantech.Ptr sets one inline:

_, err := c.Volumes.Create(ctx, pantech.CreateVolumeRequest{
	Name:             "data",
	DiskOfferingSlug: "custom",
	SizeGB:           pantech.Ptr(50),
})

For anything the typed methods do not cover, Do sends a raw call with the same auth, retries and error handling:

var out map[string]any
err := c.Do(ctx, "GET", "/instances", url.Values{"q": {"web"}}, nil, &out)

Errors

Every API error is a *pantech.Error with Status, Code, Title, Detail, RequestID, Errors (the invalid fields of a 422) and RetryAfter. Branch on Code, never on Detail:

vm, err := c.Instances.Get(ctx, id)
switch {
case pantech.IsCode(err, "RESOURCE_NOT_FOUND"):
	// gone
case err != nil:
	if e, ok := pantech.AsError(err); ok {
		log.Printf("%s (quote request %s to support)", e.Detail, e.RequestID)
	}
	return err
}

Detail is plain language and safe to show to your users.

Pagination

Lists return {data, next_cursor}. Paginated lists have two methods: List returns one *Page[T], and All iterates over every item, fetching pages as needed:

page, err := c.Volumes.List(ctx, &pantech.ListParams{Limit: 100, Q: "db"})
// page.Data, page.NextCursor, page.HasMore()

for vol, err := range c.Volumes.All(ctx, &pantech.ListParams{ObservedState: "active"}) {
	if err != nil {
		return err
	}
	fmt.Println(vol.Name)
}

Lists the API returns in one page (regions, plans, images, SSH keys, webhooks, clusters…) return a plain slice, and still follow next_cursor should the API ever add pages.

Operations

Writes return 202 Accepted with an operation. Wait for it:

accepted, err := c.Instances.Stop(ctx, id)
if err != nil {
	return err
}
op, err := c.Operations.Wait(ctx, accepted.OperationID, &pantech.WaitOptions{Timeout: 10 * time.Minute})
var failed *pantech.OperationError
if errors.As(err, &failed) {
	fmt.Println(failed.Operation.Failure.Code, failed.Operation.Failure.Reason)
}

or follow it over Server-Sent Events with c.Operations.Stream(ctx, id).

A new instance or database is an order, paid first: c.Instances.WaitForOrder and c.Databases.WaitForOrder wait until it is provisioned and return an *pantech.OrderError when it ends payment_failed or failed.

Move from another cloud

c.Migrate connects an AWS account through a read-only role that only Pantech can assume (no access keys are shared), scans what runs there, and plans the move with a price comparison and a Terraform export. Nothing is created on Pantech until you apply the Terraform.

conn, err := c.Migrate.CreateConnection(ctx, pantech.CreateCloudConnectionRequest{Name: "Production AWS"})
// Create the stack from *conn.Setup.QuickCreateURL (or conn.Setup.Template) in AWS, then:
_, err = c.Migrate.UpdateConnection(ctx, conn.ID, pantech.UpdateCloudConnectionRequest{RoleARN: &roleARN})
conn, err = c.Migrate.WaitForConnection(ctx, conn.ID, nil)

scan, err := c.Migrate.StartScan(ctx, conn.ID)
scan, err = c.Migrate.WaitForScan(ctx, scan.ID, nil)

plan, err := c.Migrate.CreateMigration(ctx, pantech.CreateMigrationRequest{ScanID: scan.ID, Name: "Move"})
fmt.Println(plan.Estimate.PantechMonthlyMinor, plan.Estimate.SourceMonthlyMinor)
tf, err := c.Migrate.ExportTerraform(ctx, plan.ID) // tf.Files: main.tf, variables.tf

A failed connection or scan returns a *pantech.CloudFailureError whose Failure.Message says what to do. c.Migrate.UpdateItem excludes an item or changes its plan, size, range or role before you export. The whole flow is in examples/migrate-from-aws.

Webhooks

Verify every delivery against the raw body before acting on it:

body, _ := io.ReadAll(r.Body)
event, err := pantech.ParseWebhook(secret, r.Header.Get("Pantech-Signature"), body, 0)
if err != nil {
	http.Error(w, "invalid signature", http.StatusBadRequest)
	return
}

pantech.VerifyWebhook(secret, header, body, tolerance) only checks the signature. The header is t=<unix>,v1=<hex HMAC-SHA256(secret, t + "." + body)>; the comparison is constant time, the default tolerance is 5 minutes, and during the 24 hours after a secret rotation either v1 value verifies. pantech.SignWebhook signs a body the same way, for testing your receiver.

Idempotency

Every POST, PUT, PATCH and DELETE gets a random Idempotency-Key (a UUIDv4), and the same key is sent on every retry of that call, so the API returns the original result instead of acting twice. To make a change safe to repeat across runs or processes, choose the key yourself:

order, err := c.Instances.Create(ctx, req, pantech.WithIdempotencyKey("deploy-42-web-1"))

Every typed method, and Do, takes these per-call options: WithIdempotencyKey(k), WithRequestHeader(k, v) and WithNoRetry().

Retries

Network errors, 429, 500, 502, 503 and 504 are retried up to 3 times with jittered exponential backoff (0.5 s, 1 s, 2 s… up to 8 s), and a Retry-After is honoured (up to 60 s). Routes the API does not replay are retried only on 429, which the API refuses before acting: creating or deleting an SSH key, opening an instance console, and testing, deleting, rotating the secret of or redelivering a webhook. WithNoRetry() sends a call once. Cancelling the context stops a call and its retries at once.

Development

go vet ./... && go test -race ./...
scripts/sync-spec.sh   # refresh testdata/public-api.yaml from the published spec

The SDK follows the published OpenAPI spec. See CONTRIBUTING.md for the workflow and how releases are made. Report security issues as described in SECURITY.md.

License

MIT. See LICENSE.

Documentation

Overview

Package pantech is the official Go SDK for the Pantech Dynamics public API (https://docs.pantechdynamics.com/api).

Create a client with NewClient, then call the typed services on it:

c, err := pantech.NewClient() // reads PANTECH_API_KEY
if err != nil { ... }
me, err := c.Me.Get(ctx)

Every write carries an Idempotency-Key that is reused when the request is retried, so a retry never makes a change twice. Errors from the API are *Error values carrying the problem's stable code; branch on it with IsCode.

Index

Constants

View Source
const (
	EnvAPIKey = "PANTECH_API_KEY"
	EnvAPIURL = "PANTECH_API_URL"
)

Environment variables NewClient reads when no option sets the value.

View Source
const (
	CloudConnectionAwaitingRole = "awaiting_role"
	CloudConnectionVerifying    = "verifying"
	CloudConnectionConnected    = "connected"
	CloudConnectionFailed       = "failed"
)

Cloud connection statuses. Connected and failed are final until the role ARN changes or a retry is asked for.

View Source
const (
	CloudScanQueued    = "queued"
	CloudScanRunning   = "running"
	CloudScanSucceeded = "succeeded"
	CloudScanFailed    = "failed"
)

Cloud scan statuses. Succeeded and failed are final.

View Source
const (
	OperationSubmitting = "submitting"
	OperationSubmitted  = "submitted"
	OperationSucceeded  = "succeeded"
	OperationFailed     = "failed"
)

Operation statuses. Succeeded and failed are final.

View Source
const (
	OrderAwaitingPayment = "awaiting_payment"
	OrderPaid            = "paid"
	OrderProvisioning    = "provisioning"
	OrderProvisioned     = "provisioned"
	OrderPaymentFailed   = "payment_failed"
	OrderFailed          = "failed"
)

Order statuses, shared by instance and database orders. Provisioned is success; payment_failed and failed are final failures, and any payment taken is returned to credit.

View Source
const (
	WebhookSignatureHeader  = "Pantech-Signature"
	WebhookEventIDHeader    = "Pantech-Event-Id"
	WebhookEventTypeHeader  = "Pantech-Event-Type"
	WebhookDeliveryIDHeader = "Pantech-Delivery-Id"
)

Webhook delivery headers.

View Source
const DefaultBaseURL = "https://api.pantechdynamics.com/public/v1"

DefaultBaseURL is the production public API. Every path is relative to it.

View Source
const DefaultMaxRetries = 3

DefaultMaxRetries is how many times a request is retried after the first try, unless WithMaxRetries says otherwise.

View Source
const DefaultWebhookTolerance = 5 * time.Minute

DefaultWebhookTolerance is how old a delivery's timestamp may be.

View Source
const Version = "0.2.0"

Version is this SDK's version. It goes into the default User-Agent.

Variables

View Source
var (
	// ErrWebhookHeader means the Pantech-Signature header is missing or malformed.
	ErrWebhookHeader = errors.New("pantech: the webhook signature header is missing or malformed")
	// ErrWebhookTimestamp means the signature's timestamp is outside the tolerance.
	ErrWebhookTimestamp = errors.New("pantech: the webhook signature has expired")
	// ErrWebhookSignature means no v1 signature matches the body and secret.
	ErrWebhookSignature = errors.New("pantech: the webhook signature does not match")
)

Errors VerifyWebhook returns. Answer any of them with a 4xx and do not act on the body.

Functions

func IsCode

func IsCode(err error, code string) bool

IsCode reports whether err is, or wraps, an *Error with this problem code, for example IsCode(err, "RESOURCE_NOT_FOUND").

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v. Optional request fields are pointers, so a field left nil is not sent, and Ptr sets one inline:

pantech.CreateVolumeRequest{Name: "data", DiskOfferingSlug: "small-5gb", SizeGB: pantech.Ptr(50)}

func SignWebhook

func SignWebhook(secret string, t time.Time, body []byte) string

SignWebhook returns the Pantech-Signature header value for body signed with secret at t, as the API sends it. Use it to test your receiver.

func VerifyWebhook

func VerifyWebhook(secret string, header string, body []byte, tolerance time.Duration) error

VerifyWebhook checks a delivery's Pantech-Signature header, "t=<unix seconds>,v1=<hex>[,v1=<hex>]", against the raw request body: one v1 must equal HMAC-SHA256(secret, t + "." + body), compared in constant time, and t must be within tolerance of now (DefaultWebhookTolerance when tolerance is 0). Pass the body exactly as received, before any JSON parsing. After a secret rotation there are two v1 values for 24 hours, one per secret.

Types

type Accepted

type Accepted struct {
	// The operation carrying out the change.
	OperationID string `json:"operation_id"`
	// The resource being created or changed, e.g. the new snapshot's id for a snapshot create.
	ResourceID string `json:"resource_id"`
	// The operation's status when the request was accepted, usually `submitting`.
	Status string `json:"status"`
}

Accepted is the API's accepted object. Returned with `202 Accepted` by every asynchronous write.

type ApplyKubernetesManifestRequest

type ApplyKubernetesManifestRequest struct {
	Manifest string `json:"manifest"`
	// Where namespaced objects without one go; default `default`.
	Namespace *string `json:"namespace,omitempty"`
}

ApplyKubernetesManifestRequest is the API's apply kubernetes manifest request object.

type AttachPublicIPRequest

type AttachPublicIPRequest struct {
	// An instance in the address's private network.
	InstanceID string `json:"instance_id"`
}

AttachPublicIPRequest is the API's attach public iprequest object.

type AttachVolumeRequest

type AttachVolumeRequest struct {
	// A running instance in the volume's zone, e.g. `vm_…`.
	InstanceID string `json:"instance_id"`
}

AttachVolumeRequest is the API's attach volume request object.

type BillingService

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

BillingService is credit, receipts and usage.

func (*BillingService) AllReceipts

func (s *BillingService) AllReceipts(ctx context.Context, params *PageParams, opts ...RequestOption) iter.Seq2[Receipt, error]

AllReceipts iterates over every item of ListReceipts, fetching pages as needed. It stops at the first error, which it yields.

func (*BillingService) CreateCreditPurchase

func (s *BillingService) CreateCreditPurchase(ctx context.Context, req CreateCreditPurchaseRequest, opts ...RequestOption) (*CreditPurchase, error)

CreateCreditPurchase buys credit: POST /billing/credit/purchases. Scope: write.

func (*BillingService) GetCredit

func (s *BillingService) GetCredit(ctx context.Context, opts ...RequestOption) (*CreditOutlook, error)

GetCredit gets credit: GET /billing/credit. Scope: read.

func (*BillingService) GetCreditPurchase

func (s *BillingService) GetCreditPurchase(ctx context.Context, purchaseID string, opts ...RequestOption) (*CreditPurchase, error)

GetCreditPurchase gets a credit purchase: GET /billing/credit/purchases/{purchase_id}. Scope: read.

func (*BillingService) GetReceipt

func (s *BillingService) GetReceipt(ctx context.Context, receiptID string, opts ...RequestOption) (*Receipt, error)

GetReceipt gets a receipt: GET /billing/receipts/{receipt_id}. Scope: read.

func (*BillingService) GetReceiptPDF

func (s *BillingService) GetReceiptPDF(ctx context.Context, receiptID string, opts ...RequestOption) ([]byte, error)

GetReceiptPDF downloads a receipt: GET /billing/receipts/{receipt_id}/pdf. Scope: read.

func (*BillingService) GetUsage

func (s *BillingService) GetUsage(ctx context.Context, opts ...RequestOption) (*UsageSummary, error)

GetUsage gets usage: GET /usage. Scope: read.

func (*BillingService) GetUsageByResource

func (s *BillingService) GetUsageByResource(ctx context.Context, params *UsageByResourceParams, opts ...RequestOption) (*UsageByResource, error)

GetUsageByResource gets cost by resource: GET /usage/by-resource. Scope: read.

func (*BillingService) ListReceipts

func (s *BillingService) ListReceipts(ctx context.Context, params *PageParams, opts ...RequestOption) (*Page[Receipt], error)

ListReceipts lists receipts: GET /billing/receipts. Scope: read.

type CatalogService

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

CatalogService is what you can buy and what it costs: regions, plans, images, disk offerings, database engines, Kubernetes versions and price estimates.

func (*CatalogService) EstimatePrice

EstimatePrice estimates a monthly bill: POST /pricing/estimate. Scope: read.

func (*CatalogService) ListDatabaseEngines

func (s *CatalogService) ListDatabaseEngines(ctx context.Context, opts ...RequestOption) ([]DatabaseEngine, error)

ListDatabaseEngines lists database engines: GET /database-engines. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*CatalogService) ListDiskOfferings

func (s *CatalogService) ListDiskOfferings(ctx context.Context, opts ...RequestOption) ([]DiskOffering, error)

ListDiskOfferings lists disk offerings: GET /disk-offerings. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*CatalogService) ListImages

func (s *CatalogService) ListImages(ctx context.Context, opts ...RequestOption) ([]Image, error)

ListImages lists images: GET /images. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*CatalogService) ListKubernetesVersions

func (s *CatalogService) ListKubernetesVersions(ctx context.Context, params *ListKubernetesVersionsParams, opts ...RequestOption) (*KubernetesVersionList, error)

ListKubernetesVersions lists Kubernetes versions: GET /kubernetes-versions. Scope: read.

func (*CatalogService) ListPlans

func (s *CatalogService) ListPlans(ctx context.Context, params *ListPlansParams, opts ...RequestOption) ([]Plan, error)

ListPlans lists plans: GET /plans. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*CatalogService) ListRegions

func (s *CatalogService) ListRegions(ctx context.Context, opts ...RequestOption) ([]Region, error)

ListRegions lists regions: GET /regions. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*CatalogService) QuoteDiskOffering

func (s *CatalogService) QuoteDiskOffering(ctx context.Context, slug string, params *DiskOfferingQuoteParams, opts ...RequestOption) (*DiskOfferingQuote, error)

QuoteDiskOffering prices a volume: GET /disk-offerings/{slug}/quote. Scope: read.

type ChangeDatabasePasswordRequest

type ChangeDatabasePasswordRequest struct {
	// The new admin password: 16 to 128 printable ASCII characters, with no spaces, single quotes (`'`), double quotes (`"`) or backslashes (`\`).
	Password string `json:"password"`
}

ChangeDatabasePasswordRequest is the API's change database password request object.

type ChangeSSHKeyRequest

type ChangeSSHKeyRequest struct {
	// The SSH key the instance should accept from now on, from `GET /public/v1/ssh-keys`.
	SSHKeyID string `json:"ssh_key_id"`
}

ChangeSSHKeyRequest is the API's change sshkey request object.

type ChangeSecurityGroupRequest

type ChangeSecurityGroupRequest struct {
	// One of your security groups in the instance's zone, e.g. `sg_…`.
	SecurityGroupID string `json:"security_group_id"`
}

ChangeSecurityGroupRequest is the API's change security group request object.

type Client

type Client struct {
	Me                  *MeService
	Billing             *BillingService
	Catalog             *CatalogService
	Instances           *InstancesService
	Networks            *NetworksService
	Subnets             *SubnetsService
	FirewallRules       *FirewallRulesService
	PublicIPs           *PublicIPsService
	PortForwardingRules *PortForwardingRulesService
	SecurityGroups      *SecurityGroupsService
	LoadBalancers       *LoadBalancersService
	Volumes             *VolumesService
	Snapshots           *SnapshotsService
	Databases           *DatabasesService
	Kubernetes          *KubernetesService
	SSHKeys             *SSHKeysService
	Webhooks            *WebhooksService
	Migrate             *MigrateService
	Operations          *OperationsService
	// contains filtered or unexported fields
}

Client talks to the Pantech Dynamics public API. It is safe for concurrent use. Create it with NewClient.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient returns a client configured by opts and the environment. It fails when there is no API key or the base URL is not an http(s) URL.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL is the base URL the client sends requests to.

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, query url.Values, body, out any, opts ...RequestOption) error

Do sends one API call and decodes the answer. It is what every typed method uses, and it is exported for calls the typed services do not cover.

path is relative to the base URL, such as "/instances" or "/instances/vm_123/start"; query may be nil. body is nil or a value that marshals to JSON (a json.RawMessage is sent as is). out is nil or a pointer: a 2xx JSON body is decoded into it, and a *[]byte receives the raw body.

POST, PUT, PATCH and DELETE carry an Idempotency-Key, the same one on every retry. Network errors, 429 (after Retry-After), 500, 502, 503 and 504 are retried with jittered backoff, except on the routes the API does not replay (creating or deleting an SSH key, opening an instance console, and testing, deleting, rotating the secret of or redelivering a webhook), which are retried only on 429. A non-2xx answer is returned as an *Error.

type CloudBucket added in v0.2.0

type CloudBucket struct {
	Name      string     `json:"name"`
	Region    *string    `json:"region"`
	CreatedAt *time.Time `json:"created_at"`
}

CloudBucket is a storage bucket a scan found, by name.

type CloudConnection added in v0.2.0

type CloudConnection struct {
	ID string `json:"id"`
	// One of: aws.
	Provider string `json:"provider"`
	Name     string `json:"name"`
	// `awaiting_role`, `verifying`, `connected` or `failed`. One of: awaiting_role, verifying, connected, failed.
	Status       string        `json:"status"`
	Failure      *CloudFailure `json:"failure"`
	RoleARN      *string       `json:"role_arn"`
	AWSAccountID *string       `json:"aws_account_id"`
	VerifiedAt   *time.Time    `json:"verified_at"`
	CreatedAt    time.Time     `json:"created_at"`
	UpdatedAt    time.Time     `json:"updated_at"`
	// What you need to create the role in your account.
	Setup CloudConnectionSetup `json:"setup"`
}

CloudConnection is the API's cloud connection object. A connection to an account in another cloud, through a read-only role.

type CloudConnectionSetup added in v0.2.0

type CloudConnectionSetup struct {
	// Pantech's identity provider URL, which your role trusts.
	IssuerURL string `json:"issuer_url"`
	// The audience every token carries.
	Audience string `json:"audience"`
	// The subject your role requires: this connection's id.
	Subject string `json:"subject"`
	// Opens AWS's create-stack page with this template and connection filled in; null when not offered.
	QuickCreateURL *string `json:"quick_create_url"`
	// A CloudFormation template (JSON) for this connection: a read-only role and, unless one exists, the identity provider.
	Template string `json:"template"`
}

CloudConnectionSetup is the API's cloud connection setup object. What you need to create the role in your account.

type CloudCost added in v0.2.0

type CloudCost struct {
	Currency string `json:"currency"`
	// Average of the months, in minor units of currency.
	AverageMonthlyMinor int64            `json:"average_monthly_minor"`
	Months              []CloudCostMonth `json:"months"`
}

CloudCost is the API's cloud cost object. The source account's whole bill, every service.

type CloudCostMonth added in v0.2.0

type CloudCostMonth struct {
	// YYYY-MM.
	Month       string `json:"month"`
	AmountMinor int64  `json:"amount_minor"`
}

CloudCostMonth is the API's cloud cost month object.

type CloudDatabase added in v0.2.0

type CloudDatabase struct {
	ID                 string `json:"id"`
	Region             string `json:"region"`
	Engine             string `json:"engine"`
	EngineVersion      string `json:"engine_version"`
	InstanceClass      string `json:"instance_class"`
	VCPU               *int   `json:"vcpu"`
	MemoryMiB          *int   `json:"memory_mib"`
	StorageGB          int    `json:"storage_gb"`
	MultiAZ            bool   `json:"multi_az"`
	PubliclyAccessible bool   `json:"publicly_accessible"`
}

CloudDatabase is a database a scan found.

type CloudFailure added in v0.2.0

type CloudFailure struct {
	// One of: assume_role_denied, permission_missing, provider_unavailable, scan_too_large, internal.
	Code string `json:"code"`
	// What to do about it.
	Message string `json:"message"`
}

CloudFailure is the API's cloud failure object. Why the last check or scan failed; null when it didn't.

type CloudFailureError added in v0.2.0

type CloudFailureError struct {
	// Kind is "connection" or "scan".
	Kind    string
	ID      string
	Failure *CloudFailure
}

CloudFailureError is returned by WaitForConnection and WaitForScan when the connection or scan ended as failed. Failure's code is stable and its message says what to do.

func (*CloudFailureError) Error added in v0.2.0

func (e *CloudFailureError) Error() string

type CloudInstance added in v0.2.0

type CloudInstance struct {
	ID               string     `json:"id"`
	Name             *string    `json:"name"`
	Region           string     `json:"region"`
	Zone             *string    `json:"zone"`
	InstanceType     string     `json:"instance_type"`
	State            string     `json:"state"`
	VCPU             *int       `json:"vcpu"`
	MemoryMiB        *int       `json:"memory_mib"`
	Architecture     string     `json:"architecture"`
	Platform         string     `json:"platform"`
	VolumeIDs        []string   `json:"volume_ids"`
	NetworkID        *string    `json:"network_id"`
	SubnetID         *string    `json:"subnet_id"`
	SecurityGroupIDs []string   `json:"security_group_ids"`
	PublicIP         *string    `json:"public_ip"`
	PrivateIP        *string    `json:"private_ip"`
	KeyName          *string    `json:"key_name"`
	LaunchedAt       *time.Time `json:"launched_at"`
}

CloudInstance is a server a scan found.

type CloudInventory added in v0.2.0

type CloudInventory struct {
	Instances      []CloudInstance      `json:"instances"`
	Volumes        []CloudVolume        `json:"volumes"`
	Networks       []CloudNetwork       `json:"networks"`
	Subnets        []CloudSubnet        `json:"subnets"`
	SecurityGroups []CloudSecurityGroup `json:"security_groups"`
	PublicIPs      []CloudPublicIP      `json:"public_ips"`
	LoadBalancers  []CloudLoadBalancer  `json:"load_balancers"`
	Databases      []CloudDatabase      `json:"databases"`
	Buckets        []CloudBucket        `json:"buckets"`
	Users          []CloudUser          `json:"users"`
	SSHKeys        []CloudSSHKey        `json:"ssh_keys"`
}

CloudInventory is the API's cloud inventory object. Everything a scan found. Names and tags are the account owner's own text.

type CloudLoadBalancer added in v0.2.0

type CloudLoadBalancer struct {
	ID        string              `json:"id"`
	Region    string              `json:"region"`
	Name      string              `json:"name"`
	Type      string              `json:"type"`
	Scheme    string              `json:"scheme"`
	NetworkID *string             `json:"network_id"`
	Listeners []MigrationListener `json:"listeners"`
}

CloudLoadBalancer is a load balancer a scan found.

type CloudNetwork added in v0.2.0

type CloudNetwork struct {
	ID        string  `json:"id"`
	Region    string  `json:"region"`
	Name      *string `json:"name"`
	CIDR      string  `json:"cidr"`
	IsDefault bool    `json:"is_default"`
}

CloudNetwork is a network a scan found.

type CloudPublicIP added in v0.2.0

type CloudPublicIP struct {
	ID         string  `json:"id"`
	Region     string  `json:"region"`
	Address    string  `json:"address"`
	InstanceID *string `json:"instance_id"`
}

CloudPublicIP is a public address a scan found.

type CloudSSHKey added in v0.2.0

type CloudSSHKey struct {
	Name        string  `json:"name"`
	Region      string  `json:"region"`
	Fingerprint *string `json:"fingerprint"`
	PublicKey   *string `json:"public_key"`
}

CloudSSHKey is an SSH key a scan found.

type CloudScan added in v0.2.0

type CloudScan struct {
	ID           string `json:"id"`
	ConnectionID string `json:"connection_id"`
	// One of: queued, running, succeeded, failed.
	Status       string        `json:"status"`
	Failure      *CloudFailure `json:"failure"`
	CreatedAt    time.Time     `json:"created_at"`
	StartedAt    *time.Time    `json:"started_at"`
	FinishedAt   *time.Time    `json:"finished_at"`
	AWSAccountID *string       `json:"aws_account_id"`
	// Regions read.
	Regions []string         `json:"regions"`
	Counts  *CloudScanCounts `json:"counts"`
	// The source account's whole bill, every service.
	Cost *CloudCost `json:"cost"`
	// Parts not read, e.g. `cost_unavailable` or `region_denied:eu-south-1`.
	Warnings []string `json:"warnings"`
	// Kinds cut at 2,000 items.
	Truncated []string `json:"truncated"`
	// Everything the scan found; only with GetCloudScanParams{Include: "inventory"}.
	Inventory *CloudInventory `json:"inventory"`
}

CloudScan is the API's cloud scan object. A read of everything a connection's role can see.

type CloudScanCounts added in v0.2.0

type CloudScanCounts struct {
	Instances      int `json:"instances"`
	Volumes        int `json:"volumes"`
	Networks       int `json:"networks"`
	Subnets        int `json:"subnets"`
	SecurityGroups int `json:"security_groups"`
	PublicIPs      int `json:"public_ips"`
	LoadBalancers  int `json:"load_balancers"`
	Databases      int `json:"databases"`
	Buckets        int `json:"buckets"`
	Users          int `json:"users"`
	SSHKeys        int `json:"ssh_keys"`
}

CloudScanCounts is the API's cloud scan counts object.

type CloudSecurityGroup added in v0.2.0

type CloudSecurityGroup struct {
	ID          string                   `json:"id"`
	Region      string                   `json:"region"`
	NetworkID   *string                  `json:"network_id"`
	Name        string                   `json:"name"`
	Description *string                  `json:"description"`
	Rules       []CloudSecurityGroupRule `json:"rules"`
}

CloudSecurityGroup is a firewall group a scan found.

type CloudSecurityGroupRule added in v0.2.0

type CloudSecurityGroupRule struct {
	// One of: ingress, egress.
	Direction     string  `json:"direction"`
	Protocol      string  `json:"protocol"`
	FromPort      *int    `json:"from_port"`
	ToPort        *int    `json:"to_port"`
	CIDR          *string `json:"cidr"`
	IPv6CIDR      *string `json:"ipv6_cidr"`
	SourceGroupID *string `json:"source_group_id"`
	PrefixListID  *string `json:"prefix_list_id"`
}

CloudSecurityGroupRule is one rule of a firewall group a scan found.

type CloudSubnet added in v0.2.0

type CloudSubnet struct {
	ID           string  `json:"id"`
	Region       string  `json:"region"`
	NetworkID    string  `json:"network_id"`
	Name         *string `json:"name"`
	CIDR         string  `json:"cidr"`
	Zone         *string `json:"zone"`
	MapsPublicIP bool    `json:"maps_public_ip"`
}

CloudSubnet is a subnet a scan found.

type CloudUser added in v0.2.0

type CloudUser struct {
	Name      string     `json:"name"`
	Email     *string    `json:"email"`
	IsAdmin   bool       `json:"is_admin"`
	CreatedAt *time.Time `json:"created_at"`
}

CloudUser is a person a scan found.

type CloudVolume added in v0.2.0

type CloudVolume struct {
	ID         string  `json:"id"`
	Region     string  `json:"region"`
	Zone       *string `json:"zone"`
	Type       string  `json:"type"`
	SizeGB     int     `json:"size_gb"`
	AttachedTo *string `json:"attached_to"`
	Device     *string `json:"device"`
	Encrypted  bool    `json:"encrypted"`
}

CloudVolume is a disk a scan found.

type ConfigureKubernetesEndpointAccessRequest

type ConfigureKubernetesEndpointAccessRequest struct {
	// Endpoint access mode. One of: public, private, dual.
	EndpointAccess string `json:"endpoint_access"`
	// IPv4 CIDRs allowed to connect to the cluster API.
	APIAllowedCIDRs *[]string `json:"api_allowed_cidrs,omitempty"`
}

ConfigureKubernetesEndpointAccessRequest is the API's configure kubernetes endpoint access request object.

type CreateCloudConnectionRequest added in v0.2.0

type CreateCloudConnectionRequest struct {
	// `aws`, the default. One of: aws.
	Provider *string `json:"provider,omitempty"`
	// 1 to 100 characters, for example `Production AWS`.
	Name string `json:"name"`
}

CreateCloudConnectionRequest is the API's create cloud connection request object.

type CreateCreditPurchaseRequest

type CreateCreditPurchaseRequest struct {
	// How much credit to buy, in minor units of your organization's currency: kobo for NGN, cents for USD.
	AmountMinor int64 `json:"amount_minor"`
}

CreateCreditPurchaseRequest is the API's create credit purchase request object.

type CreateDatabaseRequest

type CreateDatabaseRequest struct {
	// 1 to 255 characters, unique among your databases.
	Name string `json:"name"`
	// `postgresql`, `mysql` or `mariadb`; see `GET /public/v1/database-engines`. One of: postgresql, mysql, mariadb.
	Engine string `json:"engine"`
	// A version line offered for `engine` in `zone_id`, from `GET /public/v1/database-engines`, e.g. `18` for PostgreSQL or `8.4` for MySQL.
	Version string `json:"version"`
	// The size, from `GET /public/v1/plans`: its vCPU and memory, and its `disk_gb` as the smallest data disk.
	PlanSlug string `json:"plan_slug"`
	// Where to create it: a zone from the version's `zones`, e.g. `af-abj-1` (standard) or `af-abj-2` (VPC).
	ZoneID string `json:"zone_id"`
	// Required in a VPC zone (`af-abj-2`): one of your subnets there, which the database joins.
	SubnetID *string `json:"subnet_id,omitempty"`
	// The initial allow-list: IPv4 CIDRs with a prefix of `/8` or longer, never `0.0.0.0/0`, at most 50, no range twice.
	AccessRules *[]string `json:"access_rules,omitempty"`
	// The admin login's name: 3 to 32 characters, lowercase letters, digits and underscores, starting with a letter.
	AdminUsername *string `json:"admin_username,omitempty"`
	// Optional admin password: 16 to 128 printable ASCII characters, with no spaces, single quotes (`'`), double quotes (`"`) or backslashes (`\`).
	Password *string `json:"password,omitempty"`
	// Data disk size in GB.
	StorageGB *int `json:"storage_gb,omitempty"`
}

CreateDatabaseRequest is the API's create database request object.

type CreateFirewallRuleRequest

type CreateFirewallRuleRequest struct {
	// Evaluation order, 100 to 9999, unique on the subnet; lower numbers are evaluated first and the first match decides.
	Number int `json:"number"`
	// `ingress` (traffic into the subnet) or `egress` (traffic out of it). One of: ingress, egress.
	Direction *string `json:"direction,omitempty"`
	// `tcp`, `udp`, `icmp` or `all`. One of: tcp, udp, icmp, all.
	Protocol string `json:"protocol"`
	// First port, 1 to 65535.
	PortStart *int `json:"port_start,omitempty"`
	// Last port, 1 to 65535, at least `port_start`.
	PortEnd *int `json:"port_end,omitempty"`
	// ICMP type, for `icmp` only, e.g. `8` for echo request.
	ICMPType *int `json:"icmp_type,omitempty"`
	// ICMP code, for `icmp` only.
	ICMPCode *int `json:"icmp_code,omitempty"`
	// One IPv4 CIDR: the source for `ingress`, the destination for `egress`.
	CIDR string `json:"cidr"`
	// `allow` or `deny`. One of: allow, deny.
	Action *string `json:"action,omitempty"`
}

CreateFirewallRuleRequest is the API's create firewall rule request object.

type CreateInstanceRequest

type CreateInstanceRequest struct {
	// 1 to 255 characters of lowercase letters a-z, digits 0-9 and hyphens (-), starting and ending with a letter or digit, unique among your instances.
	Name string `json:"name"`
	// The size, from `GET /public/v1/plans`.
	PlanSlug string `json:"plan_slug"`
	// The operating system, from `GET /public/v1/images`.
	ImageSlug string `json:"image_slug"`
	// Optional.
	Encrypted *bool `json:"encrypted,omitempty"`
	// An SSH key from `GET /public/v1/ssh-keys`, installed for the default user.
	SSHKeyID string `json:"ssh_key_id"`
	// A region from `GET /public/v1/regions`, e.g. `af-abj`.
	Region *string `json:"region,omitempty"`
	// Place the instance in this VPC subnet, with a private address only.
	SubnetID *string `json:"subnet_id,omitempty"`
	// The subnet's VPC.
	NetworkID *string `json:"network_id,omitempty"`
	// Standard instances only: one of your security groups.
	SecurityGroupID *string `json:"security_group_id,omitempty"`
	// Your own labels, as string keys and values.
	Tags *map[string]string `json:"tags,omitempty"`
}

CreateInstanceRequest is the API's create instance request object.

type CreateKubernetesClusterRequest

type CreateKubernetesClusterRequest struct {
	// 1 to 40 lowercase letters, digits and hyphens, starting with a letter.
	Name   string `json:"name"`
	ZoneID string `json:"zone_id"`
	// From the Kubernetes versions list, in `zone_id`.
	KubernetesVersionID string `json:"kubernetes_version_id"`
	// Required in a VPC zone: the subnet the nodes go in.
	SubnetID *string `json:"subnet_id,omitempty"`
	// The plan slug every node uses, from the plans list.
	NodePlan string `json:"node_plan"`
	// 1, or 3 for a highly available control plane where the zone offers it. One of: 1, 3.
	ControlNodes *int `json:"control_nodes,omitempty"`
	// Worker nodes, 1 to 10.
	Workers     *int                   `json:"workers,omitempty"`
	Autoscaling *KubernetesAutoscaling `json:"autoscaling,omitempty"`
	// VPC zone only: the IPv4 CIDRs allowed to reach the API server (at most 20).
	APIAllowedCIDRs *[]string `json:"api_allowed_cidrs,omitempty"`
	// Cluster architecture. One of: appliance.
	Kind *string `json:"kind,omitempty"`
	// CNI backend plugin (`flannel`, `wireguard`, or `calico`).
	CNIPlugin *string `json:"cni_plugin,omitempty"`
	// IPv4 CIDR range allocated for cluster pods.
	PodCIDR *string `json:"pod_cidr,omitempty"`
	// IPv4 CIDR range allocated for cluster services.
	ServiceCIDR *string `json:"service_cidr,omitempty"`
	// Who can reach the API server. One of: private, public, dual.
	EndpointAccess *string `json:"endpoint_access,omitempty"`
}

CreateKubernetesClusterRequest is the API's create kubernetes cluster request object.

type CreateKubernetesNodePoolRequest

type CreateKubernetesNodePoolRequest struct {
	// Unique name for the node pool.
	Name string `json:"name"`
	// Compute plan ID or slug for the worker VMs.
	PlanID string `json:"plan_id"`
	// Worker nodes, 1 to 10.
	Workers            *int  `json:"workers,omitempty"`
	AutoscalingEnabled *bool `json:"autoscaling_enabled,omitempty"`
	// With autoscaling_enabled: fewest workers, 1 to 10.
	MinWorkers *int `json:"min_workers,omitempty"`
	// With autoscaling_enabled: most workers, min_workers to 10.
	MaxWorkers *int                       `json:"max_workers,omitempty"`
	Labels     *map[string]string         `json:"labels,omitempty"`
	Taints     *[]KubernetesNodePoolTaint `json:"taints,omitempty"`
}

CreateKubernetesNodePoolRequest is the API's create kubernetes node pool request object.

type CreateLoadBalancerRequest

type CreateLoadBalancerRequest struct {
	// 1 to 63 characters.
	Name string `json:"name"`
	// The zone to place the load balancer in.
	ZoneID *string `json:"zone_id,omitempty"`
	// `vpc_native` (a VPC zone: needs `public_ip_id` and `subnet_id`) or `appliance` (a standard zone: needs `zone_id`; a load balancer VM with its own public address, billed as that VM). One of: vpc_native, appliance.
	Kind *string `json:"kind,omitempty"`
	// An active public IP with `purpose` `load_balancer` (required for `vpc_native`).
	PublicIPID *string `json:"public_ip_id,omitempty"`
	// A subnet of the public IP's private network.
	SubnetID *string `json:"subnet_id,omitempty"`
	// `roundrobin` takes turns, `leastconn` picks the target with the fewest connections, `source` keeps a client on one target. One of: roundrobin, leastconn, source.
	Algorithm *string `json:"algorithm,omitempty"`
	// The TCP port clients connect to, 1 to 65535.
	PublicPort int `json:"public_port"`
	// The port on each target.
	PrivatePort *int `json:"private_port,omitempty"`
	// The listener protocol. Only `tcp` is offered: HTTP and HTTPS are balanced as `tcp`. One of: tcp.
	Protocol *string `json:"protocol,omitempty"`
	// Source addresses allowed to connect, as IPv4 CIDRs (at most 20).
	CIDRList *[]string `json:"cidr_list,omitempty"`
	// Instances to spread traffic across (at most 50).
	InstanceIDs *[]string `json:"instance_ids,omitempty"`
}

CreateLoadBalancerRequest is the API's create load balancer request object.

type CreateMigrationRequest added in v0.2.0

type CreateMigrationRequest struct {
	ScanID string `json:"scan_id"`
	Name   string `json:"name"`
	// A Pantech region code; the first region when left out.
	Region *string `json:"region,omitempty"`
}

CreateMigrationRequest is the API's create migration request object.

type CreateNetworkRequest

type CreateNetworkRequest struct {
	// 1 to 255 characters, unique among your VPC networks.
	Name string `json:"name"`
	// The VPC's private IPv4 range, e.g. `10.0.0.0/16`.
	CIDR string `json:"cidr"`
	// A region from `GET /public/v1/regions` that offers VPC networks.
	Region *string `json:"region,omitempty"`
}

CreateNetworkRequest is the API's create network request object.

type CreatePortForwardingRuleRequest

type CreatePortForwardingRuleRequest struct {
	// An instance in the public IP's VPC.
	InstanceID string `json:"instance_id"`
	// `tcp` or `udp`. One of: tcp, udp.
	Protocol string `json:"protocol"`
	// First public port, 1 to 65535.
	PublicPortStart int `json:"public_port_start"`
	// Last public port.
	PublicPortEnd *int `json:"public_port_end,omitempty"`
	// First port on the instance.
	PrivatePortStart *int `json:"private_port_start,omitempty"`
	// Last port on the instance; the private range must be as wide as the public one.
	PrivatePortEnd *int `json:"private_port_end,omitempty"`
}

CreatePortForwardingRuleRequest is the API's create port forwarding rule request object.

type CreatePublicIPRequest

type CreatePublicIPRequest struct {
	// The VPC network to allocate the address in.
	NetworkID string `json:"network_id"`
	// `static_nat` maps every port to one instance (`instance_id`). One of: static_nat, port_forwarding, load_balancer.
	Purpose *string `json:"purpose,omitempty"`
	// For `static_nat` only: an instance in `network_id` without a public IP.
	InstanceID *string `json:"instance_id,omitempty"`
}

CreatePublicIPRequest is the API's create public iprequest object.

type CreateSSHKeyRequest

type CreateSSHKeyRequest struct {
	// 1 to 255 characters, unique among your SSH keys.
	Name string `json:"name"`
	// One OpenSSH public key line, e.g. `ssh-ed25519 AAAA… deploy@ci`.
	PublicKey *string `json:"public_key,omitempty"`
}

CreateSSHKeyRequest is the API's create sshkey request object.

type CreateSecurityGroupRequest

type CreateSecurityGroupRequest struct {
	// 1 to 255 characters, unique among your live security groups.
	Name string `json:"name"`
	// The group's rules; at least one.
	Rules *[]SecurityGroupRule `json:"rules,omitempty"`
}

CreateSecurityGroupRequest is the API's create security group request object.

type CreateSnapshotRequest

type CreateSnapshotRequest struct {
	// 1 to 255 characters, unique among this resource's snapshots, e.g. `pre-upgrade`.
	Name string `json:"name"`
}

CreateSnapshotRequest is the API's create snapshot request object.

type CreateSubnetRequest

type CreateSubnetRequest struct {
	// 1 to 255 characters.
	Name string `json:"name"`
	// An IPv4 range inside the VPC's CIDR that does not overlap its other subnets, e.g. `10.0.1.0/24`.
	CIDR string `json:"cidr"`
}

CreateSubnetRequest is the API's create subnet request object.

type CreateVolumeRequest

type CreateVolumeRequest struct {
	// 1 to 255 characters.
	Name string `json:"name"`
	// The volume type, from `GET /public/v1/disk-offerings`.
	DiskOfferingSlug string `json:"disk_offering_slug"`
	// Size in GB.
	SizeGB *int `json:"size_gb,omitempty"`
	// A region from `GET /public/v1/regions`.
	Region *string `json:"region,omitempty"`
	// Attach the new volume at once to this running instance in the same zone.
	InstanceID *string `json:"instance_id,omitempty"`
	// With `instance_id`: an absolute path to mount the volume at, e.g. `/data`.
	MountPoint *string `json:"mount_point,omitempty"`
	// Optional.
	Encrypted *bool `json:"encrypted,omitempty"`
}

CreateVolumeRequest is the API's create volume request object.

type CreateWebhookRequest

type CreateWebhookRequest struct {
	// An `https` URL on the public internet, at most 2,048 characters, with no user name or password.
	URL string `json:"url"`
	// A note for yourself, at most 255 characters.
	Description *string `json:"description,omitempty"`
	// 1 to 100 entries: event types from `GET /webhook-event-types`, `<resource>.*`, or `*`.
	Events []string `json:"events"`
}

CreateWebhookRequest is the API's create webhook request object.

type CreditOutlook

type CreditOutlook struct {
	// One of: NGN, USD.
	Currency string `json:"currency"`
	// Credit you can spend now.
	AvailableMinor int64 `json:"available_minor"`
	// Credit purchases that haven't settled yet.
	PendingMinor int64 `json:"pending_minor"`
	// Initial payments for new instances that haven't been used yet.
	PrepaidMinor int64 `json:"prepaid_minor"`
	// An estimate of your next invoice, including VAT.
	EstimatedNextInvoiceMinor int64 `json:"estimated_next_invoice_minor"`
	// When the current billing period closes and the invoice is issued.
	NextInvoiceAt time.Time `json:"next_invoice_at"`
	// `covered` when credit and prepaid instance payments cover the estimate, `low` when they don't, `empty` when no credit is left. One of: covered, low, empty.
	Standing string `json:"standing"`
	// Whether a default payment method will be charged for anything credit doesn't cover.
	HasPaymentMethod bool `json:"has_payment_method"`
}

CreditOutlook is the API's credit outlook object. Credit against the estimated next invoice.

type CreditPurchase

type CreditPurchase struct {
	// e.g. `cpr_...`.
	ID string `json:"id"`
	// `pending` until paid; `settled` once the credit is in your balance. One of: pending, settled, failed, expired, refunded, charged_back.
	Status string `json:"status"`
	// The credit bought, in minor units of `currency`.
	AmountMinor int64 `json:"amount_minor"`
	// One of: NGN, USD.
	Currency string `json:"currency"`
	// `checkout` for every purchase made through the API. One of: checkout, saved_card, bank_transfer.
	Method string `json:"method"`
	// An identifier for the payment processor that takes the payment. Treat it
	// as an opaque label: values can be added.
	Provider          string     `json:"provider"`
	CheckoutURL       *string    `json:"checkout_url"`
	CheckoutExpiresAt *time.Time `json:"checkout_expires_at"`
	// Why the payment failed, when `status` is `failed`.
	FailureCode *string `json:"failure_code"`
	// When the credit was added; null until then.
	SettledAt *time.Time `json:"settled_at"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// The receipt, once the purchase has settled and the receipt is issued (usually within a minute); null until then.
	Receipt *CreditPurchaseReceipt `json:"receipt"`
}

CreditPurchase is the API's credit purchase object. One credit top-up.

type CreditPurchaseReceipt

type CreditPurchaseReceipt struct {
	// e.g. `rcp_...`.
	ID string `json:"id"`
	// e.g. `PTD-RCT-2026-000123`.
	Number string `json:"number"`
}

CreditPurchaseReceipt is the API's credit purchase receipt object. The receipt, once the purchase has settled and the receipt is issued (usually within a minute); null until then.

type Database

type Database struct {
	// The admin login to connect as: the one chosen at create, or `dbadmin`.
	AdminUsername string `json:"admin_username"`
	// Your security groups attached to the database, in the order attached (at most 5).
	SecurityGroupIDs []string `json:"security_group_ids"`
	// The allow-list as the database applies it: its own `access_rules` plus the ranges its security groups add, each range once under its first source.
	EffectiveAccessRules []DatabaseEffectiveAccessRule `json:"effective_access_rules"`
	// Rules of the attached security groups that add nothing to the database, and why.
	IgnoredSecurityGroupRules []DatabaseIgnoredSecurityGroupRule `json:"ignored_security_group_rules"`
	// The database's id, `db_` followed by 26 characters.
	ID string `json:"id"`
	// Its name, unique among your databases.
	Name string `json:"name"`
	// `postgresql`, `mysql` or `mariadb`. One of: postgresql, mysql, mariadb.
	Engine string `json:"engine"`
	// The engine's version line, e.g. `18` or `8.4`.
	Version string `json:"version"`
	// The TCP port to connect to: 5432 for PostgreSQL, 3306 for MySQL and MariaDB.
	Port int `json:"port"`
	// The plan setting its vCPU and memory.
	PlanID string `json:"plan_id"`
	// The data disk's size in GB, as in place and billed.
	DataVolumeSizeGB int `json:"data_volume_size_gb"`
	// The size a storage resize in flight is growing the data disk to; null when none.
	PendingDataVolumeSizeGB *int `json:"pending_data_volume_size_gb"`
	// The zone it runs in, e.g. `af-abj-2`.
	ZoneID string `json:"zone_id"`
	// Its VPC subnet in a VPC zone; null in a standard zone.
	SubnetID *string `json:"subnet_id"`
	// The name to connect to, e.g. `db-7k2q9x4m1a.af-abj-2.db.pantechdynamics.com`.
	Hostname *string `json:"hostname"`
	// The database's private address, never public.
	PrivateIP *string `json:"private_ip"`
	// What you asked for: `running`, `stopped` or `deleted`. One of: running, stopped, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed. One of: pending, provisioning, running, stopping, stopped, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// Increases by one with every change you request.
	Generation int `json:"generation"`
	// The `generation` last applied: equal to `generation` once the last change (access rules, security groups, password) is in effect.
	ObservedGeneration int `json:"observed_generation"`
	// The database's own allow-list, as set at create or with *Replace access rules*.
	AccessRules []DatabaseAccessRule `json:"access_rules"`
	// A stable code for why the last change failed; null when nothing failed.
	FailureCode *string `json:"failure_code"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Database is the API's database object.

type DatabaseAccessRule

type DatabaseAccessRule struct {
	// An allowed IPv4 range, in canonical form.
	CIDR string `json:"cidr"`
	// Always `tcp`. One of: tcp.
	Protocol string `json:"protocol"`
	// The engine's port: 5432 or 3306.
	Port int `json:"port"`
}

DatabaseAccessRule is the API's database access rule object.

type DatabaseAccessRuleRequest

type DatabaseAccessRuleRequest struct {
	// One IPv4 CIDR to allow, with a prefix of `/8` to `/32`; never `0.0.0.0/0`.
	CIDR string `json:"cidr"`
}

DatabaseAccessRuleRequest is the API's database access rule request object.

type DatabaseEffectiveAccessRule

type DatabaseEffectiveAccessRule struct {
	// An allowed IPv4 range, in canonical form.
	CIDR string `json:"cidr"`
	// Always `tcp`. One of: tcp.
	Protocol string `json:"protocol"`
	// The engine's port: 5432 or 3306.
	Port int `json:"port"`
	// Where the range comes from: `access_rule`, or `security_group:` followed by the group's id (e.g. `security_group:sg_…`).
	Source string `json:"source"`
}

DatabaseEffectiveAccessRule is the API's database effective access rule object.

type DatabaseEngine

type DatabaseEngine struct {
	// The value `engine` takes in *Create a database*: `postgresql`, `mysql` or `mariadb`.
	Engine string `json:"engine"`
	// The engine's name for display.
	DisplayName string `json:"display_name"`
	// The port its databases listen on: 5432 or 3306.
	Port int `json:"port"`
	// Version lines offered for new databases, long-term-support lines only.
	Versions []DatabaseEngineVersion `json:"versions"`
	// The data disk sizes a new database of this engine may have, per zone: use them for `storage_gb` in *Create a database* and *Grow a database's storage*.
	Storage []DatabaseEngineStorage `json:"storage"`
}

DatabaseEngine is the API's database engine object.

type DatabaseEngineStorage

type DatabaseEngineStorage struct {
	// The zone, e.g. `af-abj-2`.
	ZoneID string `json:"zone_id"`
	// The zone's minimum data disk in GB.
	MinGB int `json:"min_gb"`
	// True when `min_gb` is 0, so the chosen plan's `disk_gb` is the minimum.
	MinIsPlanDisk bool `json:"min_is_plan_disk"`
	// The largest data disk in GB.
	MaxGB int `json:"max_gb"`
	// Above the base size (the minimum), `storage_gb` must be a multiple of this.
	StepGB int `json:"step_gb"`
	// Price of one GB of data disk for a 730-hour month, in minor units of `currency`; null when it could not be priced.
	PricePerGBMonthMinor *int64 `json:"price_per_gb_month_minor"`
	// `NGN` or `USD`; null when not priced.
	Currency *string `json:"currency"`
}

DatabaseEngineStorage is the API's database engine storage object.

type DatabaseEngineVersion

type DatabaseEngineVersion struct {
	Version string   `json:"version"`
	EolDate *string  `json:"eol_date"`
	Zones   []string `json:"zones"`
}

DatabaseEngineVersion is the API's database engine version object.

type DatabaseIgnoredSecurityGroupRule

type DatabaseIgnoredSecurityGroupRule struct {
	// The attached group the rule belongs to.
	SecurityGroupID string `json:"security_group_id"`
	// The rule's direction. One of: ingress, egress.
	Direction string `json:"direction"`
	// The rule's protocol. One of: tcp, udp, icmp, all.
	Protocol string `json:"protocol"`
	// `80`, `3000-4000`, or null for all ports.
	PortRange *string `json:"port_range"`
	// The rule's CIDR.
	CIDR string `json:"cidr"`
	// Why it adds nothing: `egress_rule`, `protocol_not_tcp` (udp or icmp), `port_not_covered` (its ports exclude the engine's), `cidr_too_wide` (wider than /8, including `0.0.0.0/0`) or `cidr_not_ipv4`. One of: egress_rule, protocol_not_tcp, port_not_covered, cidr_too_wide, cidr_not_ipv4.
	Reason string `json:"reason"`
}

DatabaseIgnoredSecurityGroupRule is the API's database ignored security group rule object.

type DatabaseOrder

type DatabaseOrder struct {
	// The admin login the database is created with.
	AdminUsername string `json:"admin_username"`
	// The order's id, `ord_…`.
	ID string `json:"id"`
	// The same value as `id`.
	OrderID string `json:"order_id"`
	// The card payment attempt; null when the order was paid from credit or not charged yet.
	AttemptID *string `json:"attempt_id"`
	// The id the database has, or will have once provisioned.
	DatabaseID string `json:"database_id"`
	// `awaiting_payment`, then `paid`, `provisioning` and `provisioned` (final: the database exists). One of: awaiting_payment, paid, provisioning, provisioned, payment_failed, failed.
	Status string `json:"status"`
	// The database's create operation, set once provisioning starts; null before.
	OperationID *string `json:"operation_id"`
	// Why the order failed, when it did: e.g. `insufficient_credit`, `card_declined`, `payment_expired` (not paid within an hour), `database_name_taken`, `provisioning_failed`.
	FailureCode *string `json:"failure_code"`
	// The initial payment in minor units of `currency` (kobo or cents).
	AmountMinor int64 `json:"amount_minor"`
	// `NGN` or `USD`: your organization's billing currency. One of: NGN, USD.
	Currency string `json:"currency"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

DatabaseOrder is the API's database order object. How a new database is paid for and provisioned.

type DatabaseOrderAccepted

type DatabaseOrderAccepted struct {
	// The admin login the database is created with: the one you sent, or `dbadmin`.
	AdminUsername string `json:"admin_username"`
	// Follow it at `GET /public/v1/database-orders/{order_id}` (also the `Location` header).
	OrderID string `json:"order_id"`
	// The id the database will have.
	DatabaseID string `json:"database_id"`
	// Same as `database_id`.
	ResourceID string `json:"resource_id"`
	// The order's status now, usually `awaiting_payment`. One of: awaiting_payment, paid, provisioning, provisioned, payment_failed, failed.
	Status string `json:"status"`
	// Set once provisioning starts.
	OperationID *string `json:"operation_id"`
	// Null for a new order; on a retry, the order's `failure_code` if it has failed since.
	FailureCode *string `json:"failure_code"`
	// The initial payment, in minor units (kobo or cents): the price of an instance of the same plan with no public address.
	AmountMinor int64 `json:"amount_minor"`
	// `NGN` or `USD`: your organization's billing currency. One of: NGN, USD.
	Currency string `json:"currency"`
	// True only when the password was generated for you and this request created the order.
	PasswordReturned bool `json:"password_returned"`
	// The generated admin password (32 letters and digits), in this response only.
	Password *string `json:"password"`
}

DatabaseOrderAccepted is the API's database order accepted object. Returned with `202 Accepted` by `POST /public/v1/databases`, with `Cache-Control: no-store`: the order that pays for and then provisions the database.

type DatabasePasswordAccepted

type DatabasePasswordAccepted struct {
	// The operation carrying out the change.
	OperationID string `json:"operation_id"`
	// The database.
	ResourceID string `json:"resource_id"`
	// The operation's status when the request was accepted, usually `submitting`.
	Status string `json:"status"`
	// False on a retry with the same Idempotency-Key; `password` is then null.
	PasswordReturned bool `json:"password_returned"`
	// The generated admin password (32 letters and digits), in this response only.
	Password *string `json:"password"`
}

DatabasePasswordAccepted is the API's database password accepted object. Returned with `202 Accepted` by `reset-password`, with `Cache-Control: no-store`.

type DatabasesService

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

DatabasesService manages managed databases and their orders.

func (*DatabasesService) All

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*DatabasesService) AllOrders

func (s *DatabasesService) AllOrders(ctx context.Context, params *PageParams, opts ...RequestOption) iter.Seq2[DatabaseOrder, error]

AllOrders iterates over every item of ListOrders, fetching pages as needed. It stops at the first error, which it yields.

func (*DatabasesService) AllSnapshots

func (s *DatabasesService) AllSnapshots(ctx context.Context, databaseID string, params *ListParams, opts ...RequestOption) iter.Seq2[Snapshot, error]

AllSnapshots iterates over every item of ListSnapshots, fetching pages as needed. It stops at the first error, which it yields.

func (*DatabasesService) ChangePassword

func (s *DatabasesService) ChangePassword(ctx context.Context, databaseID string, req ChangeDatabasePasswordRequest, opts ...RequestOption) (*Accepted, error)

ChangePassword sets the password: PUT /databases/{database_id}/password. Scope: write.

func (*DatabasesService) Create

Create creates a database: POST /databases. Scope: write.

func (*DatabasesService) CreateSnapshot

func (s *DatabasesService) CreateSnapshot(ctx context.Context, databaseID string, req CreateSnapshotRequest, opts ...RequestOption) (*Accepted, error)

CreateSnapshot snapshots a database: POST /databases/{database_id}/snapshots. Scope: write.

func (*DatabasesService) Delete

func (s *DatabasesService) Delete(ctx context.Context, databaseID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a database: DELETE /databases/{database_id}. Scope: write.

func (*DatabasesService) DeleteSnapshot

func (s *DatabasesService) DeleteSnapshot(ctx context.Context, databaseID string, snapshotID string, opts ...RequestOption) (*Accepted, error)

DeleteSnapshot deletes a database's snapshot: DELETE /databases/{database_id}/snapshots/{snapshot_id}. Scope: write.

func (*DatabasesService) Get

func (s *DatabasesService) Get(ctx context.Context, databaseID string, opts ...RequestOption) (*Database, error)

Get gets a database: GET /databases/{database_id}. Scope: read.

func (*DatabasesService) GetOrder

func (s *DatabasesService) GetOrder(ctx context.Context, orderID string, opts ...RequestOption) (*DatabaseOrder, error)

GetOrder gets a database order: GET /database-orders/{order_id}. Scope: read.

func (*DatabasesService) GetSnapshot

func (s *DatabasesService) GetSnapshot(ctx context.Context, databaseID string, snapshotID string, opts ...RequestOption) (*Snapshot, error)

GetSnapshot gets a database's snapshot: GET /databases/{database_id}/snapshots/{snapshot_id}. Scope: read.

func (*DatabasesService) List

func (s *DatabasesService) List(ctx context.Context, params *ListParams, opts ...RequestOption) (*Page[Database], error)

List lists databases: GET /databases. Scope: read.

func (*DatabasesService) ListOrders

func (s *DatabasesService) ListOrders(ctx context.Context, params *PageParams, opts ...RequestOption) (*Page[DatabaseOrder], error)

ListOrders lists database orders: GET /database-orders. Scope: read.

func (*DatabasesService) ListSnapshots

func (s *DatabasesService) ListSnapshots(ctx context.Context, databaseID string, params *ListParams, opts ...RequestOption) (*Page[Snapshot], error)

ListSnapshots lists a database's snapshots: GET /databases/{database_id}/snapshots. Scope: read.

func (*DatabasesService) ReplaceAccessRules

func (s *DatabasesService) ReplaceAccessRules(ctx context.Context, databaseID string, req ReplaceDatabaseAccessRulesRequest, opts ...RequestOption) (*Accepted, error)

ReplaceAccessRules replaces access rules: PUT /databases/{database_id}/access-rules. Scope: write.

func (*DatabasesService) ResetPassword

func (s *DatabasesService) ResetPassword(ctx context.Context, databaseID string, opts ...RequestOption) (*DatabasePasswordAccepted, error)

ResetPassword resets the password: POST /databases/{database_id}/reset-password. Scope: write.

func (*DatabasesService) ResizeStorage

func (s *DatabasesService) ResizeStorage(ctx context.Context, databaseID string, req ResizeDatabaseStorageRequest, opts ...RequestOption) (*Accepted, error)

ResizeStorage grows a database's storage: POST /databases/{database_id}/resize-storage. Scope: write.

func (*DatabasesService) SetSecurityGroups

func (s *DatabasesService) SetSecurityGroups(ctx context.Context, databaseID string, req SetDatabaseSecurityGroupsRequest, opts ...RequestOption) (*Accepted, error)

SetSecurityGroups attaches security groups: PUT /databases/{database_id}/security-groups. Scope: write.

func (*DatabasesService) Start

func (s *DatabasesService) Start(ctx context.Context, databaseID string, opts ...RequestOption) (*Accepted, error)

Start starts a database: POST /databases/{database_id}/start. Scope: write.

func (*DatabasesService) Stop

func (s *DatabasesService) Stop(ctx context.Context, databaseID string, opts ...RequestOption) (*Accepted, error)

Stop stops a database: POST /databases/{database_id}/stop. Scope: write.

func (*DatabasesService) WaitForOrder

func (s *DatabasesService) WaitForOrder(ctx context.Context, orderID string, opts *WaitOptions) (*DatabaseOrder, error)

WaitForOrder polls GET /database-orders/{id} until the order is provisioned, and returns it. The database is then being created: wait for its OperationID with Operations.Wait to see it running. A failed or unpaid order returns an *OrderError.

type DiskOffering

type DiskOffering struct {
	// Use this in `disk_offering_slug`.
	Slug string `json:"slug"`
	// Its name for display.
	Name string `json:"name"`
	// Fixed size; null for a custom-size offering.
	SizeGB *int `json:"size_gb"`
	// When true, send `size_gb` on create; the price is then per GB.
	CustomSize bool `json:"custom_size"`
	// The storage class, e.g. `shared` or `local`; null when not stated.
	StorageType *string `json:"storage_type"`
	// `NGN` or `USD`: your organization's currency.
	Currency string `json:"currency"`
	// Price per hour in minor units of `currency`: for the whole volume, or per GB for a custom-size offering.
	HourlyPriceMinor int64 `json:"hourly_price_minor"`
}

DiskOffering is the API's disk offering object.

type DiskOfferingQuote

type DiskOfferingQuote struct {
	DiskOfferingSlug  string `json:"disk_offering_slug"`
	SizeGB            int    `json:"size_gb"`
	Currency          string `json:"currency"`
	HourlyPriceMinor  int64  `json:"hourly_price_minor"`
	MonthlyPriceMinor int64  `json:"monthly_price_minor"`
}

DiskOfferingQuote is the API's disk offering quote object.

type DiskOfferingQuoteParams

type DiskOfferingQuoteParams struct {
	SizeGB int
}

DiskOfferingQuoteParams are the query parameters of disk offering quote. Zero values are left out.

type Error

type Error struct {
	// Status is the HTTP status code.
	Status int
	// Code is the stable problem code, such as RESOURCE_NOT_FOUND or
	// VALIDATION_FAILED. It is empty when the answer was not a problem
	// document (for example a proxy's error page).
	Code string
	// Title is the short, fixed summary of the problem type.
	Title string
	// Detail says what went wrong and what to do, in plain language. It is
	// safe to show to users.
	Detail string
	// RequestID identifies the request; quote it to support.
	RequestID string
	// Type is the problem type URI.
	Type string
	// Errors names each invalid field of a 422 VALIDATION_FAILED.
	Errors []FieldError
	// RetryAfter is the wait the API asked for (on 429 and some 503s), or 0.
	RetryAfter time.Duration
}

Error is an error answer from the API: an application/problem+json document with a stable Code to branch on (never branch on Detail, which is prose).

func AsError

func AsError(err error) (*Error, bool)

AsError returns the *Error in err's chain, if there is one.

func (*Error) Error

func (e *Error) Error() string

Error reads like "Instance not found (RESOURCE_NOT_FOUND, status 404, request req_…)", followed by any field errors.

func (*Error) HasField

func (e *Error) HasField(field, code string) bool

HasField reports whether a validation failure names field with code.

type ExposeKubernetesServiceRequest

type ExposeKubernetesServiceRequest struct {
	ServiceName string `json:"service_name"`
	// Default `default`.
	Namespace  *string `json:"namespace,omitempty"`
	PublicPort int     `json:"public_port"`
	// Leave out to keep the Service's own NodePort, or let the cluster choose one.
	NodePort *int `json:"node_port,omitempty"`
	// One of: TCP, UDP.
	Protocol *string `json:"protocol,omitempty"`
}

ExposeKubernetesServiceRequest is the API's expose kubernetes service request object.

type Failure

type Failure struct {
	// A stable failure code to branch on, e.g. `INSTANCE_BUSY`.
	Code string `json:"code"`
	// A readable sentence saying what went wrong and what to do; safe to show to your users.
	Reason string `json:"reason"`
}

Failure is the API's failure object. Why it failed, when it did; otherwise null.

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

FieldError is one invalid field of a validation failure.

type FirewallRule

type FirewallRule struct {
	// e.g. `aclr_...`.
	ID string `json:"id"`
	// The subnet the rule applies to, as a whole.
	SubnetID string `json:"subnet_id"`
	// Evaluation order, 100-9999; lowest first.
	Number int `json:"number"`
	// `ingress` (into the subnet) or `egress` (out of it). One of: ingress, egress.
	Direction string `json:"direction"`
	// `tcp`, `udp`, `icmp` or `all`. One of: tcp, udp, icmp, all.
	Protocol string `json:"protocol"`
	// First port, for `tcp`/`udp`; null otherwise.
	PortStart *int `json:"port_start"`
	// Last port, for `tcp`/`udp`; null otherwise.
	PortEnd *int `json:"port_end"`
	// ICMP type, for `icmp`; null for every type.
	ICMPType *int `json:"icmp_type"`
	// ICMP code, for `icmp`; null for every code.
	ICMPCode *int `json:"icmp_code"`
	// Source (ingress) or destination (egress), e.g. `0.0.0.0/0`.
	CIDR string `json:"cidr"`
	// `allow` or `deny`. One of: allow, deny.
	Action string `json:"action"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

FirewallRule is the API's firewall rule object.

type FirewallRuleFields

type FirewallRuleFields struct {
	// Evaluation order, 100-9999; lowest first.
	Number int `json:"number"`
	// `ingress` (into the subnet) or `egress` (out of it). One of: ingress, egress.
	Direction string `json:"direction"`
	// `tcp`, `udp`, `icmp` or `all`. One of: tcp, udp, icmp, all.
	Protocol string `json:"protocol"`
	// First port, for `tcp`/`udp`; null otherwise.
	PortStart *int `json:"port_start"`
	// Last port, for `tcp`/`udp`; null otherwise.
	PortEnd *int `json:"port_end"`
	// ICMP type, for `icmp`; null for every type.
	ICMPType *int `json:"icmp_type"`
	// ICMP code, for `icmp`; null for every code.
	ICMPCode *int `json:"icmp_code"`
	// Source (ingress) or destination (egress), e.g. `0.0.0.0/0`.
	CIDR string `json:"cidr"`
	// `allow` or `deny`. One of: allow, deny.
	Action string `json:"action"`
}

FirewallRuleFields is the API's firewall rule fields object.

type FirewallRuleList

type FirewallRuleList struct {
	Data []FirewallRule `json:"data"`
	// Always null.
	NextCursor *string `json:"next_cursor"`
	// The platform's own rules around yours.
	SystemRules []FirewallRuleFields `json:"system_rules"`
}

FirewallRuleList is the API's firewall rule list object.

type FirewallRulesService

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

FirewallRulesService manages subnet firewall rules.

func (*FirewallRulesService) Create

Create adds a firewall rule: POST /subnets/{subnet_id}/firewall-rules. Scope: write.

func (*FirewallRulesService) Delete

func (s *FirewallRulesService) Delete(ctx context.Context, ruleID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a firewall rule: DELETE /firewall-rules/{rule_id}. Scope: write.

func (*FirewallRulesService) Get

func (s *FirewallRulesService) Get(ctx context.Context, subnetID string, ruleID string, opts ...RequestOption) (*FirewallRule, error)

Get gets a firewall rule: GET /subnets/{subnet_id}/firewall-rules/{rule_id}. Scope: read.

func (*FirewallRulesService) List

func (s *FirewallRulesService) List(ctx context.Context, subnetID string, opts ...RequestOption) (*FirewallRuleList, error)

List lists a subnet's firewall rules: GET /subnets/{subnet_id}/firewall-rules. Scope: read.

type GeneratedSSHKey

type GeneratedSSHKey struct {
	SSHKey
	// The private key, in this response only.
	PrivateKey string `json:"private_key"`
}

GeneratedSSHKey is the API's generated sshkey object.

type GetCloudScanParams added in v0.2.0

type GetCloudScanParams struct {
	// `inventory` returns everything the scan found. One of: inventory.
	Include string
}

GetCloudScanParams are the query parameters of get cloud scan. Zero values are left out.

type Image

type Image struct {
	// The image's id.
	ID string `json:"id"`
	// Use this in `image_slug`.
	Slug string `json:"slug"`
	// Its name for display, e.g. `Ubuntu`.
	Name string `json:"name"`
	// Its version, e.g. `24.04`.
	Version string `json:"version"`
	// Zones this image can be deployed in.
	Zones []string `json:"zones"`
	// True for an encrypted image: the instance's root disk is encrypted on our storage, with its own key, and the instance needs our key servers to start.
	Encrypted bool `json:"encrypted"`
	// On an encrypted image, the slug of the plain image it is the encrypted version of (e.g. `ubuntu-24-04` for `ubuntu-24-04-encrypted`); null otherwise.
	EncryptedVariantOf *string `json:"encrypted_variant_of"`
}

Image is the API's image object.

type Instance

type Instance struct {
	// e.g. `vm_06gf...`.
	ID string `json:"id"`
	// Its name, unique among your instances.
	Name string `json:"name"`
	// The plan's id.
	PlanID string `json:"plan_id"`
	// The plan's slug, as `plan_slug` takes it (e.g. `starter`); null if the plan has since been retired.
	PlanSlug *string `json:"plan_slug"`
	// The image's id.
	ImageID string `json:"image_id"`
	// The image's slug, as `image_slug` takes it (e.g. `ubuntu-24-04`); null if the image has since been retired.
	ImageSlug *string `json:"image_slug"`
	// True when the instance runs an encrypted image: its root disk is encrypted on our storage, with its own key.
	Encrypted bool `json:"encrypted"`
	// e.g. `af-abj`.
	Region *string `json:"region"`
	// e.g. `af-abj-1`.
	Zone *string `json:"zone"`
	// The VPC, for an instance in one.
	NetworkID *string `json:"network_id"`
	// Its VPC subnet; null for a standard instance.
	SubnetID *string `json:"subnet_id"`
	// The security group, for a standard instance.
	SecurityGroupID *string `json:"security_group_id"`
	// The instance's own public address (standard instances).
	PublicIPv4 *string `json:"public_ipv4"`
	// Its private address: in its VPC subnet, or on the zone's guest network.
	PrivateIPv4 *string `json:"private_ipv4"`
	// Its interface on the zone's private database network: `none`, `attaching`, `attached` or `detaching`. One of: none, attaching, attached, detaching.
	PrivateNetworkState string `json:"private_network_state"`
	// Platform VM deletion is refused while true.
	DeletionProtection bool `json:"deletion_protection"`
	// That interface's address once attached (kept while it is being removed); null otherwise.
	PrivateNetworkIP *string `json:"private_network_ip"`
	// What you asked for: `running`, `stopped` or `deleted`. One of: running, stopped, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed. One of: pending, provisioning, running, stopping, stopped, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// The capacity this instance was created with.
	Spec *InstanceSpec `json:"spec"`
	// Your own labels, as sent at create.
	Tags map[string]string `json:"tags"`
	// Why the last change failed, when it did; otherwise null.
	Failure *Failure `json:"failure"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Instance is the API's instance object.

type InstanceConsole

type InstanceConsole struct {
	URL string `json:"url"`
}

InstanceConsole is the API's instance console object.

type InstanceMetricsParams

type InstanceMetricsParams struct {
	// One of: 1h, 24h, 7d, 30d.
	Interval string
}

InstanceMetricsParams are the query parameters of instance metrics. Zero values are left out.

type InstanceOrder

type InstanceOrder struct {
	// e.g. `ord_...`.
	ID string `json:"id"`
	// The id the instance has, or will have once provisioned.
	InstanceID string `json:"instance_id"`
	// `awaiting_payment`, then `paid`, `provisioning` and `provisioned` (final: the instance exists). One of: awaiting_payment, paid, provisioning, provisioned, payment_failed, failed.
	Status string `json:"status"`
	// The instance's create operation, set once provisioning starts.
	OperationID *string `json:"operation_id"`
	// Why the order failed, e.g. `insufficient_credit`, `card_declined`, `payment_expired`; null otherwise.
	FailureCode *string `json:"failure_code"`
	// The initial payment in minor units of `currency`.
	AmountMinor int64 `json:"amount_minor"`
	// `NGN` or `USD`. One of: NGN, USD.
	Currency string `json:"currency"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

InstanceOrder is the API's instance order object.

type InstanceSpec

type InstanceSpec struct {
	VCPU     int `json:"vcpu"`
	MemoryMB int `json:"memory_mb"`
	DiskGB   int `json:"disk_gb"`
}

InstanceSpec is the API's instance spec object. The capacity this instance was created with.

type InstancesService

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

InstancesService manages instances (VPS) and their orders.

func (*InstancesService) All

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*InstancesService) AllOrders

func (s *InstancesService) AllOrders(ctx context.Context, params *PageParams, opts ...RequestOption) iter.Seq2[InstanceOrder, error]

AllOrders iterates over every item of ListOrders, fetching pages as needed. It stops at the first error, which it yields.

func (*InstancesService) AllSnapshots

func (s *InstancesService) AllSnapshots(ctx context.Context, instanceID string, params *ListParams, opts ...RequestOption) iter.Seq2[Snapshot, error]

AllSnapshots iterates over every item of ListSnapshots, fetching pages as needed. It stops at the first error, which it yields.

func (*InstancesService) AllVolumes

func (s *InstancesService) AllVolumes(ctx context.Context, instanceID string, params *ListParams, opts ...RequestOption) iter.Seq2[Volume, error]

AllVolumes iterates over every item of ListVolumes, fetching pages as needed. It stops at the first error, which it yields.

func (*InstancesService) AttachPrivateNetwork

func (s *InstancesService) AttachPrivateNetwork(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

AttachPrivateNetwork adds a private database network interface to an instance: POST /instances/{instance_id}/private-network. Scope: write.

func (*InstancesService) ChangeSSHKey

func (s *InstancesService) ChangeSSHKey(ctx context.Context, instanceID string, req ChangeSSHKeyRequest, opts ...RequestOption) (*Accepted, error)

ChangeSSHKey changes an instance's SSH key: POST /instances/{instance_id}/change-ssh-key. Scope: write.

func (*InstancesService) ChangeSecurityGroup

func (s *InstancesService) ChangeSecurityGroup(ctx context.Context, instanceID string, req ChangeSecurityGroupRequest, opts ...RequestOption) (*Accepted, error)

ChangeSecurityGroup changes an instance's security group: PUT /instances/{instance_id}/security-group. Scope: write.

func (*InstancesService) Create

Create creates an instance: POST /instances. Scope: write.

func (*InstancesService) CreateSnapshot

func (s *InstancesService) CreateSnapshot(ctx context.Context, instanceID string, req CreateSnapshotRequest, opts ...RequestOption) (*Accepted, error)

CreateSnapshot snapshots an instance: POST /instances/{instance_id}/snapshots. Scope: write.

func (*InstancesService) Delete

func (s *InstancesService) Delete(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

Delete deletes an instance: DELETE /instances/{instance_id}. Scope: write.

func (*InstancesService) DetachPrivateNetwork

func (s *InstancesService) DetachPrivateNetwork(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

DetachPrivateNetwork removes an instance's private database network interface: DELETE /instances/{instance_id}/private-network. Scope: write.

func (*InstancesService) Get

func (s *InstancesService) Get(ctx context.Context, instanceID string, opts ...RequestOption) (*Instance, error)

Get gets an instance: GET /instances/{instance_id}. Scope: read.

func (*InstancesService) GetMetrics

func (s *InstancesService) GetMetrics(ctx context.Context, instanceID string, params *InstanceMetricsParams, opts ...RequestOption) (*MetricsSeries, error)

GetMetrics gets instance metrics: GET /instances/{instance_id}/metrics. Scope: read.

func (*InstancesService) GetOrder

func (s *InstancesService) GetOrder(ctx context.Context, orderID string, opts ...RequestOption) (*InstanceOrder, error)

GetOrder gets an instance order: GET /instance-orders/{order_id}. Scope: read.

func (*InstancesService) GetSSHAccess

func (s *InstancesService) GetSSHAccess(ctx context.Context, instanceID string, grantID string, opts ...RequestOption) (*SSHAccessGrant, error)

GetSSHAccess gets an SSH access grant: GET /instances/{instance_id}/ssh-access/{grant_id}. Scope: read.

func (*InstancesService) GetSnapshotSchedule

func (s *InstancesService) GetSnapshotSchedule(ctx context.Context, instanceID string, opts ...RequestOption) (*SnapshotSchedule, error)

GetSnapshotSchedule gets an instance's snapshot schedule: GET /instances/{instance_id}/snapshot-schedule. Scope: read.

func (*InstancesService) GetUsage

func (s *InstancesService) GetUsage(ctx context.Context, instanceID string, opts ...RequestOption) (*UsageSummary, error)

GetUsage gets an instance's usage: GET /instances/{instance_id}/usage. Scope: read.

func (*InstancesService) IssueVolumeKeyCredential

func (s *InstancesService) IssueVolumeKeyCredential(ctx context.Context, instanceID string, opts ...RequestOption) (*VolumeKeyCredential, error)

IssueVolumeKeyCredential issues a volume key credential: POST /instances/{instance_id}/volume-key-credential. Scope: write.

func (*InstancesService) List

func (s *InstancesService) List(ctx context.Context, params *ListParams, opts ...RequestOption) (*Page[Instance], error)

List lists instances: GET /instances. Scope: read.

func (*InstancesService) ListOrders

func (s *InstancesService) ListOrders(ctx context.Context, params *PageParams, opts ...RequestOption) (*Page[InstanceOrder], error)

ListOrders lists instance orders: GET /instance-orders. Scope: read.

func (*InstancesService) ListSnapshots

func (s *InstancesService) ListSnapshots(ctx context.Context, instanceID string, params *ListParams, opts ...RequestOption) (*Page[Snapshot], error)

ListSnapshots lists an instance's snapshots: GET /instances/{instance_id}/snapshots. Scope: read.

func (*InstancesService) ListVolumes

func (s *InstancesService) ListVolumes(ctx context.Context, instanceID string, params *ListParams, opts ...RequestOption) (*Page[Volume], error)

ListVolumes lists an instance's volumes: GET /instances/{instance_id}/volumes. Scope: read.

func (*InstancesService) OpenConsole

func (s *InstancesService) OpenConsole(ctx context.Context, instanceID string, opts ...RequestOption) (*InstanceConsole, error)

OpenConsole opens the browser console: POST /instances/{instance_id}/console. Scope: write.

func (*InstancesService) OpenSSHAccess

func (s *InstancesService) OpenSSHAccess(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

OpenSSHAccess grants temporary SSH access: POST /instances/{instance_id}/ssh-access. Scope: write.

func (*InstancesService) PutSnapshotSchedule

func (s *InstancesService) PutSnapshotSchedule(ctx context.Context, instanceID string, req PutSnapshotScheduleRequest, opts ...RequestOption) (*SnapshotSchedule, error)

PutSnapshotSchedule sets an instance's snapshot schedule: PUT /instances/{instance_id}/snapshot-schedule. Scope: write.

func (*InstancesService) Reboot

func (s *InstancesService) Reboot(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

Reboot reboots an instance: POST /instances/{instance_id}/reboot. Scope: write.

func (*InstancesService) Rebuild

func (s *InstancesService) Rebuild(ctx context.Context, instanceID string, req RebuildRequest, opts ...RequestOption) (*Accepted, error)

Rebuild rebuilds an instance: POST /instances/{instance_id}/rebuild. Scope: write.

func (*InstancesService) Rename

func (s *InstancesService) Rename(ctx context.Context, instanceID string, req RenameRequest, opts ...RequestOption) (*Accepted, error)

Rename renames an instance: POST /instances/{instance_id}/rename. Scope: write.

func (*InstancesService) Resize

func (s *InstancesService) Resize(ctx context.Context, instanceID string, req ResizeRequest, opts ...RequestOption) (*Accepted, error)

Resize resizes an instance: POST /instances/{instance_id}/resize. Scope: write.

func (*InstancesService) Restore

func (s *InstancesService) Restore(ctx context.Context, instanceID string, req RestoreRequest, opts ...RequestOption) (*Accepted, error)

Restore restores an instance from a snapshot: POST /instances/{instance_id}/restore. Scope: write.

func (*InstancesService) RevokeSSHAccess

func (s *InstancesService) RevokeSSHAccess(ctx context.Context, instanceID string, grantID string, opts ...RequestOption) (*Accepted, error)

RevokeSSHAccess revokes SSH access: DELETE /instances/{instance_id}/ssh-access/{grant_id}. Scope: write.

func (*InstancesService) Start

func (s *InstancesService) Start(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

Start starts an instance: POST /instances/{instance_id}/start. Scope: write.

func (*InstancesService) Stop

func (s *InstancesService) Stop(ctx context.Context, instanceID string, opts ...RequestOption) (*Accepted, error)

Stop stops an instance: POST /instances/{instance_id}/stop. Scope: write.

func (*InstancesService) WaitForOrder

func (s *InstancesService) WaitForOrder(ctx context.Context, orderID string, opts *WaitOptions) (*InstanceOrder, error)

WaitForOrder polls GET /instance-orders/{id} until the order is provisioned, and returns it: the instance then exists (read it with Get, and wait for its OperationID, if any, to see it running). A failed or unpaid order returns an *OrderError.

type Kubeconfig

type Kubeconfig struct {
	// A kubeconfig file (YAML).
	Kubeconfig string `json:"kubeconfig"`
}

Kubeconfig is the API's kubeconfig object.

type KubernetesAppliedResource

type KubernetesAppliedResource struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
	// Empty for a cluster-wide object.
	Namespace string `json:"namespace"`
	// One of: created, configured, unchanged.
	Status string `json:"status"`
}

KubernetesAppliedResource is the API's kubernetes applied resource object.

type KubernetesAutoscaling

type KubernetesAutoscaling struct {
	// The cluster autoscaler adds and removes workers within the range as pods need them.
	Enabled bool `json:"enabled"`
	// 1 to 10 when enabled; 0 when not.
	MinWorkers int `json:"min_workers"`
	// min_workers to 10 when enabled; 0 when not.
	MaxWorkers int `json:"max_workers"`
}

KubernetesAutoscaling is the API's kubernetes autoscaling object. The platform's autoscaler: about once a minute it adds a worker when a pod that a worker could run is waiting for room, and removes the newest worker once it has run nothing but DaemonSet pods for 10 minutes, one step at a time and always within min_workers and max_workers.

type KubernetesCluster

type KubernetesCluster struct {
	// e.g. `k8s_...`.
	ID                  string `json:"id"`
	Name                string `json:"name"`
	ZoneID              string `json:"zone_id"`
	KubernetesVersionID string `json:"kubernetes_version_id"`
	KubernetesVersion   string `json:"kubernetes_version"`
	// The private network (VPC) the nodes are in; null in a standard zone.
	NetworkID    *string        `json:"network_id"`
	SubnetID     *string        `json:"subnet_id"`
	NodePlanID   string         `json:"node_plan_id"`
	Node         KubernetesNode `json:"node"`
	ControlNodes int            `json:"control_nodes"`
	Workers      int            `json:"workers"`
	// control_nodes plus workers: the VMs billed.
	Nodes int `json:"nodes"`
	// One of: running, stopped, deleted.
	DesiredState string `json:"desired_state"`
	// `updating` while a scale or upgrade runs. One of: pending, provisioning, running, updating, stopping, stopped, retired, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// False while a scale or upgrade has not finished.
	InSync        bool    `json:"in_sync"`
	FailureCode   *string `json:"failure_code"`
	FailureReason *string `json:"failure_reason"`
	// Versions this cluster can be upgraded to now.
	AvailableUpgrades []KubernetesVersion   `json:"available_upgrades"`
	Autoscaling       KubernetesAutoscaling `json:"autoscaling"`
	// Sources allowed to reach the API server; empty is any address.
	APIAllowedCIDRs []string `json:"api_allowed_cidrs"`
	// The API server's URL, once the cluster has one: the public address when the endpoint is public or dual and one is routed, else the private one.
	Endpoint *string `json:"endpoint"`
	// The public address the API server is reachable on; null until one is routed, and for a private endpoint.
	PublicIP *string `json:"public_ip"`
	// The public port the API server is reachable on; null until one is routed, and for a private endpoint.
	PublicPort *int `json:"public_port"`
	// What Kubernetes last reported of the nodes while the cluster runs; null while it is not running. One of: healthy, degraded, unknown.
	NodeHealth *string `json:"node_health"`
	// Why NodeHealth is `degraded` when the cause is the cluster itself rather than a node; null otherwise.
	NodeHealthReason *string `json:"node_health_reason"`
	// Nodes Kubernetes reports Ready, as of NodesCheckedAt; null when NodeHealth is unknown or null.
	ReadyNodes *int `json:"ready_nodes"`
	// When the nodes were last read; null if never.
	NodesCheckedAt *time.Time `json:"nodes_checked_at"`
	// Storage your workloads' persistent volume claims use, billed with the nodes' disks.
	VolumeStorageGB int `json:"volume_storage_gb"`
	// Cluster architecture kind, e.g. `appliance`.
	Kind string `json:"kind"`
	// CNI backend plugin (`flannel`, `wireguard`, or `calico`).
	CNIPlugin string `json:"cni_plugin"`
	// IPv4 CIDR range allocated for cluster pods.
	PodCIDR string `json:"pod_cidr"`
	// IPv4 CIDR range allocated for cluster services.
	ServiceCIDR string `json:"service_cidr"`
	// API server endpoint network access mode (`public`, `private`, or `dual`). One of: public, private, dual.
	EndpointAccess string     `json:"endpoint_access"`
	CreatedAt      *time.Time `json:"created_at"`
	UpdatedAt      *time.Time `json:"updated_at"`
}

KubernetesCluster is the API's kubernetes cluster object.

type KubernetesClusterAddon

type KubernetesClusterAddon struct {
	// e.g. `k8saddon_...`.
	ID        string `json:"id"`
	ClusterID string `json:"cluster_id"`
	Name      string `json:"name"`
	Version   string `json:"version"`
	Status    string `json:"status"`
	Enabled   bool   `json:"enabled"`
	// JSON-encoded add-on configuration.
	Configuration string     `json:"configuration"`
	CreatedAt     *time.Time `json:"created_at"`
	UpdatedAt     *time.Time `json:"updated_at"`
}

KubernetesClusterAddon is the API's kubernetes cluster addon object.

type KubernetesClusterNode

type KubernetesClusterNode struct {
	// The node's name, which is its id inside Kubernetes.
	ID   string `json:"id"`
	Name string `json:"name"`
	// One of: control, worker.
	Role string `json:"role"`
	// One of: Ready, NotReady.
	Status string `json:"status"`
	// The node's internal address.
	IPAddress      string     `json:"ip_address"`
	VCPU           int        `json:"vcpu"`
	MemoryMB       int        `json:"memory_mb"`
	DiskGB         int        `json:"disk_gb"`
	KubeletVersion string     `json:"kubelet_version"`
	CreatedAt      *time.Time `json:"created_at"`
}

KubernetesClusterNode is the API's kubernetes cluster node object.

type KubernetesClusterNodes

type KubernetesClusterNodes struct {
	Nodes []KubernetesClusterNode `json:"nodes"`
}

KubernetesClusterNodes is the API's kubernetes cluster nodes object.

type KubernetesLiveManifests

type KubernetesLiveManifests struct {
	ClusterID string `json:"cluster_id"`
	// Empty when you have deployed nothing.
	Manifest      string    `json:"manifest"`
	ResourceCount int       `json:"resource_count"`
	RetrievedAt   time.Time `json:"retrieved_at"`
}

KubernetesLiveManifests is the API's kubernetes live manifests object.

type KubernetesManifestApplied

type KubernetesManifestApplied struct {
	Applied   bool   `json:"applied"`
	ClusterID string `json:"cluster_id"`
	// One line per object, as kubectl prints it.
	Output    string                      `json:"output"`
	Resources []KubernetesAppliedResource `json:"resources"`
}

KubernetesManifestApplied is the API's kubernetes manifest applied object.

type KubernetesNode

type KubernetesNode struct {
	VCPU     int `json:"vcpu"`
	MemoryMB int `json:"memory_mb"`
	DiskGB   int `json:"disk_gb"`
}

KubernetesNode is the API's kubernetes node object.

type KubernetesNodePool

type KubernetesNodePool struct {
	// `provisioning` (workers being built), `ready` (every worker has joined), `updating` (a scale in progress), `deleting`, or `unavailable` (a pool made while node pools were a preview, with no node size: delete it and create it again). One of: provisioning, ready, updating, deleting, unavailable.
	Status string `json:"status"`
	// The pool's workers that have joined the cluster.
	ObservedWorkers int `json:"observed_workers"`
	// e.g. `k8spool_...`.
	ID                 string                    `json:"id"`
	ClusterID          string                    `json:"cluster_id"`
	Name               string                    `json:"name"`
	NodePlanID         string                    `json:"node_plan_id"`
	Workers            int                       `json:"workers"`
	AutoscalingEnabled bool                      `json:"autoscaling_enabled"`
	MinWorkers         int                       `json:"min_workers"`
	MaxWorkers         int                       `json:"max_workers"`
	Labels             map[string]string         `json:"labels"`
	Taints             []KubernetesNodePoolTaint `json:"taints"`
	CreatedAt          *time.Time                `json:"created_at"`
	UpdatedAt          *time.Time                `json:"updated_at"`
}

KubernetesNodePool is the API's kubernetes node pool object.

type KubernetesNodePoolTaint

type KubernetesNodePoolTaint struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	// One of: NoSchedule, PreferNoSchedule, NoExecute.
	Effect string `json:"effect"`
}

KubernetesNodePoolTaint is the API's kubernetes node pool taint object.

type KubernetesPod

type KubernetesPod struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Status    string `json:"status"`
	// Ready containers over all containers.
	Ready    string `json:"ready"`
	Restarts int    `json:"restarts"`
	NodeName string `json:"node_name"`
	PodIP    string `json:"pod_ip"`
	// As kubectl's AGE column.
	Age       string     `json:"age"`
	CreatedAt *time.Time `json:"created_at"`
}

KubernetesPod is the API's kubernetes pod object.

type KubernetesRoutingSynced

type KubernetesRoutingSynced struct {
	Success   bool   `json:"success"`
	ClusterID string `json:"cluster_id"`
	PublicIP  string `json:"public_ip"`
	// Null for a private endpoint.
	APIPort     *int                   `json:"api_port"`
	SyncedPorts []KubernetesSyncedPort `json:"synced_ports"`
	Message     string                 `json:"message"`
}

KubernetesRoutingSynced is the API's kubernetes routing synced object.

type KubernetesService

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

KubernetesService manages Kubernetes clusters, node pools and add-ons.

func (*KubernetesService) ApplyManifest

ApplyManifest applies a manifest to a cluster: POST /kubernetes-clusters/{cluster_id}/apply-manifest. Scope: write.

func (*KubernetesService) ConfigureEndpointAccess

func (s *KubernetesService) ConfigureEndpointAccess(ctx context.Context, clusterID string, req ConfigureKubernetesEndpointAccessRequest, opts ...RequestOption) (*Accepted, error)

ConfigureEndpointAccess configures API server endpoint access: POST /kubernetes-clusters/{cluster_id}/endpoint-access. Scope: write.

func (*KubernetesService) CreateCluster

CreateCluster creates a Kubernetes cluster: POST /kubernetes-clusters. Scope: write.

func (*KubernetesService) CreateNodePool

func (s *KubernetesService) CreateNodePool(ctx context.Context, clusterID string, req CreateKubernetesNodePoolRequest, opts ...RequestOption) (*Accepted, error)

CreateNodePool creates a node pool: POST /kubernetes-clusters/{cluster_id}/node-pools. Scope: write.

func (*KubernetesService) DeleteCluster

func (s *KubernetesService) DeleteCluster(ctx context.Context, clusterID string, opts ...RequestOption) (*Accepted, error)

DeleteCluster deletes a Kubernetes cluster: DELETE /kubernetes-clusters/{cluster_id}. Scope: write.

func (*KubernetesService) DeleteNodePool

func (s *KubernetesService) DeleteNodePool(ctx context.Context, clusterID string, poolID string, opts ...RequestOption) (*Accepted, error)

DeleteNodePool deletes a node pool: DELETE /kubernetes-clusters/{cluster_id}/node-pools/{pool_id}. Scope: write.

func (*KubernetesService) ExposeService

ExposeService exposes a Kubernetes service: POST /kubernetes-clusters/{cluster_id}/expose-service. Scope: write.

func (*KubernetesService) GetCluster

func (s *KubernetesService) GetCluster(ctx context.Context, clusterID string, opts ...RequestOption) (*KubernetesCluster, error)

GetCluster gets a Kubernetes cluster: GET /kubernetes-clusters/{cluster_id}. Scope: read.

func (*KubernetesService) GetKubeconfig

func (s *KubernetesService) GetKubeconfig(ctx context.Context, clusterID string, opts ...RequestOption) (*Kubeconfig, error)

GetKubeconfig downloads a kubeconfig: POST /kubernetes-clusters/{cluster_id}/kubeconfig. Scope: write.

func (*KubernetesService) GetLiveManifests

func (s *KubernetesService) GetLiveManifests(ctx context.Context, clusterID string, opts ...RequestOption) (*KubernetesLiveManifests, error)

GetLiveManifests exports a cluster's workloads as YAML: GET /kubernetes-clusters/{cluster_id}/live-manifests. Scope: read.

func (*KubernetesService) GetWorkloads

func (s *KubernetesService) GetWorkloads(ctx context.Context, clusterID string, opts ...RequestOption) (*KubernetesWorkloads, error)

GetWorkloads gets a cluster's services and pods: GET /kubernetes-clusters/{cluster_id}/workloads. Scope: read.

func (*KubernetesService) ListAddons

func (s *KubernetesService) ListAddons(ctx context.Context, clusterID string, opts ...RequestOption) ([]KubernetesClusterAddon, error)

ListAddons lists cluster add-ons: GET /kubernetes-clusters/{cluster_id}/addons. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*KubernetesService) ListClusters

func (s *KubernetesService) ListClusters(ctx context.Context, opts ...RequestOption) ([]KubernetesCluster, error)

ListClusters lists Kubernetes clusters: GET /kubernetes-clusters. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*KubernetesService) ListNodePools

func (s *KubernetesService) ListNodePools(ctx context.Context, clusterID string, opts ...RequestOption) ([]KubernetesNodePool, error)

ListNodePools lists node pools: GET /kubernetes-clusters/{cluster_id}/node-pools. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*KubernetesService) ListNodes

func (s *KubernetesService) ListNodes(ctx context.Context, clusterID string, opts ...RequestOption) (*KubernetesClusterNodes, error)

ListNodes lists a cluster's nodes: GET /kubernetes-clusters/{cluster_id}/nodes. Scope: read.

func (*KubernetesService) ResizePlan

ResizePlan resizes worker node compute plan: POST /kubernetes-clusters/{cluster_id}/resize-plan. Scope: write.

func (*KubernetesService) ScaleNodePool

func (s *KubernetesService) ScaleNodePool(ctx context.Context, clusterID string, poolID string, req ScaleKubernetesNodePoolRequest, opts ...RequestOption) (*Accepted, error)

ScaleNodePool scales a node pool: PATCH /kubernetes-clusters/{cluster_id}/node-pools/{pool_id}. Scope: write.

func (*KubernetesService) StartCluster

func (s *KubernetesService) StartCluster(ctx context.Context, clusterID string, opts ...RequestOption) (*Accepted, error)

StartCluster starts a Kubernetes cluster: POST /kubernetes-clusters/{cluster_id}/start. Scope: write.

func (*KubernetesService) StopCluster

func (s *KubernetesService) StopCluster(ctx context.Context, clusterID string, opts ...RequestOption) (*Accepted, error)

StopCluster stops a Kubernetes cluster: POST /kubernetes-clusters/{cluster_id}/stop. Scope: write.

func (*KubernetesService) SyncRouting

func (s *KubernetesService) SyncRouting(ctx context.Context, clusterID string, opts ...RequestOption) (*KubernetesRoutingSynced, error)

SyncRouting syncs a cluster's public routing: POST /kubernetes-clusters/{cluster_id}/sync-routing. Scope: write.

func (*KubernetesService) ToggleAddon

func (s *KubernetesService) ToggleAddon(ctx context.Context, clusterID string, addonName string, req ToggleKubernetesAddonRequest, opts ...RequestOption) (*Accepted, error)

ToggleAddon toggles a cluster add-on: POST /kubernetes-clusters/{cluster_id}/addons/{addon_name}/toggle. Scope: write.

func (*KubernetesService) UpdateCluster

func (s *KubernetesService) UpdateCluster(ctx context.Context, clusterID string, req UpdateKubernetesClusterRequest, opts ...RequestOption) (*Accepted, error)

UpdateCluster changes a Kubernetes cluster: PATCH /kubernetes-clusters/{cluster_id}. Scope: write.

func (*KubernetesService) UpgradeCluster

func (s *KubernetesService) UpgradeCluster(ctx context.Context, clusterID string, req UpgradeKubernetesClusterRequest, opts ...RequestOption) (*Accepted, error)

UpgradeCluster upgrades a Kubernetes cluster: POST /kubernetes-clusters/{cluster_id}/upgrade. Scope: write.

func (*KubernetesService) UpgradeNetwork

func (s *KubernetesService) UpgradeNetwork(ctx context.Context, clusterID string, req UpgradeKubernetesNetworkRequest, opts ...RequestOption) (*Accepted, error)

UpgradeNetwork upgrades Kubernetes cluster networking: POST /kubernetes-clusters/{cluster_id}/upgrade-network. Scope: write.

type KubernetesServiceExposed

type KubernetesServiceExposed struct {
	Success     bool   `json:"success"`
	ClusterID   string `json:"cluster_id"`
	ServiceName string `json:"service_name"`
	Namespace   string `json:"namespace"`
	PublicIP    string `json:"public_ip"`
	PublicPort  int    `json:"public_port"`
	NodePort    int    `json:"node_port"`
	Protocol    string `json:"protocol"`
	ExternalURL string `json:"external_url"`
	// One of: active.
	Status string `json:"status"`
}

KubernetesServiceExposed is the API's kubernetes service exposed object.

type KubernetesServicePort

type KubernetesServicePort struct {
	Name     string `json:"name"`
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
	// Left out when the target is a named container port.
	TargetPort int `json:"target_port"`
	NodePort   int `json:"node_port"`
}

KubernetesServicePort is the API's kubernetes service port object.

type KubernetesSyncedPort

type KubernetesSyncedPort struct {
	// One of: kubernetes-api, service.
	Purpose     string `json:"purpose"`
	PublicPort  int    `json:"public_port"`
	PrivatePort int    `json:"private_port"`
	Protocol    string `json:"protocol"`
	// `control node`, or the service as namespace/name.
	Target string `json:"target"`
	// One of: active.
	Status string `json:"status"`
}

KubernetesSyncedPort is the API's kubernetes synced port object.

type KubernetesVersion

type KubernetesVersion struct {
	// e.g. `k8sv_...`.
	ID      string `json:"id"`
	ZoneID  string `json:"zone_id"`
	Version string `json:"version"`
	// `withdrawn` versions take no new clusters. One of: available, withdrawn.
	Status string `json:"status"`
	// The fewest vCPUs a node plan needs for this version.
	MinCPU int `json:"min_cpu"`
	// The least memory, in MB, a node plan needs for this version.
	MinMemoryMB int `json:"min_memory_mb"`
}

KubernetesVersion is the API's kubernetes version object.

type KubernetesVersionList

type KubernetesVersionList struct {
	Data []KubernetesVersion `json:"data"`
	// Zones where a cluster can have 3 control nodes.
	HAZoneIDs []string `json:"ha_zone_ids"`
}

KubernetesVersionList is the API's kubernetes version list object.

type KubernetesWorkloadService

type KubernetesWorkloadService struct {
	Name       string                  `json:"name"`
	Namespace  string                  `json:"namespace"`
	Type       string                  `json:"type"`
	ClusterIP  string                  `json:"cluster_ip"`
	ExternalIP *string                 `json:"external_ip"`
	Ports      []KubernetesServicePort `json:"ports"`
	// The public port routed to this service; null when it is not exposed.
	PublicPort  *int       `json:"public_port"`
	ExternalURL *string    `json:"external_url"`
	CreatedAt   *time.Time `json:"created_at"`
}

KubernetesWorkloadService is the API's kubernetes workload service object.

type KubernetesWorkloads

type KubernetesWorkloads struct {
	ClusterID string `json:"cluster_id"`
	// The public address exposed services and the API server are reached on; null until routing has been synced.
	PublicIP *string `json:"public_ip"`
	// The cluster's API server port on `public_ip`; null for a private endpoint or before routing is synced.
	APIPort  *int                        `json:"api_port"`
	Services []KubernetesWorkloadService `json:"services"`
	Pods     []KubernetesPod             `json:"pods"`
}

KubernetesWorkloads is the API's kubernetes workloads object.

type ListKubernetesVersionsParams

type ListKubernetesVersionsParams struct {
	// Only versions in this zone.
	ZoneID string
}

ListKubernetesVersionsParams are the query parameters of list kubernetes versions. Zero values are left out.

type ListLoadBalancersParams

type ListLoadBalancersParams struct {
	// Only load balancers in this private network (`net_…`).
	NetworkID string
	// Only load balancers on this public IP (`pip_…`).
	PublicIPID string
}

ListLoadBalancersParams are the query parameters of list load balancers. Zero values are left out.

type ListParams

type ListParams struct {
	// Items per page, 1 to 100.
	Limit int
	// The previous page's `next_cursor`, to get the next page.
	Cursor string
	// Only items whose name contains this text (case-insensitive), at most 255 characters.
	Q string
	// Only items with this `desired_state`: `running`, `stopped` or `deleted`. One of: running, stopped, deleted.
	DesiredState string
	// Only items with this `observed_state`. One of: pending, provisioning, running, stopping, stopped, deleting, deleted, failed, unknown.
	ObservedState string
}

ListParams are the query parameters of the paging and filters most lists take. Zero values are left out.

type ListPlansParams

type ListPlansParams struct {
	// Price for standard instances or VPC instances. One of: standard, vpc.
	Placement string
}

ListPlansParams are the query parameters of list plans. Zero values are left out.

type ListPublicIPsParams

type ListPublicIPsParams struct {
	NetworkID string
}

ListPublicIPsParams are the query parameters of list public ips. Zero values are left out.

type LoadBalancer

type LoadBalancer struct {
	// e.g. `lb_...`.
	ID     string `json:"id"`
	Name   string `json:"name"`
	ZoneID string `json:"zone_id"`
	// One of: vpc_native, appliance.
	Kind       string `json:"kind"`
	PublicIPID string `json:"public_ip_id"`
	// The address clients connect to; null until it is known.
	PublicIPAddress *string `json:"public_ip_address"`
	NetworkID       *string `json:"network_id"`
	SubnetID        string  `json:"subnet_id"`
	// One of: tcp, http, https.
	Protocol string `json:"protocol"`
	// One of: roundrobin, leastconn, source.
	Algorithm   string `json:"algorithm"`
	PublicPort  int    `json:"public_port"`
	PrivatePort int    `json:"private_port"`
	// Source addresses allowed to connect; empty is anywhere.
	CIDRList []string             `json:"cidr_list"`
	Members  []LoadBalancerMember `json:"members"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// `active` once it serves traffic. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// False while a change you made has not reached the load balancer yet.
	InSync    bool       `json:"in_sync"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

LoadBalancer is the API's load balancer object.

type LoadBalancerMember

type LoadBalancerMember struct {
	InstanceID string `json:"instance_id"`
	// The instance's name; null when it is gone.
	InstanceName *string `json:"instance_name"`
	// `present` while it should receive traffic; `deleted` once you removed it and that has not finished. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// `active` once it receives traffic. One of: pending, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
}

LoadBalancerMember is the API's load balancer member object.

type LoadBalancersService

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

LoadBalancersService manages load balancers.

func (*LoadBalancersService) Create

Create creates a load balancer: POST /load-balancers. Scope: write.

func (*LoadBalancersService) Delete

func (s *LoadBalancersService) Delete(ctx context.Context, loadBalancerID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a load balancer: DELETE /load-balancers/{load_balancer_id}. Scope: write.

func (*LoadBalancersService) Get

func (s *LoadBalancersService) Get(ctx context.Context, loadBalancerID string, opts ...RequestOption) (*LoadBalancer, error)

Get gets a load balancer: GET /load-balancers/{load_balancer_id}. Scope: read.

func (*LoadBalancersService) List

List lists load balancers: GET /load-balancers. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*LoadBalancersService) Update

func (s *LoadBalancersService) Update(ctx context.Context, loadBalancerID string, req UpdateLoadBalancerRequest, opts ...RequestOption) (*Accepted, error)

Update changes a load balancer: PATCH /load-balancers/{load_balancer_id}. Scope: write.

type Me

type Me struct {
	// The organization the key belongs to.
	OrganizationID string `json:"organization_id"`
	// The organization's project; every resource belongs to it.
	ProjectID string   `json:"project_id"`
	APIKey    MeAPIKey `json:"api_key"`
}

Me is the API's me object.

type MeAPIKey

type MeAPIKey struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// `standard` for a key made under Organization › API keys; `ai_app` for the key an AI app was given when a member connected it. One of: standard, ai_app.
	Kind string `json:"kind"`
	// The AI app's name as it introduced itself (not verified by Pantech), e.g. `Research assistant`.
	ClientName *string `json:"client_name"`
	// `delete` appears only on an AI app's key, together with `write`. One of: read, write, delete.
	Scopes    []string   `json:"scopes"`
	ExpiresAt *time.Time `json:"expires_at"`
}

MeAPIKey is the API's me apikey object.

type MeService

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

MeService describes and revokes the API key making the call.

func (*MeService) Get

func (s *MeService) Get(ctx context.Context, opts ...RequestOption) (*Me, error)

Get describes this API key: GET /me. Scope: read.

func (*MeService) Revoke

func (s *MeService) Revoke(ctx context.Context, opts ...RequestOption) error

Revoke revokes the API key making the call: DELETE /me. The key stops working at once; a second call fails with 401 because the key is gone. Scope: read.

type MetricsPoint

type MetricsPoint struct {
	BucketStart                 time.Time `json:"bucket_start"`
	BucketEnd                   time.Time `json:"bucket_end"`
	CPUPercent                  *float64  `json:"cpu_percent"`
	MemoryPercent               *float64  `json:"memory_percent"`
	NetworkInBytes              *int64    `json:"network_in_bytes"`
	NetworkOutBytes             *int64    `json:"network_out_bytes"`
	DiskReadPeakBytesPerSecond  *int64    `json:"disk_read_peak_bytes_per_second"`
	DiskWritePeakBytesPerSecond *int64    `json:"disk_write_peak_bytes_per_second"`
}

MetricsPoint is the API's metrics point object.

type MetricsSeries

type MetricsSeries struct {
	// The window the points cover: `1h`, `24h`, `7d` or `30d`. One of: 1h, 24h, 7d, 30d.
	Interval string `json:"interval"`
	// False when no samples exist yet, for example just after the instance was created.
	Available bool `json:"available"`
	// When the newest sample was taken; null when none.
	SampledAt *string `json:"sampled_at"`
	// One point per bucket, oldest first.
	Points []MetricsPoint `json:"points"`
}

MetricsSeries is the API's metrics series object.

type MigrateService added in v0.2.0

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

MigrateService moves you from another cloud: it connects an AWS account through a read-only role (no access keys are shared), scans what runs there, and plans the move to Pantech with prices and a Terraform export.

func (*MigrateService) CreateConnection added in v0.2.0

CreateConnection starts a connection to an AWS account: POST /cloud-connections. Its Setup holds the template (and QuickCreateURL) that creates the read-only role; send the stack's RoleArn output with UpdateConnection. Scope: write.

func (*MigrateService) CreateMigration added in v0.2.0

func (s *MigrateService) CreateMigration(ctx context.Context, req CreateMigrationRequest, opts ...RequestOption) (*Migration, error)

CreateMigration builds a plan from a scan that succeeded: POST /migrations. Nothing is created on Pantech; the plan carries a price comparison. Scope: write.

func (*MigrateService) DeleteConnection added in v0.2.0

func (s *MigrateService) DeleteConnection(ctx context.Context, connectionID string, opts ...RequestOption) error

DeleteConnection removes a connection and its scans: DELETE /cloud-connections/{connection_id}. Migration plans made from it stay. Delete the stack in the other account to revoke the role there too. Scope: write.

func (*MigrateService) DeleteMigration added in v0.2.0

func (s *MigrateService) DeleteMigration(ctx context.Context, migrationID string, opts ...RequestOption) error

DeleteMigration deletes a plan: DELETE /migrations/{migration_id}. Nothing on Pantech or in the other cloud is touched. Scope: write.

func (*MigrateService) ExportTerraform added in v0.2.0

func (s *MigrateService) ExportTerraform(ctx context.Context, migrationID string, opts ...RequestOption) (*MigrationTerraform, error)

ExportTerraform returns the plan's planned items as Terraform (main.tf and variables.tf): GET /migrations/{migration_id}/terraform. Scope: read.

func (*MigrateService) GetConnection added in v0.2.0

func (s *MigrateService) GetConnection(ctx context.Context, connectionID string, opts ...RequestOption) (*CloudConnection, error)

GetConnection gets a cloud connection: GET /cloud-connections/{connection_id}. Scope: read.

func (*MigrateService) GetMigration added in v0.2.0

func (s *MigrateService) GetMigration(ctx context.Context, migrationID string, opts ...RequestOption) (*Migration, error)

GetMigration gets a plan with every item and a price comparison computed now: GET /migrations/{migration_id}. Scope: read.

func (*MigrateService) GetScan added in v0.2.0

func (s *MigrateService) GetScan(ctx context.Context, scanID string, params *GetCloudScanParams, opts ...RequestOption) (*CloudScan, error)

GetScan gets a scan: GET /cloud-scans/{scan_id}. Pass &GetCloudScanParams{Include: "inventory"} for everything it found. Scope: read.

func (*MigrateService) ListConnections added in v0.2.0

func (s *MigrateService) ListConnections(ctx context.Context, opts ...RequestOption) ([]CloudConnection, error)

ListConnections lists cloud connections: GET /cloud-connections. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*MigrateService) ListMigrations added in v0.2.0

func (s *MigrateService) ListMigrations(ctx context.Context, opts ...RequestOption) ([]Migration, error)

ListMigrations lists migration plans, without their items or estimate: GET /migrations. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*MigrateService) ListScans added in v0.2.0

func (s *MigrateService) ListScans(ctx context.Context, connectionID string, opts ...RequestOption) ([]CloudScan, error)

ListScans lists a connection's scans, without their inventories: GET /cloud-connections/{connection_id}/scans. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*MigrateService) RenameMigration added in v0.2.0

func (s *MigrateService) RenameMigration(ctx context.Context, migrationID string, req RenameMigrationRequest, opts ...RequestOption) (*Migration, error)

RenameMigration changes a plan's name: PATCH /migrations/{migration_id}. Scope: write.

func (*MigrateService) StartScan added in v0.2.0

func (s *MigrateService) StartScan(ctx context.Context, connectionID string, opts ...RequestOption) (*CloudScan, error)

StartScan queues a scan of a connected account: POST /cloud-connections/{connection_id}/scans. Follow it with WaitForScan. Scope: write.

func (*MigrateService) UpdateConnection added in v0.2.0

func (s *MigrateService) UpdateConnection(ctx context.Context, connectionID string, req UpdateCloudConnectionRequest, opts ...RequestOption) (*CloudConnection, error)

UpdateConnection renames a connection, sets its role ARN, or retries a failed check: PATCH /cloud-connections/{connection_id}. Setting RoleARN or Retry queues a verification; follow it with WaitForConnection. Scope: write.

func (*MigrateService) UpdateItem added in v0.2.0

func (s *MigrateService) UpdateItem(ctx context.Context, migrationID string, req UpdateMigrationItemRequest, opts ...RequestOption) (*Migration, error)

UpdateItem changes one item of a plan, named by its Key: PATCH /migrations/{migration_id}/items. It returns the whole plan. Scope: write.

func (*MigrateService) WaitForConnection added in v0.2.0

func (s *MigrateService) WaitForConnection(ctx context.Context, connectionID string, opts *WaitOptions) (*CloudConnection, error)

WaitForConnection polls GET /cloud-connections/{id} until the connection is connected, and returns it. A failed check returns it with a *CloudFailureError. A connection still awaiting its role ARN is waited on too, so set the ARN with UpdateConnection first. opts may be nil.

func (*MigrateService) WaitForScan added in v0.2.0

func (s *MigrateService) WaitForScan(ctx context.Context, scanID string, opts *WaitOptions) (*CloudScan, error)

WaitForScan polls GET /cloud-scans/{id} until the scan succeeds, and returns it (without its inventory: read that with GetScan). A failed scan returns it with a *CloudFailureError. opts may be nil.

type Migration added in v0.2.0

type Migration struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Region       string `json:"region"`
	ConnectionID string `json:"connection_id"`
	ScanID       string `json:"scan_id"`
	// `planning`. Copying arrives in a later release. One of: planning.
	Stage   string           `json:"stage"`
	Version int              `json:"version"`
	Summary MigrationSummary `json:"summary"`
	// Nil in a list.
	Estimate *MigrationEstimate `json:"estimate"`
	// Nil in a list.
	Items     []MigrationItem `json:"items"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

Migration is the API's migration object. A plan to move what a scan found to Pantech.

type MigrationEstimate added in v0.2.0

type MigrationEstimate struct {
	Currency string `json:"currency"`
	// False when part of the plan could not be priced; then PantechMonthlyMinor is nil.
	PantechPriced       bool   `json:"pantech_priced"`
	PantechMonthlyMinor *int64 `json:"pantech_monthly_minor"`
	// What the Pantech price includes: servers, volumes, networks.
	Covers []string `json:"covers"`
	// Planned items the price leaves out, e.g. databases.
	NotCovered         []string `json:"not_covered"`
	SourceKnown        bool     `json:"source_known"`
	SourceMonthlyMinor *int64   `json:"source_monthly_minor"`
	SourceCurrency     *string  `json:"source_currency"`
	SourceMonths       int      `json:"source_months"`
	// `whole_account`: the source figure is the whole cloud bill. One of: whole_account.
	SourceScope string `json:"source_scope"`
}

MigrationEstimate is the API's migration estimate object. Pantech's monthly price for the plan next to the source's monthly bill, computed when read.

type MigrationFlag added in v0.2.0

type MigrationFlag struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	// A blocking flag makes the item unsupported.
	Blocking bool `json:"blocking"`
}

MigrationFlag is the API's migration flag object.

type MigrationItem added in v0.2.0

type MigrationItem struct {
	// Stable across edits: kind, region and the source id.
	Key string `json:"key"`
	// One of: network, subnet, security_group, instance, volume, public_ip, load_balancer, database, ssh_key, user, bucket.
	Kind   string              `json:"kind"`
	Source MigrationItemSource `json:"source"`
	// One of: planned, excluded, unsupported.
	Status string          `json:"status"`
	Flags  []MigrationFlag `json:"flags"`
	// What the item becomes on Pantech.
	Target MigrationItemTarget `json:"target"`
}

MigrationItem is the API's migration item object.

type MigrationItemSource added in v0.2.0

type MigrationItemSource struct {
	ID        string  `json:"id"`
	Name      *string `json:"name"`
	Region    *string `json:"region"`
	Summary   string  `json:"summary"`
	VCPU      *int    `json:"vcpu"`
	MemoryMiB *int    `json:"memory_mib"`
	DiskGB    *int    `json:"disk_gb"`
}

MigrationItemSource is the API's migration item source object.

type MigrationItemTarget added in v0.2.0

type MigrationItemTarget struct {
	PlanSlug      *string         `json:"plan_slug"`
	DiskGB        *int            `json:"disk_gb"`
	CIDR          *string         `json:"cidr"`
	NetworkKey    *string         `json:"network_key"`
	SubnetKey     *string         `json:"subnet_key"`
	InstanceKey   *string         `json:"instance_key"`
	Rules         []MigrationRule `json:"rules"`
	Engine        *string         `json:"engine"`
	EngineVersion *string         `json:"engine_version"`
	StorageGB     *int            `json:"storage_gb"`
	// One of: admin, member.
	Role      *string             `json:"role"`
	Email     *string             `json:"email"`
	PublicKey *string             `json:"public_key"`
	Listeners []MigrationListener `json:"listeners"`
}

MigrationItemTarget is the API's migration item target object. What the item becomes on Pantech; fields that don't apply to its kind are null or empty.

type MigrationListener added in v0.2.0

type MigrationListener struct {
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
}

MigrationListener is the API's migration listener object.

type MigrationRule added in v0.2.0

type MigrationRule struct {
	// One of: ingress, egress.
	Direction string `json:"direction"`
	// One of: tcp, udp, icmp, all.
	Protocol  string  `json:"protocol"`
	PortRange *string `json:"port_range"`
	CIDR      string  `json:"cidr"`
}

MigrationRule is the API's migration rule object.

type MigrationSummary added in v0.2.0

type MigrationSummary struct {
	Planned     int `json:"planned"`
	Excluded    int `json:"excluded"`
	Unsupported int `json:"unsupported"`
	// Planned items per kind.
	ByKind map[string]int `json:"by_kind"`
}

MigrationSummary is the API's migration summary object.

type MigrationTerraform added in v0.2.0

type MigrationTerraform struct {
	Files []MigrationTerraformFile `json:"files"`
}

MigrationTerraform is the API's migration terraform object.

type MigrationTerraformFile added in v0.2.0

type MigrationTerraformFile struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

MigrationTerraformFile is one file of a Terraform export.

type MonthlyQuote

type MonthlyQuote struct {
	// `NGN` or `USD`.
	Currency string `json:"currency"`
	// Price for a full month in minor units of `currency`.
	MonthlyMinor int64 `json:"monthly_minor"`
	// Hours in the month the price assumes: 730.
	NominalMonthHours int `json:"nominal_month_hours"`
}

MonthlyQuote is the API's monthly quote object.

type Network

type Network struct {
	// e.g. `net_...`.
	ID string `json:"id"`
	// Its name, unique among your VPC networks.
	Name string `json:"name"`
	// e.g. `10.0.0.0/16`.
	CIDR string `json:"cidr"`
	// e.g. `af-abj`.
	Region *string `json:"region"`
	// e.g. `af-abj-2`.
	Zone *string `json:"zone"`
	// Instances in this VPC; null when it could not be counted.
	InstanceCount *int `json:"instance_count"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Network is the API's network object. A VPC: a private network of your own.

type NetworksService

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

NetworksService manages VPC networks.

func (*NetworksService) All

func (s *NetworksService) All(ctx context.Context, params *ListParams, opts ...RequestOption) iter.Seq2[Network, error]

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*NetworksService) Create

Create creates a VPC network: POST /networks. Scope: write.

func (*NetworksService) Delete

func (s *NetworksService) Delete(ctx context.Context, networkID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a VPC network: DELETE /networks/{network_id}. Scope: write.

func (*NetworksService) Get

func (s *NetworksService) Get(ctx context.Context, networkID string, opts ...RequestOption) (*Network, error)

Get gets a VPC network: GET /networks/{network_id}. Scope: read.

func (*NetworksService) List

func (s *NetworksService) List(ctx context.Context, params *ListParams, opts ...RequestOption) (*Page[Network], error)

List lists VPC networks: GET /networks. Scope: read.

func (*NetworksService) Quote

func (s *NetworksService) Quote(ctx context.Context, opts ...RequestOption) (*MonthlyQuote, error)

Quote prices a VPC network: GET /networks/quote. Scope: read.

type Operation

type Operation struct {
	// e.g. `op_...`.
	ID string `json:"id"`
	// e.g. `instance`, `volume`, `network`, `security_group`, `database`. One of: instance, network, subnet, security_group, snapshot, volume, ssh_access_grant, relay_vm, network_acl_rule, public_ip, port_forwarding_rule, database.
	ResourceType string `json:"resource_type"`
	// The resource the operation acts on, e.g. a `vm_…`, `db_…` or `snap_…` id.
	ResourceID string `json:"resource_id"`
	// What it does, e.g. `create_instance`, `stop_instance`.
	Kind string `json:"kind"`
	// `submitting` and `submitted` while it runs; `succeeded` and `failed` are final. One of: submitting, submitted, succeeded, failed.
	Status string `json:"status"`
	// Why it failed, when `status` is `failed`; otherwise null.
	Failure *Failure `json:"failure"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Operation is the API's operation object.

type OperationError

type OperationError struct {
	Operation *Operation
}

OperationError is returned by a wait when the operation failed. Its Failure code is stable, and its reason is safe to show to users.

func (*OperationError) Error

func (e *OperationError) Error() string

type OperationsService

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

OperationsService follows asynchronous changes.

func (*OperationsService) Get

func (s *OperationsService) Get(ctx context.Context, operationID string, opts ...RequestOption) (*Operation, error)

Get gets an operation: GET /operations/{operation_id}. Scope: read.

func (*OperationsService) Stream

func (s *OperationsService) Stream(ctx context.Context, operationID string) iter.Seq2[*Operation, error]

Stream follows an operation over Server-Sent Events: GET /operations/{operation_id}/events. It yields the operation each time it changes, and ends after it succeeds or fails. If the stream stops early the API sends an error event, yielded as an *Error (OPERATION_STREAM_TIMEOUT, OPERATION_STREAM_UNAVAILABLE or UNAUTHENTICATED): reconnect, or use Wait. The stream is opened once and never retried. Stop ranging to close it. Scope: read.

func (*OperationsService) Wait

func (s *OperationsService) Wait(ctx context.Context, operationID string, opts *WaitOptions) (*Operation, error)

Wait polls GET /operations/{id} until the operation succeeds, and returns it. A failed operation returns it with an *OperationError. ctx (and opts.Timeout) bound the wait; opts may be nil.

type Option

type Option func(*settings)

Option configures a Client in NewClient.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key (PAN_…). Without it NewClient reads PANTECH_API_KEY.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL sets the API's base URL, including the /public/v1 prefix, for example https://api.example.com/public/v1. Without it NewClient reads PANTECH_API_URL, and then uses DefaultBaseURL.

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient sets the HTTP client requests go through. Its Timeout bounds each attempt; the default client allows 90 seconds.

func WithHeader

func WithHeader(key, value string) Option

WithHeader adds a header to every request, for example Pantech-Client. It is set after the SDK's own headers, so it can replace them.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets how many times a failed request is retried after the first try. 0 turns retries off. The default is DefaultMaxRetries.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent replaces the User-Agent header, which is pantech-go/<Version> by default. Tools built on the SDK set their own, such as pantech-mcp/1.0.0.

type OptionalQuote

type OptionalQuote struct {
	// False when no price applies; `unpriced_reason` then says why.
	Priced bool `json:"priced"`
	// Why no price applies; null when priced.
	UnpricedReason *string `json:"unpriced_reason"`
	// `NGN` or `USD`; null when not priced.
	Currency *string `json:"currency"`
	// Price for a full month in minor units; null when not priced.
	MonthlyMinor *int64 `json:"monthly_minor"`
	// Hours in the month the price assumes: 730.
	NominalMonthHours int `json:"nominal_month_hours"`
}

OptionalQuote is the API's optional quote object.

type OrderAccepted

type OrderAccepted struct {
	// Follow it at `GET /public/v1/instance-orders/{order_id}` (also the `Location` header).
	OrderID string `json:"order_id"`
	// The id the instance will have.
	InstanceID string `json:"instance_id"`
	// The order's status now, usually `awaiting_payment`. One of: awaiting_payment, paid, provisioning, provisioned, payment_failed, failed.
	Status string `json:"status"`
	// Set once provisioning starts.
	OperationID *string `json:"operation_id"`
	// Null for a new order; on a retry, the order's `failure_code` if it has failed since.
	FailureCode *string `json:"failure_code"`
	// The initial payment, in minor units (kobo or cents).
	AmountMinor int64 `json:"amount_minor"`
	// `NGN` or `USD`. One of: NGN, USD.
	Currency string `json:"currency"`
}

OrderAccepted is the API's order accepted object. An instance is bought through an order: the initial payment is taken first (from credit, else the default card), then the instance is provisioned.

type OrderError

type OrderError struct {
	// Kind is "instance" or "database".
	Kind        string
	OrderID     string
	Status      string
	FailureCode string
}

OrderError is returned by an order wait when the order ended in payment_failed or failed. Nothing was provisioned.

func (*OrderError) Error

func (e *OrderError) Error() string

type Page

type Page[T any] struct {
	Data []T `json:"data"`
	// NextCursor is passed as the cursor parameter to get the next page. It
	// is nil on the last page.
	NextCursor *string `json:"next_cursor"`
}

Page is one page of a list: the items, and the cursor of the next page.

func (*Page[T]) HasMore

func (p *Page[T]) HasMore() bool

HasMore reports whether there is another page.

type PageParams

type PageParams struct {
	// Items per page, 1 to 100.
	Limit int
	// The previous page's `next_cursor`, to get the next page.
	Cursor string
}

PageParams are the query parameters of the paging of lists that take no filters. Zero values are left out.

type Plan

type Plan struct {
	// The plan's id.
	ID string `json:"id"`
	// Use this in `plan_slug`.
	Slug string `json:"slug"`
	// Its name for display.
	Name string `json:"name"`
	// Virtual CPUs.
	VCPU int `json:"vcpu"`
	// Memory in MB.
	MemoryMB int `json:"memory_mb"`
	// Root disk in GB; for a database, the smallest data disk.
	DiskGB int `json:"disk_gb"`
	// In the organization's currency; null when it cannot be priced.
	Price *PlanPrice `json:"price"`
	// Why `price` is null; null when priced.
	UnpricedReason *string `json:"unpriced_reason"`
}

Plan is the API's plan object.

type PlanPrice

type PlanPrice struct {
	Currency string `json:"currency"`
	// A full month running.
	MonthlyEstimateMinor int64 `json:"monthly_estimate_minor"`
	// A full month stopped (storage only).
	StorageFloorMinor int64 `json:"storage_floor_minor"`
	// Taken when the instance is ordered.
	InitialPaymentMinor int64 `json:"initial_payment_minor"`
}

PlanPrice is the API's plan price object. In the organization's currency; null when it cannot be priced.

type PortForwardingRule

type PortForwardingRule struct {
	// e.g. `pfr_...`.
	ID         string `json:"id"`
	PublicIPID string `json:"public_ip_id"`
	InstanceID string `json:"instance_id"`
	// The target instance's name; null when it is gone.
	InstanceName *string `json:"instance_name"`
	// `tcp` or `udp`. One of: tcp, udp.
	Protocol         string `json:"protocol"`
	PublicPortStart  int    `json:"public_port_start"`
	PublicPortEnd    int    `json:"public_port_end"`
	PrivatePortStart int    `json:"private_port_start"`
	PrivatePortEnd   int    `json:"private_port_end"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

PortForwardingRule is the API's port forwarding rule object.

type PortForwardingRulesService

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

PortForwardingRulesService manages port forwarding on public IPs.

func (*PortForwardingRulesService) Create

Create adds a port forwarding rule: POST /public-ips/{public_ip_id}/port-forwarding-rules. Scope: write.

func (*PortForwardingRulesService) Delete

func (s *PortForwardingRulesService) Delete(ctx context.Context, ruleID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a port forwarding rule: DELETE /port-forwarding-rules/{rule_id}. Scope: write.

func (*PortForwardingRulesService) Get

func (s *PortForwardingRulesService) Get(ctx context.Context, publicIPID string, ruleID string, opts ...RequestOption) (*PortForwardingRule, error)

Get gets a port forwarding rule: GET /public-ips/{public_ip_id}/port-forwarding-rules/{rule_id}. Scope: read.

func (*PortForwardingRulesService) List

List lists port forwarding rules: GET /public-ips/{public_ip_id}/port-forwarding-rules. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

type PricingEstimate

type PricingEstimate struct {
	// `NGN` or `USD`, as requested.
	Currency string `json:"currency"`
	// Hours in the month prices assume: 730.
	NominalMonthHours int                      `json:"nominal_month_hours"`
	Machines          []PricingEstimateMachine `json:"machines"`
	ExtraStorageGB    *PricingEstimateExtra    `json:"extra_storage_gb"`
	Networks          *PricingEstimateExtra    `json:"networks"`
	SnapshotGB        *PricingEstimateExtra    `json:"snapshot_gb"`
	// False when any line could not be priced.
	PricingComplete bool `json:"pricing_complete"`
	// The sum of every priced line, in minor units.
	PricedSubtotalMinor int64 `json:"priced_subtotal_minor"`
}

PricingEstimate is the API's pricing estimate object.

type PricingEstimateExtra

type PricingEstimateExtra struct {
	Requested      int     `json:"requested"`
	Priced         bool    `json:"priced"`
	UnpricedReason *string `json:"unpriced_reason"`
	AmountMinor    *int64  `json:"amount_minor"`
}

PricingEstimateExtra is the API's pricing estimate extra object.

type PricingEstimateMachine

type PricingEstimateMachine struct {
	PlanSlug                  string  `json:"plan_slug"`
	Quantity                  int     `json:"quantity"`
	RunningHours              int     `json:"running_hours"`
	Priced                    bool    `json:"priced"`
	UnpricedReason            *string `json:"unpriced_reason"`
	UnitMonthlyEstimateMinor  *int64  `json:"unit_monthly_estimate_minor"`
	TotalMonthlyEstimateMinor *int64  `json:"total_monthly_estimate_minor"`
}

PricingEstimateMachine is the API's pricing estimate machine object.

type PricingEstimateMachineRequest

type PricingEstimateMachineRequest struct {
	PlanSlug     string `json:"plan_slug"`
	Quantity     int    `json:"quantity"`
	RunningHours int    `json:"running_hours"`
	// One of: standard, vpc.
	Placement *string `json:"placement,omitempty"`
}

PricingEstimateMachineRequest is the API's pricing estimate machine request object.

type PricingEstimateRequest

type PricingEstimateRequest struct {
	// The currency to price in: `NGN` or `USD`. One of: NGN, USD.
	Currency string `json:"currency"`
	// Instances to price: up to 50 lines, each a plan, a quantity and running hours per month.
	Machines *[]PricingEstimateMachineRequest `json:"machines,omitempty"`
	// Extra volume storage in GB.
	ExtraStorageGB *int `json:"extra_storage_gb,omitempty"`
	// Number of VPC networks.
	NetworkCount *int `json:"network_count,omitempty"`
	// Snapshot storage in GB.
	SnapshotGB *int `json:"snapshot_gb,omitempty"`
}

PricingEstimateRequest is the API's pricing estimate request object.

type PublicIP

type PublicIP struct {
	// e.g. `pip_...`.
	ID        string `json:"id"`
	NetworkID string `json:"network_id"`
	// The VPC's name.
	NetworkName *string `json:"network_name"`
	// `static_nat` maps every port to one instance; `port_forwarding` carries per-port rules. One of: static_nat, port_forwarding, load_balancer.
	Purpose string `json:"purpose"`
	// The public IPv4 address; null until allocated.
	Address *string `json:"address"`
	// static_nat: the instance it maps to; null while it is detached (still yours, and billed once).
	InstanceID *string `json:"instance_id"`
	// The mapped instance's name; null when none.
	InstanceName *string `json:"instance_name"`
	Region       *string `json:"region"`
	Zone         *string `json:"zone"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// False while an attach or detach has not reached the address yet.
	InSync bool `json:"in_sync"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

PublicIP is the API's public ip object.

type PublicIPsService

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

PublicIPsService manages public IPs for VPC instances.

func (*PublicIPsService) Attach

func (s *PublicIPsService) Attach(ctx context.Context, publicIPID string, req AttachPublicIPRequest, opts ...RequestOption) (*Accepted, error)

Attach attaches a public IP to an instance: POST /public-ips/{public_ip_id}/attach. Scope: write.

func (*PublicIPsService) Create

Create allocates a public IP: POST /public-ips. Scope: write.

func (*PublicIPsService) Delete

func (s *PublicIPsService) Delete(ctx context.Context, publicIPID string, opts ...RequestOption) (*Accepted, error)

Delete releases a public IP: DELETE /public-ips/{public_ip_id}. Scope: write.

func (*PublicIPsService) Detach

func (s *PublicIPsService) Detach(ctx context.Context, publicIPID string, opts ...RequestOption) (*Accepted, error)

Detach detaches a public IP from its instance: POST /public-ips/{public_ip_id}/detach. Scope: write.

func (*PublicIPsService) Get

func (s *PublicIPsService) Get(ctx context.Context, publicIPID string, opts ...RequestOption) (*PublicIP, error)

Get gets a public IP: GET /public-ips/{public_ip_id}. Scope: read.

func (*PublicIPsService) List

func (s *PublicIPsService) List(ctx context.Context, params *ListPublicIPsParams, opts ...RequestOption) ([]PublicIP, error)

List lists public IPs: GET /public-ips. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*PublicIPsService) Quote

func (s *PublicIPsService) Quote(ctx context.Context, opts ...RequestOption) (*MonthlyQuote, error)

Quote prices a public IP: GET /public-ips/quote. Scope: read.

type PutSnapshotScheduleRequest

type PutSnapshotScheduleRequest struct {
	// How often: `daily`, `weekly` or `monthly`. One of: daily, weekly, monthly.
	Frequency string `json:"frequency"`
	// How many successful automatic snapshots to keep, 1 to 168; older ones are deleted.
	RetentionCount *int `json:"retention_count,omitempty"`
	// False pauses the schedule without forgetting it.
	Enabled *bool `json:"enabled,omitempty"`
}

PutSnapshotScheduleRequest is the API's put snapshot schedule request object.

type RebuildRequest

type RebuildRequest struct {
	// The image to install, from `GET /public/v1/images`.
	ImageSlug *string `json:"image_slug,omitempty"`
}

RebuildRequest is the API's rebuild request object.

type Receipt

type Receipt struct {
	// e.g. `rcp_...`.
	ID string `json:"id"`
	// `PTD-RCT-<year>-<number>`, sequential within the year.
	Number string `json:"number"`
	// `payment` a card payment, `invoice_payment` an invoice paid by card or from credit, `credit_purchase` a top-up, `wallet_debit` credit taken for a new resource, `refund` money returned to your credit. One of: payment, invoice_payment, credit_purchase, wallet_debit, refund.
	Kind       string `json:"kind"`
	IssuerName string `json:"issuer_name"`
	// One of: NGN, USD.
	Currency    string `json:"currency"`
	AmountMinor int64  `json:"amount_minor"`
	// When the receipt was issued.
	IssuedAt *time.Time `json:"issued_at"`
	// When the money moved.
	OccurredAt *time.Time `json:"occurred_at"`
	// What it was for, e.g. `Account credit top-up`.
	Description string `json:"description"`
	// Your organization, as printed on the receipt.
	BilledTo string `json:"billed_to"`
	// The details printed on the receipt, e.g. the payment method (`Visa •••• 4242`) and the date.
	Facts []ReceiptFact `json:"facts"`
	// The code printed on the receipt, which Pantech uses to confirm a copy is genuine.
	Verification string `json:"verification"`
	// The account transaction the receipt is for, e.g. `ltx_...`.
	TransactionID string `json:"transaction_id"`
	// The size of the PDF.
	PDFBytes int64 `json:"pdf_bytes"`
}

Receipt is the API's receipt object. A receipt for money that moved on your account.

type ReceiptFact

type ReceiptFact struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

ReceiptFact is the API's receipt fact object.

type Region

type Region struct {
	// e.g. `af-abj`.
	Code string `json:"code"`
	// Its name for display.
	Name       string            `json:"name"`
	Placements []RegionPlacement `json:"placements"`
}

Region is the API's region object.

type RegionPlacement

type RegionPlacement struct {
	// `standard` instances or `vpc` networks. One of: standard, vpc.
	Kind              string  `json:"kind"`
	Zone              string  `json:"zone"`
	Available         bool    `json:"available"`
	UnavailableReason *string `json:"unavailable_reason"`
	// The range of the zone's private database network, e.g. `10.250.0.0/20`, when instances there can add a private network interface (`POST /public/v1/instances/{instance_id}/private-network`); null otherwise, and in every VPC zone.
	PrivateNetworkCIDR *string `json:"private_network_cidr"`
}

RegionPlacement is the API's region placement object.

type RenameMigrationRequest added in v0.2.0

type RenameMigrationRequest struct {
	Name string `json:"name"`
}

RenameMigrationRequest is the API's rename migration request object.

type RenameRequest

type RenameRequest struct {
	// The new name: 1 to 255 characters of lowercase letters a-z, digits 0-9 and hyphens (-), starting and ending with a letter or digit, unique among your instances.
	Name string `json:"name"`
}

RenameRequest is the API's rename request object.

type ReplaceDatabaseAccessRulesRequest

type ReplaceDatabaseAccessRulesRequest struct {
	// The complete new allow-list, at most 50 rules with no range twice.
	Rules []DatabaseAccessRuleRequest `json:"rules"`
}

ReplaceDatabaseAccessRulesRequest is the API's replace database access rules request object.

type ReplaceSecurityGroupRulesRequest

type ReplaceSecurityGroupRulesRequest struct {
	// The complete new rule list; at least one rule.
	Rules []SecurityGroupRule `json:"rules"`
}

ReplaceSecurityGroupRulesRequest is the API's replace security group rules request object.

type RequestOption

type RequestOption func(*requestOptions)

RequestOption changes one call made with Do.

func WithIdempotencyKey

func WithIdempotencyKey(key string) RequestOption

WithIdempotencyKey sends key as the Idempotency-Key instead of a new random one. Use it to make a change that is safe to repeat across processes: the API returns the original result for a key it has seen.

func WithNoRetry

func WithNoRetry() RequestOption

WithNoRetry sends the call once, whatever the answer.

func WithRequestHeader

func WithRequestHeader(key, value string) RequestOption

WithRequestHeader sets a header on this call only. It is applied last, so it replaces any header the SDK or WithHeader set.

type ResizeDatabaseStorageRequest

type ResizeDatabaseStorageRequest struct {
	// The new data disk size in GB: larger than the current `data_volume_size_gb`, at most the zone's `max_gb` (2000 today) and a multiple of its `step_gb` (10 today); see `storage` in `GET /public/v1/database-engines`.
	StorageGB int `json:"storage_gb"`
}

ResizeDatabaseStorageRequest is the API's resize database storage request object.

type ResizeKubernetesClusterPlanRequest

type ResizeKubernetesClusterPlanRequest struct {
	// The new node plan slug, from the plans list.
	NodePlan string `json:"node_plan"`
}

ResizeKubernetesClusterPlanRequest is the API's resize kubernetes cluster plan request object.

type ResizeRequest

type ResizeRequest struct {
	// A bigger plan than the instance's current one, from `GET /public/v1/plans`.
	PlanSlug string `json:"plan_slug"`
}

ResizeRequest is the API's resize request object.

type ResizeVolumeRequest

type ResizeVolumeRequest struct {
	// The volume type after the resize, from `GET /public/v1/disk-offerings`.
	DiskOfferingSlug string `json:"disk_offering_slug"`
	// The new size in GB, for a custom-size offering: larger than the current size.
	SizeGB *int `json:"size_gb,omitempty"`
}

ResizeVolumeRequest is the API's resize volume request object.

type ResourceCost

type ResourceCost struct {
	ResourceID          string `json:"resource_id"`
	ResourceName        string `json:"resource_name"`
	ResourceKind        string `json:"resource_kind"`
	Type                string `json:"type"`
	DaysActive          int    `json:"days_active"`
	WindowDays          int    `json:"window_days"`
	RateUnit            string `json:"rate_unit"`
	RateUnitPriceMicros int64  `json:"rate_unit_price_micros"`
	CostMinor           int64  `json:"cost_minor"`
}

ResourceCost is the API's resource cost object.

type RestoreRequest

type RestoreRequest struct {
	// A snapshot of this instance's root disk.
	SnapshotID string `json:"snapshot_id"`
	// The instance's current name, exactly, to confirm: everything written since the snapshot is lost.
	ConfirmName string `json:"confirm_name"`
}

RestoreRequest is the API's restore request object.

type RestoreSnapshotRequest

type RestoreSnapshotRequest struct {
	// Name of the new volume, 1 to 255 characters.
	Name string `json:"name"`
	// The new volume's type, from `GET /public/v1/disk-offerings`.
	DiskOfferingSlug string `json:"disk_offering_slug"`
	// For a custom-size offering: at least the snapshot's size in GB.
	SizeGB *int `json:"size_gb,omitempty"`
}

RestoreSnapshotRequest is the API's restore snapshot request object.

type SSHAccessGrant

type SSHAccessGrant struct {
	// e.g. `sshg_...`.
	ID         string `json:"id"`
	InstanceID string `json:"instance_id"`
	// `pending` while the port is being opened, `active` once you can connect, then `revoking`, `revoked`, `expired` or `failed`. One of: pending, active, revoking, revoked, expired, failed.
	Status string `json:"status"`
	// Connect here once `active`.
	Host *string `json:"host"`
	// The port to connect to once `active`, usually 22.
	Port *int `json:"port"`
	// When the port closes by itself, 15 minutes after it opened.
	ExpiresAt *time.Time `json:"expires_at"`
	// When it was revoked; null otherwise.
	RevokedAt *time.Time `json:"revoked_at"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
}

SSHAccessGrant is the API's sshaccess grant object.

type SSHKey

type SSHKey struct {
	// e.g. `sshk_...`.
	ID string `json:"id"`
	// Its name, unique among your SSH keys.
	Name string `json:"name"`
	// The key's SHA256 fingerprint.
	Fingerprint string `json:"fingerprint"`
	// The OpenSSH public key.
	PublicKey string `json:"public_key"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
}

SSHKey is the API's sshkey object.

type SSHKeysService

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

SSHKeysService manages the SSH keys installed on new instances.

func (*SSHKeysService) Create

Create adds or generates an SSH key: POST /ssh-keys. Scope: write.

func (*SSHKeysService) Delete

func (s *SSHKeysService) Delete(ctx context.Context, sshKeyID string, opts ...RequestOption) error

Delete deletes an SSH key: DELETE /ssh-keys/{ssh_key_id}. Scope: write.

func (*SSHKeysService) Get

func (s *SSHKeysService) Get(ctx context.Context, sshKeyID string, opts ...RequestOption) (*SSHKey, error)

Get gets an SSH key: GET /ssh-keys/{ssh_key_id}. Scope: read.

func (*SSHKeysService) List

func (s *SSHKeysService) List(ctx context.Context, opts ...RequestOption) ([]SSHKey, error)

List lists SSH keys: GET /ssh-keys. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

type ScaleKubernetesNodePoolRequest

type ScaleKubernetesNodePoolRequest struct {
	// Worker nodes, 1 to 10.
	Workers            *int  `json:"workers,omitempty"`
	AutoscalingEnabled *bool `json:"autoscaling_enabled,omitempty"`
	MinWorkers         *int  `json:"min_workers,omitempty"`
	MaxWorkers         *int  `json:"max_workers,omitempty"`
}

ScaleKubernetesNodePoolRequest is the API's scale kubernetes node pool request object.

type SecurityGroup

type SecurityGroup struct {
	// e.g. `sg_...`.
	ID string `json:"id"`
	// Its name, unique among your live security groups.
	Name string `json:"name"`
	// Its rules.
	Rules []SecurityGroupRule `json:"rules"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

SecurityGroup is the API's security group object. A reusable firewall for standard instances.

type SecurityGroupRule

type SecurityGroupRule struct {
	// `ingress` (into the instance) or `egress` (out of it). One of: ingress, egress.
	Direction string `json:"direction"`
	// `tcp`, `udp`, `icmp` or `all`. One of: tcp, udp, icmp, all.
	Protocol string `json:"protocol"`
	// For `tcp`/`udp`: one port (`22`) or an inclusive range (`8000-8100`).
	PortRange string `json:"port_range"`
	// One IPv4 CIDR: the source for `ingress`, the destination for `egress`, e.g. `203.0.113.4/32`.
	CIDR string `json:"cidr"`
}

SecurityGroupRule is the API's security group rule object.

type SecurityGroupsService

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

SecurityGroupsService manages security groups, the firewalls of standard instances.

func (*SecurityGroupsService) All

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*SecurityGroupsService) Create

Create creates a security group: POST /security-groups. Scope: write.

func (*SecurityGroupsService) Delete

func (s *SecurityGroupsService) Delete(ctx context.Context, securityGroupID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a security group: DELETE /security-groups/{security_group_id}. Scope: write.

func (*SecurityGroupsService) Get

func (s *SecurityGroupsService) Get(ctx context.Context, securityGroupID string, opts ...RequestOption) (*SecurityGroup, error)

Get gets a security group: GET /security-groups/{security_group_id}. Scope: read.

func (*SecurityGroupsService) List

List lists security groups: GET /security-groups. Scope: read.

func (*SecurityGroupsService) ReplaceRules

func (s *SecurityGroupsService) ReplaceRules(ctx context.Context, securityGroupID string, req ReplaceSecurityGroupRulesRequest, opts ...RequestOption) (*Accepted, error)

ReplaceRules replaces a security group's rules: PUT /security-groups/{security_group_id}/rules. Scope: write.

type SetDatabaseSecurityGroupsRequest

type SetDatabaseSecurityGroupsRequest struct {
	// The complete set to attach: at most 5 distinct ids of your own security groups in the database's zone, e.g. `sg_…`.
	SecurityGroupIDs []string `json:"security_group_ids"`
}

SetDatabaseSecurityGroupsRequest is the API's set database security groups request object.

type Snapshot

type Snapshot struct {
	// e.g. `snap_...`.
	ID string `json:"id"`
	// Its name, unique among its source's snapshots.
	Name string `json:"name"`
	// Set for a snapshot of an instance's root disk.
	InstanceID *string `json:"instance_id"`
	// The source instance's name; null when it is gone or not an instance snapshot.
	SourceInstanceName *string `json:"source_instance_name"`
	// Set for a snapshot of a volume.
	VolumeID *string `json:"volume_id"`
	// The source volume's name; null when it is gone or not a volume snapshot.
	VolumeName *string `json:"volume_name"`
	// Set for a snapshot of a managed database's data disk.
	DatabaseID *string `json:"database_id"`
	// The source's region, e.g. `af-abj`.
	Region *string `json:"region"`
	// `automatic` when taken by a snapshot schedule. One of: manual, automatic.
	Trigger string `json:"trigger"`
	// Storage used; 0 until complete.
	SizeBytes int64 `json:"size_bytes"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// When the snapshot finished; null until then.
	CompletedAt *time.Time `json:"completed_at"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Snapshot is the API's snapshot object.

type SnapshotSchedule

type SnapshotSchedule struct {
	// The instance whose root disk is snapshotted; null for a volume's schedule.
	InstanceID *string `json:"instance_id"`
	// The volume snapshotted; null for an instance's schedule.
	VolumeID *string `json:"volume_id"`
	// `daily`, `weekly` or `monthly`. One of: daily, weekly, monthly.
	Frequency string `json:"frequency"`
	// Successful copies kept; older ones are deleted.
	RetentionCount int `json:"retention_count"`
	// False while paused.
	Enabled bool `json:"enabled"`
	// When the next automatic snapshot is due; null while paused.
	NextRunAt *time.Time `json:"next_run_at"`
}

SnapshotSchedule is the API's snapshot schedule object.

type SnapshotsService

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

SnapshotsService manages snapshots of root disks, volumes and databases.

func (*SnapshotsService) All

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*SnapshotsService) Delete

func (s *SnapshotsService) Delete(ctx context.Context, snapshotID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a snapshot: DELETE /snapshots/{snapshot_id}. Scope: write.

func (*SnapshotsService) Get

func (s *SnapshotsService) Get(ctx context.Context, snapshotID string, opts ...RequestOption) (*Snapshot, error)

Get gets a snapshot: GET /snapshots/{snapshot_id}. Scope: read.

func (*SnapshotsService) GetUsage

func (s *SnapshotsService) GetUsage(ctx context.Context, snapshotID string, opts ...RequestOption) (*UsageSummary, error)

GetUsage gets a snapshot's usage: GET /snapshots/{snapshot_id}/usage. Scope: read.

func (*SnapshotsService) List

func (s *SnapshotsService) List(ctx context.Context, params *ListParams, opts ...RequestOption) (*Page[Snapshot], error)

List lists snapshots: GET /snapshots. Scope: read.

func (*SnapshotsService) Quote

func (s *SnapshotsService) Quote(ctx context.Context, sizeGB int, opts ...RequestOption) (*OptionalQuote, error)

Quote prices a snapshot: GET /snapshots/quote. Scope: read.

func (*SnapshotsService) Restore

func (s *SnapshotsService) Restore(ctx context.Context, snapshotID string, req RestoreSnapshotRequest, opts ...RequestOption) (*Accepted, error)

Restore restores a snapshot to a new volume: POST /snapshots/{snapshot_id}/restore. Scope: write.

type Subnet

type Subnet struct {
	// e.g. `snet_...`.
	ID        string `json:"id"`
	NetworkID string `json:"network_id"`
	// Its name.
	Name string `json:"name"`
	// Inside the VPC's CIDR.
	CIDR string `json:"cidr"`
	// e.g. `af-abj`.
	Region *string `json:"region"`
	// e.g. `af-abj-2`.
	Zone *string `json:"zone"`
	// Instances in this subnet; null when they could not be counted.
	InstanceCount *int `json:"instance_count"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Subnet is the API's subnet object.

type SubnetsService

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

SubnetsService manages the subnets of VPC networks.

func (*SubnetsService) All

func (s *SubnetsService) All(ctx context.Context, networkID string, params *ListParams, opts ...RequestOption) iter.Seq2[Subnet, error]

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*SubnetsService) Create

func (s *SubnetsService) Create(ctx context.Context, networkID string, req CreateSubnetRequest, opts ...RequestOption) (*Accepted, error)

Create creates a subnet: POST /networks/{network_id}/subnets. Scope: write.

func (*SubnetsService) Delete

func (s *SubnetsService) Delete(ctx context.Context, subnetID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a subnet: DELETE /subnets/{subnet_id}. Scope: write.

func (*SubnetsService) Get

func (s *SubnetsService) Get(ctx context.Context, subnetID string, opts ...RequestOption) (*Subnet, error)

Get gets a subnet: GET /subnets/{subnet_id}. Scope: read.

func (*SubnetsService) List

func (s *SubnetsService) List(ctx context.Context, networkID string, params *ListParams, opts ...RequestOption) (*Page[Subnet], error)

List lists subnets: GET /networks/{network_id}/subnets. Scope: read.

type ToggleKubernetesAddonRequest

type ToggleKubernetesAddonRequest struct {
	// Whether the add-on should be enabled or disabled.
	Enabled bool `json:"enabled"`
}

ToggleKubernetesAddonRequest is the API's toggle kubernetes addon request object.

type UpdateCloudConnectionRequest added in v0.2.0

type UpdateCloudConnectionRequest struct {
	Name *string `json:"name,omitempty"`
	// The stack's RoleArn output.
	RoleARN *string `json:"role_arn,omitempty"`
	// Check the role again.
	Retry *bool `json:"retry,omitempty"`
}

UpdateCloudConnectionRequest is the API's update cloud connection request object.

type UpdateKubernetesClusterRequest

type UpdateKubernetesClusterRequest struct {
	// A fixed worker count, 1 to 10.
	Workers     *int                   `json:"workers,omitempty"`
	Autoscaling *KubernetesAutoscaling `json:"autoscaling,omitempty"`
	// VPC zone only: the whole new list of IPv4 CIDRs allowed to reach the API server.
	APIAllowedCIDRs *[]string `json:"api_allowed_cidrs,omitempty"`
}

UpdateKubernetesClusterRequest is the API's update kubernetes cluster request object. Send any of the fields; those left out stay as they are.

type UpdateLoadBalancerRequest

type UpdateLoadBalancerRequest struct {
	// A new name, 1 to 63 characters.
	Name *string `json:"name,omitempty"`
	// One of: roundrobin, leastconn, source.
	Algorithm *string `json:"algorithm,omitempty"`
	// The whole new set of targets (at most 50).
	InstanceIDs *[]string `json:"instance_ids,omitempty"`
}

UpdateLoadBalancerRequest is the API's update load balancer request object.

type UpdateMigrationItemRequest added in v0.2.0

type UpdateMigrationItemRequest struct {
	// The item's key.
	Key       string  `json:"key"`
	Excluded  *bool   `json:"excluded,omitempty"`
	PlanSlug  *string `json:"plan_slug,omitempty"`
	StorageGB *int    `json:"storage_gb,omitempty"`
	CIDR      *string `json:"cidr,omitempty"`
	// One of: member, admin.
	Role  *string `json:"role,omitempty"`
	Email *string `json:"email,omitempty"`
}

UpdateMigrationItemRequest is the API's update migration item request object.

type UpdateWebhookRequest

type UpdateWebhookRequest struct {
	// A new `https` URL.
	URL *string `json:"url,omitempty"`
	// A new note, at most 255 characters.
	Description *string `json:"description,omitempty"`
	// The new subscriptions, replacing the old ones.
	Events *[]string `json:"events,omitempty"`
	// `false` stops deliveries; `true` resumes them and clears the failure history.
	Enabled *bool `json:"enabled,omitempty"`
}

UpdateWebhookRequest is the API's update webhook request object.

type UpgradeKubernetesClusterRequest

type UpgradeKubernetesClusterRequest struct {
	// One of the cluster's `available_upgrades`.
	KubernetesVersionID string `json:"kubernetes_version_id"`
}

UpgradeKubernetesClusterRequest is the API's upgrade kubernetes cluster request object.

type UpgradeKubernetesNetworkRequest

type UpgradeKubernetesNetworkRequest struct {
	// The new CNI plugin (`flannel`, `wireguard`, or `calico`).
	CNIPlugin *string `json:"cni_plugin,omitempty"`
	// The new IPv4 CIDR range allocated for cluster pods.
	PodCIDR *string `json:"pod_cidr,omitempty"`
	// The new IPv4 CIDR range allocated for cluster services.
	ServiceCIDR *string `json:"service_cidr,omitempty"`
	// The new allowed IPv4 CIDRs reaching the API server.
	APIAllowedCIDRs *[]string `json:"api_allowed_cidrs,omitempty"`
}

UpgradeKubernetesNetworkRequest is the API's upgrade kubernetes network request object.

type UsageByResource

type UsageByResource struct {
	Currency    string         `json:"currency"`
	PeriodStart string         `json:"period_start"`
	PeriodEnd   string         `json:"period_end"`
	Data        []ResourceCost `json:"data"`
}

UsageByResource is the API's usage by resource object.

type UsageByResourceParams

type UsageByResourceParams struct {
	// One of: 30d, 7d, month, last_month.
	Period string
}

UsageByResourceParams are the query parameters of usage by resource. Zero values are left out.

type UsageEntry

type UsageEntry struct {
	ResourceID  *string    `json:"resource_id"`
	UsageType   int        `json:"usage_type"`
	Usage       string     `json:"usage"`
	PeriodStart *time.Time `json:"period_start"`
	PeriodEnd   *time.Time `json:"period_end"`
}

UsageEntry is the API's usage entry object.

type UsageSummary

type UsageSummary struct {
	// Start of the measured window; null when nothing was measured.
	WindowStart *time.Time `json:"window_start"`
	// End of the measured window; null when nothing was measured.
	WindowEnd *time.Time   `json:"window_end"`
	Totals    UsageTotals  `json:"totals"`
	Entries   []UsageEntry `json:"entries"`
}

UsageSummary is the API's usage summary object.

type UsageTotals

type UsageTotals struct {
	RunningHours           float64 `json:"running_hours"`
	StorageGBHours         float64 `json:"storage_gb_hours"`
	AllocatedMemoryMBHours float64 `json:"allocated_memory_mb_hours"`
	NetworkBytesSent       float64 `json:"network_bytes_sent"`
	NetworkBytesReceived   float64 `json:"network_bytes_received"`
}

UsageTotals is the API's usage totals object.

type Volume

type Volume struct {
	// e.g. `vol_...`.
	ID string `json:"id"`
	// Its name.
	Name string `json:"name"`
	// Its size in GB.
	SizeGB int `json:"size_gb"`
	// See `GET /public/v1/disk-offerings`.
	DiskOfferingSlug string `json:"disk_offering_slug"`
	// The storage class, e.g. `shared`; null when not stated.
	StorageType *string `json:"storage_type"`
	Region      *string `json:"region"`
	Zone        *string `json:"zone"`
	// The instance it is attached to; null when detached.
	AttachedInstanceID *string `json:"attached_instance_id"`
	// That instance's name; null when detached.
	AttachedInstanceName *string `json:"attached_instance_name"`
	// Where an attach in progress is moving it.
	DesiredInstanceID *string `json:"desired_instance_id"`
	// Where it is mounted, when mounted at create; null otherwise.
	MountPoint *string `json:"mount_point"`
	// Set when restored from a snapshot.
	SourceSnapshotID *string `json:"source_snapshot_id"`
	// What it costs per month at its size; null when it cannot be priced.
	MonthlyCost *VolumeMonthlyCost `json:"monthly_cost"`
	// What you asked for: `present`, or `deleted` once you deleted it. One of: present, deleted.
	DesiredState string `json:"desired_state"`
	// What the platform last observed: `pending` and `provisioning` while it is being created, `active` once ready, `deleting`/`deleted` on the way out, `failed` if it could not be made, `unknown` when it could not be checked. One of: pending, provisioning, active, deleting, deleted, failed, unknown.
	ObservedState string `json:"observed_state"`
	// What the platform can truthfully say about this volume's encryption.
	Encryption *VolumeEncryption `json:"encryption"`
	// When it was created (RFC 3339, UTC).
	CreatedAt *time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt *time.Time `json:"updated_at"`
}

Volume is the API's volume object.

type VolumeEncryption

type VolumeEncryption struct {
	// One of: none, requested, encrypted.
	Status string `json:"status"`
}

VolumeEncryption is the API's volume encryption object. What the platform can truthfully say about this volume's encryption.

type VolumeKeyCredential

type VolumeKeyCredential struct {
	InstanceID string `json:"instance_id"`
	// The secret, `pvk_` followed by 43 characters.
	Credential string `json:"credential"`
}

VolumeKeyCredential is the API's volume key credential object.

type VolumeMonthlyCost

type VolumeMonthlyCost struct {
	Currency    string `json:"currency"`
	AmountMinor int64  `json:"amount_minor"`
}

VolumeMonthlyCost is the API's volume monthly cost object. What it costs per month at its size; null when it cannot be priced.

type VolumesService

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

VolumesService manages data disks.

func (*VolumesService) All

func (s *VolumesService) All(ctx context.Context, params *ListParams, opts ...RequestOption) iter.Seq2[Volume, error]

All iterates over every item of List, fetching pages as needed. It stops at the first error, which it yields.

func (*VolumesService) AllSnapshots

func (s *VolumesService) AllSnapshots(ctx context.Context, volumeID string, params *ListParams, opts ...RequestOption) iter.Seq2[Snapshot, error]

AllSnapshots iterates over every item of ListSnapshots, fetching pages as needed. It stops at the first error, which it yields.

func (*VolumesService) Attach

func (s *VolumesService) Attach(ctx context.Context, volumeID string, req AttachVolumeRequest, opts ...RequestOption) (*Accepted, error)

Attach attaches a volume: POST /volumes/{volume_id}/attach. Scope: write.

func (*VolumesService) Create

Create creates a volume: POST /volumes. Scope: write.

func (*VolumesService) CreateSnapshot

func (s *VolumesService) CreateSnapshot(ctx context.Context, volumeID string, req CreateSnapshotRequest, opts ...RequestOption) (*Accepted, error)

CreateSnapshot snapshots a volume: POST /volumes/{volume_id}/snapshots. Scope: write.

func (*VolumesService) Delete

func (s *VolumesService) Delete(ctx context.Context, volumeID string, opts ...RequestOption) (*Accepted, error)

Delete deletes a volume: DELETE /volumes/{volume_id}. Scope: write.

func (*VolumesService) Detach

func (s *VolumesService) Detach(ctx context.Context, volumeID string, opts ...RequestOption) (*Accepted, error)

Detach detaches a volume: POST /volumes/{volume_id}/detach. Scope: write.

func (*VolumesService) Get

func (s *VolumesService) Get(ctx context.Context, volumeID string, opts ...RequestOption) (*Volume, error)

Get gets a volume: GET /volumes/{volume_id}. Scope: read.

func (*VolumesService) GetSnapshotSchedule

func (s *VolumesService) GetSnapshotSchedule(ctx context.Context, volumeID string, opts ...RequestOption) (*SnapshotSchedule, error)

GetSnapshotSchedule gets a volume's snapshot schedule: GET /volumes/{volume_id}/snapshot-schedule. Scope: read.

func (*VolumesService) GetUsage

func (s *VolumesService) GetUsage(ctx context.Context, volumeID string, opts ...RequestOption) (*UsageSummary, error)

GetUsage gets a volume's usage: GET /volumes/{volume_id}/usage. Scope: read.

func (*VolumesService) List

func (s *VolumesService) List(ctx context.Context, params *ListParams, opts ...RequestOption) (*Page[Volume], error)

List lists volumes: GET /volumes. Scope: read.

func (*VolumesService) ListSnapshots

func (s *VolumesService) ListSnapshots(ctx context.Context, volumeID string, params *ListParams, opts ...RequestOption) (*Page[Snapshot], error)

ListSnapshots lists a volume's snapshots: GET /volumes/{volume_id}/snapshots. Scope: read.

func (*VolumesService) PutSnapshotSchedule

func (s *VolumesService) PutSnapshotSchedule(ctx context.Context, volumeID string, req PutSnapshotScheduleRequest, opts ...RequestOption) (*SnapshotSchedule, error)

PutSnapshotSchedule sets a volume's snapshot schedule: PUT /volumes/{volume_id}/snapshot-schedule. Scope: write.

func (*VolumesService) Resize

func (s *VolumesService) Resize(ctx context.Context, volumeID string, req ResizeVolumeRequest, opts ...RequestOption) (*Accepted, error)

Resize grows a volume: POST /volumes/{volume_id}/resize. Scope: write.

type WaitOptions

type WaitOptions struct {
	// Interval is the pause between polls. Default 2s.
	Interval time.Duration
	// Timeout bounds the whole wait. 0 means only ctx bounds it.
	Timeout time.Duration
}

WaitOptions tune a wait. The zero value polls every 2 seconds with no time limit beyond ctx's.

type Webhook

type Webhook struct {
	// e.g. `whk_...`.
	ID string `json:"id"`
	// Where events are sent: an `https` URL on the public internet.
	URL string `json:"url"`
	// Your note about it; may be empty.
	Description string `json:"description"`
	// What it subscribes to: event types, `<resource>.*`, or `*`.
	Events []string `json:"events"`
	// Whether events are sent to it.
	Enabled bool `json:"enabled"`
	// Why it is disabled: `disabled_by_user`, or `failing` after three days of failed deliveries. One of: disabled_by_user, failing.
	DisabledReason *string `json:"disabled_reason"`
	// When its deliveries started failing with no success since (RFC 3339, UTC); null while they succeed.
	FailingSince *time.Time `json:"failing_since"`
	// When it was created (RFC 3339, UTC).
	CreatedAt time.Time `json:"created_at"`
	// When it last changed (RFC 3339, UTC).
	UpdatedAt time.Time `json:"updated_at"`
}

Webhook is the API's webhook object. A URL Pantech sends your organization's events to.

type WebhookDelivery

type WebhookDelivery struct {
	// e.g. `whd_...`.
	ID string `json:"id"`
	// The webhook it is for.
	WebhookID string `json:"webhook_id"`
	// The event's `id`, the same in every delivery of it: deduplicate on it.
	EventID string `json:"event_id"`
	// e.g. `instance.created`.
	EventType string `json:"event_type"`
	// `pending` until it succeeds, fails eight times, or is cancelled because the webhook was disabled or deleted. One of: pending, succeeded, failed, canceled.
	Status string `json:"status"`
	// How many times it has been sent.
	Attempts int `json:"attempts"`
	// When it is next sent, while `pending`.
	NextAttemptAt *time.Time `json:"next_attempt_at"`
	// When it was last sent.
	LastAttemptAt *time.Time `json:"last_attempt_at"`
	// The HTTP status your endpoint last answered; null if it did not answer.
	LastStatusCode *int `json:"last_status_code"`
	// Why the last attempt failed: `http_<status>`, `timeout`, `connection_failed`, `dns_failed`, `tls_failed`, `blocked_address` (the URL resolved to an address that is not on the public internet), `invalid_url`, `endpoint_disabled` or `endpoint_deleted`.
	LastError *string `json:"last_error"`
	// The first 1,024 characters of your endpoint's last response body.
	LastResponse *string `json:"last_response"`
	// How long the last attempt took, in milliseconds.
	LastDurationMS *int `json:"last_duration_ms"`
	// When it succeeded.
	DeliveredAt *time.Time `json:"delivered_at"`
	// When the event was queued for this webhook.
	CreatedAt time.Time `json:"created_at"`
}

WebhookDelivery is the API's webhook delivery object. One event sent, or waiting to be sent, to one webhook.

type WebhookDeliveryDetail

type WebhookDeliveryDetail struct {
	WebhookDelivery
	Payload WebhookEvent `json:"payload"`
}

WebhookDeliveryDetail is the API's webhook delivery detail object.

type WebhookEvent

type WebhookEvent struct {
	// The event's id (`evt_…`).
	ID string `json:"id"`
	// e.g. `instance.created`, `invoice.paid`, `webhook.test`.
	Type string `json:"type"`
	// The shape of this body, as a date: `2026-10-22`.
	APIVersion string `json:"api_version"`
	// When it happened (RFC 3339, UTC).
	CreatedAt time.Time `json:"created_at"`
	// Your organization.
	OrganizationID string `json:"organization_id"`
	// The project (`acc_…`) the resource is in.
	ProjectID string `json:"project_id"`
	// What happened; depends on `type`.
	Data map[string]any `json:"data"`
}

WebhookEvent is the API's webhook event object. The body of every delivery.

func ParseWebhook

func ParseWebhook(secret string, header string, body []byte, tolerance time.Duration) (*WebhookEvent, error)

ParseWebhook verifies a delivery like VerifyWebhook, then decodes its body.

type WebhookEventType

type WebhookEventType struct {
	// e.g. `instance.created`.
	Type string `json:"type"`
	// What it is about, for `<resource>.*` subscriptions.
	Resource string `json:"resource"`
	// What it means.
	Description string `json:"description"`
}

WebhookEventType is the API's webhook event type object.

type WebhookWithSecret

type WebhookWithSecret struct {
	Webhook
	// The signing secret (`whsec_…`).
	Secret *string `json:"secret"`
}

WebhookWithSecret is the API's webhook with secret object.

type WebhooksService

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

WebhooksService manages webhooks and their deliveries.

func (*WebhooksService) AllDeliveries

func (s *WebhooksService) AllDeliveries(ctx context.Context, webhookID string, params *PageParams, opts ...RequestOption) iter.Seq2[WebhookDelivery, error]

AllDeliveries iterates over every item of ListDeliveries, fetching pages as needed. It stops at the first error, which it yields.

func (*WebhooksService) Create

Create creates a webhook: POST /webhooks. Scope: write.

func (*WebhooksService) Delete

func (s *WebhooksService) Delete(ctx context.Context, webhookID string, opts ...RequestOption) error

Delete deletes a webhook: DELETE /webhooks/{webhook_id}. Scope: write.

func (*WebhooksService) Get

func (s *WebhooksService) Get(ctx context.Context, webhookID string, opts ...RequestOption) (*Webhook, error)

Get gets a webhook: GET /webhooks/{webhook_id}. Scope: read.

func (*WebhooksService) GetDelivery

func (s *WebhooksService) GetDelivery(ctx context.Context, webhookID string, deliveryID string, opts ...RequestOption) (*WebhookDeliveryDetail, error)

GetDelivery gets a delivery: GET /webhooks/{webhook_id}/deliveries/{delivery_id}. Scope: read.

func (*WebhooksService) List

func (s *WebhooksService) List(ctx context.Context, opts ...RequestOption) ([]Webhook, error)

List lists webhooks: GET /webhooks. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*WebhooksService) ListDeliveries

func (s *WebhooksService) ListDeliveries(ctx context.Context, webhookID string, params *PageParams, opts ...RequestOption) (*Page[WebhookDelivery], error)

ListDeliveries lists a webhook's deliveries: GET /webhooks/{webhook_id}/deliveries. Scope: read.

func (*WebhooksService) ListEventTypes

func (s *WebhooksService) ListEventTypes(ctx context.Context, opts ...RequestOption) ([]WebhookEventType, error)

ListEventTypes lists webhook event types: GET /webhook-event-types. Scope: read. It follows next_cursor until the list ends, so the slice holds every item.

func (*WebhooksService) Redeliver

func (s *WebhooksService) Redeliver(ctx context.Context, webhookID string, deliveryID string, opts ...RequestOption) (*WebhookDelivery, error)

Redeliver sends a delivery again: POST /webhooks/{webhook_id}/deliveries/{delivery_id}/redeliver. Scope: write.

func (*WebhooksService) RotateSecret

func (s *WebhooksService) RotateSecret(ctx context.Context, webhookID string, opts ...RequestOption) (*WebhookWithSecret, error)

RotateSecret rotates a webhook's secret: POST /webhooks/{webhook_id}/rotate-secret. Scope: write.

func (*WebhooksService) Test

func (s *WebhooksService) Test(ctx context.Context, webhookID string, opts ...RequestOption) (*WebhookDeliveryDetail, error)

Test sends a test event: POST /webhooks/{webhook_id}/test. Scope: write.

func (*WebhooksService) Update

func (s *WebhooksService) Update(ctx context.Context, webhookID string, req UpdateWebhookRequest, opts ...RequestOption) (*Webhook, error)

Update changes a webhook: PATCH /webhooks/{webhook_id}. Scope: write.

Directories

Path Synopsis
examples
create-instance command
Command create-instance orders an instance, waits until it is provisioned and running, and prints its address.
Command create-instance orders an instance, waits until it is provisioned and running, and prints its address.
list-everything command
Command list-everything prints what the API key's organization runs: instances, volumes, networks, databases and Kubernetes clusters.
Command list-everything prints what the API key's organization runs: instances, volumes, networks, databases and Kubernetes clusters.
migrate-from-aws command
Command migrate-from-aws connects an AWS account to Pantech through a read-only role, scans it, plans the move, prints the price comparison and writes the plan as Terraform.
Command migrate-from-aws connects an AWS account to Pantech through a read-only role, scans it, plans the move, prints the price comparison and writes the plan as Terraform.
wait-operation command
Command wait-operation stops or starts an instance and follows the change, either by polling or over the event stream.
Command wait-operation stops or starts an instance and follows the change, either by polling or over the event stream.
webhook-receiver command
Command webhook-receiver accepts Pantech webhook deliveries and verifies their signatures before acting on them.
Command webhook-receiver accepts Pantech webhook deliveries and verifies their signatures before acting on them.

Jump to

Keyboard shortcuts

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