client

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

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

Documentation

Overview

Package client owns authenticated API transport. Only invoice downloads follow redirects, dropping credentials when leaving the original origin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactRecord

type ArtifactRecord struct {
	Fields  map[string]any
	RawJSON json.RawMessage
}

ArtifactRecord retains the server's field order for human-readable metadata.

type AuditPage

type AuditPage struct {
	Page
	EventData []json.RawMessage
}

type Client

type Client struct {
	Config    config.Config
	HTTP      *http.Client
	UserAgent string
	Trace     io.Writer
	Timings   io.Writer
}

func New

func New(cfg config.Config, transport *http.Client, userAgent string) *Client

New copies the HTTP client so composing an admin command cannot change another client's redirect policy or timeout. Credentials are sent only to Config.Host.

func (*Client) AccessToken

func (c *Client) AccessToken(ctx context.Context, path string) (map[string]any, error)

func (*Client) AccessTokens

func (c *Client) AccessTokens(ctx context.Context, path string, query url.Values) (Page, error)

func (*Client) Artifact

func (c *Client) Artifact(ctx context.Context, path string) (ArtifactRecord, error)

func (*Client) Artifacts

func (c *Client) Artifacts(ctx context.Context, path string, query url.Values) (Page, error)

func (*Client) AttachPaymentMethod

func (c *Client) AttachPaymentMethod(ctx context.Context, path, id string) (map[string]any, error)

func (*Client) AuditEvents

func (c *Client) AuditEvents(ctx context.Context, org string, query url.Values) (AuditPage, error)

func (*Client) BillingSettings

func (c *Client) BillingSettings(ctx context.Context, path string) (map[string]any, error)

func (*Client) BillingSummary

func (c *Client) BillingSummary(ctx context.Context, path string) (map[string]any, error)

func (*Client) CacheEntries

func (c *Client) CacheEntries(ctx context.Context, org, repo string, query url.Values) (Page, error)

func (*Client) CacheUsage

func (c *Client) CacheUsage(ctx context.Context, org, repo string) (map[string]any, error)

func (*Client) CancelRun

func (c *Client) CancelRun(ctx context.Context, org, id string) (map[string]any, error)

func (*Client) ConfigureSAML

func (c *Client) ConfigureSAML(ctx context.Context, path string, metadata []byte, query url.Values) (map[string]any, error)

func (*Client) ConfirmCard

func (c *Client) ConfirmCard(ctx context.Context, key, secret string, card StripeCard) (string, error)

ConfirmCard uses a fixed Stripe origin and deliberately bypasses API tracing, authentication and cookies. Its transport is injectable for isolated tests.

func (*Client) CreateFirewallRule

func (c *Client) CreateFirewallRule(ctx context.Context, path string, body map[string]any) (map[string]any, error)

func (*Client) CreateGitLabRunner

func (c *Client) CreateGitLabRunner(ctx context.Context, token string, body map[string]any) (string, string, error)

CreateGitLabRunner sends the personal token only to GitLab's fixed origin. It does not inherit API authentication, tracing, cookies, or redirects.

func (*Client) CreateOrganization

func (c *Client) CreateOrganization(ctx context.Context, name string) (map[string]any, error)

func (*Client) CreateVM

func (c *Client) CreateVM(ctx context.Context, path string, request map[string]any, rules *[]any, bootstrap map[string]any) (map[string]any, error)

func (*Client) DeleteFirewallRule

func (c *Client) DeleteFirewallRule(ctx context.Context, path string) error

func (*Client) DeleteVM

func (c *Client) DeleteVM(ctx context.Context, path string) (map[string]any, error)

func (*Client) DispatchWorkflow

func (c *Client) DispatchWorkflow(ctx context.Context, org, repo, file, ref string, inputs map[string]string) (map[string]any, error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body any) (map[string]any, error)

func (*Client) Download

func (c *Client) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download streams an authenticated response, with an inactivity timeout rather than a whole-file deadline. The caller must close the body. Redirects are refused even if the supplied transport allows them.

func (*Client) DownloadDecoded

