api

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 20 Imported by: 74

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceNotFoundError = errors.New("Resource not found")

Functions

func HealthEndpointHandler added in v0.10.0

func HealthEndpointHandler(w http.ResponseWriter, r *http.Request)

func RunHealthEndpoint added in v0.7.0

func RunHealthEndpoint(port string)

func SortByTime added in v0.8.0

func SortByTime(events []*models.KeptnContextExtendedCE)

SortByTime sorts the event slice by time (oldest to newest)

Types

type APIHandler added in v0.7.0

type APIHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

APIHandler handles projects

func NewAuthenticatedAPIHandler added in v0.7.0

func NewAuthenticatedAPIHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *APIHandler

NewAuthenticatedAPIHandler returns a new APIHandler that authenticates at the api-service endpoint via the provided token

func (*APIHandler) CreateProject added in v0.7.0

func (a *APIHandler) CreateProject(project models.CreateProject) (string, *models.Error)

CreateProject creates a new project

func (*APIHandler) CreateService added in v0.7.0

func (a *APIHandler) CreateService(project string, service models.CreateService) (string, *models.Error)

CreateService creates a new service

func (*APIHandler) DeleteProject added in v0.7.0

func (a *APIHandler) DeleteProject(project models.Project) (*models.DeleteProjectResponse, *models.Error)

DeleteProject deletes a project

func (*APIHandler) DeleteService added in v0.7.1

func (a *APIHandler) DeleteService(project, service string) (*models.DeleteServiceResponse, *models.Error)

DeleteProject deletes a project

func (*APIHandler) GetMetadata added in v0.7.0

func (a *APIHandler) GetMetadata() (*models.Metadata, *models.Error)

GetMetadata retrieve keptn MetaData information

func (*APIHandler) SendEvent added in v0.7.0

SendEvent sends an event to Keptn

func (*APIHandler) TriggerEvaluation added in v0.8.0

func (a *APIHandler) TriggerEvaluation(project, stage, service string, evaluation models.Evaluation) (*models.EventContext, *models.Error)

TriggerEvaluation triggers a new evaluation

func (*APIHandler) UpdateProject added in v0.8.0

func (a *APIHandler) UpdateProject(project models.CreateProject) (string, *models.Error)

UpdateProject updates project

type APIService

type APIService interface {
	// contains filtered or unexported methods
}

APIService represents the interface for accessing the configuration service

type AuthHandler

type AuthHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

AuthHandler handles projects

func NewAuthHandler

func NewAuthHandler(baseURL string) *AuthHandler

NewAuthHandler returns a new AuthHandler

func NewAuthenticatedAuthHandler

func NewAuthenticatedAuthHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *AuthHandler

NewAuthenticatedAuthHandler returns a new AuthHandler that authenticates at the endpoint via the provided token

func (*AuthHandler) Authenticate

func (a *AuthHandler) Authenticate() (*models.EventContext, *models.Error)

Authenticate authenticates the client request against the server

type ConfigurableSleeper added in v0.8.0

type ConfigurableSleeper struct {
	// contains filtered or unexported fields
}

ConfigurableSleeper is an implementation of a sleeper that can be configured to sleep for a specific duration

func NewConfigurableSleeper added in v0.8.0

func NewConfigurableSleeper(duration time.Duration) *ConfigurableSleeper

NewConfigurableSleeper creates a new instance of a configurable sleeper which will pause execution of the current thread for a given duration

func (*ConfigurableSleeper) Sleep added in v0.8.0

func (c *ConfigurableSleeper) Sleep()

Sleep pauses the execution

type EventFilter added in v0.7.0

type EventFilter struct {
	Project       string
	Stage         string
	Service       string
	EventType     string
	KeptnContext  string
	EventID       string
	PageSize      string
	NumberOfPages int
	FromTime      string
}

EventFilter allows to filter events based on the provided properties

type EventHandler

type EventHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

EventHandler handles services

func NewAuthenticatedEventHandler

func NewAuthenticatedEventHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *EventHandler

NewAuthenticatedEventHandler returns a new EventHandler that authenticates at the endpoint via the provided token

func NewEventHandler

func NewEventHandler(baseURL string) *EventHandler

NewEventHandler returns a new EventHandler

func (*EventHandler) GetEvents added in v0.7.0

