Documentation
¶
Index ¶
Constants ¶
const ( StatusDeployed = "deployed" StatusDecommissioned = "decommissioned" )
Status constants for deployment records.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an API client for posting deployment records.
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
ClientError represents a client error that can not be retried.
func (*ClientError) Error ¶
func (c *ClientError) Error() string
func (*ClientError) Unwrap ¶
func (c *ClientError) Unwrap() error
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures the Client.
func WithAPIToken ¶
func WithAPIToken(token string) ClientOption
WithAPIToken sets the API token for Bearer authentication.
func WithGHApp ¶
func WithGHApp(id, installID, pk string) ClientOption
WithGHApp configures a GitHub app to use for authentication. If provided values are invalid, this will panic. If an API token is also set, the GitHub App will take precedence.
func WithRateLimiter ¶
func WithRateLimiter(rps float64, burst int) ClientOption
WithRateLimiter sets a custom rate limiter for API calls.
func WithRetries ¶
func WithRetries(retries int) ClientOption
WithRetries sets the number of retries for failed requests.
func WithTimeout ¶
func WithTimeout(seconds int) ClientOption
WithTimeout sets the HTTP client timeout in seconds.
type DeploymentRecord ¶
type DeploymentRecord struct {
Name string `json:"name"`
Digest string `json:"digest"`
Version string `json:"version,omitempty"`
LogicalEnvironment string `json:"logical_environment"`
PhysicalEnvironment string `json:"physical_environment"`
Cluster string `json:"cluster"`
Status string `json:"status"`
DeploymentName string `json:"deployment_name"`
RuntimeRisks []RuntimeRisk `json:"runtime_risks,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
}
DeploymentRecord represents a deployment event record.
func NewDeploymentRecord ¶
func NewDeploymentRecord(name, digest, version, logicalEnv, physicalEnv, cluster, status, deploymentName string, runtimeRisks []RuntimeRisk, tags map[string]string) *DeploymentRecord
NewDeploymentRecord creates a new DeploymentRecord with the given status. Status must be either StatusDeployed or StatusDecommissioned.
type RuntimeRisk ¶
type RuntimeRisk string
RuntimeRisk for deployment records.
const ( CriticalResource RuntimeRisk = "critical-resource" InternetExposed RuntimeRisk = "internet-exposed" LateralMovement RuntimeRisk = "lateral-movement" SensitiveData RuntimeRisk = "sensitive-data" )
Valid runtime risks.
func ValidateRuntimeRisk ¶
func ValidateRuntimeRisk(risk string) RuntimeRisk
ValidateRuntimeRisk confirms if string is a valid runtime risk, then returns the canonical runtime risk constant if valid, empty string otherwise.