api

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ErrWithStatusCode = v2.ErrWithStatusCode

ErrWithStatusCode message

Variables

View Source
var DefaultInClusterAPIMappings = InClusterAPIMappings{
	ConfigurationService: "resource-service:8080",
	ShipyardController:   "shipyard-controller:8080",
	ApiService:           "api-service:8080",
	SecretService:        "secret-service:8080",
	MongoDBDatastore:     "mongodb-datastore:8080",
}

DefaultInClusterAPIMappings gives you the default InClusterAPIMappings

View Source
var ResourceNotFoundError = v2.ResourceNotFoundError

Functions

func HealthEndpointHandler

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

func RunHealthEndpoint

func RunHealthEndpoint(port string, opts ...HealthHandlerOption)

RunHealthEndpoint starts an http server on the specified port and provides a simple HTTP Get endpoint that can be used for health checks per default, the endpoint will be reachable under the path '/health'

func SortByTime

func SortByTime(events []*models.KeptnContextExtendedCE)

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

func WithAuthToken

func WithAuthToken(authToken string, authHeader ...string) func(*APISet)

WithAuthToken sets the given auth token. Optionally a custom auth header can be set (default x-token)

func WithHTTPClient

func WithHTTPClient(client *http.Client) func(*APISet)

WithHTTPClient configures a custom http client to use

func WithScheme

func WithScheme(scheme string) func(*APISet)

WithScheme sets the scheme If this option is not used, then default scheme "http" is used by the APISet

Types

type APIHandler

type APIHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

APIHandler handles projects

func NewAPIHandler

func NewAPIHandler(baseURL string) *APIHandler

NewAPIHandler returns a new APIHandler

func NewAPIHandlerWithHTTPClient

func NewAPIHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *APIHandler

NewAPIHandlerWithHTTPClient returns a new APIHandler that uses the specified http.Client

func NewAuthenticatedAPIHandler

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 Deprecated: use APISet instead

func (*APIHandler) CreateProject

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

CreateProject creates a new project.

func (*APIHandler) CreateService

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

CreateService creates a new service.

func (*APIHandler) DeleteProject

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

DeleteProject deletes a project.

func (*APIHandler) DeleteService

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

DeleteService deletes a service.

func (*APIHandler) GetMetadata

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

GetMetadata retrieves Keptn metadata information.

func (*APIHandler) SendEvent

SendEvent sends an event to Keptn.

func (*APIHandler) TriggerEvaluation

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

TriggerEvaluation triggers a new evaluation.

func (*APIHandler) UpdateProject

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

UpdateProject updates a project.

type APIService

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

APIService represents the interface for accessing the configuration service

type APISet

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

APISet contains the API utils for all Keptn APIs

func New

func New(baseURL string, options ...func(*APISet)) (*APISet, error)

New creates a new APISet instance

func (*APISet) APIV1

func (c *APISet) APIV1() APIV1Interface

APIV1 retrieves the APIHandler

func (*APISet) AuthV1

func (c *APISet) AuthV1() AuthV1Interface

AuthV1 retrieves the AuthHandler

func (*APISet) Endpoint

func (c *APISet) Endpoint() *url.URL

Endpoint retrieves the base API endpoint URL

func (*APISet) EventsV1

func (c *APISet) EventsV1() EventsV1Interface

EventsV1 retrieves the EventHandler

func (*APISet) LogsV1

func (c *APISet) LogsV1() LogsV1Interface

LogsV1 retrieves the LogHandler

func (*APISet) ProjectsV1

func (c *APISet) ProjectsV1() ProjectsV1Interface

ProjectsV1 retrieves the ProjectHandler

func (*APISet) ResourcesV1

func (c *APISet) ResourcesV1() ResourcesV1Interface

ResourcesV1 retrieves the ResourceHandler

func (*APISet) SecretsV1

func (c *APISet) SecretsV1() SecretsV1Interface

SecretsV1 retrieves the SecretHandler

func (*APISet) SequencesV1

func (c *APISet) SequencesV1() SequencesV1Interface

SequencesV1 retrieves the SequenceControlHandler

func (*APISet) ServicesV1

func (c *APISet) ServicesV1() ServicesV1Interface

ServicesV1 retrieves the ServiceHandler

func (*APISet) ShipyardControlV1

func (c *APISet) ShipyardControlV1() ShipyardControlV1Interface

ShipyardControlV1 retrieves the ShipyardControllerHandler

func (*APISet) StagesV1

func (c *APISet) StagesV1() StagesV1Interface

StagesV1 retrieves the StageHandler

func (*APISet) Token

func (c *APISet) Token() string

Token retrieves the API token

func (*APISet) UniformV1

func (c *APISet) UniformV1() UniformV1Interface

UniformV1 retrieves the UniformHandler

type APIV1Interface

type APIV1Interface interface {
	// SendEvent sends an event to Keptn.
	SendEvent(event models.KeptnContextExtendedCE) (*models.EventContext, *models.Error)

	// TriggerEvaluation triggers a new evaluation.
	TriggerEvaluation(project string, stage string, service string, evaluation models.Evaluation) (*models.EventContext, *models.Error)

	// CreateProject creates a new project.
	CreateProject(project models.CreateProject) (string, *models.Error)

	// UpdateProject updates a project.
	UpdateProject(project models.CreateProject) (string, *models.Error)

	// DeleteProject deletes a project.
	DeleteProject(project models.Project) (*models.DeleteProjectResponse, *models.Error)

	// CreateService creates a new service.
	CreateService(project string, service models.CreateService) (string, *models.Error)

	// DeleteService deletes a service.
	DeleteService(project string, service string) (*models.DeleteServiceResponse, *models.Error)

	// GetMetadata retrieves Keptn metadata information.
	GetMetadata() (*models.Metadata, *models.Error)
}

type AuthHandler

type AuthHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

AuthHandler handles projects

func NewAuthHandler

func NewAuthHandler(baseURL string) *AuthHandler

NewAuthHandler returns a new AuthHandler

func NewAuthHandlerWithHTTPClient

func NewAuthHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *AuthHandler

NewAuthHandlerWithHTTPClient returns a new AuthHandler that uses the specified http.Client

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 Deprecated: use APISet instead

func (*AuthHandler) Authenticate

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

Authenticate authenticates the client request against the server.

type AuthV1Interface

type AuthV1Interface interface {
	// Authenticate authenticates the client request against the server.
	Authenticate() (*models.EventContext, *models.Error)
}

type ConfigurableSleeper

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

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

func (c *ConfigurableSleeper) Sleep()

Sleep pauses the execution

type EventFilter

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
	// contains filtered or unexported fields
}

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 Deprecated: use APISet instead

func NewEventHandler

func NewEventHandler(baseURL string) *EventHandler

NewEventHandler returns a new EventHandler

func NewEventHandlerWithHTTPClient

func NewEventHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *EventHandler

NewEventHandlerWithHTTPClient returns a new EventHandler that uses the specified http.Client

func (*EventHandler) GetEvents

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

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

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

type EventManipulatorFunc func([]*models.KeptnContextExtendedCE)

EventManipulatorFunc can be used to manipulate a slice of events

type EventWatcher

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

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

func NewEventWatcher

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

NewEventWatcher creates a new event watcher with the given options

func (*EventWatcher) Watch

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

type EventWatcherOption func(*EventWatcher)

EventWatcherOption can be used to configure the EventWatcher

func WithEventFilter

func WithEventFilter(filter EventFilter) EventWatcherOption

WithEventFilter configures the EventWatcher to use a filter

func WithInterval

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

func WithStartTime(startTime time.Time) EventWatcherOption

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

func WithTimeout

func WithTimeout(duration time.Duration) EventWatcherOption

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

type EventsV1Interface

type EventsV1Interface interface {
	// GetEvents returns all events matching the properties in the passed filter object.
	GetEvents(filter *EventFilter) ([]*models.KeptnContextExtendedCE, *models.Error)

	// GetEventsWithRetry tries to retrieve events matching the passed filter.
	GetEventsWithRetry(filter *EventFilter, maxRetries int, retrySleepTime time.Duration) ([]*models.KeptnContextExtendedCE, error)
}

