Documentation
¶
Overview ¶
Package client owns authenticated API transport. Only invoice downloads follow redirects, dropping credentials when leaving the original origin.
Index ¶
- type ArtifactRecord
- type AuditPage
- type Client
- func (c *Client) AccessToken(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) AccessTokens(ctx context.Context, path string, query url.Values) (Page, error)
- func (c *Client) Artifact(ctx context.Context, path string) (ArtifactRecord, error)
- func (c *Client) Artifacts(ctx context.Context, path string, query url.Values) (Page, error)
- func (c *Client) AttachPaymentMethod(ctx context.Context, path, id string) (map[string]any, error)
- func (c *Client) AuditEvents(ctx context.Context, org string, query url.Values) (AuditPage, error)
- func (c *Client) BillingSettings(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) BillingSummary(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) CacheEntries(ctx context.Context, org, repo string, query url.Values) (Page, error)
- func (c *Client) CacheUsage(ctx context.Context, org, repo string) (map[string]any, error)
- func (c *Client) CancelRun(ctx context.Context, org, id string) (map[string]any, error)
- func (c *Client) ConfigureSAML(ctx context.Context, path string, metadata []byte, query url.Values) (map[string]any, error)
- func (c *Client) ConfirmCard(ctx context.Context, key, secret string, card StripeCard) (string, error)
- func (c *Client) CreateFirewallRule(ctx context.Context, path string, body map[string]any) (map[string]any, error)
- func (c *Client) CreateGitLabRunner(ctx context.Context, token string, body map[string]any) (string, string, error)
- func (c *Client) CreateOrganization(ctx context.Context, name string) (map[string]any, error)
- func (c *Client) CreateVM(ctx context.Context, path string, request map[string]any, rules *[]any, ...) (map[string]any, error)
- func (c *Client) DeleteFirewallRule(ctx context.Context, path string) error
- func (c *Client) DeleteVM(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) DispatchWorkflow(ctx context.Context, org, repo, file, ref string, inputs map[string]string) (map[string]any, error)
- func (c *Client) Do(ctx context.Context, method, path string, body any) (map[string]any, error)
- func (c *Client) Download(ctx context.Context, path string) (io.ReadCloser, error)
- func (c *Client) DownloadDecoded(ctx context.Context, path string) (io.ReadCloser, error)
- func (c *Client) DownloadInvoice(ctx context.Context, path string) (io.ReadCloser, error)
- func (c *Client) EmailDomains(ctx context.Context, path string) (Page, error)
- func (c *Client) EnforceSAML(ctx context.Context, path string, enforce bool) (map[string]any, error)
- func (c *Client) FeatureFlag(ctx context.Context, org, key string) (map[string]any, error)
- func (c *Client) FirewallFlows(ctx context.Context, path string, query url.Values) (map[string]any, error)
- func (c *Client) FirewallRules(ctx context.Context, path string) (Page, error)
- func (c *Client) GenerateSBOM(ctx context.Context, path string, body map[string]any) (map[string]any, error)
- func (c *Client) Get(ctx context.Context, path string, query url.Values) (map[string]any, error)
- func (c *Client) GitClusters(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) GitMirror(ctx context.Context, method, path string, body any) (map[string]any, error)
- func (c *Client) GitToken(ctx context.Context, repository string) (map[string]any, error)
- func (c *Client) Health(ctx context.Context) (map[string]any, error)
- func (c *Client) Installations(ctx context.Context) (Page, error)
- func (c *Client) Invoice(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) Invoices(ctx context.Context, path string, query url.Values) (Page, error)
- func (c *Client) Job(ctx context.Context, org, id string, query url.Values) (map[string]any, error)
- func (c *Client) JobAggregates(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) JobMetrics(ctx context.Context, org, id, source string, query url.Values) (map[string]any, error)
- func (c *Client) Jobs(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) MintAccessToken(ctx context.Context, path string, body map[string]any) (any, error)
- func (c *Client) MirrorSession(ctx context.Context, repository string) (map[string]any, error)
- func (c *Client) MutateEmailDomain(ctx context.Context, path string, body any) (map[string]any, error)
- func (c *Client) OpenObservability(ctx context.Context, path, signal string, timeout time.Duration) (*ObservabilityStream, error)
- func (c *Client) OrganizationMembers(ctx context.Context, org string) (Page, error)
- func (c *Client) Organizations(ctx context.Context) (Page, error)
- func (c *Client) PaymentMethods(ctx context.Context, path string) (Page, error)
- func (c *Client) PublicMirror(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) PublicMirrorRequest(ctx context.Context, method, path string, body any, fallbackID string) (map[string]any, error)
- func (c *Client) PublicMirrorRequests(ctx context.Context, path string) (Page, error)
- func (c *Client) PullRequests(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) Raw(ctx context.Context, method, path string, body any) ([]byte, error)
- func (c *Client) RawContent(ctx context.Context, method, path string, content []byte, contentType string) ([]byte, error)
- func (c *Client) RemovePaymentMethod(ctx context.Context, path string) error
- func (c *Client) ReorderFirewallRules(ctx context.Context, path string, ids []string) error
- func (c *Client) Repositories(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) Repository(ctx context.Context, org, id string) (map[string]any, error)
- func (c *Client) RepositoryWorkflows(ctx context.Context, org, repo string, query url.Values) (Page, error)
- func (c *Client) Request(ctx context.Context, method, path string, body any, headers http.Header) (map[string]any, error)
- func (c *Client) Rerun(ctx context.Context, org, id string, failed bool) error
- func (c *Client) ResolveRepository(ctx context.Context, org string, query url.Values) (map[string]any, error)
- func (c *Client) ResolvedFirewall(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) RunByReference(ctx context.Context, org, id string, platform bool, query url.Values) (map[string]any, error)
- func (c *Client) RunJobs(ctx context.Context, org, id string, query url.Values) (map[string]any, error)
- func (c *Client) RunMetrics(ctx context.Context, org, id string, query url.Values) (map[string]any, error)
- func (c *Client) Runs(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) SAML(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) SBOM(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) SBOMTaskState(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) SBOMs(ctx context.Context, path string, query url.Values) (Page, error)
- func (c *Client) SSHForwarding(ctx context.Context, id string) (map[string]any, error)
- func (c *Client) SearchLogs(ctx context.Context, payload map[string]any) (map[string]any, error)
- func (c *Client) SetDefaultPaymentMethod(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) SetEmailDomains(ctx context.Context, path string, domains []string) (Page, error)
- func (c *Client) SetSetting(ctx context.Context, path, key string, value any) (map[string]any, error)
- func (c *Client) Settings(ctx context.Context, path string, query url.Values) (Page, error)
- func (c *Client) SettingsSchema(ctx context.Context, query url.Values) (Page, error)
- func (c *Client) SetupIntent(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) StripeKey(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) SubmitNativeDispatch(ctx context.Context, path string, content []byte, key string) (map[string]any, error)
- func (c *Client) SubmitNativeRerun(ctx context.Context, path string, body map[string]any) (map[string]any, error)
- func (c *Client) TransitionVM(ctx context.Context, path string, body any) (map[string]any, error)
- func (c *Client) UpdateBillingSettings(ctx context.Context, path string, body map[string]any) (map[string]any, error)
- func (c *Client) UpdateFirewallRule(ctx context.Context, path string, body map[string]any) (map[string]any, error)
- func (c *Client) UpdateVM(ctx context.Context, path string, request map[string]any, rules *[]any) (map[string]any, error)
- func (c *Client) VM(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) VMCapabilities(ctx context.Context, path string) (map[string]any, error)
- func (c *Client) VMMetrics(ctx context.Context, path string, query url.Values) (map[string]any, error)
- func (c *Client) VMUsage(ctx context.Context, path string, query url.Values) (map[string]any, error)
- func (c *Client) VMs(ctx context.Context, path string, query url.Values) (Page, error)
- func (c *Client) WorkflowAggregates(ctx context.Context, org string, query url.Values) (Page, error)
- type DownloadError
- type GitLabRunnerError
- type HTTPError
- type ObservabilityStream
- type Page
- type StreamError
- type StripeCard
- type StripeError
- type TimingEvent
- type TransportError
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 ¶
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 (*Client) AccessTokens ¶
func (*Client) AttachPaymentMethod ¶
func (*Client) AuditEvents ¶
func (*Client) BillingSettings ¶
func (*Client) BillingSummary ¶
func (*Client) CacheEntries ¶
func (*Client) CacheUsage ¶
func (*Client) ConfigureSAML ¶
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 (*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 (*Client) DeleteFirewallRule ¶
func (*Client) DispatchWorkflow ¶
func (*Client) Download ¶
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 ¶
DownloadDecoded supports opaque analysis artifacts with the same compression negotiation as Python. The decoded bytes stream without the JSON size limit.
func (*Client) DownloadInvoice ¶
DownloadInvoice follows PDF redirects without forwarding API credentials outside the original origin. Other API and artifact requests refuse redirects.
func (*Client) EmailDomains ¶
func (*Client) EnforceSAML ¶
func (*Client) FeatureFlag ¶
func (*Client) FirewallFlows ¶
func (*Client) FirewallRules ¶
func (*Client) GenerateSBOM ¶
func (*Client) GitClusters ¶
func (*Client) JobAggregates ¶
func (*Client) JobMetrics ¶
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 (*Client) MutateEmailDomain ¶
func (*Client) OpenObservability ¶
func (*Client) OrganizationMembers ¶
func (*Client) PaymentMethods ¶
func (*Client) PublicMirror ¶
func (*Client) PublicMirrorRequest ¶
func (*Client) PublicMirrorRequests ¶
func (*Client) PullRequests ¶
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 (*Client) ReorderFirewallRules ¶
func (*Client) Repositories ¶
func (*Client) Repository ¶
func (*Client) RepositoryWorkflows ¶
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) ResolveRepository ¶
func (*Client) ResolvedFirewall ¶
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) RunMetrics ¶
func (*Client) SBOMTaskState ¶
func (*Client) SSHForwarding ¶
func (*Client) SearchLogs ¶
SearchLogs retains raw values for display while validating the wire record.
func (*Client) SetDefaultPaymentMethod ¶
func (*Client) SetEmailDomains ¶
func (*Client) SetSetting ¶
func (*Client) SettingsSchema ¶
func (*Client) SetupIntent ¶
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 (*Client) UpdateBillingSettings ¶
func (*Client) UpdateFirewallRule ¶
func (*Client) VMCapabilities ¶
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 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()
type Page ¶
Page retains the response envelope, record maps and pagination cursor. JSON output and terminal rendering share the same decoded response values.
type StreamError ¶
StreamError retains retry decisions without leaking transport URLs or headers.
func (*StreamError) Error ¶
func (e *StreamError) Error() string
type StripeCard ¶
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