func (c *Client) DownloadDecoded(ctx context.Context, path string) (io.ReadCloser, error)

DownloadDecoded supports opaque analysis artifacts with the same compression negotiation as Python. The decoded bytes stream without the JSON size limit.

func (*Client) DownloadInvoice

func (c *Client) DownloadInvoice(ctx context.Context, path string) (io.ReadCloser, error)

DownloadInvoice follows PDF redirects without forwarding API credentials outside the original origin. Other API and artifact requests refuse redirects.

func (*Client) EmailDomains

func (c *Client) EmailDomains(ctx context.Context, path string) (Page, error)

func (*Client) EnforceSAML

func (c *Client) EnforceSAML(ctx context.Context, path string, enforce bool) (map[string]any, error)

func (*Client) FeatureFlag

func (c *Client) FeatureFlag(ctx context.Context, org, key string) (map[string]any, error)

func (*Client) FirewallFlows

func (c *Client) FirewallFlows(ctx context.Context, path string, query url.Values) (map[string]any, error)

func (*Client) FirewallRules

func (c *Client) FirewallRules(ctx context.Context, path string) (Page, error)

func (*Client) GenerateSBOM

func (c *Client) GenerateSBOM(ctx context.Context, path string, body map[string]any) (map[string]any, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, query url.Values) (map[string]any, error)

func (*Client) GitClusters

func (c *Client) GitClusters(ctx context.Context, org string, query url.Values) (Page, error)

func (*Client) GitMirror

func (c *Client) GitMirror(ctx context.Context, method, path string, body any) (map[string]any, error)

func (*Client) GitToken

func (c *Client) GitToken(ctx context.Context, repository string) (map[string]any, error)

func (*Client) Health

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

func (*Client) Installations

func (c *Client) Installations(ctx context.Context) (Page, error)

func (*Client) Invoice

func (c *Client) Invoice(ctx context.Context, path string) (map[string]any, error)

func (*Client) Invoices

func (c *Client) Invoices(ctx context.Context, path string, query url.Values) (Page, error)

func (*Client) Job

func (c *Client) Job(ctx context.Context, org, id string, query url.Values) (map[string]any, error)

func (*Client) JobAggregates

func (c *Client) JobAggregates(ctx context.Context, org string, query url.Values) (Page, error)

func (*Client) JobMetrics

func (c *Client) JobMetrics(ctx context.Context, org, id, source string, query url.Values) (map[string]any, error)

func (*Client) Jobs

func (c *Client) Jobs(ctx context.Context, org string, query url.Values) (Page, error)

func (*Client) MintAccessToken

func (c *Client) MintAccessToken(ctx context.Context, path string, body map[string]any) (any, error)

MintAccessToken keeps the successful raw JSON until the one-time credential is delivered. An unrelated malformed summary field must not discard it.

func (*Client) MirrorSession

func (c *Client) MirrorSession(ctx context.Context, repository string) (map[string]any, error)

func (*Client) MutateEmailDomain

func (c *Client) MutateEmailDomain(ctx context.Context, path string, body any) (map[string]any, error)

func (*Client) OpenObservability

func (c *Client) OpenObservability(ctx context.Context, path, signal string, timeout time.Duration) (*ObservabilityStream, error)

func (*Client) OrganizationMembers

func (c *Client) OrganizationMembers(ctx context.Context, org string) (Page, error)

func (*Client) Organizations

func (c *Client) Organizations(ctx context.Context) (Page, error)

func (*Client) PaymentMethods

func (c *Client) PaymentMethods(ctx context.Context, path string) (Page, error)

func (*Client) PublicMirror

func (c *Client) PublicMirror(ctx context.Context, path string) (map[string]any, error)

func (*Client) PublicMirrorRequest

func (c *Client) PublicMirrorRequest(ctx context.Context, method, path string, body any, fallbackID string) (map[string]any, error)

func (*Client) PublicMirrorRequests

func (c *Client) PublicMirrorRequests(ctx context.Context, path string) (Page, error)

func (*Client) PullRequests