func (e *EventHandler) GetEvents(filter *EventFilter) ([]*models.KeptnContextExtendedCE, *models.Error)

GetEvents returns all events matching the properties in the passed filter object

func (*EventHandler) GetEventsWithRetry added in v0.8.0

func (e *EventHandler) GetEventsWithRetry(filter *EventFilter, maxRetries int, retrySleepTime time.Duration) ([]*models.KeptnContextExtendedCE, error)

GetEventsWithRetry tries to retrieve events matching the passed filter

type EventHandlerInterface added in v0.8.0

type EventHandlerInterface interface {
	GetEventsWithRetry(filter *EventFilter, maxRetries int, retrySleepTime time.Duration) ([]*models.KeptnContextExtendedCE, error)
	GetEvents(filter *EventFilter) ([]*models.KeptnContextExtendedCE, *models.Error)
}

EventHandlerInterface is the api to fetch events from the event store

type EventManipulatorFunc added in v0.8.0

type EventManipulatorFunc func([]*models.KeptnContextExtendedCE)

EventManipulatorFunc can be used to manipulate a slice of events

type EventWatcher added in v0.8.0

type EventWatcher struct {
	// contains filtered or unexported fields
}

EventWatcher implements the logic to query for events and provide them to the client

func NewEventWatcher added in v0.8.0

func NewEventWatcher(eventHandler EventHandlerInterface, opts ...EventWatcherOption) *EventWatcher

NewEventWatcher creates a new event watcher with the given options

func (*EventWatcher) Watch added in v0.8.0

Watch starts the watch loop and returns a channel to get the actual events as well as a context.CancelFunc in order to stop the watch routine

type EventWatcherOption added in v0.8.0

type EventWatcherOption func(*EventWatcher)

EventWatcherOption can be used to configure the EventWatcher

func WithEventFilter added in v0.8.0

func WithEventFilter(filter EventFilter) EventWatcherOption

WithEventFilter configures the EventWatcher to use a filter

func WithInterval added in v0.8.0

func WithInterval(ticker *time.Ticker) EventWatcherOption

WithInterval configures the EventWatcher to use a custom delay between each query You can use this to overwrite the default which is 10 * time.Second

func WithStartTime added in v0.8.0

func WithStartTime(startTime time.Time) EventWatcherOption

WithStartTime configures the EventWatcher to use a specific start timestamp for the first query

func WithTimeout added in v0.8.0

func WithTimeout(duration time.Duration) EventWatcherOption

WithTimeout configures the EventWatcher to use a custom timeout specifying after which duration the watcher shall stop

type FakeSleeper added in v0.8.0

type FakeSleeper struct {
}

FakeSleeper is a sleeper that does not sleep

func NewFakeSleeper added in v0.8.0

func NewFakeSleeper() *FakeSleeper

NewFakeSleeper creates a new instance of a FakeSleeper

func (*FakeSleeper) Sleep added in v0.8.0

func (f *FakeSleeper) Sleep()

Sleep does nothing, not even sleep

type ILogHandler added in v0.8.5

type ILogHandler interface {
	Log(logs []models.LogEntry)
	Flush() error
	GetLogs(params models.GetLogsParams) (*models.GetLogsResponse, error)
	DeleteLogs(filter models.LogFilter) error
	Start(ctx context.Context)
}

type LogHandler added in v0.8.5

type LogHandler struct {
	BaseURL      string
	AuthToken    string
	AuthHeader   string
	HTTPClient   *http.Client
	Scheme       string
	LogCache     []models.LogEntry
	TheClock     clock.Clock
	SyncInterval time.Duration
	// contains filtered or unexported fields
}

func NewAuthenticatedLogHandler added in v0.8.5

func NewAuthenticatedLogHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *LogHandler

func NewLogHandler added in v0.8.5

func NewLogHandler(baseURL string) *LogHandler

func (*LogHandler) DeleteLogs added in v0.8.5

func (lh *LogHandler) DeleteLogs(params models.LogFilter) error

func (*LogHandler) Flush added in v0.8.5

func (lh *LogHandler) Flush() error

func (*LogHandler) GetLogs added in v0.8.5

func (lh *LogHandler) GetLogs(params models.GetLogsParams) (*models.GetLogsResponse, error)

func (*LogHandler) Log added in v0.8.5

