sdk

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ArtifactMediaTypePolicyBundle uploads a policy bundle as a tar or gzipped tar.
	ArtifactMediaTypePolicyBundle = artifact.MediaTypePolicyBundle
	// ArtifactMediaTypeJSON uploads any JSON value.
	ArtifactMediaTypeJSON = artifact.MediaTypeJSON
)

Variables

View Source
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

func SeededUUID

func SeededUUID(seedMap map[string]string) (uuid.UUID, error)

SeededUUID generates a consistent UUID for the same seedMap. This is useful for generating consistent StreamIDs across executions.

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 AgentAuthConfig struct {
	ClientID     string
	ClientSecret string
}

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

type ArtifactInfo = artifact.Info

ArtifactInfo describes a stored artifact. The API computes Digest from the content's canonical form.

type ArtifactStatusError added in v0.20.0

type ArtifactStatusError struct {
	StatusCode int
	Body       string
}

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
}

func NewClient

func NewClient(client *http.Client, config *Config) *Client

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method string, path string, reader io.Reader) (*http.Response, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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