Documentation ¶
Index ¶
- Variables
- func GetImportHandlerFunc(storagePath string, checker projectChecker, maxPackageSize uint64, ...) ...
- func GetMetadataHandlerFunc(params metadata.MetadataParams, principal *models.Principal) middleware.Responder
- func PostEventHandlerFunc(eventValidation bool) func(event.PostEventParams, *models.Principal) middleware.Responder
- func Validate(e models.KeptnContextExtendedCE) error
- type ControlPlaneProjectRetriever
- type EventHandler
- type EventValidationError
- type ImportHandler
- type KeptnControlPlaneEndpointProvider
- type ZippedPackage
Constants ¶
This section is empty.
Variables ¶
var ErrorInvalidResourcePath = errors.New("invalid resource path")
ErrorInvalidResourcePath is returned whenever the requested resource location would not be within the ZippedPackage content
var ErrorUncompressedSizeTooBig = errors.New("uncompressed size of package exceeds configured maximum size")
ErrorUncompressedSizeTooBig signals that a zip archive has an uncompressed size greater than maximum size allowed
Functions ¶
func GetImportHandlerFunc ¶
func GetImportHandlerFunc( storagePath string, checker projectChecker, maxPackageSize uint64, processor importPackageProcessor, ) func( params import_operations.ImportParams, principal *models.Principal, ) middleware.Responder
GetImportHandlerFunc will instantiate a configured ImportHandler and return the method that can be used for handling http requests to the endpoint. See restapi.configureAPI for usage
func GetMetadataHandlerFunc ¶
func GetMetadataHandlerFunc(params metadata.MetadataParams, principal *models.Principal) middleware.Responder
GetMetadataHandlerFunc returns metadata of the keptn installation
func PostEventHandlerFunc ¶
func PostEventHandlerFunc(eventValidation bool) func(event.PostEventParams, *models.Principal) middleware.Responder
func Validate ¶
func Validate(e models.KeptnContextExtendedCE) error
Validate takes a KeptnContextExtendedCE value and validates its content. If the event is valid, the returned error is nil. If it is not valid a EventValidationError is returned
Types ¶
type ControlPlaneProjectRetriever ¶
type ControlPlaneProjectRetriever struct {
// contains filtered or unexported fields
}
ControlPlaneProjectRetriever is a simple client that will check the existence of a keptn project by querying the control plane service
func NewControlPlaneProjectRetriever ¶
func NewControlPlaneProjectRetriever(provider KeptnControlPlaneEndpointProvider) *ControlPlaneProjectRetriever
NewControlPlaneProjectRetriever instantiates a new initialized ControlPlaneProjectRetriever that will use the control plane service available at controlPlaneURI
func (*ControlPlaneProjectRetriever) GetStages ¶
func (c *ControlPlaneProjectRetriever) GetStages(projectName string) ([]string, error)
GetStages will perform a GetProject on controlPlane and parse the output to return the defined stages names.
func (*ControlPlaneProjectRetriever) ProjectExists ¶
func (c *ControlPlaneProjectRetriever) ProjectExists(projectName string) (bool, error)
ProjectExists will perform a GetProject on controlPlane to test if the specific project exists. In case of error performing the HTTP request the returned error will be not nil and will wrap the original error received from the http client It returns (true, nil) if the http status code from the control plane is 200, (false, nil) otherwise.
type EventHandler ¶
type EventHandler struct { EventPublisher eventPublisher EventValidationEnabled bool }
func GetEventHandlerInstance ¶
func GetEventHandlerInstance(eventValidation bool) *EventHandler
func (*EventHandler) PostEvent ¶
func (eh *EventHandler) PostEvent(event models.KeptnContextExtendedCE) (*models.EventContext, error)
type EventValidationError ¶
type EventValidationError struct{ Msg string }
EventValidationError is a custom error used to represent errors during validation of keptn events sent to the API
func (EventValidationError) Error ¶
func (e EventValidationError) Error() string
func (EventValidationError) Unwrap ¶
func (e EventValidationError) Unwrap() error
type ImportHandler ¶
type ImportHandler struct {
// contains filtered or unexported fields
}
ImportHandler is the rest handler for the /import endpoint
func (*ImportHandler) HandleImport ¶
func (ih *ImportHandler) HandleImport( params import_operations.ImportParams, principal *models.Principal, ) middleware.Responder
HandleImport is the method invoked when a POST request is received on the import endpoint. This method will check that the project passed as parameter already exists in Keptn ( return a 404 immediately if that is not the case), save the import package on the scratch storage and parse its contents.
type KeptnControlPlaneEndpointProvider ¶
type KeptnControlPlaneEndpointProvider interface {
GetControlPlaneEndpoint() string
}
type ZippedPackage ¶
type ZippedPackage struct {
// contains filtered or unexported fields
}
ZippedPackage represents a zipped import package ready to be use (it is extracted to a temp directory)
func NewZippedPackage ¶
func NewZippedPackage(zipFile string, maxSize uint64) (*ZippedPackage, error)
NewZippedPackage creates a new ZippedPackage object ready to be used. The zip file contents will be extracted in a subDirectory with the same name as the file stripped of the .zip extension. During the extraction, zip file uncompressed content is checked not to surpass maxSize. If any error occurs, the temporary folder is cleaned up and (nil, error) will be returned
func (*ZippedPackage) Close ¶
func (m *ZippedPackage) Close() error
Close signals that the package resources can be freed (including any extracted files). Once Close has been called it's illegal to call any other ZippedPackage operation
func (*ZippedPackage) GetResource ¶
func (m *ZippedPackage) GetResource(resourceName string) (io.ReadCloser, error)
func (*ZippedPackage) ResourceExists ¶
func (m *ZippedPackage) ResourceExists(resourceName string) (bool, error)