Documentation
¶
Overview ¶
Package client owns authenticated API transport. Only invoice downloads follow redirects, dropping credentials when leaving the original origin.
Index ¶
- func DecodeJSON(data []byte) (any, error)
- type APIResponse
- type ArtifactRecord
- type AuditPage
- type Availability
- 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) CallAPI(ctx context.Context, method, path string, body []byte, headers http.Header) (APIResponse, error)
- func (c *Client) CancelRun(ctx context.Context, org, id string) (map[string]any, error)
- func (c *Client) ConfigurationMetadataRequest(ctx context.Context, method, path string, body any, target any) error
- func (c *Client) ConfigurationRequest(ctx context.Context, method, path string, body any, target 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) CreatePullRequestComment(ctx context.Context, org, repo string, number int, body string) (map[string]any, error)
- func (c *Client) CreateReviewThread(ctx context.Context, org, repo string, number int, body string, ...) (thread, comment map[string]any, err 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) ExportFirewall(ctx context.Context, path string) (FirewallPolicy, error)
- func (c *Client) FeatureFlag(ctx context.Context, org, key string) (map[string]any, error)
- func (c *Client) Feedback(ctx context.Context, id 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) Groups(ctx context.Context, org string, query url.Values) (Page, error)
- func (c *Client) Health(ctx context.Context) (map[string]any, error)
- func (c *Client) ImportFirewall(ctx context.Context, path, mode string, policy FirewallPolicy, revision string) 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) MirrorPullRequest(ctx context.Context, org, repo string, number int) (map[string]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) PreviewFirewallImport(ctx context.Context, path, mode string, policy FirewallPolicy) (FirewallImportPreview, 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) ServiceTokenIdentity(ctx context.Context) (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) SubmitFeedback(ctx context.Context, body any, key 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 ConfigurationValue
- type DownloadError
- type FirewallImportPreview
- type FirewallPolicy
- type GitLabRunnerError
- type HTTPError
- type ObservabilityStream
- type Page
- type ReviewAnchor
- type ScopedValue
- type StreamError
- type StripeCard
- type StripeError
- type TimingEvent
- type TransportError
- type ValueWrite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶ added in v0.9.0
DecodeJSON parses exactly one JSON value in a single pass, keeping numbers exact.
Types ¶
type APIResponse ¶ added in v0.9.0
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 Availability ¶ added in v0.9.0
type Availability struct {
Repositories []string `json:"repositories,omitempty"`
Environments []string `json:"environments,omitempty"`
Branches []string `json:"branches,omitempty"`
Workflows []string `json:"workflows,omitempty"`
PrivateOnly bool `json:"private_only,omitempty"`
}
Availability contains the selector categories understood by the secret manager. Empty categories are unrestricted; values within each category are alternatives.
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 a 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) ConfigurationMetadataRequest ¶ added in v0.9.0
func (c *Client) ConfigurationMetadataRequest(ctx context.Context, method, path string, body any, target any) error
ConfigurationMetadataRequest opts into parsed refusal details. Callers must use it only for requests that do not carry secret or variable values.
func (*Client) ConfigurationRequest ¶ added in v0.9.0
func (c *Client) ConfigurationRequest(ctx context.Context, method, path string, body any, target any) error
ConfigurationRequest deliberately disables diagnostics and transport replay. A value PUT appends a version, so retrying it is not an idempotent replacement. Error details are hidden by default because proxies can echo plaintext. Raw payloads and diagnostics are never exposed.
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) CreatePullRequestComment ¶ added in v0.9.0
func (c *Client) CreatePullRequestComment(ctx context.Context, org, repo string, number int, body string) (map[string]any, error)
CreatePullRequestComment posts a general comment on the whole pull request.
func (*Client) CreateReviewThread ¶ added in v0.9.0
func (c *Client) CreateReviewThread(ctx context.Context, org, repo string, number int, body string, anchor ReviewAnchor) (thread, comment map[string]any, err error)
CreateReviewThread starts an inline review thread and returns it with its first comment, which carries the comment's own GitHub publication status.
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) ExportFirewall ¶ added in v0.8.0
func (*Client) FeatureFlag ¶
func (*Client) FirewallFlows ¶
func (*Client) FirewallRules ¶
func (*Client) GenerateSBOM ¶
func (*Client) GitClusters ¶
func (*Client) ImportFirewall ¶ added in v0.8.0
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) MirrorPullRequest ¶ added in v0.9.0
func (c *Client) MirrorPullRequest(ctx context.Context, org, repo string, number int) (map[string]any, error)
MirrorPullRequest reads one pull request's metadata, including the head and base commits that inline comments anchor to.
func (*Client) MirrorSession ¶
func (*Client) MutateEmailDomain ¶
func (*Client) OpenObservability ¶
func (*Client) OrganizationMembers ¶
func (*Client) PaymentMethods ¶
func (*Client) PreviewFirewallImport ¶ added in v0.8.0
func (c *Client) PreviewFirewallImport(ctx context.Context, path, mode string, policy FirewallPolicy) (FirewallImportPreview, error)
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) ServiceTokenIdentity ¶ added in v0.9.0
ServiceTokenIdentity reads the presented service token's own identity. The API answers only a service token; other credentials receive 403.
func (*Client) SetDefaultPaymentMethod ¶
func (*Client) SetEmailDomains ¶
func (*Client) SetSetting ¶
func (*Client) SettingsSchema ¶
func (*Client) SetupIntent ¶
func (*Client) SubmitFeedback ¶ added in v0.8.0
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 ConfigurationValue ¶ added in v0.9.0
type ConfigurationValue struct {
SecretID string `json:"secret_id,omitempty"`
VariableID string `json:"variable_id,omitempty"`
Name string `json:"name"`
Description *string `json:"description"`
AsFile bool `json:"as_file"`
UpdatedAt *string `json:"updated_at"`
Variants []ScopedValue `json:"variants"`
}
func (ConfigurationValue) ID ¶ added in v0.9.0
func (v ConfigurationValue) ID() string
type DownloadError ¶
type DownloadError struct{}
DownloadError deliberately excludes URLs, credentials and transport internals.
func (*DownloadError) Error ¶
func (*DownloadError) Error() string
type FirewallImportPreview ¶ added in v0.8.0
type FirewallImportPreview struct {
Policy FirewallPolicy `json:"policy"`
Before FirewallPolicy `json:"before"`
After FirewallPolicy `json:"after"`
Revision string `json:"revision"`
Added int `json:"added"`
Removed int `json:"removed"`
Skipped int `json:"skipped"`
}
type FirewallPolicy ¶ added in v0.8.0
FirewallPolicy is the portable, versioned document shared with the console. Raw JSON retains absent fields so the server supplies its schema defaults.
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 ReviewAnchor ¶ added in v0.9.0
type ReviewAnchor struct {
CommitSHA string `json:"commit_sha"`
BaseSHA string `json:"base_sha"`
Path string `json:"path"`
Side string `json:"side"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
ReviewAnchor is an immutable diff location: inclusive 1-based lines on one side of the comparison between BaseSHA and CommitSHA.
type ScopedValue ¶ added in v0.9.0
type ScopedValue struct {
VariantID string `json:"variant_id,omitempty"`
VariableVariantID string `json:"variable_variant_id,omitempty"`
Label *string `json:"label"`
Availability Availability `json:"availability"`
RotationReminderDays *int `json:"rotation_reminder_days,omitempty"`
Value *string `json:"value,omitempty"`
HasValue bool `json:"has_value"`
CurrentVersionID *string `json:"current_version_id"`
CurrentVersion *int `json:"current_version"`
CurrentVersionCreatedAt *string `json:"current_version_created_at"`
UpdatedAt *string `json:"updated_at"`
}
func (ScopedValue) ID ¶ added in v0.9.0
func (v ScopedValue) ID() string
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
type ValueWrite ¶ added in v0.9.0
Source Files
¶
- artifacts.go
- audit.go
- billing.go
- billing_card.go
- client.go
- download.go
- feedback.go
- firewall.go
- git_mirrors.go
- gitlab_runner.go
- inspection.go
- native_dispatch.go
- observability.go
- organization.go
- public_mirrors.go
- pull_request_comments.go
- records.go
- repo_clone.go
- saml.go
- sbom.go
- secrets.go
- settings.go
- timing.go
- token.go
- vm.go
- vm_create.go
- vm_mutations.go