type FakeSleeper

type FakeSleeper struct {
}

FakeSleeper is a sleeper that does not sleep

func NewFakeSleeper

func NewFakeSleeper() *FakeSleeper

NewFakeSleeper creates a new instance of a FakeSleeper

func (*FakeSleeper) Sleep

func (f *FakeSleeper) Sleep()

Sleep does nothing, not even sleep

type HealthHandlerOption

type HealthHandlerOption func(h *healthHandler)

func WithPath

func WithPath(path string) HealthHandlerOption

WithPath allows to specify the path under which the endpoint should be reachable

func WithReadinessConditionFunc

func WithReadinessConditionFunc(rc ReadinessConditionFunc) HealthHandlerOption

WithReadinessConditionFunc allows to specify a function that should determine if the endpoint should return an HTTP 200 (OK), or a 412 (Precondition failed) response

type ILogHandler

type ILogHandler interface {

	// Log appends the specified logs to the log cache.
	Log(logs []models.LogEntry)

	// Flush flushes the log cache.
	Flush() error

	// GetLogs gets logs with the specified parameters.
	GetLogs(params models.GetLogsParams) (*models.GetLogsResponse, error)

	// DeleteLogs deletes logs matching the specified log filter.
	DeleteLogs(filter models.LogFilter) error

	Start(ctx context.Context)
}

type InClusterAPIMappings

type InClusterAPIMappings map[InternalService]string

InClusterAPIMappings maps a keptn service name to its reachable domain name

type InternalAPIHandler

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

InternalAPIHandler is used instead of APIHandler from go-utils because we cannot support (unauthenticated) internal calls to the api-service at the moment. So this implementation will panic as soon as a client wants to call these methods

func (*InternalAPIHandler) CreateProject

func (i *InternalAPIHandler) CreateProject(project models.CreateProject) (string, *models.Error)

func (*InternalAPIHandler) CreateService

func (i *InternalAPIHandler) CreateService(project string, service models.CreateService) (string, *models.Error)

func (*InternalAPIHandler) DeleteProject

func (i *InternalAPIHandler) DeleteProject(project models.Project) (*models.DeleteProjectResponse, *models.Error)

func (*InternalAPIHandler) DeleteService

func (i *InternalAPIHandler) DeleteService(project string, service string) (*models.DeleteServiceResponse, *models.Error)

func (*InternalAPIHandler) GetMetadata

func (i *InternalAPIHandler) GetMetadata() (*models.Metadata, *models.Error)

func (*InternalAPIHandler) SendEvent

func (*InternalAPIHandler) TriggerEvaluation

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

func (*InternalAPIHandler) UpdateProject

func (i *InternalAPIHandler) UpdateProject(project models.CreateProject) (string, *models.Error)

type InternalAPISet

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

InternalAPISet is an implementation of APISet which can be used from within the Keptn control plane

func NewInternal

func NewInternal(client *http.Client, apiMappings ...InClusterAPIMappings) (*InternalAPISet, error)

NewInternal creates a new InternalAPISet usable for calling keptn services from within the control plane

func (*InternalAPISet) APIV1

func (c *InternalAPISet) APIV1() APIV1Interface

APIV1 retrieves the APIHandler

func (*InternalAPISet) AuthV1

func (c *InternalAPISet) AuthV1() AuthV1Interface

AuthV1 retrieves the AuthHandler

func (*InternalAPISet) EventsV1

func (c *InternalAPISet) EventsV1() EventsV1Interface

EventsV1 retrieves the EventHandler

func (*InternalAPISet) LogsV1

func (c *InternalAPISet) LogsV1() LogsV1Interface

LogsV1 retrieves the LogHandler

func (*InternalAPISet) ProjectsV1

func (c *InternalAPISet) ProjectsV1() ProjectsV1Interface

ProjectsV1 retrieves the ProjectHandler

func (*InternalAPISet) ResourcesV1

func (c *InternalAPISet) ResourcesV1() ResourcesV1Interface

ResourcesV1 retrieves the ResourceHandler

func (*InternalAPISet) SecretsV1

func (c *InternalAPISet) SecretsV1() SecretsV1Interface

SecretsV1 retrieves the SecretHandler

func (*InternalAPISet) SequencesV1

func (c *InternalAPISet) SequencesV1() SequencesV1Interface

SequencesV1 retrieves the SequenceControlHandler

func (*InternalAPISet) ServicesV1

func (c *InternalAPISet) ServicesV1() ServicesV1Interface

ServicesV1 retrieves the ServiceHandler

func (*InternalAPISet) ShipyardControlV1

func (c *InternalAPISet) ShipyardControlV1() ShipyardControlV1Interface

ShipyardControlV1 retrieves the ShipyardControllerHandler

func (*InternalAPISet) StagesV1

func (c *InternalAPISet) StagesV1() StagesV1Interface

StagesV1 retrieves the StageHandler

func (*InternalAPISet) UniformV1

func (c *InternalAPISet) UniformV1() UniformV1Interface

UniformV1 retrieves the UniformHandler

type InternalService

type InternalService int

InternalService is used to enumerate internal Keptn services

const (
	ConfigurationService InternalService = iota
	ShipyardController
	ApiService
	SecretService
	MongoDBDatastore
)

type KeptnInterface

type KeptnInterface interface {
	APIV1() APIV1Interface
	AuthV1() AuthV1Interface
	EventsV1() EventsV1Interface
	LogsV1() LogsV1Interface
	ProjectsV1() ProjectsV1Interface
	ResourcesV1() ResourcesV1Interface
	SecretsV1() SecretsV1Interface
	SequencesV1() SequencesV1Interface
	ServicesV1() ServicesV1Interface
	StagesV1() StagesV1Interface
	UniformV1() UniformV1Interface
	ShipyardControlV1() ShipyardControlV1Interface
}

type LogHandler

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

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

NewAuthenticatedLogHandler returns a new EventHandler that authenticates at the endpoint via the provided token Deprecated: use APISet instead

func NewLogHandler

func NewLogHandler(baseURL string) *LogHandler

NewLogHandler returns a new LogHandler

func NewLogHandlerWithHTTPClient

func NewLogHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *LogHandler

NewLogHandlerWithHTTPClient returns a new LogHandler that uses the specified http.Client

func (*LogHandler) DeleteLogs

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

DeleteLogs deletes logs matching the specified log filter.

func (*LogHandler) Flush

func (lh *LogHandler) Flush() error

Flush flushes the log cache.

func (*LogHandler) GetLogs

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

GetLogs gets logs with the specified parameters.

func (*LogHandler) Log

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

Log appends the specified logs to the log cache.

func (*LogHandler) Start

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

type LogsV1Interface

type LogsV1Interface interface {
	ILogHandler
}

type ProjectHandler

type ProjectHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

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 resource-service Deprecated: use APISet instead

func NewProjectHandler

func NewProjectHandler(baseURL string) *ProjectHandler

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

func NewProjectHandlerWithHTTPClient

func NewProjectHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ProjectHandler

NewProjectHandlerWithHTTPClient returns a new ProjectHandler which sends all requests directly to the resource-service using the specified http.Client

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

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

GetAllProjects returns all projects.

func (*ProjectHandler) GetProject

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

GetProject returns a project.

func (*ProjectHandler) UpdateConfigurationServiceProject

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

UpdateConfigurationServiceProject updates a configuration service project.

type ProjectsV1Interface

type ProjectsV1Interface interface {
	// CreateProject creates a new project.
	CreateProject(project models.Project) (*models.EventContext, *models.Error)

	// DeleteProject deletes a project.
	DeleteProject(project models.Project) (*models.EventContext, *models.Error)

	// GetProject returns a project.
	GetProject(project models.Project) (*models.Project, *models.Error)

	// GetAllProjects returns all projects.
	GetAllProjects() ([]*models.Project, error)

	// UpdateConfigurationServiceProject updates a configuration service project.
	UpdateConfigurationServiceProject(project models.Project) (*models.EventContext, *models.Error)
}

type ReadinessConditionFunc

type ReadinessConditionFunc func() bool

type ResourceHandler

type ResourceHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

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 resource-service Deprecated: use APISet instead

func NewResourceHandler

func NewResourceHandler(baseURL string) *ResourceHandler

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

func NewResourceHandlerWithHTTPClient

func NewResourceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ResourceHandler

NewResourceHandlerWithHTTPClient returns a new ResourceHandler which sends all requests directly to the resource-service using the specified http.Client

func (*ResourceHandler) CreateProjectResources

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

CreateProjectResources creates multiple project resources.

func (*ResourceHandler) CreateResource

func (r *ResourceHandler) CreateResource(resource []*models.Resource, scope ResourceScope, options ...URIOption) (string, error)

CreateResource creates one or more resources at the URI defined by ResourceScope and modified by the URIOption.

func (*ResourceHandler) CreateResources

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. Deprecated: use CreateResource instead.

func (*ResourceHandler) CreateStageResources

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

CreateStageResources creates a stage resource. Deprecated: use CreateResource instead.

func (*ResourceHandler) DeleteProjectResource

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

DeleteProjectResource deletes a project resource. Deprecated: use DeleteResource instead.

func (*ResourceHandler) DeleteResource

func (r *ResourceHandler) DeleteResource(scope ResourceScope, options ...URIOption) error

DeleteResource delete a resource from the URI defined by ResourceScope and modified by the URIOption.

func (*ResourceHandler) DeleteServiceResource

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

DeleteServiceResource deletes a service resource. Deprecated: use DeleteResource instead.

func (*ResourceHandler) DeleteStageResource

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

DeleteStageResource deletes a stage resource. Deprecated: use DeleteResource instead.

func (*ResourceHandler) GetAllServiceResources

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

GetAllServiceResources returns a list of all resources.

func (*ResourceHandler) GetAllStageResources

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

GetAllStageResources returns a list of all resources.

func (*ResourceHandler) GetProjectResource

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

GetProjectResource retrieves a project resource from the configuration service. Deprecated: use GetResource instead.

func (*ResourceHandler) GetResource

func (r *ResourceHandler) GetResource(scope ResourceScope, options ...URIOption) (*models.Resource, error)

GetResource returns a resource from the defined ResourceScope after applying all URI change configured in the options.

func (*ResourceHandler) GetServiceResource

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

GetServiceResource retrieves a service resource from the configuration service. Deprecated: use GetResource instead.

func (*ResourceHandler) GetStageResource

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

GetStageResource retrieves a stage resource from the configuration service. Deprecated: use GetResource instead.

func (*ResourceHandler) UpdateProjectResource

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

UpdateProjectResource updates a project resource. Deprecated: use UpdateResource instead.

func (*ResourceHandler) UpdateProjectResources

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

UpdateProjectResources updates multiple project resources.

func (*ResourceHandler) UpdateResource

func (r *ResourceHandler) UpdateResource(resource *models.Resource, scope ResourceScope, options ...URIOption) (string, error)

UpdateResource updates a resource from the URI defined by ResourceScope and modified by the URIOption.

func (*ResourceHandler) UpdateServiceResource

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

UpdateServiceResource updates a service resource. Deprecated: use UpdateResource instead.

func (*ResourceHandler) UpdateServiceResources

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

UpdateServiceResources updates multiple service resources.

func (*ResourceHandler) UpdateStageResource

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

UpdateStageResource updates a stage resource. Deprecated: use UpdateResource instead.

func (*ResourceHandler) UpdateStageResources

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

UpdateStageResources updates multiple stage resources. Deprecated: use UpdateResource instead.

type ResourceScope

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

ResourceScope contains the necessary information to get a resource

func NewResourceScope

func NewResourceScope() *ResourceScope

NewResourceScope returns an empty ResourceScope to fill in calling Project Stage Service or Resource functions

