Documentation
¶
Overview ¶
Package webhooks describes Encore's webhook data structures.
Index ¶
- Variables
- func ComputeSignature(t time.Time, payload []byte, secret string) []byte
- type Application
- type Build
- type BuildConclusion
- type BuildStatus
- type Deploy
- type DeployConclusion
- type DeployStatus
- type Environment
- type EnvironmentType
- type Event
- type InfraChange
- type InfraChangeConclusion
- type InfraChangeStatus
- type Rollout
- type RolloutAwaitingInfraApprovalEvent
- type RolloutCompletedEvent
- type RolloutConclusion
- type RolloutCreatedEvent
- type RolloutEvent
- type RolloutStatus
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Application ¶
type Application struct {
// ID is a unique id for this application.
ID string `json:"id"`
// Slug is the unique, human-readable string used to identify the application.
Slug string `json:"slug"`
// CreatedAt is when the application was created.
CreatedAt time.Time `json:"created_at"`
}
Application describes an Encore application.
type Build ¶
type Build struct {
// ID is the unique id of the build.
ID string `json:"id"`
// Status describes the current status of the build.
Status BuildStatus `json:"status"`
// Conclusion describes the conclusion of the build.
// It is set only when the build is completed.
Conclusion BuildConclusion `json:"conclusion"`
// CommitHash is the commit hash being built.
CommitHash string `json:"commit_hash"`
// QueuedAt defines when the build was queued.
QueuedAt time.Time `json:"queued_at"`
// StartedAt defines when the build started.
// It's nil if the build hasn't started yet.
StartedAt *time.Time `json:"started_at"`
// CompletedAt defines when the build completed.
// It's nil if the build hasn't completed yet.
CompletedAt *time.Time `json:"completed_at"`
}
type BuildConclusion ¶
type BuildConclusion string
BuildConclusion defines the result of a build.
Additional conclusions may be added in the future to distinguish between different types of failures.
const ( // BuildSuccess means the build succeeded. BuildSuccess BuildConclusion = "success" // BuildFailure means the build failed. BuildFailure BuildConclusion = "failure" // BuildCanceled means the build was canceled. BuildCanceled BuildConclusion = "canceled" )
type BuildStatus ¶
type BuildStatus string
BuildStatus defines the different build statuses.
const ( // BuildQueued means the build is queued. BuildQueued BuildStatus = "queued" // BuildRunning means the build is running. BuildRunning BuildStatus = "running" // BuildCompleted means the build is completed. // See BuildConclusion to know if it succeeded or failed. BuildCompleted BuildStatus = "completed" )
type Deploy ¶
type Deploy struct {
// ID is the unique id of the deploy.
ID string `json:"id"`
// Status describes the current status of the deploy.
Status DeployStatus `json:"status"`
// Conclusion describes the conclusion of the deploy.
// It is set only when the deploy is completed.
Conclusion DeployConclusion `json:"conclusion"`
// QueuedAt defines when the deploy was queued.
// It's nil if the status is pending.
QueuedAt *time.Time `json:"queued_at"`
// StartedAt defines when the deploy started.
// It's nil if the deploy hasn't started yet.
StartedAt *time.Time `json:"started_at"`
// CompletedAt defines when the deploy completed.
// It's nil if the deploy hasn't completed yet.
CompletedAt *time.Time `json:"completed_at"`
}
Deploy describes the deploy phase of a rollout.
type DeployConclusion ¶
type DeployConclusion string
DeployConclusion defines the result of a deploy.
Additional conclusions may be added in the future to distinguish between different types of failures.
const ( // DeploySuccess means the deploy succeeded. DeploySuccess DeployConclusion = "success" // DeployFailure means the deploy failed. DeployFailure DeployConclusion = "failure" // DeployCanceled means the deploy was canceled. DeployCanceled DeployConclusion = "canceled" )
type DeployStatus ¶
type DeployStatus string
DeployStatus defines the different deploy statuses.
const ( // DeployPending means the deploy is pending, meaning it's created // but not yet queued. DeployPending DeployStatus = "pending" // DeployQueued means the deploy is queued. DeployQueued DeployStatus = "queued" // DeployRunning means the deploy is running. DeployRunning DeployStatus = "running" // DeployCompleted means the deploy is completed. // See DeployConclusion to know if it succeeded or failed. DeployCompleted DeployStatus = "completed" )
type Environment ¶
type Environment struct {
// ID is a unique id for this environment.
ID string `json:"id"`
// Name is the name of the environment.
Name string `json:"name"`
// Type is the type of the environment.
Type EnvironmentType `json:"type"`
// APIBaseURL is the base URL for making requests to this environment.
APIBaseURL string `json:"api_base_url"`
// CreatedAt is the time the environment was created.
CreatedAt time.Time `json:"created_at"`
}
Environment describes an Encore application environment.
type EnvironmentType ¶
type EnvironmentType string
const ( // EnvironmentTypeProduction represents production environments. EnvironmentTypeProduction EnvironmentType = "production" // EnvironmentTypeDevelopment represents development environments, // meaning a cloud-hosted, persistent environment that is not production. EnvironmentTypeDevelopment EnvironmentType = "development" // EnvironmentTypePreview represents preview environments, // meaning an ephemeral development environment for a specific Pull Request. EnvironmentTypePreview EnvironmentType = "preview" )
type Event ¶
type Event struct {
// ID is a unique id for this event.
ID string `json:"id"`
// WebhookID is the id of the webhook that received this event.
WebhookID string `json:"webhook_id"`
// SequenceID is a unique, incrementing sequence id for this event,
// specific to the webhook.
SequenceID int64 `json:"sequence_id"`
// Type is the type of the event.
Type string `json:"type"`
// Data is the parsed event data.
// The concrete type depends on what event it is.
Data any `json:"data"`
}
Event represents a webhook event.
type InfraChange ¶
type InfraChange struct {
// ID is the unique id of the infrastructure change.
ID string `json:"id"`
// Status describes the current status of the infra change.
Status InfraChangeStatus `json:"status"`
// Conclusion describes the conclusion of the infra change.
// It is set only when the infra change is completed.
Conclusion InfraChangeConclusion `json:"conclusion"`
// QueuedAt defines when the infra change was queued.
// It's nil if the change hasn't been queued yet.
QueuedAt *time.Time `json:"queued_at"`
// StartedAt defines when the infra change started.
// It's nil if the infra change hasn't started yet.
StartedAt *time.Time `json:"started_at"`
// CompletedAt defines when the infra change completed.
// It's nil if the infra change hasn't completed yet.
CompletedAt *time.Time `json:"completed_at"`
}
InfraChange describes the infrastructure provisioning change phase of a rollout.
type InfraChangeConclusion ¶
type InfraChangeConclusion string
InfraChangeConclusion defines the result of a infra change.
Additional conclusions may be added in the future to distinguish between different types of failures.
const ( // InfraChangeSuccess means the infra change succeeded. InfraChangeSuccess InfraChangeConclusion = "success" // InfraChangeFailure means the infra change failed. InfraChangeFailure InfraChangeConclusion = "failure" // InfraChangeCanceled means the infra change was canceled. InfraChangeCanceled InfraChangeConclusion = "canceled" // InfraChangeRejected means the infra change was rejected by the user // at the manual approval stage. InfraChangeRejected InfraChangeConclusion = "rejected" )
type InfraChangeStatus ¶
type InfraChangeStatus string
InfraChangeStatus describes the different infra change statuses.
const ( // InfraChangePending means the infra change is pending, meaning it's created // but not yet queued. InfraChangePending InfraChangeStatus = "pending" // InfraChangeAwaitingApproval means the infra change is blocked awaiting approval. InfraChangeAwaitingApproval InfraChangeStatus = "awaiting_approval" // InfraChangeQueued means the infra change is queued. InfraChangeQueued InfraChangeStatus = "queued" // InfraChangeRunning means the infra change is running. InfraChangeRunning InfraChangeStatus = "running" // InfraChangeCompleted means the infra change is completed. // See InfraChangeConclusion to know if it succeeded or failed. InfraChangeCompleted InfraChangeStatus = "completed" )
type Rollout ¶
type Rollout struct {
// ID is the unique id of the rollout.
ID string `json:"id"`
// Status describes the current status of the rollout.
Status RolloutStatus `json:"status"`
// Conclusion describes the conclusion of the rollout.
// It is set only when the rollout is completed.
Conclusion RolloutConclusion `json:"conclusion"`
// Build is the build used by the rollout.
// It's always non-nil.
//
// Encore re-uses builds when possible, so the build may
// be shared by multiple rollouts, and may be already underway or
// completed when a rollout is created.
Build *Build `json:"build"`
// InfraProvision describes the infrastructure provisioning phase of the rollout.
// It's nil until the infrastructure provisioning phase starts.
InfraProvision *InfraChange `json:"infra_provision"`
// Deploy describes the deploy phase of the rollout.
// It's nil until the deploy phase starts.
Deploy *Deploy `json:"deploy"`
// QueuedAt defines when the rollout was queued.
// It's nil if the status is pending.
QueuedAt *time.Time `json:"queued_at"`
// StartedAt defines when the rollout started.
// It's nil if the rollout hasn't started yet.
StartedAt *time.Time `json:"started_at"`
// CompletedAt defines when the rollout completed.
// It's nil if the rollout hasn't completed yet.
CompletedAt *time.Time `json:"completed_at"`
}
type RolloutAwaitingInfraApprovalEvent ¶
type RolloutAwaitingInfraApprovalEvent struct {
// Rollout describes the current rollout state.
// It's always non-nil.
Rollout *Rollout `json:"rollout"`
// Env is the environment the rollout is targeting.
// It's always non-nil.
Env *Environment `json:"env"`
// App is the application the event is for.
// It's always non-nil.
App *Application `json:"app"`
}
RolloutAwaitingInfraApprovalEvent describes the "rollout.awaiting_infra_approval" webhook event.
func (*RolloutAwaitingInfraApprovalEvent) GetApp ¶
func (e *RolloutAwaitingInfraApprovalEvent) GetApp() *Application
func (*RolloutAwaitingInfraApprovalEvent) GetEnv ¶
func (e *RolloutAwaitingInfraApprovalEvent) GetEnv() *Environment
func (*RolloutAwaitingInfraApprovalEvent) GetRollout ¶
func (e *RolloutAwaitingInfraApprovalEvent) GetRollout() *Rollout
type RolloutCompletedEvent ¶
type RolloutCompletedEvent struct {
// Rollout describes the current rollout state.
// It's always non-nil.
Rollout *Rollout `json:"rollout"`
// Env is the environment the rollout is targeting.
// It's always non-nil.
Env *Environment `json:"env"`
// App is the application the event is for.
// It's always non-nil.
App *Application `json:"app"`
}
RolloutCompletedEvent describes the "rollout.completed" webhook event.
func (*RolloutCompletedEvent) GetApp ¶
func (e *RolloutCompletedEvent) GetApp() *Application
func (*RolloutCompletedEvent) GetEnv ¶
func (e *RolloutCompletedEvent) GetEnv() *Environment
func (*RolloutCompletedEvent) GetRollout ¶
func (e *RolloutCompletedEvent) GetRollout() *Rollout
type RolloutConclusion ¶
type RolloutConclusion string
RolloutConclusion defines the result of a rollout.
Additional conclusions may be added in the future to distinguish between different types of failures.
const ( // RolloutSuccess means the rollout succeeded. RolloutSuccess RolloutConclusion = "success" // RolloutFailure means the rollout failed. RolloutFailure RolloutConclusion = "failure" // RolloutCanceled means the rollout was canceled. RolloutCanceled RolloutConclusion = "canceled" )
type RolloutCreatedEvent ¶
type RolloutCreatedEvent struct {
// Rollout describes the current rollout state.
// It's always non-nil.
Rollout *Rollout `json:"rollout"`
// Env is the environment the rollout is targeting.
// It's always non-nil.
Env *Environment `json:"env"`
// App is the application the event is for.
// It's always non-nil.
App *Application `json:"app"`
}
RolloutCreatedEvent describes the "rollout.created" webhook event.
func (*RolloutCreatedEvent) GetApp ¶
func (e *RolloutCreatedEvent) GetApp() *Application
func (*RolloutCreatedEvent) GetEnv ¶
func (e *RolloutCreatedEvent) GetEnv() *Environment
func (*RolloutCreatedEvent) GetRollout ¶
func (e *RolloutCreatedEvent) GetRollout() *Rollout
type RolloutEvent ¶
type RolloutEvent interface {
GetRollout() *Rollout
GetEnv() *Environment
GetApp() *Application
}
RolloutEvent is the interface implemented by all rollout-related events.
type RolloutStatus ¶
type RolloutStatus string
RolloutStatus defines the different rollout statuses.
const ( // RolloutPending means the rollout is pending, meaning it's created // but not yet queued. RolloutPending RolloutStatus = "pending" // RolloutQueued means the rollout is queued. RolloutQueued RolloutStatus = "queued" // RolloutRunning means the rollout is running. RolloutRunning RolloutStatus = "running" // RolloutCompleted means the rollout is completed. // See RolloutConclusion to know if it succeeded or failed. RolloutCompleted RolloutStatus = "completed" )