github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/model/formation_constraint.go (about) 1 package model 2 3 // FormationConstraintType represents the constraint type. It is part of the Join point location along with TargetOperation 4 type FormationConstraintType string 5 6 const ( 7 // PreOperation denotes the constraint should be enforced before the operation execution 8 PreOperation FormationConstraintType = "PRE" 9 // PostOperation denotes the constraint should be enforced after the operation execution 10 PostOperation FormationConstraintType = "POST" 11 ) 12 13 // TargetOperation represents the operation to which the constraint is applicable. Different values are defined in the GraphQL schema. 14 type TargetOperation string 15 16 const ( 17 // AssignFormationOperation represents the assign formation operation 18 AssignFormationOperation TargetOperation = "ASSIGN_FORMATION" 19 // UnassignFormationOperation represents the unassign formation operation 20 UnassignFormationOperation TargetOperation = "UNASSIGN_FORMATION" 21 // CreateFormationOperation represents the create formation operation 22 CreateFormationOperation TargetOperation = "CREATE_FORMATION" 23 // DeleteFormationOperation represents the delete formation operation 24 DeleteFormationOperation TargetOperation = "DELETE_FORMATION" 25 // GenerateFormationAssignmentNotificationOperation represents the generate formation assignment notifications operation 26 GenerateFormationAssignmentNotificationOperation TargetOperation = "GENERATE_FORMATION_ASSIGNMENT_NOTIFICATION" 27 // GenerateFormationNotificationOperation represents the generate formation notifications operation 28 GenerateFormationNotificationOperation TargetOperation = "GENERATE_FORMATION_NOTIFICATION" 29 // SendNotificationOperation represents the send notification operation 30 SendNotificationOperation TargetOperation = "SEND_NOTIFICATION" 31 // NotificationStatusReturned represents the notification status returned operation 32 NotificationStatusReturned TargetOperation = "NOTIFICATION_STATUS_RETURNED" 33 ) 34 35 // ResourceType represents the type of resource the constraint is applicable to 36 type ResourceType string 37 38 const ( 39 // ApplicationResourceType represents the application resource type 40 ApplicationResourceType ResourceType = "APPLICATION" 41 // RuntimeResourceType represents the runtime resource type 42 RuntimeResourceType ResourceType = "RUNTIME" 43 // RuntimeContextResourceType represents the runtime context resource type 44 RuntimeContextResourceType ResourceType = "RUNTIME_CONTEXT" 45 // TenantResourceType represents the tenant resource type 46 TenantResourceType ResourceType = "TENANT" 47 // FormationResourceType represents the formation resource type 48 FormationResourceType ResourceType = "FORMATION" 49 ) 50 51 // FormationConstraintScope defines the scope of the constraint 52 type FormationConstraintScope string 53 54 const ( 55 // GlobalFormationConstraintScope denotes the constraint is not bound to any formation type 56 GlobalFormationConstraintScope FormationConstraintScope = "GLOBAL" 57 // FormationTypeFormationConstraintScope denotes the constraint is applicable only to formations of the specified formation type 58 FormationTypeFormationConstraintScope FormationConstraintScope = "FORMATION_TYPE" 59 ) 60 61 // FormationConstraintInput represents the input for creating FormationConstraint 62 type FormationConstraintInput struct { 63 Name string 64 ConstraintType FormationConstraintType 65 TargetOperation TargetOperation 66 Operator string 67 ResourceType ResourceType 68 ResourceSubtype string 69 InputTemplate string 70 ConstraintScope FormationConstraintScope 71 } 72 73 // FormationConstraint represents the constraint entity 74 type FormationConstraint struct { 75 ID string 76 Name string 77 ConstraintType FormationConstraintType 78 TargetOperation TargetOperation 79 Operator string 80 ResourceType ResourceType 81 ResourceSubtype string 82 InputTemplate string 83 ConstraintScope FormationConstraintScope 84 }