Documentation ¶
Index ¶
- Constants
- func AddBasicAuth(req *http.Request) error
- func BuildFunctionContext(function string) string
- func CreateServiceURL(URL, suffix string) string
- func FormatServiceName(owner, functionName string) string
- func GetPrivateKeyPath() string
- func HmacEnabled() bool
- func MarshalToken(token string) string
- func PostAudit(auditEvent AuditEvent)
- func ReadSecret(key string) (string, error)
- func UnmarshalToken(data []byte) (string, error)
- func ValidHMAC(payload *[]byte, secretKey string, digest string) error
- func ValidToken(token string) bool
- type Audit
- type AuditEvent
- type AuditLogger
- type BuildResult
- type CommitStatus
- type Customer
- type Event
- type NilLogger
- type Owner
- type PipelineLog
- type PushEvent
- type PushEventInstallation
- type PushEventRepository
- type Sender
- type Status
Constants ¶
const ( //CloudSignatureHeader header name to pass signed payload secret CloudSignatureHeader = "X-Cloud-Signature" // FunctionLabelPrefix is a prefix for openfaas labels inside functions FunctionLabelPrefix = "com.openfaas.cloud." )
const ( StatusSuccess = "success" StatusFailure = "failure" StatusPending = "pending" )
github status constant
const ( FunctionContext = "%s" StackContext = "stack-deploy" EmptyAuthToken = "" )
context constant
Variables ¶
This section is empty.
Functions ¶
func AddBasicAuth ¶
AddBasicAuth to a request by reading secrets when available
func BuildFunctionContext ¶
BuildFunctionContext build a github context for a function
Example: sdk.BuildFunctionContext(functionName)
func CreateServiceURL ¶
func FormatServiceName ¶
func GetPrivateKeyPath ¶
func GetPrivateKeyPath() string
func HmacEnabled ¶
func HmacEnabled() bool
HmacEnabled uses validate_hmac env-var to verify if the feature is enabled
func MarshalToken ¶
MarshalToken marshal a token into json i.e. {"token": "auth_token_value"}
func PostAudit ¶
func PostAudit(auditEvent AuditEvent)
func ReadSecret ¶
ReadSecret reads a secret from /var/openfaas/secrets or from env-var 'secret_mount_path' if set.
func UnmarshalToken ¶
UnmarshalToken unmarshal a token and validate
Types ¶
type Audit ¶
type Audit interface {
Post(AuditEvent) error
}
type AuditLogger ¶
type AuditLogger struct { }
func (AuditLogger) Post ¶
func (l AuditLogger) Post(auditEvent AuditEvent) error
type BuildResult ¶
type BuildResult struct { Log []string `json:"log"` ImageName string `json:"imageName"` Status string `json:"status"` }
BuildResult represents a successful Docker build and push operation to a remote registry
type CommitStatus ¶
type Event ¶
type Event struct { Service string `json:"service"` Owner string `json:"owner"` Repository string `json:"repository"` Image string `json:"image"` SHA string `json:"sha"` URL string `json:"url"` InstallationID int `json:"installationID"` Environment map[string]string `json:"environment"` Secrets []string `json:"secrets"` Private bool `json:"private"` }
Event info to pass/store events across functions
func BuildEventFromPushEvent ¶
BuildEventFromPushEvent function to build Event from PushEvent
type NilLogger ¶
type NilLogger struct { }
func (NilLogger) Post ¶
func (l NilLogger) Post(auditEvent AuditEvent) error
type PipelineLog ¶
type PipelineLog struct { RepoPath string CommitSHA string Function string Source string Data string }
PipelineLog stores a log output from a given stage of a pipeline such as the container builder
type PushEvent ¶
type PushEvent struct { Ref string `json:"ref"` Repository PushEventRepository AfterCommitID string `json:"after"` Installation PushEventInstallation }
type PushEventInstallation ¶
type PushEventInstallation struct {
ID int `json:"id"`
}
PushEvent as received from GitHub
type PushEventRepository ¶
type Status ¶
type Status struct { CommitStatuses map[string]CommitStatus `json:"commit-statuses"` EventInfo Event `json:"event"` AuthToken string `json:"auth-token"` }
Status to post status to github-status function
func BuildStatus ¶
BuildStatus constructs a status object from event
func UnmarshalStatus ¶
UnmarshalStatus unmarshal a status object from json
func (*Status) AddStatus ¶
AddStatus adds a commit status into a status object
a status can contain multiple commit status