func (lh *LogHandler) Log(logs []models.LogEntry)

func (*LogHandler) Start added in v0.8.5

func (lh *LogHandler) Start(ctx context.Context)

type ProjectHandler

type ProjectHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

ProjectHandler handles projects

func NewAuthenticatedProjectHandler

func NewAuthenticatedProjectHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ProjectHandler

NewAuthenticatedProjectHandler returns a new ProjectHandler that authenticates at the api via the provided token and sends all requests directly to the configuration-service

func NewProjectHandler

func NewProjectHandler(baseURL string) *ProjectHandler

NewProjectHandler returns a new ProjectHandler which sends all requests directly to the configuration-service

func (*ProjectHandler) CreateProject

func (p *ProjectHandler) CreateProject(project models.Project) (*models.EventContext, *models.Error)

CreateProject creates a new project

func (*ProjectHandler) DeleteProject

func (p *ProjectHandler) DeleteProject(project models.Project) (*models.EventContext, *models.Error)

DeleteProject deletes a project

func (*ProjectHandler) GetAllProjects added in v0.6.2

func (p *ProjectHandler) GetAllProjects() ([]*models.Project, error)

GetProjects returns a project

func (*ProjectHandler) GetProject

func (p *ProjectHandler) GetProject(project models.Project) (*models.Project, *models.Error)

GetProject returns a project

func (*ProjectHandler) UpdateConfigurationServiceProject added in v0.7.0

func (p *ProjectHandler) UpdateConfigurationServiceProject(project models.Project) (*models.EventContext, *models.Error)

type ResourceHandler

type ResourceHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

ResourceHandler handles resources

func NewAuthenticatedResourceHandler

func NewAuthenticatedResourceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ResourceHandler

NewAuthenticatedResourceHandler returns a new ResourceHandler that authenticates at the api via the provided token and sends all requests directly to the configuration-service

func NewResourceHandler

func NewResourceHandler(baseURL string) *ResourceHandler

NewResourceHandler returns a new ResourceHandler which sends all requests directly to the configuration-service

func (*ResourceHandler) CreateProjectResources added in v0.6.2

func (r *ResourceHandler) CreateProjectResources(project string, resources []*models.Resource) (string, error)

CreateProjectResources creates multiple project resources

func (*ResourceHandler) CreateResources added in v0.6.0

func (r *ResourceHandler) CreateResources(project string, stage string, service string, resources []*models.Resource) (*models.EventContext, *models.Error)

CreateResources creates a resource for the specified entity

func (*ResourceHandler) CreateServiceResources

func (r *ResourceHandler) CreateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)

CreateServiceResources creates a service resource

func (*ResourceHandler) CreateStageResources added in v0.6.2

func (r *ResourceHandler) CreateStageResources(project string, stage string, resources []*models.Resource) (string, error)

CreateStageResources creates a stage resource

func (*ResourceHandler) DeleteProjectResource added in v0.6.2

func (r *ResourceHandler) DeleteProjectResource(project string, resourceURI string) error

DeleteProjectResource deletes a project resource

func (*ResourceHandler) DeleteServiceResource added in v0.6.2

func (r *ResourceHandler) DeleteServiceResource(project string, stage string, service string, resourceURI string) error

DeleteServiceResource deletes a service resource

func (*ResourceHandler) DeleteStageResource added in v0.6.2

func (r *ResourceHandler) DeleteStageResource(project string, stage string, resourceURI string) error

DeleteStageResource deletes a stage resource

func (*ResourceHandler) GetAllServiceResources added in v0.6.2

func (r *ResourceHandler) GetAllServiceResources(project string, stage string, service string) ([]*models.Resource, error)

GetAllServiceResources returns a list of all resources.

func (*ResourceHandler) GetAllStageResources added in v0.6.2

func (r *ResourceHandler) GetAllStageResources(project string, stage string) ([]*models.Resource, error)

GetAllStageResources returns a list of all resources.

func (*ResourceHandler) GetProjectResource added in v0.6.2

func (r *ResourceHandler) GetProjectResource(project string, resourceURI string) (*models.Resource, error)

GetProjectResource retrieves a project resource from the configuration service

func (*ResourceHandler) GetServiceResource added in v0.6.2

func (r *ResourceHandler) GetServiceResource(project string, stage string, service string, resourceURI string) (*models.Resource, error)

