Documentation
¶
Index ¶
Constants ¶
const ( // ArtifactMediaTypePolicyBundle uploads a policy bundle as a tar or gzipped tar. ArtifactMediaTypePolicyBundle = artifact.MediaTypePolicyBundle // ArtifactMediaTypeJSON uploads any JSON value. ArtifactMediaTypeJSON = artifact.MediaTypeJSON )
Variables ¶
var ( // ErrRemoteConfigUnsupported is returned when the API answers 404 on a remote agent // configuration route, meaning the API predates the feature. ErrRemoteConfigUnsupported = errors.New("sdk: api does not support remote agent configuration") // ErrAgentAuthRequired is returned, without making a request, when the client has no agent // credentials (Config.AgentAuth). The remote configuration routes accept agent JWTs only. ErrAgentAuthRequired = errors.New("sdk: remote agent configuration requires agent credentials") )
Functions ¶
Types ¶
type APIStatusError ¶ added in v0.21.0
type APIStatusError struct {
// StatusCode is the HTTP status code of the response.
StatusCode int
// Body is the response body, truncated to at most 4 KiB.
Body string
}
APIStatusError is returned for any non-2xx response that has no dedicated sentinel error. Callers map specific statuses (401, 403, 409, 413, ...) from StatusCode.
func (*APIStatusError) Error ¶ added in v0.21.0
func (e *APIStatusError) Error() string
Error implements error. It includes the status code and the (truncated) response body.
type AgentAuthConfig ¶ added in v0.15.0
type AgentConfigResult ¶ added in v0.21.0
type AgentConfigResult struct {
// Document is the current overlay document; nil when NotModified is true.
Document *agentconfig.OverlayDocument
// NotModified is true when the API answered 304 to the presented If-None-Match.
NotModified bool
// ETag is the raw ETag response header. Store it and send it back verbatim as
// If-None-Match (R7); never construct one. On a 304 without an ETag header it is the
// If-None-Match value that was sent.
ETag string
}
AgentConfigResult is the outcome of AgentConfig.Get.
type ArtifactInfo ¶ added in v0.20.0
ArtifactInfo describes a stored artifact. The API computes Digest from the content's canonical form.
type ArtifactStatusError ¶ added in v0.20.0
ArtifactStatusError is an unexpected HTTP status from an artifact route. A 404 or 405 on Upload means the API predates artifact storage.
func (*ArtifactStatusError) Error ¶ added in v0.20.0
func (e *ArtifactStatusError) Error() string
type Client ¶
type Client struct {
Evidence *evidenceClient
RiskTemplate *riskTemplateClient
SubjectTemplate *subjectTemplateClient
Heartbeat *heartbeatClient
Playback *playbackClient
// AgentConfig fetches the remote configuration overlay and submits instance config reports.
// Both routes require agent credentials (Config.AgentAuth).
AgentConfig *agentConfigClient
Artifact *artifactClient
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
BaseURL string
Logger *zap.SugaredLogger
AgentAuth *AgentAuthConfig
}
type PlaybackPolicyError ¶ added in v0.19.0
type PlaybackPolicyError struct {
Errors []policyeval.EvalError
}
PlaybackPolicyError is returned when the API rejects the policy itself (422): it does not parse, compile or evaluate, times out, or contains no compliance_framework package.
func (*PlaybackPolicyError) Error ¶ added in v0.19.0
func (e *PlaybackPolicyError) Error() string
type PlaybackRequest ¶ added in v0.19.0
type PlaybackRequest = policyeval.EvaluateRequest
type PlaybackResponse ¶ added in v0.19.0
type PlaybackResponse = policyeval.EvaluateResponse