Documentation ¶
Index ¶
- Variables
- func NewConverter() *converter
- func NewFormationStatusService(formationRepository FormationRepository, labelDefRepository labelDefRepository, ...) *formationStatusService
- func NewNotificationService(tenantRepository tenantRepository, webhookClient webhookClient, ...) *notificationsService
- func NewRepository(conv EntityConverter) *repository
- func NewService(transact persistence.Transactioner, ...) *service
- type ASAEngine
- func (s *ASAEngine) EnsureScenarioAssigned(ctx context.Context, in *model.AutomaticScenarioAssignment, ...) error
- func (s *ASAEngine) GetMatchingFuncByFormationObjectType(objType graphql.FormationObjectType) (MatchingFunc, error)
- func (s *ASAEngine) GetScenariosFromMatchingASAs(ctx context.Context, objectID string, objType graphql.FormationObjectType) ([]string, error)
- func (s *ASAEngine) IsFormationComingFromASA(ctx context.Context, objectID, formation string, ...) (bool, error)
- func (s *ASAEngine) UnassignFormationComingFromASA(ctx context.Context, in *model.AutomaticScenarioAssignment, ...) error
- type Converter
- type Entity
- type EntityCollection
- type EntityConverter
- type FormationAssignmentConverter
- type FormationAssignmentInputBuilder
- type FormationAssignmentNotificationsService
- type FormationAssignmentRepository
- type FormationRepository
- type FormationTemplateRepository
- type MatchingFunc
- type NotificationBuilder
- func (nb *NotificationBuilder) BuildFormationAssignmentNotificationRequest(ctx context.Context, ...) (*webhookclient.FormationAssignmentNotificationRequest, error)
- func (nb *NotificationBuilder) BuildFormationNotificationRequests(ctx context.Context, ...) ([]*webhookclient.FormationNotificationRequest, error)
- func (nb *NotificationBuilder) PrepareDetailsForApplicationTenantMappingNotificationGeneration(operation model.FormationOperation, formationTemplateID string, ...) (...)
- func (nb *NotificationBuilder) PrepareDetailsForConfigurationChangeNotificationGeneration(operation model.FormationOperation, formationTemplateID string, ...) (...)
- type NotificationsGenerator
- func (ns *NotificationsGenerator) GenerateFormationLifecycleNotifications(ctx context.Context, formationTemplateWebhooks []*model.Webhook, ...) ([]*webhookclient.FormationNotificationRequest, error)
- func (ns *NotificationsGenerator) GenerateNotificationsAboutApplicationsForTheRuntimeContextThatIsAssigned(ctx context.Context, tenant, runtimeCtxID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- func (ns *NotificationsGenerator) GenerateNotificationsAboutApplicationsForTheRuntimeThatIsAssigned(ctx context.Context, tenant, runtimeID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- func (ns *NotificationsGenerator) GenerateNotificationsAboutRuntimeAndRuntimeContextForTheApplicationThatIsAssigned(ctx context.Context, tenant string, appID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- func (ns *NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheApplicationThatIsAssigned(ctx context.Context, tenant string, appID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- func (ns *NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheRuntimeContextThatIsAssigned(ctx context.Context, tenant, runtimeCtxID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- func (ns *NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheRuntimeThatIsAssigned(ctx context.Context, tenant, runtimeID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- func (ns *NotificationsGenerator) GenerateNotificationsForRuntimeAboutTheApplicationThatIsAssigned(ctx context.Context, tenant string, appID string, formation *model.Formation, ...) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
- type NotificationsService
- type ProcessScenarioFunc
- type Resolver
- func (r *Resolver) AssignFormation(ctx context.Context, objectID string, objectType graphql.FormationObjectType, ...) (*graphql.Formation, error)
- func (r *Resolver) CreateFormation(ctx context.Context, formationInput graphql.FormationInput) (*graphql.Formation, error)
- func (r *Resolver) DeleteFormation(ctx context.Context, formation graphql.FormationInput) (*graphql.Formation, error)
- func (r *Resolver) FinalizeDraftFormation(ctx context.Context, formationID string) (*graphql.Formation, error)
- func (r *Resolver) Formation(ctx context.Context, id string) (*graphql.Formation, error)
- func (r *Resolver) FormationAssignment(ctx context.Context, obj *graphql.Formation, id string) (*graphql.FormationAssignment, error)
- func (r *Resolver) FormationAssignments(ctx context.Context, obj *graphql.Formation, first *int, ...) (*graphql.FormationAssignmentPage, error)
- func (r *Resolver) FormationAssignmentsDataLoader(keys []dataloader.ParamFormationAssignment) ([]*graphql.FormationAssignmentPage, []error)
- func (r *Resolver) FormationByName(ctx context.Context, name string) (*graphql.Formation, error)
- func (r *Resolver) Formations(ctx context.Context, first *int, after *graphql.PageCursor) (*graphql.FormationPage, error)
- func (r *Resolver) FormationsForObject(ctx context.Context, objectID string) ([]*graphql.Formation, error)
- func (r *Resolver) ResynchronizeFormationNotifications(ctx context.Context, formationID string, reset *bool) (*graphql.Formation, error)
- func (r *Resolver) Status(ctx context.Context, obj *graphql.Formation) (*graphql.FormationStatus, error)
- func (r *Resolver) StatusDataLoader(keys []dataloader.ParamFormationStatus) ([]*graphql.FormationStatus, []error)
- func (r *Resolver) UnassignFormation(ctx context.Context, objectID string, objectType graphql.FormationObjectType, ...) (*graphql.Formation, error)
- func (r *Resolver) UnassignFormationGlobal(ctx context.Context, objectID string, objectType graphql.FormationObjectType, ...) (*graphql.Formation, error)
- type Service
- type TenantFetcher
Constants ¶
This section is empty.
Variables ¶
var ( // Now is a function variable that returns the current time. It is used, so we could mock it in the tests. Now = time.Now )
Functions ¶
func NewFormationStatusService ¶
func NewFormationStatusService(formationRepository FormationRepository, labelDefRepository labelDefRepository, labelDefService labelDefService, notificationsService NotificationsService, constraintEngine constraintEngine) *formationStatusService
NewFormationStatusService creates formation status service
func NewNotificationService ¶
func NewNotificationService( tenantRepository tenantRepository, webhookClient webhookClient, notificationsGenerator notificationsGenerator, constraintEngine constraintEngine, webhookConverter webhookConverter, formationTemplateRepository FormationTemplateRepository, formationAssignmentRepo FormationAssignmentRepository, formationRepo FormationRepository, ) *notificationsService
NewNotificationService creates notifications service for formation assignment and unassignment
func NewRepository ¶
func NewRepository(conv EntityConverter) *repository
NewRepository creates a new Formation repository
func NewService ¶
func NewService( transact persistence.Transactioner, applicationRepository applicationRepository, labelDefRepository labelDefRepository, labelRepository labelRepository, formationRepository FormationRepository, formationTemplateRepository FormationTemplateRepository, labelService labelService, uuidService uuidService, labelDefService labelDefService, asaRepo automaticFormationAssignmentRepository, asaService automaticFormationAssignmentService, tenantSvc tenantService, runtimeRepo runtimeRepository, runtimeContextRepo runtimeContextRepository, formationAssignmentService formationAssignmentService, assignmentOperationService assignmentOperationService, formationAssignmentNotificationService FormationAssignmentNotificationsService, notificationsService NotificationsService, constraintEngine constraintEngine, webhookRepository webhookRepository, statusService statusService, runtimeTypeLabelKey, applicationTypeLabelKey string) *service
NewService creates formation service
Types ¶
type ASAEngine ¶
type ASAEngine struct {
// contains filtered or unexported fields
}
ASAEngine processes Automatic Scenario Assignments
func NewASAEngine ¶
func NewASAEngine(asaRepository automaticFormationAssignmentRepository, runtimeRepository runtimeRepository, runtimeContextRepository runtimeContextRepository, formationRepository FormationRepository, formationTemplateRepository FormationTemplateRepository, runtimeTypeLabelKey, applicationTypeLabelKey string) *ASAEngine
NewASAEngine returns ASAEngine
func (*ASAEngine) EnsureScenarioAssigned ¶
func (s *ASAEngine) EnsureScenarioAssigned(ctx context.Context, in *model.AutomaticScenarioAssignment, processScenarioFunc ProcessScenarioFunc) error
EnsureScenarioAssigned ensures that the scenario is assigned to all the runtimes and runtimeContexts that are in the ASAs target_tenant_id
func (*ASAEngine) GetMatchingFuncByFormationObjectType ¶
func (s *ASAEngine) GetMatchingFuncByFormationObjectType(objType graphql.FormationObjectType) (MatchingFunc, error)
GetMatchingFuncByFormationObjectType gets matching func based on the objType
func (*ASAEngine) GetScenariosFromMatchingASAs ¶
func (s *ASAEngine) GetScenariosFromMatchingASAs(ctx context.Context, objectID string, objType graphql.FormationObjectType) ([]string, error)
GetScenariosFromMatchingASAs gets all the scenarios that should be added to the runtime based on the matching Automatic Scenario Assignments In order to do that, the ASAs should be searched in the caller tenant as this is the tenant that modifies the runtime and this is the tenant that the ASA produced labels should be added to.
func (*ASAEngine) IsFormationComingFromASA ¶
func (s *ASAEngine) IsFormationComingFromASA(ctx context.Context, objectID, formation string, objectType graphql.FormationObjectType) (bool, error)
IsFormationComingFromASA checks whether the formation comes from ASA
func (*ASAEngine) UnassignFormationComingFromASA ¶
func (s *ASAEngine) UnassignFormationComingFromASA(ctx context.Context, in *model.AutomaticScenarioAssignment, processScenarioFunc ProcessScenarioFunc) error
UnassignFormationComingFromASA removes all the scenarios that are coming from the provided ASA
type Converter ¶
type Converter interface { FromGraphQL(i graphql.FormationInput) model.Formation ToGraphQL(i *model.Formation) (*graphql.Formation, error) MultipleToGraphQL(in []*model.Formation) ([]*graphql.Formation, error) }
Converter missing godoc
type Entity ¶
type Entity struct { ID string `db:"id"` TenantID string `db:"tenant_id"` FormationTemplateID string `db:"formation_template_id"` Name string `db:"name"` State string `db:"state"` Error sql.NullString `db:"error"` LastStateChangeTimestamp *time.Time `db:"last_state_change_timestamp"` LastNotificationSentTimestamp *time.Time `db:"last_notification_sent_timestamp"` }
Entity represents the formation entity
type EntityCollection ¶
type EntityCollection []*Entity
EntityCollection is a collection of formation entities.
func (EntityCollection) Len ¶
func (s EntityCollection) Len() int
Len returns the number of entities in the collection.
type EntityConverter ¶
type EntityConverter interface { ToEntity(in *model.Formation) *Entity FromEntity(entity *Entity) *model.Formation }
EntityConverter converts between the internal model and entity
type FormationAssignmentConverter ¶
type FormationAssignmentConverter interface { MultipleToGraphQL(in []*model.FormationAssignment) ([]*graphql.FormationAssignment, error) ToGraphQL(in *model.FormationAssignment) (*graphql.FormationAssignment, error) }
FormationAssignmentConverter converts FormationAssignment between the model.FormationAssignment service-layer representation and graphql.FormationAssignment.
type FormationAssignmentInputBuilder ¶
type FormationAssignmentInputBuilder func(details *formationconstraintpkg.GenerateFormationAssignmentNotificationOperationDetails) webhookdir.FormationAssignmentTemplateInput
FormationAssignmentInputBuilder represents expected signature for methods that create operator input from the provided details
type FormationAssignmentNotificationsService ¶
type FormationAssignmentNotificationsService interface {
GenerateFormationAssignmentNotification(ctx context.Context, formationAssignment *model.FormationAssignment, operation model.FormationOperation) (*webhookclient.FormationAssignmentNotificationRequest, error)
}
FormationAssignmentNotificationsService represents the notification service for generating and sending notifications
type FormationAssignmentRepository ¶
type FormationAssignmentRepository interface {
UpdateLastNotificationSentTimestamps(ctx context.Context, formationAssignmentID string) error
}
FormationAssignmentRepository represents the Formation Assignment repository layer
type FormationRepository ¶
type FormationRepository interface { Get(ctx context.Context, id, tenantID string) (*model.Formation, error) GetByName(ctx context.Context, name, tenantID string) (*model.Formation, error) GetGlobalByID(ctx context.Context, id string) (*model.Formation, error) List(ctx context.Context, tenant string, pageSize int, cursor string) (*model.FormationPage, error) ListByIDs(ctx context.Context, formationIDs []string) ([]*model.Formation, error) ListObjectIDsOfTypeForFormations(ctx context.Context, tenantID string, formationNames []string, objectType model.FormationAssignmentType) ([]string, error) ListObjectIDsOfTypeForFormationsGlobal(ctx context.Context, formationNames []string, objectType model.FormationAssignmentType) ([]string, error) ListByIDsGlobal(ctx context.Context, formationIDs []string) ([]*model.Formation, error) Create(ctx context.Context, item *model.Formation) error DeleteByName(ctx context.Context, tenantID, name string) error Update(ctx context.Context, model *model.Formation) error UpdateLastNotificationSentTimestamps(ctx context.Context, formationID string) error }
FormationRepository represents the Formations repository layer
type FormationTemplateRepository ¶
type FormationTemplateRepository interface { Get(ctx context.Context, id string) (*model.FormationTemplate, error) GetByNameAndTenant(ctx context.Context, templateName, tenantID string) (*model.FormationTemplate, error) }
FormationTemplateRepository represents the FormationTemplate repository layer
type MatchingFunc ¶
type MatchingFunc func(ctx context.Context, asa *model.AutomaticScenarioAssignment, runtimeID string) (bool, error)
MatchingFunc provides signature for functions used for matching asa against runtimeID
type NotificationBuilder ¶
type NotificationBuilder struct {
// contains filtered or unexported fields
}
NotificationBuilder is responsible for building notification requests
func NewNotificationsBuilder ¶
func NewNotificationsBuilder(webhookConverter webhookConverter, constraintEngine constraintEngine, runtimeTypeLabelKey, applicationTypeLabelKey string) *NotificationBuilder
NewNotificationsBuilder creates new NotificationBuilder
func (*NotificationBuilder) BuildFormationAssignmentNotificationRequest ¶
func (nb *NotificationBuilder) BuildFormationAssignmentNotificationRequest( ctx context.Context, joinPointDetails *formationconstraintpkg.GenerateFormationAssignmentNotificationOperationDetails, webhook *model.Webhook, ) (*webhookclient.FormationAssignmentNotificationRequest, error)
BuildFormationAssignmentNotificationRequest builds new formation assignment notification request
func (*NotificationBuilder) BuildFormationNotificationRequests ¶
func (nb *NotificationBuilder) BuildFormationNotificationRequests(ctx context.Context, joinPointDetails *formationconstraintpkg.GenerateFormationNotificationOperationDetails, formation *model.Formation, formationTemplateWebhooks []*model.Webhook) ([]*webhookclient.FormationNotificationRequest, error)
BuildFormationNotificationRequests builds new formation notification request
func (*NotificationBuilder) PrepareDetailsForApplicationTenantMappingNotificationGeneration ¶
func (nb *NotificationBuilder) PrepareDetailsForApplicationTenantMappingNotificationGeneration( operation model.FormationOperation, formationTemplateID string, formation *model.Formation, sourceApplicationTemplate *webhookdir.ApplicationTemplateWithLabels, sourceApplication *webhookdir.ApplicationWithLabels, targetApplicationTemplate *webhookdir.ApplicationTemplateWithLabels, targetApplication *webhookdir.ApplicationWithLabels, assignment *webhookdir.FormationAssignment, reverseAssignment *webhookdir.FormationAssignment, tenantContext *webhookdir.CustomerTenantContext, tenantID string, ) (*formationconstraintpkg.GenerateFormationAssignmentNotificationOperationDetails, error)
PrepareDetailsForApplicationTenantMappingNotificationGeneration returns GenerateFormationAssignmentNotificationOperationDetails for applicationTenantMapping webhooks
func (*NotificationBuilder) PrepareDetailsForConfigurationChangeNotificationGeneration ¶
func (nb *NotificationBuilder) PrepareDetailsForConfigurationChangeNotificationGeneration( operation model.FormationOperation, formationTemplateID string, formation *model.Formation, applicationTemplate *webhookdir.ApplicationTemplateWithLabels, application *webhookdir.ApplicationWithLabels, runtime *webhookdir.RuntimeWithLabels, runtimeContext *webhookdir.RuntimeContextWithLabels, assignment *webhookdir.FormationAssignment, reverseAssignment *webhookdir.FormationAssignment, targetType model.ResourceType, tenantContext *webhookdir.CustomerTenantContext, tenantID string, ) (*formationconstraintpkg.GenerateFormationAssignmentNotificationOperationDetails, error)
PrepareDetailsForConfigurationChangeNotificationGeneration returns GenerateFormationAssignmentNotificationOperationDetails for ConfigurationChanged webhooks
type NotificationsGenerator ¶
type NotificationsGenerator struct {
// contains filtered or unexported fields
}
NotificationsGenerator is responsible for generation of notification requests
func NewNotificationsGenerator ¶
func NewNotificationsGenerator( applicationRepository applicationRepository, runtimeRepo runtimeRepository, runtimeContextRepo runtimeContextRepository, labelRepository labelRepository, webhookRepository webhookRepository, webhookDataInputBuilder databuilder.DataInputBuilder, notificationBuilder notificationBuilder) *NotificationsGenerator
NewNotificationsGenerator returns an instance of NotificationsGenerator
func (*NotificationsGenerator) GenerateFormationLifecycleNotifications ¶
func (ns *NotificationsGenerator) GenerateFormationLifecycleNotifications(ctx context.Context, formationTemplateWebhooks []*model.Webhook, tenantID string, formation *model.Formation, formationTemplateName, formationTemplateID string, formationOperation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationNotificationRequest, error)
GenerateFormationLifecycleNotifications generates formation notifications for the provided webhooks
func (*NotificationsGenerator) GenerateNotificationsAboutApplicationsForTheRuntimeContextThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsAboutApplicationsForTheRuntimeContextThatIsAssigned(ctx context.Context, tenant, runtimeCtxID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsAboutApplicationsForTheRuntimeContextThatIsAssigned generates notification per runtime context that is part of the formation with target the runtime context and source the application on which `operation` is performed
func (*NotificationsGenerator) GenerateNotificationsAboutApplicationsForTheRuntimeThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsAboutApplicationsForTheRuntimeThatIsAssigned(ctx context.Context, tenant, runtimeID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsAboutApplicationsForTheRuntimeThatIsAssigned generates notification per runtime that is part of the formation with target the runtime and source the application on which `operation` is performed
func (*NotificationsGenerator) GenerateNotificationsAboutRuntimeAndRuntimeContextForTheApplicationThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsAboutRuntimeAndRuntimeContextForTheApplicationThatIsAssigned(ctx context.Context, tenant string, appID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsAboutRuntimeAndRuntimeContextForTheApplicationThatIsAssigned generates notification with target the application that is assigned about for each runtime and each runtimeContext that is part of the formation
func (*NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheApplicationThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheApplicationThatIsAssigned(ctx context.Context, tenant string, appID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsForApplicationsAboutTheApplicationThatIsAssigned generates notification per application that is part of the formation with target the application and source the application on which `operation` is performed
func (*NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheRuntimeContextThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheRuntimeContextThatIsAssigned(ctx context.Context, tenant, runtimeCtxID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsForApplicationsAboutTheRuntimeContextThatIsAssigned generates notification per application that is part of the formation with target the application and source the runtime context on which `operation` is performed
func (*NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheRuntimeThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsForApplicationsAboutTheRuntimeThatIsAssigned(ctx context.Context, tenant, runtimeID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsForApplicationsAboutTheRuntimeThatIsAssigned generates notification per application that is part of the formation with target the application and source the runtime on which `operation` is performed
func (*NotificationsGenerator) GenerateNotificationsForRuntimeAboutTheApplicationThatIsAssigned ¶
func (ns *NotificationsGenerator) GenerateNotificationsForRuntimeAboutTheApplicationThatIsAssigned(ctx context.Context, tenant string, appID string, formation *model.Formation, operation model.FormationOperation, customerTenantContext *webhookdir.CustomerTenantContext) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error)
GenerateNotificationsForRuntimeAboutTheApplicationThatIsAssigned generates notification per runtime that is part of the formation with target the runtime and source the application on which `operation` is performed
type NotificationsService ¶
type NotificationsService interface { GenerateFormationAssignmentNotifications(ctx context.Context, tenant, objectID string, formation *model.Formation, operation model.FormationOperation, objectType graphql.FormationObjectType) ([]*webhookclient.FormationAssignmentNotificationRequestTargetMapping, error) GenerateFormationNotifications(ctx context.Context, formationTemplateWebhooks []*model.Webhook, tenantID string, formation *model.Formation, formationTemplateName, formationTemplateID string, formationOperation model.FormationOperation) ([]*webhookclient.FormationNotificationRequest, error) SendNotification(ctx context.Context, webhookNotificationReq webhookclient.WebhookExtRequest) (*webhookdir.Response, error) PrepareDetailsForNotificationStatusReturned(ctx context.Context, formation *model.Formation, operation model.FormationOperation) (*formationconstraint.NotificationStatusReturnedOperationDetails, error) }
NotificationsService represents the notification service for generating and sending notifications
type ProcessScenarioFunc ¶
type ProcessScenarioFunc func(context.Context, string, string, graphql.FormationObjectType, model.Formation) (*model.Formation, error)
ProcessScenarioFunc provides the signature for functions that process scenarios
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is the formation resolver
func NewResolver ¶
func NewResolver(transact persistence.Transactioner, service Service, conv Converter, formationAssignmentSvc formationAssignmentService, formationAssignmentConv FormationAssignmentConverter, fetcher TenantFetcher, tenantSvc tenantSvc) *Resolver
NewResolver creates formation resolver
func (*Resolver) AssignFormation ¶
func (r *Resolver) AssignFormation(ctx context.Context, objectID string, objectType graphql.FormationObjectType, formation graphql.FormationInput, initialConfigurations []*graphql.InitialConfiguration) (*graphql.Formation, error)
AssignFormation assigns object to the provided formation
func (*Resolver) CreateFormation ¶
func (r *Resolver) CreateFormation(ctx context.Context, formationInput graphql.FormationInput) (*graphql.Formation, error)
CreateFormation creates new formation for the caller tenant
func (*Resolver) DeleteFormation ¶
func (r *Resolver) DeleteFormation(ctx context.Context, formation graphql.FormationInput) (*graphql.Formation, error)
DeleteFormation deletes the formation from the caller tenant formations
func (*Resolver) FinalizeDraftFormation ¶
func (r *Resolver) FinalizeDraftFormation(ctx context.Context, formationID string) (*graphql.Formation, error)
FinalizeDraftFormation changes the formation state to initial and start processing the formation and formation assignment notifications
func (*Resolver) FormationAssignment ¶
func (r *Resolver) FormationAssignment(ctx context.Context, obj *graphql.Formation, id string) (*graphql.FormationAssignment, error)
FormationAssignment missing godoc
func (*Resolver) FormationAssignments ¶
func (r *Resolver) FormationAssignments(ctx context.Context, obj *graphql.Formation, first *int, after *graphql.PageCursor) (*graphql.FormationAssignmentPage, error)
FormationAssignments retrieves a page of FormationAssignments for the specified Formation
func (*Resolver) FormationAssignmentsDataLoader ¶
func (r *Resolver) FormationAssignmentsDataLoader(keys []dataloader.ParamFormationAssignment) ([]*graphql.FormationAssignmentPage, []error)
FormationAssignmentsDataLoader retrieves a page of FormationAssignments for each Formation ID in the keys argument The sub-resolver is referred from tenant scoped resolvers but in some cases it can be referred in non tenant scoped resolver(e.g. formationsForObject) In order to work correctly in both cases the formations from the keys are processed grouped by tenant. After the processing the correct order of the assignment pages(same as the order of the formations from the keys) must be ensured as the dataloaders depend on the order of the results when resolving the sub-resolvers
func (*Resolver) FormationByName ¶
FormationByName returns a Formation by its name
func (*Resolver) Formations ¶
func (r *Resolver) Formations(ctx context.Context, first *int, after *graphql.PageCursor) (*graphql.FormationPage, error)
Formations returns paginated Formations based on first and after
func (*Resolver) FormationsForObject ¶
func (r *Resolver) FormationsForObject(ctx context.Context, objectID string) ([]*graphql.Formation, error)
FormationsForObject returns all Formations `objectID` is part of
func (*Resolver) ResynchronizeFormationNotifications ¶
func (r *Resolver) ResynchronizeFormationNotifications(ctx context.Context, formationID string, reset *bool) (*graphql.Formation, error)
ResynchronizeFormationNotifications sends all notifications that are in error or initial state
func (*Resolver) Status ¶
func (r *Resolver) Status(ctx context.Context, obj *graphql.Formation) (*graphql.FormationStatus, error)
Status retrieves a Status for the specified Formation
func (*Resolver) StatusDataLoader ¶
func (r *Resolver) StatusDataLoader(keys []dataloader.ParamFormationStatus) ([]*graphql.FormationStatus, []error)
StatusDataLoader retrieves a Status for each Formation ID in the keys argument The sub-resolver is referred from tenant scoped resolvers but in some cases it can be referred in non tenant scoped resolver(e.g. formationsForObject) In order to work correctly in both cases the formations from the keys are processed grouped by tenant. After the processing the correct order of the statuses(same as the order of the formations from the keys) must be ensured as the dataloaders depend on the order of the results when resolving the sub-resolvers
func (*Resolver) UnassignFormation ¶
func (r *Resolver) UnassignFormation(ctx context.Context, objectID string, objectType graphql.FormationObjectType, formation graphql.FormationInput) (*graphql.Formation, error)
UnassignFormation unassigns the object from the provided formation
type Service ¶
type Service interface { Get(ctx context.Context, id string) (*model.Formation, error) GetFormationByName(ctx context.Context, formationName, tnt string) (*model.Formation, error) List(ctx context.Context, pageSize int, cursor string) (*model.FormationPage, error) GetGlobalByID(ctx context.Context, id string) (*model.Formation, error) ListFormationsForObjectGlobal(ctx context.Context, objectID string) ([]*model.Formation, error) CreateFormation(ctx context.Context, tnt string, formation model.Formation, templateName string) (*model.Formation, error) DeleteFormation(ctx context.Context, tnt string, formation model.Formation) (*model.Formation, error) AssignFormation(ctx context.Context, tnt, objectID string, objectType graphql.FormationObjectType, formation model.Formation, initialConfigurations model.InitialConfigurations) (*model.Formation, error) UnassignFormation(ctx context.Context, tnt, objectID string, objectType graphql.FormationObjectType, formation model.Formation, ignoreASA bool) (*model.Formation, error) ResynchronizeFormationNotifications(ctx context.Context, formationID string, reset bool) (*model.Formation, error) FinalizeDraftFormation(ctx context.Context, formationID string) (*model.Formation, error) }
Service missing godoc
type TenantFetcher ¶
type TenantFetcher interface {
FetchOnDemand(ctx context.Context, tenant, parentTenant string) error
}
TenantFetcher calls an API which fetches details for the given tenant from an external tenancy service, stores the tenant in the Compass DB and returns 200 OK if the tenant was successfully created.