Documentation ¶
Index ¶
- Constants
- Variables
- func LoadRequirements(file string) (requirements []*orchestrator.Requirement, err error)
- type Service
- func (svc *Service) CreateCertificate(_ context.Context, req *orchestrator.CreateCertificateRequest) (*orchestrator.Certificate, error)
- func (s *Service) CreateDefaultTargetCloudService() (service *orchestrator.CloudService, err error)
- func (svc *Service) CreateMetric(_ context.Context, req *orchestrator.CreateMetricRequest) (metric *assessment.Metric, err error)
- func (svc *Service) GetCertificate(_ context.Context, req *orchestrator.GetCertificateRequest) (response *orchestrator.Certificate, err error)
- func (s *Service) GetCloudService(_ context.Context, req *orchestrator.GetCloudServiceRequest) (response *orchestrator.CloudService, err error)
- func (svc *Service) GetMetric(_ context.Context, req *orchestrator.GetMetricRequest) (metric *assessment.Metric, err error)
- func (svc *Service) GetMetricConfiguration(_ context.Context, req *orchestrator.GetMetricConfigurationRequest) (response *assessment.MetricConfiguration, err error)
- func (svc *Service) GetMetricImplementation(ctx context.Context, req *orchestrator.GetMetricImplementationRequest) (res *assessment.MetricImplementation, err error)
- func (svc *Service) ListAssessmentResults(_ context.Context, req *assessment.ListAssessmentResultsRequest) (res *assessment.ListAssessmentResultsResponse, err error)
- func (svc *Service) ListCertificates(_ context.Context, req *orchestrator.ListCertificatesRequest) (res *orchestrator.ListCertificatesResponse, err error)
- func (svc *Service) ListCloudServices(_ context.Context, req *orchestrator.ListCloudServicesRequest) (res *orchestrator.ListCloudServicesResponse, err error)
- func (svc *Service) ListMetricConfigurations(ctx context.Context, req *orchestrator.ListMetricConfigurationRequest) (response *orchestrator.ListMetricConfigurationResponse, err error)
- func (svc *Service) ListMetrics(_ context.Context, req *orchestrator.ListMetricsRequest) (res *orchestrator.ListMetricsResponse, err error)
- func (svc *Service) ListRequirements(_ context.Context, req *orchestrator.ListRequirementsRequest) (res *orchestrator.ListRequirementsResponse, err error)
- func (s *Service) RegisterAssessmentResultHook(hook func(result *assessment.AssessmentResult, err error))
- func (s *Service) RegisterCloudService(_ context.Context, req *orchestrator.RegisterCloudServiceRequest) (service *orchestrator.CloudService, err error)
- func (s *Service) RegisterCloudServiceHook(hook orchestrator.CloudServiceHookFunc)
- func (svc *Service) RemoveCertificate(_ context.Context, req *orchestrator.RemoveCertificateRequest) (response *emptypb.Empty, err error)
- func (s *Service) RemoveCloudService(_ context.Context, req *orchestrator.RemoveCloudServiceRequest) (response *emptypb.Empty, err error)
- func (s *Service) StoreAssessmentResult(_ context.Context, req *orchestrator.StoreAssessmentResultRequest) (resp *orchestrator.StoreAssessmentResultResponse, err error)
- func (s *Service) StoreAssessmentResults(stream orchestrator.Orchestrator_StoreAssessmentResultsServer) (err error)
- func (svc *Service) SubscribeMetricChangeEvents(_ *orchestrator.SubscribeMetricChangeEventRequest, ...) (err error)
- func (svc *Service) UpdateCertificate(_ context.Context, req *orchestrator.UpdateCertificateRequest) (response *orchestrator.Certificate, err error)
- func (s *Service) UpdateCloudService(_ context.Context, req *orchestrator.UpdateCloudServiceRequest) (response *orchestrator.CloudService, err error)
- func (svc *Service) UpdateMetric(_ context.Context, req *orchestrator.UpdateMetricRequest) (metric *assessment.Metric, err error)
- func (svc *Service) UpdateMetricConfiguration(_ context.Context, req *orchestrator.UpdateMetricConfigurationRequest) (res *assessment.MetricConfiguration, err error)
- func (svc *Service) UpdateMetricImplementation(_ context.Context, req *orchestrator.UpdateMetricImplementationRequest) (impl *assessment.MetricImplementation, err error)
- type ServiceOption
Constants ¶
const ( DefaultTargetCloudServiceId = "00000000-0000-0000-000000000000" DefaultTargetCloudServiceName = "default" DefaultTargetCloudServiceDescription = "The default target cloud service" )
Variables ¶
var DefaultMetricsFile = "metrics.json"
var DefaultRequirementsFile = "requirements.json"
Functions ¶
func LoadRequirements ¶ added in v1.4.0
func LoadRequirements(file string) (requirements []*orchestrator.Requirement, err error)
LoadRequirements loads requirements definitions from a JSON file.
Types ¶
type Service ¶
type Service struct { orchestrator.UnimplementedOrchestratorServer // Hook AssessmentResultHooks []func(result *assessment.AssessmentResult, err error) // contains filtered or unexported fields }
Service is an implementation of the Clouditor Orchestrator service
func NewService ¶ added in v1.3.11
func NewService(opts ...ServiceOption) *Service
NewService creates a new Orchestrator service
func (*Service) CreateCertificate ¶ added in v1.4.9
func (svc *Service) CreateCertificate(_ context.Context, req *orchestrator.CreateCertificateRequest) ( *orchestrator.Certificate, error)
CreateCertificate implements method for creating a new certificate
func (*Service) CreateDefaultTargetCloudService ¶ added in v1.3.11
func (s *Service) CreateDefaultTargetCloudService() (service *orchestrator.CloudService, err error)
CreateDefaultTargetCloudService creates a new "default" target cloud services, if no target service exists in the database.
If a new target cloud service was created, it will be returned.
func (*Service) CreateMetric ¶ added in v1.3.14
func (svc *Service) CreateMetric(_ context.Context, req *orchestrator.CreateMetricRequest) (metric *assessment.Metric, err error)
CreateMetric creates a new metric in the database.
func (*Service) GetCertificate ¶ added in v1.4.9
func (svc *Service) GetCertificate(_ context.Context, req *orchestrator.GetCertificateRequest) (response *orchestrator.Certificate, err error)
GetCertificate implements method for getting a certificate, e.g. to show its state in the UI
func (*Service) GetCloudService ¶ added in v1.3.11
func (s *Service) GetCloudService(_ context.Context, req *orchestrator.GetCloudServiceRequest) (response *orchestrator.CloudService, err error)
GetCloudService implements method for OrchestratorServer interface for getting a cloud service with provided id
func (*Service) GetMetric ¶
func (svc *Service) GetMetric(_ context.Context, req *orchestrator.GetMetricRequest) (metric *assessment.Metric, err error)
GetMetric retrieves a metric specified by req.MetridId
func (*Service) GetMetricConfiguration ¶ added in v1.3.11
func (svc *Service) GetMetricConfiguration(_ context.Context, req *orchestrator.GetMetricConfigurationRequest) (response *assessment.MetricConfiguration, err error)
func (*Service) GetMetricImplementation ¶ added in v1.4.5
func (svc *Service) GetMetricImplementation(ctx context.Context, req *orchestrator.GetMetricImplementationRequest) (res *assessment.MetricImplementation, err error)
func (*Service) ListAssessmentResults ¶ added in v1.3.12
func (svc *Service) ListAssessmentResults(_ context.Context, req *assessment.ListAssessmentResultsRequest) (res *assessment.ListAssessmentResultsResponse, err error)
ListAssessmentResults is a method implementation of the orchestrator interface
func (*Service) ListCertificates ¶ added in v1.4.9
func (svc *Service) ListCertificates(_ context.Context, req *orchestrator.ListCertificatesRequest) (res *orchestrator.ListCertificatesResponse, err error)
ListCertificates implements method for getting a certificate, e.g. to show its state in the UI
func (*Service) ListCloudServices ¶ added in v1.3.11
func (svc *Service) ListCloudServices(_ context.Context, req *orchestrator.ListCloudServicesRequest) (res *orchestrator.ListCloudServicesResponse, err error)
ListCloudServices implements method for OrchestratorServer interface for listing all cloud services
func (*Service) ListMetricConfigurations ¶ added in v1.3.11
func (svc *Service) ListMetricConfigurations(ctx context.Context, req *orchestrator.ListMetricConfigurationRequest) (response *orchestrator.ListMetricConfigurationResponse, err error)
ListMetricConfigurations retrieves a list of MetricConfiguration objects for a particular target cloud service specified in req.
The list MUST include a configuration for each known metric. If the user did not specify a custom configuration for a particular metric within the service, the default metric configuration is inserted into the list.
func (*Service) ListMetrics ¶
func (svc *Service) ListMetrics(_ context.Context, req *orchestrator.ListMetricsRequest) (res *orchestrator.ListMetricsResponse, err error)
ListMetrics lists all available metrics.
func (*Service) ListRequirements ¶ added in v1.4.0
func (svc *Service) ListRequirements(_ context.Context, req *orchestrator.ListRequirementsRequest) (res *orchestrator.ListRequirementsResponse, err error)
ListRequirements is a method implementation of the OrchestratorServer interface, returning a list of requirements
func (*Service) RegisterAssessmentResultHook ¶ added in v1.3.11
func (s *Service) RegisterAssessmentResultHook(hook func(result *assessment.AssessmentResult, err error))
func (*Service) RegisterCloudService ¶ added in v1.3.11
func (s *Service) RegisterCloudService(_ context.Context, req *orchestrator.RegisterCloudServiceRequest) (service *orchestrator.CloudService, err error)
func (*Service) RegisterCloudServiceHook ¶ added in v1.4.10
func (s *Service) RegisterCloudServiceHook(hook orchestrator.CloudServiceHookFunc)
func (*Service) RemoveCertificate ¶ added in v1.4.9
func (svc *Service) RemoveCertificate(_ context.Context, req *orchestrator.RemoveCertificateRequest) (response *emptypb.Empty, err error)
RemoveCertificate implements method for removing a certificate
func (*Service) RemoveCloudService ¶ added in v1.3.11
func (s *Service) RemoveCloudService(_ context.Context, req *orchestrator.RemoveCloudServiceRequest) (response *emptypb.Empty, err error)
RemoveCloudService implements method for OrchestratorServer interface for removing a cloud service
func (*Service) StoreAssessmentResult ¶ added in v1.3.11
func (s *Service) StoreAssessmentResult(_ context.Context, req *orchestrator.StoreAssessmentResultRequest) (resp *orchestrator.StoreAssessmentResultResponse, err error)
StoreAssessmentResult is a method implementation of the orchestrator interface: It receives an assessment result and stores it
func (*Service) StoreAssessmentResults ¶ added in v1.3.11
func (s *Service) StoreAssessmentResults(stream orchestrator.Orchestrator_StoreAssessmentResultsServer) (err error)
func (*Service) SubscribeMetricChangeEvents ¶ added in v1.4.5
func (svc *Service) SubscribeMetricChangeEvents(_ *orchestrator.SubscribeMetricChangeEventRequest, stream orchestrator.Orchestrator_SubscribeMetricChangeEventsServer) (err error)
SubscribeMetricChangeEvents implements a stream of metric events to the subscribed client.
func (*Service) UpdateCertificate ¶ added in v1.4.9
func (svc *Service) UpdateCertificate(_ context.Context, req *orchestrator.UpdateCertificateRequest) (response *orchestrator.Certificate, err error)
UpdateCertificate implements method for updating an existing certificate
func (*Service) UpdateCloudService ¶ added in v1.3.11
func (s *Service) UpdateCloudService(_ context.Context, req *orchestrator.UpdateCloudServiceRequest) (response *orchestrator.CloudService, err error)
UpdateCloudService implements method for OrchestratorServer interface for updating a cloud service
func (*Service) UpdateMetric ¶ added in v1.3.14
func (svc *Service) UpdateMetric(_ context.Context, req *orchestrator.UpdateMetricRequest) (metric *assessment.Metric, err error)
UpdateMetric updates an existing metric, specified by the identifier in req.MetricId.
func (*Service) UpdateMetricConfiguration ¶ added in v1.4.10
func (svc *Service) UpdateMetricConfiguration(_ context.Context, req *orchestrator.UpdateMetricConfigurationRequest) (res *assessment.MetricConfiguration, err error)
UpdateMetricConfiguration updates the configuration for a metric, specified by the identifier in req.MetricId.
func (*Service) UpdateMetricImplementation ¶ added in v1.4.5
func (svc *Service) UpdateMetricImplementation(_ context.Context, req *orchestrator.UpdateMetricImplementationRequest) (impl *assessment.MetricImplementation, err error)
UpdateMetricImplementation updates an existing metric implementation, specified by the identifier in req.MetricId.
type ServiceOption ¶ added in v1.3.14
type ServiceOption func(*Service)
ServiceOption is a function-style option to configure the Orchestrator Service
func WithExternalMetrics ¶ added in v1.4.6
func WithExternalMetrics(f func() ([]*assessment.Metric, error)) ServiceOption
WithExternalMetrics can be used to load metric definitions from an external source
func WithMetricsFile ¶ added in v1.3.14
func WithMetricsFile(file string) ServiceOption
WithMetricsFile can be used to load a different metrics file
func WithRequirements ¶ added in v1.4.0
func WithRequirements(r []*orchestrator.Requirement) ServiceOption
func WithStorage ¶ added in v1.4.0
func WithStorage(storage persistence.Storage) ServiceOption
WithStorage is an option to set the storage. If not set, NewService will use inmemory storage.