func (c *Client) PullRequests(ctx context.Context, org string, query url.Values) (Page, error)

func (*Client) Raw

func (c *Client) Raw(ctx context.Context, method, path string, body any) ([]byte, error)

Raw retains JSON member order for Python-compatible key/value output.

func (*Client) RawContent

func (c *Client) RawContent(ctx context.Context, method, path string, content []byte, contentType string) ([]byte, error)

RawContent uses the same authenticated, bounded transport for non-JSON bodies.

func (*Client) RemovePaymentMethod

func (c *Client) RemovePaymentMethod(ctx context.Context, path string) error

func (*Client) ReorderFirewallRules

func (c *Client) ReorderFirewallRules(ctx context.Context, path string, ids []string) error

func (*Client) Repositories

func (c *Client) Repositories(ctx context.Context, org string, query url.Values) (Page, error)

func (*Client) Repository

func (c *Client) Repository(ctx context.Context, org, id string) (map[string]any, error)

func (*Client) RepositoryWorkflows

func (c *Client) RepositoryWorkflows(ctx context.Context, org, repo string, query url.Values) (Page, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, body any, headers http.Header) (map[string]any, error)

Request supports session-cookie requests during login. It does not inherit the API key: callers explicitly select the authentication for each request.

func (*Client) Rerun

func (c *Client) Rerun(ctx context.Context, org, id string, failed bool) error

func (*Client) ResolveRepository

func (c *Client) ResolveRepository(ctx context.Context, org string, query url.Values) (map[string]any, error)

func (*Client) ResolvedFirewall

func (c *Client) ResolvedFirewall(ctx context.Context, path string) (map[string]any, error)

func (*Client) RunByReference

func (c *Client) RunByReference(ctx context.Context, org, id string, platform bool, query url.Values) (map[string]any, error)

RunByReference accepts an already parsed Avrea ID or decimal platform ID. It never follows the URL supplied by a user or sends credentials to it.

func (*Client) RunJobs

func (c *Client) RunJobs(ctx context.Context, org, id string, query url.Values) (map[string]any, error)

func (*Client) RunMetrics

func (c *Client) RunMetrics(ctx context.Context, org, id string, query url.Values) (map[string]any, error)

func (*Client) Runs

func (c *Client) Runs(ctx context.Context, org string, query url.Values) (Page, error)

func (*Client) SAML

func (c *Client) SAML(ctx context.Context, path string) (map[string]any, error)

func (*Client) SBOM

func (c *Client) SBOM(ctx context.Context, path string) (map[string]any, error)

func (*Client) SBOMTaskState

func (c *Client) SBOMTaskState(ctx context.Context, path string) (map[string]any, error)

func (*Client) SBOMs

func (c *Client) SBOMs(ctx context.Context, path string, query url.Values) (Page, error)

func (*Client) SSHForwarding

func (c *Client) SSHForwarding(ctx context.Context, id string) (map[string]any, error)

func (*Client) SearchLogs

func (c *Client) SearchLogs(ctx context.Context, payload map[string]any) (map[string]any, error)

SearchLogs retains raw values for display while validating the wire record.

func (*Client) SetDefaultPaymentMethod

func (c *Client) SetDefaultPaymentMethod(ctx context.Context, path string) (map[string]any, error)

func (*Client) SetEmailDomains

func (c *Client) SetEmailDomains(ctx context.Context, path string, domains []string) (Page, error)

func (*Client) SetSetting

func (c *Client) SetSetting(ctx context.Context, path, key string, value any) (map[string]any, error)

func (*Client) Settings

func (c *Client) Settings(ctx context.Context, path string, query url.Values) (Page, error)

func (*Client) SettingsSchema

func (c *Client) SettingsSchema(ctx context.Context, query url.Values) (Page, error)

func (*Client) SetupIntent

func (c *Client) SetupIntent(ctx context.Context, path string) (map[string]any, error)

func (*Client) StripeKey

func (c *Client) StripeKey(ctx context.Context, path string) (map[string]any, error)

func (*Client) SubmitNativeDispatch

