webhook

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2020 WILDCARD SA.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Created on 20/01/2021

Copyright 2020 WILDCARD SA.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Created on 20/01/2021

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPlayPayload

func BuildPlayPayload(play *ci.Play, status ci.State, logger logr.Logger) error

Types

type Object

type Object struct {
	NamespacedName types.NamespacedName `json:"namespaced_name,omitempty"`
	Kind           string               `json:"kind,omitempty"`
}

type Payload

type Payload interface {
	// Send sends the event to a webhook address
	Send(string) error

	// DoSend loop on webhook address and call Send
	DoSend([]Webhook) error

	// GetStatus return the name of the object in Payload
	GetStatus() ci.State

	// SetStatus record the status in the Payload
	SetStatus(ci.State)

	// GetObjectName return the name of the object in Payload
	GetObjectNamespacedName() types.NamespacedName

	// SetObjectName record the status in the Payload
	SetObjectNamespacedName(name types.NamespacedName)
}

func GetPayLoad

func GetPayLoad() Payload

GetPayLoad returns the

type PlayPayload

type PlayPayload struct {
	Object     Object    `json:"object,omitempty"`
	ProjectID  int64     `json:"project_id,omitempty"`
	PipelineID int64     `json:"pipeline_id,omitempty"`
	RepoURL    string    `json:"repo_url,omitempty"`
	Commit     ci.Commit `json:"ref,omitempty"`
	Stack      ci.Stack  `json:"stack,omitempty"`
	Status     ci.State  `json:"status,omitempty"`
}

func (*PlayPayload) DoSend

func (p *PlayPayload) DoSend(whs []Webhook) error

func (*PlayPayload) GetObjectNamespacedName

func (p *PlayPayload) GetObjectNamespacedName() types.NamespacedName

GetObjectName returns the object name from payload

func (*PlayPayload) GetStatus

func (p *PlayPayload) GetStatus() ci.State

GetStatus returns the play status from payload

func (*PlayPayload) Send

func (p *PlayPayload) Send(URL string) error

func (*PlayPayload) SetObjectNamespacedName

func (p *PlayPayload) SetObjectNamespacedName(namespacedName types.NamespacedName)

SetObjectName sets the object name in payload

func (*PlayPayload) SetStatus

func (p *PlayPayload) SetStatus(state ci.State)

SetStatus sets the play status to payload

type Webhook

type Webhook struct {
	Name   string `json:"name" yaml:"name"`
	URLRaw string `json:"url" yaml:"url"`
	URL    *url.URL
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL