Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(assignee-group): api definition (#2224)

p0nycafdca87e935
diff --git a/api/policy.go b/api/policy.go
index f41caa38ec..d3b92d9aa0 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -13,6 +13,9 @@ type PolicyType string
// PipelineApprovalValue is value for approval policy.
type PipelineApprovalValue string
+// AssigneeGroupValue is the value for assignee group policy.
+type AssigneeGroupValue string
+
// BackupPlanPolicySchedule is value for backup plan policy.
type BackupPlanPolicySchedule string
@@ -32,6 +35,9 @@ const (
// PipelineApprovalValueManualAlways means the pipeline should be manually approved by user to proceed.
PipelineApprovalValueManualAlways PipelineApprovalValue = "MANUAL_APPROVAL_ALWAYS"
+ // AssigneeGroupValueProjectOwner means the assignee can be selected from the project owners.
+ AssigneeGroupValueProjectOwner AssigneeGroupValue = "PROJECT_OWNER"
+
// BackupPlanPolicyScheduleUnset is NEVER backup plan policy value.
BackupPlanPolicyScheduleUnset BackupPlanPolicySchedule = "UNSET"
// BackupPlanPolicyScheduleDaily is DAILY backup plan policy value.
@@ -117,6 +123,10 @@ type PolicyDelete struct {
// PipelineApprovalPolicy is the policy configuration for pipeline approval.
type PipelineApprovalPolicy struct {
Value PipelineApprovalValue `json:"value"`
+ // if the approval policy is MANUAL_APPROVAL_NEVER, there shouldn't be AssigneeGroupList.
+ // if the approval policy is MANUAL_APPROVAL_ALWAYS, the assignee group is the DBAs by default,
+ // and we set the assignee group to the project owners for corresponding issue types.
+ AssigneeGroupList []AssigneeGroup `json:"assigneeGroupList"`
}
func (pa PipelineApprovalPolicy) String() (string, error) {
@@ -136,6 +146,20 @@ func UnmarshalPipelineApprovalPolicy(payload string) (*PipelineApprovalPolicy, e
return &pa, nil
}
+// AssigneeGroup is the configuration of the assignee group.
+type AssigneeGroup struct {
+ IssueType IssueType `json:"issueType"`
+ Value AssigneeGroupValue `json:"value"`
+}
+
+func (p AssigneeGroup) String() (string, error) {
+ s, err := json.Marshal(p)
+ if err != nil {
+ return "", err
+ }
+ return string(s), nil
+}
+
// BackupPlanPolicy is the policy configuration for backup plan.
type BackupPlanPolicy struct {
Schedule BackupPlanPolicySchedule `json:"schedule"`