func (*ResourceScope) GetProject

func (s *ResourceScope) GetProject() string

GetProject returns the project name

func (*ResourceScope) GetProjectPath

func (s *ResourceScope) GetProjectPath() string

GetProjectPath returns a string to construct the url to path eg. /<api-version>/project/<project-name> or an empty string if the project is not set

func (*ResourceScope) GetResource

func (s *ResourceScope) GetResource() string

GetResource returns the resource name

func (*ResourceScope) GetResourcePath

func (s *ResourceScope) GetResourcePath() string

GetResourcePath returns a string to construct the url to a resource eg. /resource/<escaped-resource-name> or /resource if the resource scope is empty

func (*ResourceScope) GetService

func (s *ResourceScope) GetService() string

GetService returns the service name

func (*ResourceScope) GetServicePath

func (s *ResourceScope) GetServicePath() string

GetServicePath returns a string to construct the url to a service eg. /service/<service-name> or an empty string if the service is unset

func (*ResourceScope) GetStage

func (s *ResourceScope) GetStage() string

GetStage returns the stage name

func (*ResourceScope) GetStagePath

func (s *ResourceScope) GetStagePath() string

GetStagePath returns a string to construct the url to a stage eg. /stage/<stage-name> or an empty string if the stage is unset

func (*ResourceScope) Project

func (s *ResourceScope) Project(project string) *ResourceScope

Project sets the resource scope project value

func (*ResourceScope) Resource

func (s *ResourceScope) Resource(resource string) *ResourceScope

Resource sets the resource scope resource

func (*ResourceScope) Service

func (s *ResourceScope) Service(service string) *ResourceScope

Service sets the resource scope service value

func (*ResourceScope) Stage

func (s *ResourceScope) Stage(stage string) *ResourceScope

Stage sets the resource scope stage value

type ResourcesV1Interface

type ResourcesV1Interface interface {
	// CreateResources creates a resource for the specified entity.
	CreateResources(project string, stage string, service string, resources []*models.Resource) (*models.EventContext, *models.Error)

	// CreateProjectResources creates multiple project resources.
	CreateProjectResources(project string, resources []*models.Resource) (string, error)

	// GetProjectResource retrieves a project resource from the configuration service.
	// Deprecated: use GetResource instead.
	GetProjectResource(project string, resourceURI string) (*models.Resource, error)

	// UpdateProjectResource updates a project resource.
	// Deprecated: use UpdateResource instead.
	UpdateProjectResource(project string, resource *models.Resource) (string, error)

	// DeleteProjectResource deletes a project resource.
	// Deprecated: use DeleteResource instead.
	DeleteProjectResource(project string, resourceURI string) error

	// UpdateProjectResources updates multiple project resources.
	UpdateProjectResources(project string, resources []*models.Resource) (string, error)

	// CreateStageResources creates a stage resource.
	// Deprecated: use CreateResource instead.
	CreateStageResources(project string, stage string, resources []*models.Resource) (string, error)

	// GetStageResource retrieves a stage resource from the configuration service.
	// Deprecated: use GetResource instead.
	GetStageResource(project string, stage string, resourceURI string) (*models.Resource, error)

	// UpdateStageResource updates a stage resource.
	// Deprecated: use UpdateResource instead.
	UpdateStageResource(project string, stage string, resource *models.Resource) (string, error)

	// UpdateStageResources updates multiple stage resources.
	// Deprecated: use UpdateResource instead.
	UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error)

	// DeleteStageResource deletes a stage resource.
	// Deprecated: use DeleteResource instead.
	DeleteStageResource(project string, stage string, resourceURI string) error

	// CreateServiceResources creates a service resource.
	// Deprecated: use CreateResource instead.
	CreateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)

	// GetServiceResource retrieves a service resource from the configuration service.
	// Deprecated: use GetResource instead.
	GetServiceResource(project string, stage string, service string, resourceURI string) (*models.Resource, error)

	// UpdateServiceResource updates a service resource.
	// Deprecated: use UpdateResource instead.
	UpdateServiceResource(project string, stage string, service string, resource *models.Resource) (string, error)

	// UpdateServiceResources updates multiple service resources.
	UpdateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)

	// DeleteServiceResource deletes a service resource.
	// Deprecated: use DeleteResource instead.
	DeleteServiceResource(project string, stage string, service string, resourceURI string) error

	// GetAllStageResources returns a list of all resources.
	GetAllStageResources(project string, stage string) ([]*models.Resource, error)

	// GetAllServiceResources returns a list of all resources.
	GetAllServiceResources(project string, stage string, service string) ([]*models.Resource, error)
}

type SecretHandler

type SecretHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

SecretHandler handles services

func NewAuthenticatedSecretHandler

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 Deprecated: use APISet instead

func NewSecretHandler

func NewSecretHandler(baseURL string) *SecretHandler

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

func NewSecretHandlerWithHTTPClient

func NewSecretHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *SecretHandler

NewSecretHandlerWithHTTPClient returns a new SecretHandler which sends all requests directly to the secret-service using the specified http.Client

func (*SecretHandler) CreateSecret

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

CreateSecret creates a new secret.

func (*SecretHandler) DeleteSecret

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

DeleteSecret deletes a secret.

func (*SecretHandler) GetSecrets

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

GetSecrets returns a list of created secrets.

func (*SecretHandler) UpdateSecret

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

UpdateSecret creates a new secret.

type SecretHandlerInterface

type SecretHandlerInterface interface {
	// CreateSecret creates a new secret.
	CreateSecret(secret models.Secret) error

	// UpdateSecret creates a new secret.
	UpdateSecret(secret models.Secret) error

	// DeleteSecret deletes a secret.
	DeleteSecret(secretName, secretScope string) error

	// GetSecrets returns a list of created secrets.
	GetSecrets() (*models.GetSecretsResponse, error)
}

type SecretsV1Interface

type SecretsV1Interface interface {
	SecretHandlerInterface
}

type SequenceControlBody

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

func (*SequenceControlBody) FromJSON

func (s *SequenceControlBody) FromJSON(b []byte) error

FromJSON converts JSON string to object

func (*SequenceControlBody) ToJSON

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

Converts object to JSON string

type SequenceControlHandler

type SequenceControlHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

func NewAuthenticatedSequenceControlHandler

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

NewAuthenticatedSequenceControlHandler returns a new SequenceControlHandler that authenticates at the api via the provided token Deprecated: use APISet instead

func NewSequenceControlHandler

func NewSequenceControlHandler(baseURL string) *SequenceControlHandler

NewSequenceControlHandler returns a new SequenceControlHandler

func NewSequenceControlHandlerWithHTTPClient

func NewSequenceControlHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *SequenceControlHandler

NewSequenceControlHandlerWithHTTPClient returns a new SequenceControlHandler using the specified http.Client

func (*SequenceControlHandler) ControlSequence

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

type SequenceControlParams

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

func (*SequenceControlParams) Validate

func (s *SequenceControlParams) Validate() error

type SequencesV1Interface

type SequencesV1Interface interface {
	ControlSequence(params SequenceControlParams) error
}

type ServiceHandler

type ServiceHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

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 resource-service Deprecated: use APISet instead

func NewServiceHandler

func NewServiceHandler(baseURL string) *ServiceHandler

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

func NewServiceHandlerWithHTTPClient

func NewServiceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ServiceHandler

NewServiceHandlerWithHTTPClient returns a new ServiceHandler which sends all requests directly to the resource-service using the specified http.Client

func (*ServiceHandler) CreateServiceInStage

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

CreateServiceInStage creates a new service.

func (*ServiceHandler) DeleteServiceFromStage

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

DeleteServiceFromStage deletes a service from a stage.

func (*ServiceHandler) GetAllServices

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

GetAllServices returns a list of all services.

func (*ServiceHandler) GetService

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

GetService gets a service.

type ServicesV1Interface