func (c *Client) SubmitNativeDispatch(ctx context.Context, path string, content []byte, key string) (map[string]any, error)

SubmitNativeDispatch keeps decimal input bytes and the invocation key identical across retries. Its longer source-check budget is local to this request.

func (*Client) SubmitNativeRerun

func (c *Client) SubmitNativeRerun(ctx context.Context, path string, body map[string]any) (map[string]any, error)

SubmitNativeRerun carries its durable key in the request body, as the API requires.

func (*Client) TransitionVM

func (c *Client) TransitionVM(ctx context.Context, path string, body any) (map[string]any, error)

func (*Client) UpdateBillingSettings

func (c *Client) UpdateBillingSettings(ctx context.Context, path string, body map[string]any) (map[string]any, error)

func (*Client) UpdateFirewallRule

func (c *Client) UpdateFirewallRule(ctx context.Context, path string, body map[string]any) (map[string]any, error)

func (*Client) UpdateVM

func (c *Client) UpdateVM(ctx context.Context, path string, request map[string]any, rules *[]any) (map[string]any, error)

func (*Client) VM

func (c *Client) VM(ctx context.Context, path string) (map[string]any, error)

func (*Client) VMCapabilities

func (c *Client) VMCapabilities(ctx context.Context, path string) (map[string]any, error)

func (*Client) VMMetrics

func (c *Client) VMMetrics(ctx context.Context, path string, query url.Values) (map[string]any, error)

func (*Client) VMUsage

func (c *Client) VMUsage(ctx context.Context, path string, query url.Values) (map[string]any, error)

func (*Client) VMs

func (c *Client) VMs(ctx context.Context, path string, query url.Values) (Page, error)

func (*Client) WorkflowAggregates

func (c *Client) WorkflowAggregates(ctx context.Context, org string, query url.Values) (Page, error)

type DownloadError

type DownloadError struct{}

DownloadError deliberately excludes URLs, credentials and transport internals.

func (*DownloadError) Error

func (*DownloadError) Error() string

type GitLabRunnerError

type GitLabRunnerError struct{ Message string }

func (*GitLabRunnerError) Error

func (e *GitLabRunnerError) Error() string

type HTTPError

type HTTPError struct {
	Status     int
	Path       string
	Detail     string
	RetryAfter string
	Payload    map[string]any
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type ObservabilityStream

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

ObservabilityStream has a single reader. Idle ticks don't cancel Read: doing that would close the WebSocket and reconnect every time the stream is quiet.

func (*ObservabilityStream) Close

func (s *ObservabilityStream) Close()

func (*ObservabilityStream) Next

func (s *ObservabilityStream) Next(ctx context.Context, idle time.Duration) ([]byte, error)

Next returns nil data on an idle tick. The owner must Close even after error.

type Page

type Page struct {
	Fields     map[string]any
	Items      []map[string]any
	NextCursor string
}

Page retains the response envelope, record maps and pagination cursor. JSON output and terminal rendering share the same decoded response values.

type StreamError

type StreamError struct {
	HTTPStatus int
	CloseCode  int
	Reason     string
}

StreamError retains retry decisions without leaking transport URLs or headers.

func (*StreamError) Error

func (e *StreamError) Error() string

type StripeCard

type StripeCard struct {
	Number, CVC string
	Month, Year int
}

StripeCard contains input sent only to Stripe. It must never be logged.

type StripeError

type StripeError struct{ Message string }

func (*StripeError) Error

func (e *StripeError) Error() string

type TimingEvent

type TimingEvent struct {
	Name         string  `json:"name"`
	Milliseconds float64 `json:"ms"`
	Attempt      int     `json:"attempt,omitempty"`
	Failed       bool    `json:"failed,omitempty"`
}

TimingEvent records an offset from the start of one HTTP operation. Events retain concurrent connection attempts rather than adding overlapping durations.

type TransportError

type TransportError struct{ Message, Reason string }

TransportError preserves retry classification without exposing net/http's original error, which can include sensitive request URLs.

func (*TransportError) Error

func (e *TransportError) Error() string

Jump to

Keyboard shortcuts

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