Documentation
¶
Index ¶
- Constants
- func NewSemaphoreResourceManager(ctx context.Context, URL string, authenticate integrations.AuthenticateFn) (integrations.ResourceManager, error)
- type CreateWorkflowRequest
- type CreateWorkflowResponse
- type Hook
- type HookPipeline
- type HookWorkflow
- type Notification
- type NotificationMetadata
- type NotificationNotifySlack
- type NotificationNotifyWebhook
- type NotificationRule
- type NotificationRuleFilter
- type NotificationRuleNotify
- type NotificationSpec
- type Pipeline
- type PipelineResponse
- type Project
- type ProjectMetadata
- type RunTaskRequest
- type RunTaskResponse
- type Secret
- type SecretMetadata
- type SecretSpecData
- type SecretSpecDataEnvVar
- type SemaphoreEvent
- type SemaphoreEventHandler
- type SemaphoreOIDCVerifier
- type SemaphoreResourceManager
- func (i *SemaphoreResourceManager) Cancel(resourceType, id string, _ integrations.Resource) error
- func (i *SemaphoreResourceManager) CleanupWebhook(options integrations.WebhookOptions) error
- func (i *SemaphoreResourceManager) Get(resourceType, id string) (integrations.Resource, error)
- func (i *SemaphoreResourceManager) List(resourceTypes string) ([]integrations.Resource, error)
- func (i *SemaphoreResourceManager) RunWorkflow(params any) (integrations.StatefulResource, error)
- func (i *SemaphoreResourceManager) SetupWebhook(options integrations.WebhookOptions) (any, error)
- func (i *SemaphoreResourceManager) Status(resourceType, id string, _ integrations.Resource) (integrations.StatefulResource, error)
- type Task
- type WebhookMetadata
- type WebhookNotificationMetadata
- type WebhookSecretMetadata
- type Workflow
- type WorkflowResponse
Constants ¶
View Source
const ( PipelineStateDone = "done" PipelineResultPassed = "passed" PipelineResultFailed = "failed" ResourceTypeTask = "task" ResourceTypeProject = "project" ResourceTypeWorkflow = "workflow" ResourceTypeNotification = "notification" ResourceTypeSecret = "secret" ResourceTypePipeline = "pipeline" )
View Source
const (
PipelineDoneEvent = "pipeline_done"
)
Variables ¶
This section is empty.
Functions ¶
func NewSemaphoreResourceManager ¶
func NewSemaphoreResourceManager(ctx context.Context, URL string, authenticate integrations.AuthenticateFn) (integrations.ResourceManager, error)
Types ¶
type CreateWorkflowRequest ¶
type CreateWorkflowResponse ¶
type CreateWorkflowResponse struct {
WorkflowID string `json:"workflow_id"`
}
type Hook ¶
type Hook struct {
Workflow HookWorkflow
Pipeline HookPipeline
}
type HookPipeline ¶
type HookWorkflow ¶
type HookWorkflow struct {
ID string `json:"id"`
}
type Notification ¶
type Notification struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata NotificationMetadata `json:"metadata"`
Spec NotificationSpec `json:"spec"`
}
func (*Notification) Id ¶
func (p *Notification) Id() string
func (*Notification) Name ¶
func (p *Notification) Name() string
func (*Notification) Type ¶
func (p *Notification) Type() string
func (*Notification) URL ¶
func (p *Notification) URL() string
type NotificationMetadata ¶
type NotificationNotifySlack ¶
type NotificationRule ¶
type NotificationRule struct {
Name string `json:"name"`
Filter NotificationRuleFilter `json:"filter"`
Notify NotificationRuleNotify `json:"notify"`
}
type NotificationRuleFilter ¶
type NotificationRuleNotify ¶
type NotificationRuleNotify struct {
Webhook NotificationNotifyWebhook `json:"webhook"`
// TODO
// we don't really need this, but if it's not in the request,
// the API does not work properly.
// Once it's fixed, or we migrate to v2 API, we can remove it from here.
//
Slack NotificationNotifySlack `json:"slack"`
}
type NotificationSpec ¶
type NotificationSpec struct {
Rules []NotificationRule `json:"rules"`
}
type Pipeline ¶
type Pipeline struct {
PipelineURL string `json:"-"`
PipelineName string `json:"name"`
PipelineID string `json:"ppl_id"`
WorkflowID string `json:"wf_id"`
State string `json:"state"`
Result string `json:"result"`
}
func (*Pipeline) Successful ¶
type PipelineResponse ¶
type PipelineResponse struct {
Pipeline *Pipeline `json:"pipeline"`
}
type Project ¶
type Project struct {
ProjectURL string `json:"-"`
Metadata *ProjectMetadata `json:"metadata"`
}
type ProjectMetadata ¶
type RunTaskRequest ¶
type RunTaskResponse ¶
type RunTaskResponse struct {
WorkflowID string `json:"workflow_id"`
}
type Secret ¶
type Secret struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata SecretMetadata `json:"metadata"`
Data SecretSpecData `json:"data"`
}
type SecretMetadata ¶
type SecretSpecData ¶
type SecretSpecData struct {
EnvVars []SecretSpecDataEnvVar `json:"env_vars"`
}
type SecretSpecDataEnvVar ¶
type SemaphoreEvent ¶
type SemaphoreEvent struct {
PayloadSignature string `json:"signature"`
Payload Hook `json:"payload"`
}
func (*SemaphoreEvent) Signature ¶
func (e *SemaphoreEvent) Signature() string
func (*SemaphoreEvent) Type ¶
func (e *SemaphoreEvent) Type() string
Semaphore only has one type of event. Even though the event type is not in the event payload, this event is always sent when a pipeline is done, so we use the 'pipeline_done' type here.
type SemaphoreEventHandler ¶
type SemaphoreEventHandler struct{}
func (*SemaphoreEventHandler) EventTypes ¶
func (i *SemaphoreEventHandler) EventTypes() []string
func (*SemaphoreEventHandler) Handle ¶
func (i *SemaphoreEventHandler) Handle(data []byte, header http.Header) (integrations.Event, error)
func (*SemaphoreEventHandler) Status ¶
func (i *SemaphoreEventHandler) Status(_ string, data []byte) (integrations.StatefulResource, error)
type SemaphoreOIDCVerifier ¶
type SemaphoreOIDCVerifier struct{}
func (*SemaphoreOIDCVerifier) Verify ¶
func (h *SemaphoreOIDCVerifier) Verify(ctx context.Context, verifier *crypto.OIDCVerifier, token string, options integrations.VerifyTokenOptions) error
type SemaphoreResourceManager ¶
func (*SemaphoreResourceManager) Cancel ¶
func (i *SemaphoreResourceManager) Cancel(resourceType, id string, _ integrations.Resource) error
func (*SemaphoreResourceManager) CleanupWebhook ¶
func (i *SemaphoreResourceManager) CleanupWebhook(options integrations.WebhookOptions) error
func (*SemaphoreResourceManager) Get ¶
func (i *SemaphoreResourceManager) Get(resourceType, id string) (integrations.Resource, error)
func (*SemaphoreResourceManager) List ¶
func (i *SemaphoreResourceManager) List(resourceTypes string) ([]integrations.Resource, error)
func (*SemaphoreResourceManager) RunWorkflow ¶
func (i *SemaphoreResourceManager) RunWorkflow(params any) (integrations.StatefulResource, error)
func (*SemaphoreResourceManager) SetupWebhook ¶
func (i *SemaphoreResourceManager) SetupWebhook(options integrations.WebhookOptions) (any, error)
func (*SemaphoreResourceManager) Status ¶
func (i *SemaphoreResourceManager) Status(resourceType, id string, _ integrations.Resource) (integrations.StatefulResource, error)
type WebhookMetadata ¶
type WebhookMetadata struct {
Secret WebhookSecretMetadata `json:"secret"`
Notification WebhookNotificationMetadata `json:"notification"`
}
type WebhookSecretMetadata ¶
type Workflow ¶
type Workflow struct {
WorkflowURL string `json:"url"`
WfID string `json:"wf_id"`
InitialPplID string `json:"initial_ppl_id"`
Pipeline *Pipeline `json:"pipeline"`
}
func (*Workflow) Successful ¶
type WorkflowResponse ¶
type WorkflowResponse struct {
Workflow *Workflow `json:"workflow"`
}
Click to show internal directories.
Click to hide internal directories.