GetServiceResource retrieves a service resource from the configuration service

func (*ResourceHandler) GetStageResource added in v0.6.2

func (r *ResourceHandler) GetStageResource(project string, stage string, resourceURI string) (*models.Resource, error)

GetStageResource retrieves a stage resource from the configuration service

func (*ResourceHandler) UpdateProjectResource added in v0.6.2

func (r *ResourceHandler) UpdateProjectResource(project string, resource *models.Resource) (string, error)

UpdateProjectResource updates a project resource

func (*ResourceHandler) UpdateProjectResources added in v0.6.2

func (r *ResourceHandler) UpdateProjectResources(project string, resources []*models.Resource) (string, error)

UpdateProjectResources updates multiple project resources

func (*ResourceHandler) UpdateServiceResource added in v0.6.2

func (r *ResourceHandler) UpdateServiceResource(project string, stage string, service string, resource *models.Resource) (string, error)

UpdateServiceResource updates a service resource

func (*ResourceHandler) UpdateServiceResources added in v0.6.2

func (r *ResourceHandler) UpdateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)

UpdateServiceResources updates multiple service resources

func (*ResourceHandler) UpdateStageResource added in v0.6.2

func (r *ResourceHandler) UpdateStageResource(project string, stage string, resource *models.Resource) (string, error)

UpdateStageResource updates a stage resource

func (*ResourceHandler) UpdateStageResources added in v0.6.2

func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error)

UpdateStageResources updates multiple stage resources

type SecretHandler added in v0.8.1

type SecretHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

SecretHandler handles services

func NewAuthenticatedSecretHandler added in v0.8.1

func NewAuthenticatedSecretHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *SecretHandler

NewAuthenticatedSecretHandler returns a new SecretHandler that authenticates at the api via the provided token and sends all requests directly to the secret-service

func NewSecretHandler added in v0.8.1

func NewSecretHandler(baseURL string) *SecretHandler

NewSecretHandler returns a new SecretHandler which sends all requests directly to the secret-service

func (*SecretHandler) CreateSecret added in v0.8.1

func (s *SecretHandler) CreateSecret(secret models.Secret) error

CreateSecret creates a new secret

func (*SecretHandler) DeleteSecret added in v0.8.1

func (s *SecretHandler) DeleteSecret(secretName, secretScope string) error

DeleteSecret deletes a secret

func (*SecretHandler) GetSecrets added in v0.8.5

func (s *SecretHandler) GetSecrets() (*models.GetSecretsResponse, error)

GetSecrets returns a list of created secrets

func (*SecretHandler) UpdateSecret added in v0.8.1

func (s *SecretHandler) UpdateSecret(secret models.Secret) error

UpdateSecret creates a new secret

type SecretHandlerInterface added in v0.8.1

type SecretHandlerInterface interface {
	CreateSecret(secret models.Secret) error
	UpdateSecret(secret models.Secret) error
	DeleteSecret(secretName, secretScope string) error
	GetSecrets() (*models.GetSecretsResponse, error)
}

type SequenceControlBody added in v0.9.0

type SequenceControlBody struct {
	Stage string `json:"stage"`
	State string `json:"state"`
}

func (*SequenceControlBody) ToJSON added in v0.9.0

func (s *SequenceControlBody) ToJSON() ([]byte, error)

type SequenceControlHandler added in v0.9.0

type SequenceControlHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

func NewAuthenticatedSequenceControlHandler added in v0.9.0

func NewAuthenticatedSequenceControlHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *SequenceControlHandler

func NewSequenceControlHandler added in v0.9.0

func NewSequenceControlHandler(baseURL string) *SequenceControlHandler

func (*SequenceControlHandler) ControlSequence added in v0.9.0

func (s *SequenceControlHandler) ControlSequence(params SequenceControlParams) error

type SequenceControlParams added in v0.9.0

type SequenceControlParams struct {
	Project      string `json:"project"`
	KeptnContext string `json:"keptnContext"`
	Stage        string `json:"stage"`
	State        string `json:"state"`
}

func (*SequenceControlParams) Validate added in v0.9.0

func (s *SequenceControlParams) Validate() error

type ServiceHandler

type ServiceHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

ServiceHandler handles services

func NewAuthenticatedServiceHandler

func NewAuthenticatedServiceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ServiceHandler

NewAuthenticatedServiceHandler returns a new ServiceHandler that authenticates at the api via the provided token and sends all requests directly to the configuration-service

func NewServiceHandler

func NewServiceHandler(baseURL string) *ServiceHandler

NewServiceHandler returns a new ServiceHandler which sends all requests directly to the configuration-service

func (*ServiceHandler) CreateServiceInStage added in v0.6.2

func (s *ServiceHandler) CreateServiceInStage(project string, stage string, serviceName string) (*models.EventContext, *models.Error)

CreateService creates a new service

func (*ServiceHandler) DeleteServiceFromStage added in v0.7.1

func (s *ServiceHandler) DeleteServiceFromStage(project string, stage string, serviceName string) (*models.EventContext, *models.Error)

DeleteServiceFromStage godoc

func (*ServiceHandler) GetAllServices added in v0.6.2

func (s *ServiceHandler) GetAllServices(project string, stage string) ([]*models.Service, error)

GetAllServices returns a list of all services.

func (*ServiceHandler) GetService added in v0.7.0

func (s *ServiceHandler) GetService(project, stage, service string) (*models.Service, error)

type ShipyardControllerHandler added in v0.8.0

type ShipyardControllerHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

ShipyardControllerHandler handles services

func NewAuthenticatedShipyardControllerHandler added in v0.8.0

func NewAuthenticatedShipyardControllerHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ShipyardControllerHandler

NewAuthenticatedShipyardControllerHandler returns a new ShipyardControllerHandler that authenticates at the api via the provided token and sends all requests directly to the configuration-service

func NewShipyardControllerHandler added in v0.8.0

func NewShipyardControllerHandler(baseURL string) *ShipyardControllerHandler

NewShipyardControllerHandler returns a new ShipyardControllerHandler which sends all requests directly to the configuration-service

func (*ShipyardControllerHandler) GetOpenTriggeredEvents added in v0.8.0

func (s *ShipyardControllerHandler) GetOpenTriggeredEvents(filter EventFilter) ([]*models.KeptnContextExtendedCE, error)

GetOpenTriggeredEvents returns all open triggered events

type Sleeper added in v0.8.0

type Sleeper interface {
	Sleep()
}

Sleeper defines the interface to sleep

type StageHandler added in v0.6.2

type StageHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

StageHandler handles stages

func NewAuthenticatedStageHandler added in v0.6.2

func NewAuthenticatedStageHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *StageHandler

NewAuthenticatedStageHandler returns a new StageHandler that authenticates at the api via the provided token and sends all requests directly to the configuration-service

func NewStageHandler added in v0.6.2

func NewStageHandler(baseURL string) *StageHandler

NewStageHandler returns a new StageHandler which sends all requests directly to the configuration-service

func (*StageHandler) CreateStage added in v0.6.2

func (s *StageHandler) CreateStage(project string, stageName string) (*models.EventContext, *models.Error)

CreateStage creates a new stage with the provided name

func (*StageHandler) GetAllStages added in v0.6.2

func (s *StageHandler) GetAllStages(project string) ([]*models.Stage, error)

GetAllStages returns a list of all stages.

type StatusBody added in v0.7.0

type StatusBody struct {
	Status string `json:"status"`
}

type UniformHandler added in v0.8.5

type UniformHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
}

func NewAuthenticatedUniformHandler added in v0.8.5

func NewAuthenticatedUniformHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *UniformHandler

func NewUniformHandler added in v0.8.5

func NewUniformHandler(baseURL string) *UniformHandler

func (*UniformHandler) CreateSubscription added in v0.9.0

func (u *UniformHandler) CreateSubscription(integrationID string, subscription models.EventSubscription) (string, error)

func (*UniformHandler) GetRegistrations added in v0.8.5

func (u *UniformHandler) GetRegistrations() ([]*models.Integration, error)

func (*UniformHandler) Ping added in v0.9.0

func (u *UniformHandler) Ping(integrationID string) (*models.Integration, error)

func (*UniformHandler) RegisterIntegration added in v0.8.5

func (u *UniformHandler) RegisterIntegration(integration models.Integration) (string, error)

func (*UniformHandler) UnregisterIntegration added in v0.8.5

func (u *UniformHandler) UnregisterIntegration(integrationID string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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