Documentation
¶
Overview ¶
Package types holds most of the types used across bow
Index ¶
- Constants
- func ParseEventNotificationChannels(annotations map[string]string) []string
- func ParseReleaseNotesURL(annotations map[string]string) string
- type Approval
- type ApprovalStatus
- type AuditLog
- type AuditLogQuery
- type AuditLogStats
- type AuditLogStatsQuery
- type Credentials
- type Event
- type EventNotification
- type GetApprovalQuery
- type JSONB
- type Level
- type Notification
- type Policy
- type ProviderType
- type Repository
- type TrackedImage
- type TriggerType
- type Version
- type VersionInfo
- type VersionResponse
Constants ¶
const ( AuditActionCreated = "created" AuditActionUpdated = "updated" AuditActionDeleted = "deleted" // Approval specific actions AuditActionApprovalApproved = "approved" AuditActionApprovalRejected = "rejected" AuditActionApprovalExpired = "expired" AuditActionApprovalArchived = "archived" // audit specific resource kinds (others are set by // providers, ie: deployment, daemonset, helm chart) AuditResourceKindApproval = "approval" AuditResourceKindWebhook = "webhook" )
const BowApprovalDeadlineDefault = 24
BowApprovalDeadlineDefault - default deadline in hours
const BowApprovalDeadlineLabel = "bow/approvalDeadline"
BowApprovalDeadlineLabel - approval deadline
const BowDefaultPort = 9300
BowDefaultPort - default port for application
const BowDigestAnnotation = "bow/digest"
BowDigestAnnotation - digest annotation
const BowForceTagMatchLabel = "bow/matchTag"
const BowForceTagMatchLegacyLabel = "bow/match-tag"
BowForceTagMatchLabel - label that checks whether tags match before force updating
const BowImagePullSecretAnnotation = "bow/imagePullSecret"
const BowMinimumApprovalsLabel = "bow/approvals"
BowMinimumApprovalsLabel - min approvals
const BowNotificationChanAnnotation = "bow/notify"
BowNotificationChanAnnotation - optional notification to override default notification channel(-s) per deployment/chart
const BowPolicyLabel = "bow/policy"
BowPolicyLabel - bow update policies (version checking)
const BowPollDefaultSchedule = "@every 5m"
BowPollDefaultSchedule - defaul polling schedule
const BowPollScheduleAnnotation = "bow/pollSchedule"
BowPollScheduleAnnotation - optional variable to setup custom schedule for polling, defaults to @every 10m
const BowReleaseNotesURL = "bow/releaseNotes"
BowReleasePage - optional release notes URL passed on with notification
const BowTriggerLabel = "bow/trigger"
BowTriggerLabel - trigger label is used to specify custom trigger types for example bow.sh/trigger=poll would signal poll trigger to start watching for repository changes
const BowUpdateTimeAnnotation = "bow/update-time"
bowUpdateTimeAnnotation - update time
Variables ¶
This section is empty.
Functions ¶
func ParseEventNotificationChannels ¶
ParseEventNotificationChannels - parses deployment annotations or chart config to get channel overrides
func ParseReleaseNotesURL ¶
Types ¶
type Approval ¶
type Approval struct {
ID string `json:"id" gorm:"primary_key;type:varchar(36)"`
// Archived is set to true once approval is finally approved/rejected
Archived bool `json:"archived"`
// Provider name - Kubernetes/Helm
Provider ProviderType `json:"provider"`
// Identifier is used to inform user about specific
// Helm release or k8s deployment
// ie: k8s <namespace>/<deployment name>
// helm: <namespace>/<release name>
Identifier string `json:"identifier"`
// Event that triggered evaluation
Event *Event `json:"event" gorm:"type:json"`
Message string `json:"message"`
CurrentVersion string `json:"currentVersion"`
NewVersion string `json:"newVersion"`
// Digest is used to verify that images are the ones that got the approvals.
// If digest doesn't match for the image, votes are reset.
Digest string `json:"digest"`
// Requirements for the update such as number of votes
// and deadline
VotesRequired int `json:"votesRequired"`
VotesReceived int `json:"votesReceived"`
// Voters is a list of voter
// IDs for audit
Voters JSONB `json:"voters" gorm:"type:json"`
// Explicitly rejected approval
// can be set directly by user
// so even if deadline is not reached approval
// could be turned down
Rejected bool `json:"rejected"`
// Deadline for this request
Deadline time.Time `json:"deadline"`
// When this approval was created
CreatedAt time.Time `json:"createdAt"`
// WHen this approval was updated
UpdatedAt time.Time `json:"updatedAt"`
}
Approval used to store and track updates
func (*Approval) Delta ¶
Delta of what's changed ie: webhookrelay/webhook-demo:0.15.0 -> webhookrelay/webhook-demo:0.16.0
func (*Approval) Status ¶
func (a *Approval) Status() ApprovalStatus
Status - returns current approval status
type ApprovalStatus ¶
type ApprovalStatus int
ApprovalStatus - approval status type used in approvals to determine whether it was rejected/approved or still pending
const ( ApprovalStatusUnknown ApprovalStatus = iota ApprovalStatusPending ApprovalStatusApproved ApprovalStatusRejected )
Available approval status types
func (ApprovalStatus) String ¶
func (s ApprovalStatus) String() string
type AuditLog ¶
type AuditLog struct {
ID string `json:"id" gorm:"primary_key;type:varchar(36)"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
AccountID string `json:"accountId"`
Username string `json:"username"`
Email string `json:"email"`
// create/delete/update
Action string `json:"action"`
ResourceKind string `json:"resourceKind"` // approval/deployment/daemonset/statefulset/etc...
Identifier string `json:"identifier"`
Message string `json:"message"`
Payload string `json:"payload"` // can be used for bigger messages such as webhook payload
PayloadType string `json:"payloadType"`
Metadata JSONB `json:"metadata" gorm:"type:json"`
}
AuditLog - audit logs lets users basic things happening in bow such as deployment updates and approval actions
func (*AuditLog) SetMetadata ¶
SetMetadata - set audit log metadata (providers, namespaces)
type AuditLogQuery ¶
type AuditLogQuery struct {
Email string `json:"email"`
Username string `json:"username"`
Order string `json:"order"` // empty or "desc"
Limit int `json:"limit"`
Offset int `json:"offset"`
ResourceKindFilter []string `json:"resourceKindFilter"`
}
AuditLogQuery - struct used to query audit logs
type AuditLogStats ¶
type AuditLogStatsQuery ¶
type AuditLogStatsQuery struct {
Days int
}
type Credentials ¶
type Credentials struct {
Username, Password string
}
Credentials - registry credentials
type Event ¶
type Event struct {
Repository Repository `json:"repository,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
// optional field to identify trigger
TriggerName string `json:"triggerName,omitempty"`
}
Event - holds information about new event from trigger
type EventNotification ¶
type EventNotification struct {
Name string `json:"name"`
Message string `json:"message"`
CreatedAt time.Time `json:"createdAt"`
Type Notification `json:"type"`
Level Level `json:"level"`
ResourceKind string `json:"resourceKind"`
Identifier string `json:"identifier"`
// Channels is an optional variable to override
// default channel(-s) when performing an update
Channels []string `json:"-"`
Metadata map[string]string `json:"metadata"`
}
EventNotification notification used for sending
type GetApprovalQuery ¶
type Level ¶
type Level int
Level - event levet
Available event levels
func ParseLevel ¶
ParseLevel takes a string level and returns notification level constant.
func (Level) MarshalJSON ¶
MarshalJSON is generated so Level satisfies json.Marshaler.
func (*Level) UnmarshalJSON ¶
UnmarshalJSON is generated so Level satisfies json.Unmarshaler.
type Notification ¶
type Notification int
Notification - notification types used by notifier
const ( PreProviderSubmitNotification Notification = iota PostProviderSubmitNotification // Kubernetes notification types NotificationPreDeploymentUpdate NotificationDeploymentUpdate // Helm notification types NotificationPreReleaseUpdate NotificationReleaseUpdate NotificationSystemEvent NotificationUpdateApproved NotificationUpdateRejected )
available notification types for hooks
func (Notification) MarshalJSON ¶
func (r Notification) MarshalJSON() ([]byte, error)
MarshalJSON is generated so Notification satisfies json.Marshaler.
func (Notification) String ¶
func (n Notification) String() string
func (*Notification) UnmarshalJSON ¶
func (r *Notification) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so Notification satisfies json.Unmarshaler.
type ProviderType ¶
type ProviderType int
ProviderType - provider type used to differentiate different providers when used with plugins
const ( ProviderTypeUnknown ProviderType = iota ProviderTypeKubernetes ProviderTypeHelm )
Known provider types
func (ProviderType) MarshalJSON ¶
func (r ProviderType) MarshalJSON() ([]byte, error)
MarshalJSON is generated so ProviderType satisfies json.Marshaler.
func (ProviderType) String ¶
func (t ProviderType) String() string
func (*ProviderType) UnmarshalJSON ¶
func (r *ProviderType) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so ProviderType satisfies json.Unmarshaler.
type Repository ¶
type Repository struct {
Host string `json:"host"`
Name string `json:"name"`
Tag string `json:"tag"`
Digest string `json:"digest"` // optional digest field
OldTag string
}
Repository - represents main docker repository fields that bow cares about
func (*Repository) String ¶
func (r *Repository) String() string
String gives you [host/]team/repo[:tag] identifier
type TrackedImage ¶
type TrackedImage struct {
Image *image.Reference `json:"image"`
Trigger TriggerType `json:"trigger"`
PollSchedule string `json:"pollSchedule"`
Provider string `json:"provider"`
Namespace string `json:"namespace"`
Secrets []string `json:"secrets"`
Meta map[string]string `json:"meta"` // metadata supplied by providers
// a list of pre-release tags, ie: 1.0.0-dev, 1.5.0-prod get translated into
// dev, prod
// combined semver tags
Tags []string `json:"tags"`
Policy Policy `json:"policy"`
}
TrackedImage - tracked image data+metadata
func (TrackedImage) String ¶
func (i TrackedImage) String() string
type TriggerType ¶
type TriggerType int
TriggerType - trigger types
const ( TriggerTypeDefault TriggerType = iota // default policy is to wait for external triggers TriggerTypePoll // poll policy sets up watchers for the affected repositories TriggerTypeApproval // fulfilled approval requests trigger events )
Available trigger types
func ParseTrigger ¶
func ParseTrigger(trigger string) TriggerType
ParseTrigger - parse trigger string into type
func (TriggerType) MarshalJSON ¶
func (r TriggerType) MarshalJSON() ([]byte, error)
MarshalJSON is generated so TriggerType satisfies json.Marshaler.
func (TriggerType) String ¶
func (t TriggerType) String() string
func (*TriggerType) UnmarshalJSON ¶
func (r *TriggerType) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so TriggerType satisfies json.Unmarshaler.
type Version ¶
type Version struct {
Major int64
Minor int64
Patch int64
PreRelease string
Metadata string
Original string
}
Version - version container
type VersionInfo ¶
type VersionInfo struct {
Name string `json:"name"`
BuildDate string `json:"buildDate"`
Revision string `json:"revision"`
Version string `json:"version"`
APIVersion string `json:"apiVersion"`
GoVersion string `json:"goVersion"`
OS string `json:"os"`
Arch string `json:"arch"`
KernelVersion string `json:"kernelVersion"`
Experimental bool `json:"experimental"`
}
VersionInfo describes version and runtime info.
type VersionResponse ¶
type VersionResponse struct {
Client *VersionInfo
Server *VersionInfo
}
VersionResponse - version API call response
func (VersionResponse) ServerOK ¶
func (v VersionResponse) ServerOK() bool
ServerOK returns true when the client could connect to the bow and parse the information received. It returns false otherwise.