type ServicesV1Interface interface {
	// CreateServiceInStage creates a new service.
	CreateServiceInStage(project string, stage string, serviceName string) (*models.EventContext, *models.Error)

	// DeleteServiceFromStage deletes a service from a stage.
	DeleteServiceFromStage(project string, stage string, serviceName string) (*models.EventContext, *models.Error)

	// GetService gets a service.
	GetService(project, stage, service string) (*models.Service, error)

	// GetAllServices returns a list of all services.
	GetAllServices(project string, stage string) ([]*models.Service, error)
}

type ShipyardControlV1Interface

type ShipyardControlV1Interface interface {
	// GetOpenTriggeredEvents returns all open triggered events.
	GetOpenTriggeredEvents(filter EventFilter) ([]*models.KeptnContextExtendedCE, error)
}

type ShipyardControllerHandler

type ShipyardControllerHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

ShipyardControllerHandler handles services

func NewAuthenticatedShipyardControllerHandler

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 resource-service Deprecated: use APISet instead

func NewShipyardControllerHandler

func NewShipyardControllerHandler(baseURL string) *ShipyardControllerHandler

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

func NewShipyardControllerHandlerWithHTTPClient

func NewShipyardControllerHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ShipyardControllerHandler

NewShipyardControllerHandlerWithHTTPClient returns a new ShipyardControllerHandler which sends all requests directly to the resource-service using the specified http.Client

func (*ShipyardControllerHandler) GetOpenTriggeredEvents

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

GetOpenTriggeredEvents returns all open triggered events.

type Sleeper

type Sleeper interface {
	Sleep()
}

Sleeper defines the interface to sleep

type StageHandler

type StageHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

StageHandler handles stages

func NewAuthenticatedStageHandler

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 resource-service Deprecated: use APISet instead

func NewStageHandler

func NewStageHandler(baseURL string) *StageHandler

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

func NewStageHandlerWithHTTPClient

func NewStageHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *StageHandler

NewStageHandlerWithHTTPClient returns a new StageHandler which sends all requests directly to the resource-service using the specified http.Client

func (*StageHandler) CreateStage

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

CreateStage creates a new stage with the provided name.

func (*StageHandler) GetAllStages

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

GetAllStages returns a list of all stages.

type StagesV1Interface

type StagesV1Interface interface {
	// CreateStage creates a new stage with the provided name.
	CreateStage(project string, stageName string) (*models.EventContext, *models.Error)

	// GetAllStages returns a list of all stages.
	GetAllStages(project string) ([]*models.Stage, error)
}

type StatusBody

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

func (*StatusBody) ToJSON

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

ToJSON converts object to JSON string

type URIOption

type URIOption func(url string) string

URIOption returns a function that modifies an url

func AppendQuery

func AppendQuery(queryParams url.Values) URIOption

AppendQuery returns an option function that can modify an URI by appending a map of url query values

type UniformHandler

type UniformHandler struct {
	BaseURL    string
	AuthToken  string
	AuthHeader string
	HTTPClient *http.Client
	Scheme     string
	// contains filtered or unexported fields
}

func NewAuthenticatedUniformHandler

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

NewAuthenticatedUniformHandler returns a new UniformHandler that authenticates at the api via the provided token Deprecated: use APISet instead

func NewUniformHandler

func NewUniformHandler(baseURL string) *UniformHandler

NewUniformHandler returns a new UniformHandler

func NewUniformHandlerWithHTTPClient

func NewUniformHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *UniformHandler

NewUniformHandlerWithHTTPClient returns a new UniformHandler using the specified http.Client

func (*UniformHandler) CreateSubscription

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

func (*UniformHandler) GetRegistrations

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

func (*UniformHandler) Ping

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

func (*UniformHandler) RegisterIntegration

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

func (*UniformHandler) UnregisterIntegration

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

type UniformV1Interface

type UniformV1Interface interface {
	Ping(integrationID string) (*models.Integration, error)
	RegisterIntegration(integration models.Integration) (string, error)
	CreateSubscription(integrationID string, subscription models.EventSubscription) (string, error)
	UnregisterIntegration(integrationID string) error
	GetRegistrations() ([]*models.Integration, error)
}

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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