Documentation
¶
Overview ¶
Package campaigns reads Vulnetix remediation campaigns from the console's site API (GET /api/site/v1/campaigns), the source of the GitHub security campaigns that `vulnesis gha publish campaigns` creates.
The routes are Pro. A caller who is not entitled gets HTTP 200 with a marker body ({"planLocked": true, ...}) instead of an error so the console can show an upgrade prompt; that is surfaced here as ErrNotEntitled. The caller authenticates as for the config engine (an owner or admin credential).
Index ¶
Constants ¶
const ( StatusActive = "ACTIVE" StatusCompleted = "COMPLETED" StatusArchived = "ARCHIVED" )
Status values of a campaign.
Variables ¶
var ErrNotEntitled = errors.New("campaigns need a Pro plan (the organization is not entitled)")
ErrNotEntitled is returned when the organization is not on a plan with campaigns.
Functions ¶
This section is empty.
Types ¶
type Campaign ¶
type Campaign struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Description string `json:"description"`
TargetKind string `json:"targetKind"`
Status string `json:"status"`
// DeadlineAt is epoch milliseconds, absent when the campaign has none.
DeadlineAt *int64 `json:"deadlineAt"`
CohortSize int `json:"cohortSize"`
ClosedCount int `json:"closedCount"`
Scope json.RawMessage `json:"scope"`
CompletedAt *int64 `json:"completedAt"`
ArchivedAt *int64 `json:"archivedAt"`
}
Campaign is a Vulnetix remediation campaign.
type Client ¶
type Client struct {
Site Getter
// PerPage is the items page size (the API caps it at 200).
PerPage int
}
Client reads campaigns.
func (*Client) Items ¶
Items returns the campaign's cohort items in the given state ("open", "done", or "" for all), following pagination.
type Getter ¶
Getter fetches a path under the site API and returns the body. The CLI's siteClient implements it, so credentials and the base URL stay in one place.
type Item ¶
type Item struct {
UUID string `json:"uuid"`
ItemKey string `json:"itemKey"`
Kind string `json:"kind"` // finding or dependency
RepoName string `json:"repoName"`
FindingID string `json:"findingId"`
Category string `json:"category"`
PackageName string `json:"packageName"`
PackageVersion string `json:"packageVersion"`
PackageEcosystem string `json:"packageEcosystem"`
DependencyKey string `json:"dependencyKey"`
Severity string `json:"severity"`
State string `json:"state"` // open or done
}
Item is one member of a campaign's frozen cohort.