Documentation
¶
Index ¶
- Constants
- Variables
- type Service
- func (svc *Service) AddControlToScope(ctx context.Context, req *orchestrator.AddControlToScopeRequest) (res *orchestrator.ControlInScope, err error)
- func (svc *Service) CreateCatalog(_ context.Context, req *orchestrator.CreateCatalogRequest) (*orchestrator.Catalog, error)
- func (svc *Service) CreateCertificate(ctx context.Context, req *orchestrator.CreateCertificateRequest) (res *orchestrator.Certificate, err 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) CreateTargetOfEvaluation(ctx context.Context, req *orchestrator.CreateTargetOfEvaluationRequest) (res *orchestrator.TargetOfEvaluation, err error)
- func (svc *Service) GetAssessmentResult(ctx context.Context, req *orchestrator.GetAssessmentResultRequest) (res *assessment.AssessmentResult, err error)
- func (svc *Service) GetCatalog(_ context.Context, req *orchestrator.GetCatalogRequest) (response *orchestrator.Catalog, err error)
- func (srv *Service) GetCategory(_ context.Context, req *orchestrator.GetCategoryRequest) (res *orchestrator.Category, err error)
- func (svc *Service) GetCertificate(ctx context.Context, req *orchestrator.GetCertificateRequest) (res *orchestrator.Certificate, err error)
- func (s *Service) GetCloudService(ctx context.Context, req *orchestrator.GetCloudServiceRequest) (response *orchestrator.CloudService, err error)
- func (s *Service) GetCloudServiceStatistics(ctx context.Context, req *orchestrator.GetCloudServiceStatisticsRequest) (response *orchestrator.GetCloudServiceStatisticsResponse, err error)
- func (srv *Service) GetControl(_ context.Context, req *orchestrator.GetControlRequest) (res *orchestrator.Control, err error)
- func (svc *Service) GetMetric(_ context.Context, req *orchestrator.GetMetricRequest) (metric *assessment.Metric, err error)
- func (svc *Service) GetMetricConfiguration(ctx context.Context, req *orchestrator.GetMetricConfigurationRequest) (res *assessment.MetricConfiguration, err error)
- func (svc *Service) GetMetricImplementation(_ context.Context, req *orchestrator.GetMetricImplementationRequest) (res *assessment.MetricImplementation, err error)
- func (*Service) GetRuntimeInfo(_ context.Context, _ *runtime.GetRuntimeInfoRequest) (res *runtime.Runtime, err error)
- func (svc *Service) GetTargetOfEvaluation(ctx context.Context, req *orchestrator.GetTargetOfEvaluationRequest) (response *orchestrator.TargetOfEvaluation, err error)
- func (svc *Service) ListAssessmentResults(ctx context.Context, req *orchestrator.ListAssessmentResultsRequest) (res *orchestrator.ListAssessmentResultsResponse, err error)
- func (svc *Service) ListCatalogs(_ context.Context, req *orchestrator.ListCatalogsRequest) (res *orchestrator.ListCatalogsResponse, err error)
- func (svc *Service) ListCertificates(ctx context.Context, req *orchestrator.ListCertificatesRequest) (res *orchestrator.ListCertificatesResponse, err error)
- func (svc *Service) ListCloudServices(ctx context.Context, req *orchestrator.ListCloudServicesRequest) (res *orchestrator.ListCloudServicesResponse, err error)
- func (srv *Service) ListControls(_ context.Context, req *orchestrator.ListControlsRequest) (res *orchestrator.ListControlsResponse, err error)
- func (svc *Service) ListControlsInScope(ctx context.Context, req *orchestrator.ListControlsInScopeRequest) (res *orchestrator.ListControlsInScopeResponse, 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) ListPublicCertificates(_ context.Context, req *orchestrator.ListPublicCertificatesRequest) (res *orchestrator.ListPublicCertificatesResponse, err error)
- func (svc *Service) ListTargetsOfEvaluation(ctx context.Context, req *orchestrator.ListTargetsOfEvaluationRequest) (res *orchestrator.ListTargetsOfEvaluationResponse, err error)
- func (s *Service) RegisterAssessmentResultHook(hook assessment.ResultHookFunc)
- func (s *Service) RegisterCloudService(ctx context.Context, req *orchestrator.RegisterCloudServiceRequest) (res *orchestrator.CloudService, err error)
- func (s *Service) RegisterCloudServiceHook(hook orchestrator.CloudServiceHookFunc)
- func (s *Service) RegisterToeHook(hook orchestrator.TargetOfEvaluationHookFunc)
- func (svc *Service) RemoveCatalog(_ context.Context, req *orchestrator.RemoveCatalogRequest) (response *emptypb.Empty, err error)
- func (svc *Service) RemoveCertificate(ctx context.Context, req *orchestrator.RemoveCertificateRequest) (response *emptypb.Empty, err error)
- func (s *Service) RemoveCloudService(ctx context.Context, req *orchestrator.RemoveCloudServiceRequest) (response *emptypb.Empty, err error)
- func (svc *Service) RemoveControlFromScope(ctx context.Context, req *orchestrator.RemoveControlFromScopeRequest) (res *emptypb.Empty, err error)
- func (svc *Service) RemoveTargetOfEvaluation(ctx context.Context, req *orchestrator.RemoveTargetOfEvaluationRequest) (response *emptypb.Empty, err error)
- func (svc *Service) StoreAssessmentResult(ctx context.Context, req *orchestrator.StoreAssessmentResultRequest) (res *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) UpdateCatalog(_ context.Context, req *orchestrator.UpdateCatalogRequest) (res *orchestrator.Catalog, err error)
- func (svc *Service) UpdateCertificate(ctx context.Context, req *orchestrator.UpdateCertificateRequest) (response *orchestrator.Certificate, err error)
- func (s *Service) UpdateCloudService(ctx context.Context, req *orchestrator.UpdateCloudServiceRequest) (res *orchestrator.CloudService, err error)
- func (svc *Service) UpdateControlInScope(ctx context.Context, req *orchestrator.UpdateControlInScopeRequest) (res *orchestrator.ControlInScope, err error)
- func (svc *Service) UpdateMetric(_ context.Context, req *orchestrator.UpdateMetricRequest) (metric *assessment.Metric, err error)
- func (svc *Service) UpdateMetricConfiguration(ctx context.Context, req *orchestrator.UpdateMetricConfigurationRequest) (res *assessment.MetricConfiguration, err error)
- func (svc *Service) UpdateMetricImplementation(_ context.Context, req *orchestrator.UpdateMetricImplementationRequest) (impl *assessment.MetricImplementation, err error)
- func (svc *Service) UpdateTargetOfEvaluation(ctx context.Context, req *orchestrator.UpdateTargetOfEvaluationRequest) (res *orchestrator.TargetOfEvaluation, err error)
- type ServiceOption
- func WithAuthorizationStrategy(authz service.AuthorizationStrategy) ServiceOption
- func WithAuthorizationStrategyJWT(key string, allowAllKey string) ServiceOption
- func WithCatalogsFolder(folder string) ServiceOption
- func WithExternalCatalogs(f func() ([]*orchestrator.Catalog, error)) ServiceOption
- func WithExternalMetrics(f func() ([]*assessment.Metric, error)) ServiceOption
- func WithMetricsFile(file string) ServiceOption
- func WithStorage(storage persistence.Storage) ServiceOption
Constants ¶
const ( DefaultTargetCloudServiceId = "00000000-0000-0000-0000-000000000000" DefaultTargetCloudServiceName = "default" DefaultTargetCloudServiceDescription = "The default target cloud service" )
Variables ¶
var DefaultCatalogsFolder = "catalogs"
var DefaultMetricsFile = "metrics.json"
var ErrCertificationNotFound = status.Error(codes.NotFound, "certificate not found")
ErrCertificationNotFound indicates the certification was not found
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct { orchestrator.UnimplementedOrchestratorServer // Hook AssessmentResultHooks []assessment.ResultHookFunc // 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) AddControlToScope ¶ added in v1.7.2
func (svc *Service) AddControlToScope(ctx context.Context, req *orchestrator.AddControlToScopeRequest) (res *orchestrator.ControlInScope, err error)
func (*Service) CreateCatalog ¶ added in v1.6.0
func (svc *Service) CreateCatalog(_ context.Context, req *orchestrator.CreateCatalogRequest) ( *orchestrator.Catalog, error)
CreateCatalog implements a method for creating a new catalog.
func (*Service) CreateCertificate ¶ added in v1.4.9
func (svc *Service) CreateCertificate(ctx context.Context, req *orchestrator.CreateCertificateRequest) ( res *orchestrator.Certificate, err 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) CreateTargetOfEvaluation ¶ added in v1.6.0
func (svc *Service) CreateTargetOfEvaluation(ctx context.Context, req *orchestrator.CreateTargetOfEvaluationRequest) (res *orchestrator.TargetOfEvaluation, err error)
func (*Service) GetAssessmentResult ¶ added in v1.7.7
func (svc *Service) GetAssessmentResult(ctx context.Context, req *orchestrator.GetAssessmentResultRequest) (res *assessment.AssessmentResult, err error)
GetAssessmentResult gets one assessment result by id
func (*Service) GetCatalog ¶ added in v1.6.0
func (svc *Service) GetCatalog(_ context.Context, req *orchestrator.GetCatalogRequest) (response *orchestrator.Catalog, err error)
GetCatalog retrieves a control specified by the catalog ID, the control's category name and the control ID. If present, it also includes a list of sub-controls and any metrics associated to any controls.
func (*Service) GetCategory ¶ added in v1.6.0
func (srv *Service) GetCategory(_ context.Context, req *orchestrator.GetCategoryRequest) (res *orchestrator.Category, err error)
GetCategory retrieves a category of a catalog specified by the catalog ID and the category name. It includes the first level of controls within each category.
func (*Service) GetCertificate ¶ added in v1.4.9
func (svc *Service) GetCertificate(ctx context.Context, req *orchestrator.GetCertificateRequest) ( res *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(ctx 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) GetCloudServiceStatistics ¶ added in v1.9.0
func (s *Service) GetCloudServiceStatistics(ctx context.Context, req *orchestrator.GetCloudServiceStatisticsRequest) (response *orchestrator.GetCloudServiceStatisticsResponse, err error)
GetCloudServiceStatistics implements method for OrchestratorServer interface for retrieving cloud service statistics
func (*Service) GetControl ¶ added in v1.6.0
func (srv *Service) GetControl(_ context.Context, req *orchestrator.GetControlRequest) (res *orchestrator.Control, err error)
GetControl retrieves a control specified by the catalog ID, the control's category name and the control ID. If present, it also includes a list of sub-controls and any metrics associated to the control.
func (*Service) GetMetric ¶
func (svc *Service) GetMetric(_ context.Context, req *orchestrator.GetMetricRequest) (metric *assessment.Metric, err error)
GetMetric retrieves a metric specified by req.MetricId.
func (*Service) GetMetricConfiguration ¶ added in v1.3.11
func (svc *Service) GetMetricConfiguration(ctx context.Context, req *orchestrator.GetMetricConfigurationRequest) (res *assessment.MetricConfiguration, err error)
func (*Service) GetMetricImplementation ¶ added in v1.4.5
func (svc *Service) GetMetricImplementation(_ context.Context, req *orchestrator.GetMetricImplementationRequest) (res *assessment.MetricImplementation, err error)
GetMetricImplementation retrieves a metric implementation specified by req.MetricId.
func (*Service) GetRuntimeInfo ¶ added in v1.7.4
func (*Service) GetRuntimeInfo(_ context.Context, _ *runtime.GetRuntimeInfoRequest) (res *runtime.Runtime, err error)
GetRuntimeInfo implements a method to retrieve runtime information
func (*Service) GetTargetOfEvaluation ¶ added in v1.6.0
func (svc *Service) GetTargetOfEvaluation(ctx context.Context, req *orchestrator.GetTargetOfEvaluationRequest) (response *orchestrator.TargetOfEvaluation, err error)
GetTargetOfEvaluation implements method for getting a TargetOfEvaluation, e.g. to show its state in the UI
func (*Service) ListAssessmentResults ¶ added in v1.3.12
func (svc *Service) ListAssessmentResults(ctx context.Context, req *orchestrator.ListAssessmentResultsRequest) (res *orchestrator.ListAssessmentResultsResponse, err error)
ListAssessmentResults is a method implementation of the orchestrator interface
func (*Service) ListCatalogs ¶ added in v1.6.0
func (svc *Service) ListCatalogs(_ context.Context, req *orchestrator.ListCatalogsRequest) (res *orchestrator.ListCatalogsResponse, err error)
ListCatalogs Lists all security controls catalogs. Each catalog includes a list of its categories but no additional sub-resources.
func (*Service) ListCertificates ¶ added in v1.4.9
func (svc *Service) ListCertificates(ctx context.Context, req *orchestrator.ListCertificatesRequest) ( res *orchestrator.ListCertificatesResponse, err error)
ListCertificates implements method for getting all certificates, e.g. to show its state in the UI. The response does not indicate whether there are no certificates available or the access is denied.
func (*Service) ListCloudServices ¶ added in v1.3.11
func (svc *Service) ListCloudServices(ctx context.Context, req *orchestrator.ListCloudServicesRequest) ( res *orchestrator.ListCloudServicesResponse, err error)
ListCloudServices implements method for OrchestratorServer interface for listing all cloud services
func (*Service) ListControls ¶ added in v1.6.0
func (srv *Service) ListControls(_ context.Context, req *orchestrator.ListControlsRequest) (res *orchestrator.ListControlsResponse, err error)
ListControls lists controls. If no additional parameters are specified, this lists all controls. If a catalog ID and a category name is specified, then only controls containing in this category are returned.
func (*Service) ListControlsInScope ¶ added in v1.7.2
func (svc *Service) ListControlsInScope(ctx context.Context, req *orchestrator.ListControlsInScopeRequest) (res *orchestrator.ListControlsInScopeResponse, err error)
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) ListPublicCertificates ¶ added in v1.9.2
func (svc *Service) ListPublicCertificates(_ context.Context, req *orchestrator.ListPublicCertificatesRequest) (res *orchestrator.ListPublicCertificatesResponse, err error)
ListPublicCertificates implements method for getting all certificates wihtout the state history, e.g. to show its state in the UI
func (*Service) ListTargetsOfEvaluation ¶ added in v1.6.0
func (svc *Service) ListTargetsOfEvaluation(ctx context.Context, req *orchestrator.ListTargetsOfEvaluationRequest) (res *orchestrator.ListTargetsOfEvaluationResponse, err error)
ListTargetsOfEvaluation implements method for getting a TargetOfEvaluation
func (*Service) RegisterAssessmentResultHook ¶ added in v1.3.11
func (s *Service) RegisterAssessmentResultHook(hook assessment.ResultHookFunc)
func (*Service) RegisterCloudService ¶ added in v1.3.11
func (s *Service) RegisterCloudService(ctx context.Context, req *orchestrator.RegisterCloudServiceRequest) (res *orchestrator.CloudService, err error)
func (*Service) RegisterCloudServiceHook ¶ added in v1.4.10
func (s *Service) RegisterCloudServiceHook(hook orchestrator.CloudServiceHookFunc)
func (*Service) RegisterToeHook ¶ added in v1.7.0
func (s *Service) RegisterToeHook(hook orchestrator.TargetOfEvaluationHookFunc)
RegisterToeHook registers the Target of Evaluation hook function
func (*Service) RemoveCatalog ¶ added in v1.6.0
func (svc *Service) RemoveCatalog(_ context.Context, req *orchestrator.RemoveCatalogRequest) (response *emptypb.Empty, err error)
RemoveCatalog implements a method for removing a catalog
func (*Service) RemoveCertificate ¶ added in v1.4.9
func (svc *Service) RemoveCertificate(ctx context.Context, req *orchestrator.RemoveCertificateRequest) (response *emptypb.Empty, err error)
RemoveCertificate implements method for removing a certificate. The response does not indicate whether there are no certificates available or the access is denied.
func (*Service) RemoveCloudService ¶ added in v1.3.11
func (s *Service) RemoveCloudService(ctx context.Context, req *orchestrator.RemoveCloudServiceRequest) (response *emptypb.Empty, err error)
RemoveCloudService implements method for OrchestratorServer interface for removing a cloud service
func (*Service) RemoveControlFromScope ¶ added in v1.7.2
func (svc *Service) RemoveControlFromScope(ctx context.Context, req *orchestrator.RemoveControlFromScopeRequest) (res *emptypb.Empty, err error)
func (*Service) RemoveTargetOfEvaluation ¶ added in v1.6.0
func (svc *Service) RemoveTargetOfEvaluation(ctx context.Context, req *orchestrator.RemoveTargetOfEvaluationRequest) (response *emptypb.Empty, err error)
RemoveTargetOfEvaluation implements method for removing a TargetOfEvaluation
func (*Service) StoreAssessmentResult ¶ added in v1.3.11
func (svc *Service) StoreAssessmentResult(ctx context.Context, req *orchestrator.StoreAssessmentResultRequest) (res *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) UpdateCatalog ¶ added in v1.6.0
func (svc *Service) UpdateCatalog(_ context.Context, req *orchestrator.UpdateCatalogRequest) (res *orchestrator.Catalog, err error)
UpdateCatalog implements a method for updating an existing catalog
func (*Service) UpdateCertificate ¶ added in v1.4.9
func (svc *Service) UpdateCertificate(ctx 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(ctx context.Context, req *orchestrator.UpdateCloudServiceRequest) (res *orchestrator.CloudService, err error)
UpdateCloudService implements method for OrchestratorServer interface for updating a cloud service
func (*Service) UpdateControlInScope ¶ added in v1.7.2
func (svc *Service) UpdateControlInScope(ctx context.Context, req *orchestrator.UpdateControlInScopeRequest) (res *orchestrator.ControlInScope, err error)
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(ctx 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.
func (*Service) UpdateTargetOfEvaluation ¶ added in v1.6.0
func (svc *Service) UpdateTargetOfEvaluation(ctx context.Context, req *orchestrator.UpdateTargetOfEvaluationRequest) (res *orchestrator.TargetOfEvaluation, err error)
UpdateTargetOfEvaluation implements method for updating an existing TargetOfEvaluation
type ServiceOption ¶ added in v1.3.14
type ServiceOption func(*Service)
ServiceOption is a function-style option to configure the Orchestrator Service
func WithAuthorizationStrategy ¶ added in v1.7.8
func WithAuthorizationStrategy(authz service.AuthorizationStrategy) ServiceOption
func WithAuthorizationStrategyJWT ¶ added in v1.6.2
func WithAuthorizationStrategyJWT(key string, allowAllKey string) ServiceOption
WithAuthorizationStrategyJWT is an option that configures an JWT-based authorization strategy using a specific claim key.
func WithCatalogsFolder ¶ added in v1.9.0
func WithCatalogsFolder(folder string) ServiceOption
WithCatalogsFolder can be used to load catalog files from a different catalogs folder
func WithExternalCatalogs ¶ added in v1.6.0
func WithExternalCatalogs(f func() ([]*orchestrator.Catalog, error)) ServiceOption
WithExternalCatalogs can be used to load catalog definitions from an external source
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 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.