api

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 20 Imported by: 82

Documentation

Index

Constants

View Source
const ErrWithStatusCode = "error with status code %d"

ErrWithStatusCode message

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, 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 added in v0.8.0

func SortByTime(events []*models.KeptnContextExtendedCE)

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

func WithAuthToken added in v0.13.0

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 added in v0.13.0

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

WithHTTPClient configures a custom http client to use

func WithScheme added in v0.13.0

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

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 APISet added in v0.13.0

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

APISet contains the API utils for all Keptn APIs

func New added in v0.13.0

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

New creates a new APISet instance

func (*APISet) APIV1 added in v0.13.0

func (c *APISet) APIV1() APIV1Interface

APIV1 retrieves the APIHandler

func (*APISet) AuthV1 added in v0.13.0

func (c *APISet) AuthV1() AuthV1Interface

AuthV1 retrieves the AuthHandler

func (*APISet) Endpoint added in v0.13.0

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

Endpoint retrieves the base API endpoint URL

func (*APISet) EventsV1 added in v0.13.0

func (c *APISet) EventsV1() EventsV1Interface

EventsV1 retrieves the EventHandler

func (*APISet) LogsV1 added in v0.13.0

func (c *APISet) LogsV1() LogsV1Interface

LogsV1 retrieves the LogHandler

func (*APISet) ProjectsV1 added in v0.13.0

func (c *APISet) ProjectsV1() ProjectsV1Interface

ProjectsV1 retrieves the ProjectHandler

func (*APISet) ResourcesV1 added in v0.13.0

func (c *APISet) ResourcesV1() ResourcesV1Interface

ResourcesV1 retrieves the ResourceHandler

func (*APISet) SecretsV1 added in v0.13.0

func (c *APISet) SecretsV1() SecretsV1Interface

SecretsV1 retrieves the SecretHandler

func (*APISet) SequencesV1 added in v0.13.0

func (c *APISet) SequencesV1() SequencesV1Interface

SequencesV1 retrieves the SequenceControlHandler

func (*APISet) ServicesV1 added in v0.13.0

func (c *APISet) ServicesV1() ServicesV1Interface

ServicesV1 retrieves the ServiceHandler

func (*APISet) ShipyardControlV1 added in v0.13.0

func (c *APISet) ShipyardControlV1() ShipyardControlV1Interface

ShipyardControlV1 retrieves the ShipyardControllerHandler

func (*APISet) StagesV1 added in v0.13.0

func (c *APISet) StagesV1() StagesV1Interface

StagesV1 retrieves the StageHandler

func (*APISet) Token added in v0.13.0

func (c *APISet) Token() string

Token retrieves the API token

func (*APISet) UniformV1 added in v0.13.0

func (c *APISet) UniformV1() UniformV1Interface

UniformV1 retrieves the UniformHandler

type APIV1Interface added in v0.13.0

type APIV1Interface interface {
	SendEvent(event models.KeptnContextExtendedCE) (*models.EventContext, *models.Error)
	TriggerEvaluation(project string, stage string, service string, evaluation models.Evaluation) (*models.EventContext, *models.Error)
	CreateProject(project models.CreateProject) (string, *models.Error)
	UpdateProject(project models.CreateProject) (string, *models.Error)
	DeleteProject(project models.Project) (*models.DeleteProjectResponse, *models.Error)
	CreateService(project string, service models.CreateService) (string, *models.Error)
	DeleteService(project string, service string) (*models.DeleteServiceResponse, *models.Error)
	GetMetadata() (*models.Metadata, *models.Error)
}

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 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 added in v0.13.0

type AuthV1Interface interface {
	Authenticate() (*models.EventContext, *models.Error)
}

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

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 EventsV1Interface added in v0.13.0

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

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 HealthHandlerOption added in v0.16.0

type HealthHandlerOption func(h *healthHandler)

func WithPath added in v0.16.0

func WithPath(path string) HealthHandlerOption

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

func WithReadinessConditionFunc added in v0.16.0

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 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 KeptnInterface added in v0.13.0

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 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

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

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 LogsV1Interface added in v0.13.0

type LogsV1Interface interface {
	ILogHandler
}

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

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 ProjectsV1Interface added in v0.13.0

type ProjectsV1Interface interface {
	CreateProject(project models.Project) (*models.EventContext, *models.Error)
	DeleteProject(project models.Project) (*models.EventContext, *models.Error)
	GetProject(project models.Project) (*models.Project, *models.Error)
	GetAllProjects() ([]*models.Project, error)
	UpdateConfigurationServiceProject(project models.Project) (*models.EventContext, *models.Error)
}

type ReadinessConditionFunc added in v0.16.0

