providers

package
v0.0.0-...-53d3859 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock abstracts time so that we can mock and test for generated names.

type Platform

type Platform interface {
	// CreateHook creates a hook for the respective platform.
	// Events define the events this hook subscribes to. Since we don't want all hooks
	// to subscribe to all events all the time, we provide the option to the user
	// to select the events.
	CreateHook(ctx context.Context, repo *v1alpha1.KrokRepository, providerToken, secret string) error
	// ValidateRequest will take a hook and verify it being a valid hook request according to
	// platform rules.
	ValidateRequest(ctx context.Context, r *http.Request, secret string) (bool, error)
	// GetEventID Based on the platform, retrieve the ID of the event.
	GetEventID(ctx context.Context, r *http.Request) (string, error)
	// GetEventType Based on the platform, retrieve the Type of the event.
	GetEventType(ctx context.Context, r *http.Request) (string, error)
	// GetRefIfPresent returns a Ref if the payload contains one.
	GetRefIfPresent(ctx context.Context, event *v1alpha1.KrokEvent) (string, string, error)
	// CheckoutCode will get the code given an event which needs the codebase.
	CheckoutCode(ctx context.Context, event *v1alpha1.KrokEvent, repository *v1alpha1.KrokRepository, location string) (string, error)
}

Platform defines what a platform should be able to do in order for it to work with hooks. Once a provider is selected when creating a repository given the right authorization the platform provider will create the hook on this repository.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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