type ReadinessConditionFunc func() bool

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

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) CreateResource added in v0.13.0

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

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

func (*ResourceHandler) DeleteProjectResource added in v0.6.2

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

DeleteProjectResource deletes a project resource Deprecated: use DeleteResource instead

func (*ResourceHandler) DeleteResource added in v0.13.0

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 added in v0.6.2

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 added in v0.6.2

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

DeleteStageResource deletes a stage resource Deprecated: use DeleteResource instead

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

func (*ResourceHandler) GetResource added in v0.13.0

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

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

func (*ResourceHandler) UpdateProjectResource added in v0.6.2

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

UpdateProjectResource updates a project resource Deprecated: use UpdateResource instead

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) UpdateResource added in v0.13.0

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

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

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

type ResourceScope added in v0.13.0

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

ResourceScope contains the necessary information to get a resource

func NewResourceScope added in v0.13.0

func NewResourceScope() *ResourceScope

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

func (*ResourceScope) GetProjectPath added in v0.13.0

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) GetResourcePath added in v0.13.0

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) GetServicePath added in v0.13.0

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) GetStagePath added in v0.13.0

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 added in v0.13.0

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

Project sets the resource scope project value

func (*ResourceScope) Resource added in v0.13.0

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

Resource sets the resource scope resource

func (*ResourceScope) Service added in v0.13.0

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

Service sets the resource scope service value

func (*ResourceScope) Stage added in v0.13.0

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

Stage sets the resource scope stage value

type ResourcesV1Interface added in v0.13.0

type ResourcesV1Interface interface {
	CreateResources(project string, stage string, service string, resources []*models.Resource) (*models.EventContext, *models.Error)
	CreateProjectResources(project string, resources []*models.Resource) (string, error)
	GetProjectResource(project string, resourceURI string) (*models.Resource, error)
	UpdateProjectResource(project string, resource *models.Resource) (string, error)
	DeleteProjectResource(project string, resourceURI string) error
	UpdateProjectResources(project string, resources []*models.Resource) (string, error)
	CreateStageResources(project string, stage string, resources []*models.Resource) (string, error)
	GetStageResource(project string, stage string, resourceURI string) (*models.Resource, error)
	UpdateStageResource(project string, stage string, resource *models.Resource) (string, error)
	UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error)
	DeleteStageResource(project string, stage string, resourceURI string) error
	CreateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)
	GetServiceResource(project string, stage string, service string, resourceURI string) (*models.Resource, error)
	UpdateServiceResource(project string, stage string, service string, resource *models.Resource) (string, error)
	UpdateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)
	DeleteServiceResource(project string, stage string, service string, resourceURI string) error
	GetAllStageResources(project string, stage string) ([]*models.Resource, error)
	GetAllServiceResources(project string, stage string, service string) ([]*models.Resource, error)
}

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

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 SecretsV1Interface added in v0.13.0

type SecretsV1Interface interface {
	SecretHandlerInterface
}

type SequenceControlBody added in v0.9.0

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

func (*SequenceControlBody) FromJSON added in v0.12.0

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

FromJSON converts JSON string to object

func (*SequenceControlBody) ToJSON added in v0.9.0

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

Converts object to JSON string

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

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

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 SequencesV1Interface added in v0.13.0

type SequencesV1Interface interface {
	ControlSequence(params SequenceControlParams) 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 Deprecated: use APISet instead

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 ServicesV1Interface added in v0.13.0

type ServicesV1Interface interface {
	CreateServiceInStage(project string, stage string, serviceName string) (*models.EventContext, *models.Error)
	DeleteServiceFromStage(project string, stage string, serviceName string) (*models.EventContext, *models.Error)
	GetService(project, stage, service string) (*models.Service, error)
	GetAllServices(project string, stage string) ([]*models.Service, error)
}

type ShipyardControlV1Interface added in v0.13.0

type ShipyardControlV1Interface interface {
	GetOpenTriggeredEvents(filter EventFilter) ([]*models.KeptnContextExtendedCE, 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 Deprecated: use APISet instead

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

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 StagesV1Interface added in v0.13.0

type StagesV1Interface interface {
	CreateStage(project string, stageName string) (*models.EventContext, *models.Error)
	GetAllStages(project string) ([]*models.Stage, error)
}

type StatusBody added in v0.7.0

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

func (*StatusBody) ToJSON added in v0.12.0

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

ToJSON converts object to JSON string

type URIOption added in v0.13.0

type URIOption func(url string) string

URIOption returns a function that modifies an url

func AppendQuery added in v0.13.0

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 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

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

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

type UniformV1Interface added in v0.13.0

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

Jump to

Keyboard shortcuts

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