diff --git a/api/dms/service/v1/masking.go b/api/dms/service/v1/masking.go index 7bb26d88..534191ea 100644 --- a/api/dms/service/v1/masking.go +++ b/api/dms/service/v1/masking.go @@ -8,12 +8,22 @@ import ( type ListMaskingRulesReq struct { } +// swagger:model ListMaskingRulesData type ListMaskingRulesData struct { - MaskingType string `json:"masking_type"` - Description string `json:"description"` + // masking type + // Example: "MASK_DIGIT" + MaskingType string `json:"masking_type"` + // description + // Example: "mask digits" + Description string `json:"description"` + // reference fields ReferenceFields []string `json:"reference_fields"` - Effect string `json:"effect"` - Id int `json:"id"` + // effect + // Example: "******" + Effect string `json:"effect"` + // masking rule id + // Example: 1 + Id int `json:"id"` } // swagger:model ListMaskingRulesReply @@ -21,6 +31,606 @@ type ListMaskingRulesReply struct { // list masking rule reply Data []ListMaskingRulesData `json:"data"` - // Generic reply + base.GenericResp +} + +// swagger:parameters ListMaskingTemplates +type ListMaskingTemplatesReq struct { + // the maximum count of masking templates to be returned, default is 20 + // in: query + PageSize uint32 `query:"page_size" json:"page_size"` + // the offset of masking templates to be returned, default is 0 + // in: query + PageIndex uint32 `query:"page_index" json:"page_index"` +} + +// swagger:model ListMaskingTemplatesData +type ListMaskingTemplatesData struct { + // masking template id + // Example: 1 + Id int `json:"id"` + // masking template name + // Example: "Standard Template" + Name string `json:"name"` + // count of rules in the template + // Example: 5 + RuleCount int `json:"rule_count"` + // preview of rule name in the template, up to 3 items + RuleNames []string `json:"rule_names"` +} + +// swagger:model ListMaskingTemplatesReply +type ListMaskingTemplatesReply struct { + // list masking templates reply + Data []ListMaskingTemplatesData `json:"data"` + // total count of masking templates + // Example: 100 + Total int64 `json:"total_nums"` + + base.GenericResp +} + +// swagger:model AddMaskingTemplateReq +type AddMaskingTemplateReq struct { + // masking template + // Required: true + MaskingTemplate *AddMaskingTemplate `json:"masking_template" validate:"required"` +} + +// swagger:model AddMaskingTemplate +type AddMaskingTemplate struct { + // masking template name + // Required: true + // Example: "New Template" + Name string `json:"name" validate:"required"` + // masking rule id list + // Required: true + // MinLength: 1 + // Example: [1, 2, 3] + RuleIDs []int `json:"rule_ids" validate:"required,min=1"` +} + +// swagger:model AddMaskingTemplateReply +type AddMaskingTemplateReply struct { + base.GenericResp +} + +// swagger:model UpdateMaskingTemplateReq +type UpdateMaskingTemplateReq struct { + // masking template id + // in: path + // Required: true + // Example: 1 + TemplateID int `param:"template_id" json:"template_id" validate:"required"` + // masking template + // Required: true + MaskingTemplate *UpdateMaskingTemplate `json:"masking_template" validate:"required"` +} + +// swagger:model UpdateMaskingTemplate +type UpdateMaskingTemplate struct { + // masking rule id list + // Required: true + // MinLength: 1 + // Example: [1, 2] + RuleIDs []int `json:"rule_ids" validate:"required,min=1"` +} + +// swagger:model UpdateMaskingTemplateReply +type UpdateMaskingTemplateReply struct { + base.GenericResp +} + +// swagger:parameters DeleteMaskingTemplate +type DeleteMaskingTemplateReq struct { + // masking template id + // in: path + // Required: true + // Example: 1 + TemplateID int `param:"template_id" json:"template_id" validate:"required"` +} + +// swagger:model DeleteMaskingTemplateReply +type DeleteMaskingTemplateReply struct { + base.GenericResp +} + +// swagger:parameters ListSensitiveDataDiscoveryTasks +type ListSensitiveDataDiscoveryTasksReq struct { + // the maximum count of tasks to be returned, default is 20 + // in: query + // Example: 20 + PageSize uint32 `query:"page_size" json:"page_size"` + // the offset of tasks to be returned, default is 0 + // in: query + // Example: 0 + PageIndex uint32 `query:"page_index" json:"page_index"` +} + +// swagger:enum SensitiveDataDiscoveryTaskType +type SensitiveDataDiscoveryTaskType string + +const ( + SensitiveDataDiscoveryTaskTypePeriodic SensitiveDataDiscoveryTaskType = "PERIODIC" + SensitiveDataDiscoveryTaskTypeOneTime SensitiveDataDiscoveryTaskType = "ONE_TIME" +) + +// swagger:enum SensitiveDataDiscoveryTaskStatus +type SensitiveDataDiscoveryTaskStatus string + +const ( + SensitiveDataDiscoveryTaskStatusPendingChangeConfirm SensitiveDataDiscoveryTaskStatus = "PENDING_CHANGE_CONFIRM" + SensitiveDataDiscoveryTaskStatusNormal SensitiveDataDiscoveryTaskStatus = "NORMAL" + SensitiveDataDiscoveryTaskStatusCompleted SensitiveDataDiscoveryTaskStatus = "COMPLETED" +) + +// swagger:model ListSensitiveDataDiscoveryTasksData +type ListSensitiveDataDiscoveryTasksData struct { + // sensitive data discovery task id + // Example: 1 + ID int `json:"id"` + // database instance name + // Example: "mysql-01" + DBServiceName string `json:"db_service_name"` + // task type + // Enum: [PERIODIC, ONE_TIME] + // Example: "PERIODIC" + TaskType SensitiveDataDiscoveryTaskType `json:"task_type"` + // related masking template name + // Example: "Standard Template" + MaskingTemplateName string `json:"masking_template_name"` + // next run time, periodic task returns RFC3339 time, one-time task returns N/A + // Format: date-time (RFC3339) + // Example: "2024-01-15T10:30:00Z" + NextExecutionAt string `json:"next_execution_at"` + // task status + // Enum: [PENDING_CHANGE_CONFIRM, NORMAL, COMPLETED] + // Example: "NORMAL" + Status SensitiveDataDiscoveryTaskStatus `json:"status"` +} + +// swagger:model ListSensitiveDataDiscoveryTasksReply +type ListSensitiveDataDiscoveryTasksReply struct { + // sensitive data discovery tasks list reply + Data []ListSensitiveDataDiscoveryTasksData `json:"data"` + // total count of sensitive data discovery tasks + // Example: 100 + Total int64 `json:"total_nums"` + + base.GenericResp +} + +// swagger:enum SensitiveDataIdentificationMethod +type SensitiveDataIdentificationMethod string + +const ( + SensitiveDataIdentificationMethodByFieldName SensitiveDataIdentificationMethod = "BY_FIELD_NAME" + SensitiveDataIdentificationMethodBySampleData SensitiveDataIdentificationMethod = "BY_SAMPLE_DATA" +) + +// swagger:enum SensitiveDataDiscoveryExecutionPlan +type SensitiveDataDiscoveryExecutionPlan string + +const ( + SensitiveDataDiscoveryExecutionPlanImmediate SensitiveDataDiscoveryExecutionPlan = "IMMEDIATE" + SensitiveDataDiscoveryExecutionPlanPeriodic SensitiveDataDiscoveryExecutionPlan = "PERIODIC" +) + +// swagger:model AddSensitiveDataDiscoveryTaskReq +type AddSensitiveDataDiscoveryTaskReq struct { + // sensitive data discovery task + // Required: true + Task *AddSensitiveDataDiscoveryTask `json:"task" validate:"required"` +} + +// swagger:model AddSensitiveDataDiscoveryTask +type AddSensitiveDataDiscoveryTask struct { + // database instance id + // Required: true + // Example: 1 + DBServiceID int `json:"db_service_id" validate:"required"` + // masking template id + // Required: true + // Example: 1 + MaskingTemplateID int `json:"masking_template_id" validate:"required"` + // sensitive data identification method + // Required: true + // Enum: [BY_FIELD_NAME, BY_SAMPLE_DATA] + // Example: "BY_FIELD_NAME" + IdentificationMethod SensitiveDataIdentificationMethod `json:"identification_method" validate:"required"` + // execution plan + // Required: true + // Enum: [IMMEDIATE, PERIODIC] + // Example: "IMMEDIATE" + ExecutionPlan SensitiveDataDiscoveryExecutionPlan `json:"execution_plan" validate:"required"` + // cron expression, required when execution_plan is PERIODIC + // Example: "0 0 * * *" + CronExpression string `json:"cron_expression"` +} + +// swagger:model SensitiveFieldScanResult +type SensitiveFieldScanResult struct { + // scan information for the field + // Example: "matched by field name 'email'" + ScanInfo string `json:"scan_info"` + // recommended masking rules + // Example: "Email Masking" + RecommendedMaskingRuleName string `json:"recommended_masking_rule_name"` +} + +// swagger:model SuspectedSensitiveFieldsTree +type SuspectedSensitiveFieldsTree struct { + // database_name -> database node + Databases map[string]SuspectedSensitiveDatabaseNode `json:"databases"` +} + +// swagger:model SuspectedSensitiveDatabaseNode +type SuspectedSensitiveDatabaseNode struct { + // table_name -> table node + Tables map[string]SuspectedSensitiveTableNode `json:"tables"` +} + +// swagger:model SuspectedSensitiveTableNode +type SuspectedSensitiveTableNode struct { + // field_name -> scan result + Fields map[string]SensitiveFieldScanResult `json:"fields"` +} + +// swagger:model AddSensitiveDataDiscoveryTaskData +type AddSensitiveDataDiscoveryTaskData struct { + // suspected sensitive fields tree + SuspectedSensitiveFieldsTree SuspectedSensitiveFieldsTree `json:"suspected_sensitive_fields_tree"` +} + +// swagger:model AddSensitiveDataDiscoveryTaskReply +type AddSensitiveDataDiscoveryTaskReply struct { + // add sensitive data discovery task reply + Data AddSensitiveDataDiscoveryTaskData `json:"data"` + + base.GenericResp +} + +// swagger:model UpdateSensitiveDataDiscoveryTaskReq +type UpdateSensitiveDataDiscoveryTaskReq struct { + // sensitive data discovery task id + // in: path + // Required: true + // Example: 1 + TaskID int `param:"task_id" json:"task_id" validate:"required"` + // sensitive data discovery task + // Required: true + Task *UpdateSensitiveDataDiscoveryTask `json:"task" validate:"required"` +} + +// swagger:model UpdateSensitiveDataDiscoveryTask +type UpdateSensitiveDataDiscoveryTask struct { + // masking template id + // Required: true + // Example: 1 + MaskingTemplateID int `json:"masking_template_id" validate:"required"` + // sensitive data identification method + // Required: true + // Enum: [BY_FIELD_NAME, BY_SAMPLE_DATA] + // Example: "BY_FIELD_NAME" + IdentificationMethod SensitiveDataIdentificationMethod `json:"identification_method" validate:"required"` + // execution plan + // Required: true + // Enum: [IMMEDIATE, PERIODIC] + // Example: "PERIODIC" + ExecutionPlan SensitiveDataDiscoveryExecutionPlan `json:"execution_plan" validate:"required"` + // cron expression, required when execution_plan is PERIODIC + // Example: "0 0 * * *" + CronExpression string `json:"cron_expression"` +} + +// swagger:model UpdateSensitiveDataDiscoveryTaskData +type UpdateSensitiveDataDiscoveryTaskData struct { + // suspected sensitive fields tree + SuspectedSensitiveFieldsTree SuspectedSensitiveFieldsTree `json:"suspected_sensitive_fields_tree"` +} + +// swagger:model UpdateSensitiveDataDiscoveryTaskReply +type UpdateSensitiveDataDiscoveryTaskReply struct { + // update sensitive data discovery task reply + Data UpdateSensitiveDataDiscoveryTaskData `json:"data"` + + base.GenericResp +} + +// swagger:parameters ListSensitiveDataDiscoveryTaskHistories +type ListSensitiveDataDiscoveryTaskHistoriesReq struct { + // sensitive data discovery task id + // in: path + // Required: true + // Example: 1 + TaskID int `param:"task_id" json:"task_id" validate:"required"` + // the maximum count of histories to be returned, default is 20 + // in: query + // Example: 20 + PageSize uint32 `query:"page_size" json:"page_size"` + // the offset of histories to be returned, default is 0 + // in: query + // Example: 0 + PageIndex uint32 `query:"page_index" json:"page_index"` +} + +// swagger:model ListSensitiveDataDiscoveryTaskHistoriesData +type ListSensitiveDataDiscoveryTaskHistoriesData struct { + // execution time in RFC3339 format + // Format: date-time (RFC3339) + // Example: "2024-01-15T10:30:00Z" + ExecutedAt string `json:"executed_at"` + // execution status + // Enum: [PENDING_CHANGE_CONFIRM, NORMAL, COMPLETED] + // Example: "NORMAL" + Status SensitiveDataDiscoveryTaskStatus `json:"status"` + // newly discovered sensitive field count + // Example: 10 + NewSensitiveFieldCount int `json:"new_sensitive_field_count"` + // remark + // Example: "scan completed successfully" + Remark string `json:"remark"` +} + +// swagger:model ListSensitiveDataDiscoveryTaskHistoriesReply +type ListSensitiveDataDiscoveryTaskHistoriesReply struct { + // sensitive data discovery task histories reply + Data []ListSensitiveDataDiscoveryTaskHistoriesData `json:"data"` + // total count of sensitive data discovery task histories + // Example: 100 + Total int64 `json:"total_nums"` + + base.GenericResp +} + +// swagger:model ConfigureMaskingRulesReq +type ConfigureMaskingRulesReq struct { + // masking rule configurations for batch create or update + // Required: true + // MinLength: 1 + MaskingRuleConfigs []MaskingRuleConfig `json:"masking_rule_configs" validate:"required,min=1"` +} + +// swagger:model MaskingRuleConfig +type MaskingRuleConfig struct { + // data source id + // Required: true + // Example: 1 + DBServiceID int `json:"db_service_id" validate:"required"` + // table name + // Required: true + // Example: "users" + TableName string `json:"table_name" validate:"required"` + // column name + // Required: true + // Example: "email" + ColumnName string `json:"column_name" validate:"required"` + // masking rule id + // Required: true + // Example: 1 + MaskingRuleID int `json:"masking_rule_id" validate:"required"` + // whether to enable masking for this column + // Required: true + // Example: true + IsMaskingEnabled bool `json:"is_masking_enabled" validate:"required"` +} + +// swagger:model ConfigureMaskingRulesReply +type ConfigureMaskingRulesReply struct { + base.GenericResp +} + +// swagger:enum MaskingConfigStatus +type MaskingConfigStatus string + +const ( + MaskingConfigStatusConfigured MaskingConfigStatus = "CONFIGURED" + MaskingConfigStatusPendingConfirm MaskingConfigStatus = "PENDING_CONFIRM" +) + +// swagger:parameters GetMaskingOverviewTree +type GetMaskingOverviewTreeReq struct { + // project id + // in: query + // Required: true + // Example: 1 + ProjectID int `query:"project_id" json:"project_id" validate:"required"` + // data source id + // in: query + // Required: true + // Example: 1 + DBServiceID int `query:"db_service_id" json:"db_service_id" validate:"required"` + // fuzzy search keyword for database name, table name, and column name + // in: query + // Example: "user" + Search string `query:"search" json:"search"` + // masking config status filters + // in: query + // Enum: [CONFIGURED, PENDING_CONFIRM] + MaskingConfigStatuses []MaskingConfigStatus `query:"masking_config_statuses" json:"masking_config_statuses"` +} + +// swagger:model MaskingOverviewDashboard +type MaskingOverviewDashboard struct { + // total count of tables that contain sensitive data + // Example: 50 + TotalSensitiveTables int `json:"total_sensitive_tables"` + // total count of columns with configured masking + // Example: 120 + ConfiguredMaskingColumns int `json:"configured_masking_columns"` + // total count of columns pending masking confirmation + // Example: 5 + PendingConfirmMaskingColumns int `json:"pending_confirm_masking_columns"` +} + +// swagger:model MaskingOverviewTableData +type MaskingOverviewTableData struct { + // table id + // Example: 1 + TableID int `json:"table_id"` + // configured masking column count for this table + // Example: 3 + ConfiguredMaskingColumns int `json:"configured_masking_columns"` + // pending masking confirmation column count for this table + // Example: 1 + PendingConfirmMaskingColumns int `json:"pending_confirm_masking_columns"` +} + +// swagger:model MaskingOverviewDatabaseNode +type MaskingOverviewDatabaseNode struct { + // table_name -> table overview data + Tables map[string]MaskingOverviewTableData `json:"tables"` +} + +// swagger:model GetMaskingOverviewTreeData +type GetMaskingOverviewTreeData struct { + // dashboard summary for the selected data source + Dashboard MaskingOverviewDashboard `json:"dashboard"` + // database_name -> database node + Databases map[string]MaskingOverviewDatabaseNode `json:"databases"` +} + +// swagger:model GetMaskingOverviewTreeReply +type GetMaskingOverviewTreeReply struct { + // masking overview tree reply + Data GetMaskingOverviewTreeData `json:"data"` + + base.GenericResp +} + +// swagger:parameters GetTableColumnMaskingDetails +type GetTableColumnMaskingDetailsReq struct { + // table id from masking overview tree + // in: path + // Required: true + // Example: 1 + TableID int `param:"table_id" json:"table_id" validate:"required"` +} + +// swagger:model TableColumnMaskingDetail +type TableColumnMaskingDetail struct { + // column name + // Example: "email" + ColumnName string `json:"column_name"` + // current masking rule name + // Example: "Email Masking" + MaskingRuleName string `json:"masking_rule_name"` +} + +// swagger:model GetTableColumnMaskingDetailsReply +type GetTableColumnMaskingDetailsReply struct { + // table column masking details reply + Data []TableColumnMaskingDetail `json:"data"` + + base.GenericResp +} + +// swagger:parameters ListPendingApprovalRequests +type ListPendingApprovalRequestsReq struct { + // the maximum count of requests to be returned, default is 20 + // in: query + // Example: 20 + PageSize uint32 `query:"page_size" json:"page_size"` + // the offset of requests to be returned, default is 0 + // in: query + // Example: 0 + PageIndex uint32 `query:"page_index" json:"page_index"` +} + +// swagger:model PendingApprovalRequestData +type PendingApprovalRequestData struct { + // approval request id + // Example: 1 + ID int `json:"id"` + // applicant name + // Example: "admin" + ApplicantName string `json:"applicant_name"` + // application time in RFC3339 format + // Format: date-time (RFC3339) + // Example: "2024-01-15T10:30:00Z" + AppliedAt string `json:"applied_at"` + // application reason + // Example: "data analysis" + Reason string `json:"reason"` + // data scope + // Example: "database 'db1', table 'users'" + DataScope string `json:"data_scope"` +} + +// swagger:model ListPendingApprovalRequestsReply +type ListPendingApprovalRequestsReply struct { + // pending approval requests reply + Data []PendingApprovalRequestData `json:"data"` + // total count of pending approval requests + // Example: 100 + Total int64 `json:"total_nums"` + + base.GenericResp +} + +// swagger:enum ApprovalAction +type ApprovalAction string + +const ( + ApprovalActionApprove ApprovalAction = "APPROVE" + ApprovalActionReject ApprovalAction = "REJECT" +) + +// swagger:model ProcessApprovalRequestReq +type ProcessApprovalRequestReq struct { + // approval request id + // swagger:ignore + RequestID int `param:"request_id" json:"request_id" validate:"required"` + // process action + // Required: true + // Enum: [APPROVE, REJECT] + // Example: "APPROVE" + Action ApprovalAction `json:"action" validate:"required"` + // reject reason, required when action is REJECT + // Example: "insufficient reason" + RejectReason string `json:"reject_reason"` + // approval remark, optional when action is APPROVE + // Example: "approved for one-time access" + ApproveRemark string `json:"approve_remark"` +} + +// swagger:model ProcessApprovalRequestReply +type ProcessApprovalRequestReply struct { + base.GenericResp +} + +// swagger:parameters GetPlaintextAccessRequestDetail +type GetPlaintextAccessRequestDetailReq struct { + // approval request id + // in: path + // Required: true + // Example: 1 + RequestID int `param:"request_id" json:"request_id" validate:"required"` +} + +// swagger:model MaskingPreviewData +type MaskingPreviewData struct { + // preview columns + // Example: ["id", "name", "email"] + Columns []string `json:"columns"` + // preview rows + // Example: [["1", "John", "j***@example.com"], ["2", "Alice", "a***@example.com"]] + Rows [][]string `json:"rows"` +} + +// swagger:model GetPlaintextAccessRequestDetailReply +type GetPlaintextAccessRequestDetailReply struct { + // plaintext access request detail reply + Data struct { + // query sql statement + // Example: "SELECT * FROM users" + QuerySQL string `json:"query_sql"` + // masking result preview + MaskingPreview MaskingPreviewData `json:"masking_preview"` + // application reason + // Example: "troubleshooting" + Reason string `json:"reason"` + } `json:"data"` + base.GenericResp } diff --git a/api/swagger.json b/api/swagger.json index 0077be0a..d8f34f7c 100644 --- a/api/swagger.json +++ b/api/swagger.json @@ -1592,22 +1592,601 @@ } } }, + "/v1/dms/masking/approval-requests/pending": { + "get": { + "tags": [ + "Masking" + ], + "summary": "List pending approval requests.", + "operationId": "ListPendingApprovalRequests", + "parameters": [ + { + "type": "integer", + "format": "uint32", + "example": "20", + "x-go-name": "PageSize", + "description": "the maximum count of requests to be returned, default is 20", + "name": "page_size", + "in": "query" + }, + { + "type": "integer", + "format": "uint32", + "example": "0", + "x-go-name": "PageIndex", + "description": "the offset of requests to be returned, default is 0", + "name": "page_index", + "in": "query" + } + ], + "responses": { + "200": { + "description": "List pending approval requests successfully", + "schema": { + "$ref": "#/definitions/ListPendingApprovalRequestsReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/approval-requests/{request_id}": { + "get": { + "tags": [ + "Masking" + ], + "summary": "Get plaintext access request detail.", + "operationId": "GetPlaintextAccessRequestDetail", + "parameters": [ + { + "type": "integer", + "format": "int64", + "example": 1, + "x-go-name": "RequestID", + "description": "approval request id", + "name": "request_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Get plaintext access request detail successfully", + "schema": { + "$ref": "#/definitions/GetPlaintextAccessRequestDetailReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/approval-requests/{request_id}/decisions": { + "post": { + "tags": [ + "Masking" + ], + "summary": "Process approval request.", + "operationId": "ProcessApprovalRequest", + "parameters": [ + { + "type": "integer", + "description": "approval request id", + "name": "request_id", + "in": "path", + "required": true + }, + { + "description": "process action info", + "name": "action", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ProcessApprovalRequestReq" + } + } + ], + "responses": { + "200": { + "description": "Process approval request successfully", + "schema": { + "$ref": "#/definitions/ProcessApprovalRequestReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/overview": { + "get": { + "tags": [ + "Masking" + ], + "summary": "Get masking overview tree.", + "operationId": "GetMaskingOverviewTree", + "parameters": [ + { + "type": "integer", + "format": "int64", + "example": 1, + "x-go-name": "ProjectID", + "description": "project id", + "name": "project_id", + "in": "query", + "required": true + }, + { + "type": "integer", + "format": "int64", + "example": 1, + "x-go-name": "DBServiceID", + "description": "data source id", + "name": "db_service_id", + "in": "query", + "required": true + }, + { + "type": "string", + "example": "\"user\"", + "x-go-name": "Search", + "description": "fuzzy search keyword for database name, table name, and column name", + "name": "search", + "in": "query" + }, + { + "enum": [ + "[CONFIGURED", + " PENDING_CONFIRM]" + ], + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MaskingConfigStatuses", + "description": "masking config status filters, enum: CONFIGURED/PENDING_CONFIRM", + "name": "masking_config_statuses", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Get masking overview tree successfully", + "schema": { + "$ref": "#/definitions/GetMaskingOverviewTreeReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/rule-configs": { + "put": { + "tags": [ + "Masking" + ], + "summary": "Configure masking rules in batch.", + "operationId": "ConfigureMaskingRules", + "parameters": [ + { + "description": "masking rule configurations", + "name": "masking_rule_configs", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "masking_rule_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/MaskingRuleConfig" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "Configure masking rules successfully", + "schema": { + "$ref": "#/definitions/ConfigureMaskingRulesReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, "/v1/dms/masking/rules": { "get": { "tags": [ "Masking" ], - "summary": "List masking rules.", - "operationId": "ListMaskingRules", + "summary": "List masking rules.", + "operationId": "ListMaskingRules", + "responses": { + "200": { + "description": "ListMaskingRulesReply", + "schema": { + "$ref": "#/definitions/ListMaskingRulesReply" + } + }, + "default": { + "description": "GenericResp", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/sensitive-data-discovery-tasks": { + "get": { + "tags": [ + "Masking" + ], + "summary": "List sensitive data discovery tasks.", + "operationId": "ListSensitiveDataDiscoveryTasks", + "parameters": [ + { + "type": "integer", + "format": "uint32", + "example": "20", + "x-go-name": "PageSize", + "description": "the maximum count of tasks to be returned, default is 20", + "name": "page_size", + "in": "query" + }, + { + "type": "integer", + "format": "uint32", + "example": "0", + "x-go-name": "PageIndex", + "description": "the offset of tasks to be returned, default is 0", + "name": "page_index", + "in": "query" + } + ], + "responses": { + "200": { + "description": "List sensitive data discovery tasks successfully", + "schema": { + "$ref": "#/definitions/ListSensitiveDataDiscoveryTasksReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + }, + "post": { + "tags": [ + "Masking" + ], + "summary": "Add sensitive data discovery task.", + "operationId": "AddSensitiveDataDiscoveryTask", + "parameters": [ + { + "description": "sensitive data discovery task info", + "name": "task", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddSensitiveDataDiscoveryTask" + } + } + ], + "responses": { + "200": { + "description": "Add sensitive data discovery task successfully", + "schema": { + "$ref": "#/definitions/AddSensitiveDataDiscoveryTaskReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/sensitive-data-discovery-tasks/{task_id}": { + "put": { + "tags": [ + "Masking" + ], + "summary": "Update sensitive data discovery task.", + "operationId": "UpdateSensitiveDataDiscoveryTask", + "parameters": [ + { + "type": "integer", + "description": "sensitive data discovery task id", + "name": "task_id", + "in": "path", + "required": true + }, + { + "description": "sensitive data discovery task info", + "name": "task", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateSensitiveDataDiscoveryTask" + } + } + ], + "responses": { + "200": { + "description": "Update sensitive data discovery task successfully", + "schema": { + "$ref": "#/definitions/UpdateSensitiveDataDiscoveryTaskReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/sensitive-data-discovery-tasks/{task_id}/histories": { + "get": { + "tags": [ + "Masking" + ], + "summary": "List sensitive data discovery task histories.", + "operationId": "ListSensitiveDataDiscoveryTaskHistories", + "parameters": [ + { + "type": "integer", + "format": "int64", + "example": 1, + "x-go-name": "TaskID", + "description": "sensitive data discovery task id", + "name": "task_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "uint32", + "example": "20", + "x-go-name": "PageSize", + "description": "the maximum count of histories to be returned, default is 20", + "name": "page_size", + "in": "query" + }, + { + "type": "integer", + "format": "uint32", + "example": "0", + "x-go-name": "PageIndex", + "description": "the offset of histories to be returned, default is 0", + "name": "page_index", + "in": "query" + } + ], + "responses": { + "200": { + "description": "List sensitive data discovery task histories successfully", + "schema": { + "$ref": "#/definitions/ListSensitiveDataDiscoveryTaskHistoriesReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/tables/{table_id}/column-masking-details": { + "get": { + "tags": [ + "Masking" + ], + "summary": "Get table column masking details.", + "operationId": "GetTableColumnMaskingDetails", + "parameters": [ + { + "type": "integer", + "format": "int64", + "example": 1, + "x-go-name": "TableID", + "description": "table id from masking overview tree", + "name": "table_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Get table column masking details successfully", + "schema": { + "$ref": "#/definitions/GetTableColumnMaskingDetailsReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/templates": { + "get": { + "tags": [ + "Masking" + ], + "summary": "List masking templates.", + "operationId": "ListMaskingTemplates", + "parameters": [ + { + "type": "integer", + "format": "uint32", + "x-go-name": "PageSize", + "description": "the maximum count of masking templates to be returned, default is 20", + "name": "page_size", + "in": "query" + }, + { + "type": "integer", + "format": "uint32", + "x-go-name": "PageIndex", + "description": "the offset of masking templates to be returned, default is 0", + "name": "page_index", + "in": "query" + } + ], + "responses": { + "200": { + "description": "List masking templates successfully", + "schema": { + "$ref": "#/definitions/ListMaskingTemplatesReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + }, + "post": { + "tags": [ + "Masking" + ], + "summary": "Add masking template.", + "operationId": "AddMaskingTemplate", + "parameters": [ + { + "description": "masking template info", + "name": "masking_template", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddMaskingTemplate" + } + } + ], + "responses": { + "200": { + "description": "Add masking template successfully", + "schema": { + "$ref": "#/definitions/AddMaskingTemplateReply" + } + }, + "default": { + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + } + }, + "/v1/dms/masking/templates/{template_id}": { + "put": { + "tags": [ + "Masking" + ], + "summary": "Update masking template.", + "operationId": "UpdateMaskingTemplate", + "parameters": [ + { + "type": "integer", + "description": "masking template id", + "name": "template_id", + "in": "path", + "required": true + }, + { + "description": "masking template info", + "name": "masking_template", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateMaskingTemplate" + } + } + ], "responses": { "200": { - "description": "ListMaskingRulesReply", + "description": "Update masking template successfully", "schema": { - "$ref": "#/definitions/ListMaskingRulesReply" + "$ref": "#/definitions/UpdateMaskingTemplateReply" } }, "default": { - "description": "GenericResp", + "description": "Generic error response", + "schema": { + "$ref": "#/definitions/GenericResp" + } + } + } + }, + "delete": { + "tags": [ + "Masking" + ], + "summary": "Delete masking template.", + "operationId": "DeleteMaskingTemplate", + "parameters": [ + { + "type": "integer", + "format": "int64", + "example": 1, + "x-go-name": "TemplateID", + "description": "masking template id", + "name": "template_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Delete masking template successfully", + "schema": { + "$ref": "#/definitions/DeleteMaskingTemplateReply" + } + }, + "default": { + "description": "Generic error response", "schema": { "$ref": "#/definitions/GenericResp" } @@ -7015,6 +7594,66 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "AddMaskingTemplate": { + "type": "object", + "required": [ + "name", + "rule_ids" + ], + "properties": { + "name": { + "description": "masking template name", + "type": "string", + "x-go-name": "Name", + "example": "\"New Template\"" + }, + "rule_ids": { + "description": "masking rule id list", + "type": "array", + "minLength": 1, + "items": { + "type": "integer", + "format": "int64" + }, + "x-go-name": "RuleIDs", + "example": [ + 1, + 2, + 3 + ] + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "AddMaskingTemplateReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "AddMaskingTemplateReq": { + "type": "object", + "required": [ + "masking_template" + ], + "properties": { + "masking_template": { + "$ref": "#/definitions/AddMaskingTemplate" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "AddMemberGroupReply": { "type": "object", "properties": { @@ -7233,6 +7872,101 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "AddSensitiveDataDiscoveryTask": { + "type": "object", + "required": [ + "db_service_id", + "masking_template_id", + "identification_method", + "execution_plan" + ], + "properties": { + "cron_expression": { + "description": "cron expression, required when execution_plan is PERIODIC", + "type": "string", + "x-go-name": "CronExpression", + "example": "\"0 0 * * *\"" + }, + "db_service_id": { + "description": "database instance id", + "type": "integer", + "format": "int64", + "x-go-name": "DBServiceID", + "example": 1 + }, + "execution_plan": { + "description": "execution plan\nIMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate\nPERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic", + "type": "string", + "enum": [ + "[IMMEDIATE", + " PERIODIC]" + ], + "x-go-enum-desc": "IMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate\nPERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic", + "x-go-name": "ExecutionPlan", + "example": "\"IMMEDIATE\"" + }, + "identification_method": { + "description": "sensitive data identification method\nBY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName\nBY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData", + "type": "string", + "enum": [ + "[BY_FIELD_NAME", + " BY_SAMPLE_DATA]" + ], + "x-go-enum-desc": "BY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName\nBY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData", + "x-go-name": "IdentificationMethod", + "example": "\"BY_FIELD_NAME\"" + }, + "masking_template_id": { + "description": "masking template id", + "type": "integer", + "format": "int64", + "x-go-name": "MaskingTemplateID", + "example": 1 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "AddSensitiveDataDiscoveryTaskData": { + "type": "object", + "properties": { + "suspected_sensitive_fields_tree": { + "$ref": "#/definitions/SuspectedSensitiveFieldsTree" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "AddSensitiveDataDiscoveryTaskReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "$ref": "#/definitions/AddSensitiveDataDiscoveryTaskData" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "AddSensitiveDataDiscoveryTaskReq": { + "type": "object", + "required": [ + "task" + ], + "properties": { + "task": { + "$ref": "#/definitions/AddSensitiveDataDiscoveryTask" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "AddSession": { "description": "Use this struct to add a new session", "type": "object", @@ -8044,6 +8778,41 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "ConfigureMaskingRulesReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "ConfigureMaskingRulesReq": { + "type": "object", + "required": [ + "masking_rule_configs" + ], + "properties": { + "masking_rule_configs": { + "description": "masking rule configurations for batch create or update", + "type": "array", + "minLength": 1, + "items": { + "$ref": "#/definitions/MaskingRuleConfig" + }, + "x-go-name": "MaskingRuleConfigs" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "CreateBusinessTagReq": { "type": "object", "properties": { @@ -8680,6 +9449,23 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "DeleteMaskingTemplateReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "EnvironmentTag": { "type": "object", "properties": { @@ -9217,6 +10003,43 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "GetMaskingOverviewTreeData": { + "type": "object", + "properties": { + "dashboard": { + "$ref": "#/definitions/MaskingOverviewDashboard" + }, + "databases": { + "description": "database_name -\u003e database node", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/MaskingOverviewDatabaseNode" + }, + "x-go-name": "Databases" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "GetMaskingOverviewTreeReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "$ref": "#/definitions/GetMaskingOverviewTreeData" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "GetMemberGroup": { "type": "object", "properties": { @@ -9251,7 +10074,7 @@ "x-go-name": "Users" } }, - "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, "GetMemberGroupReply": { "type": "object", @@ -9442,6 +10265,45 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "GetPlaintextAccessRequestDetailReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "description": "plaintext access request detail reply", + "type": "object", + "properties": { + "masking_preview": { + "$ref": "#/definitions/MaskingPreviewData" + }, + "query_sql": { + "description": "query sql statement", + "type": "string", + "x-go-name": "QuerySQL", + "example": "\"SELECT * FROM users\"" + }, + "reason": { + "description": "application reason", + "type": "string", + "x-go-name": "Reason", + "example": "\"troubleshooting\"" + } + }, + "x-go-name": "Data" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "GetProjectTipsReply": { "type": "object", "properties": { @@ -9571,7 +10433,27 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, - "GetSystemVariablesReply": { + "GetSystemVariablesReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "$ref": "#/definitions/SystemVariablesResV1" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" + }, + "GetTableColumnMaskingDetailsReply": { "type": "object", "properties": { "code": { @@ -9581,7 +10463,12 @@ "x-go-name": "Code" }, "data": { - "$ref": "#/definitions/SystemVariablesResV1" + "description": "table column masking details reply", + "type": "array", + "items": { + "$ref": "#/definitions/TableColumnMaskingDetail" + }, + "x-go-name": "Data" }, "message": { "description": "message", @@ -9589,7 +10476,7 @@ "x-go-name": "Message" } }, - "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, "GetUser": { "description": "A dms user", @@ -11552,23 +12439,32 @@ "type": "object", "properties": { "description": { + "description": "description", "type": "string", - "x-go-name": "Description" + "x-go-name": "Description", + "example": "\"mask digits\"" }, "effect": { + "description": "effect", "type": "string", - "x-go-name": "Effect" + "x-go-name": "Effect", + "example": "\"******\"" }, "id": { + "description": "masking rule id", "type": "integer", "format": "int64", - "x-go-name": "Id" + "x-go-name": "Id", + "example": 1 }, "masking_type": { + "description": "masking type", "type": "string", - "x-go-name": "MaskingType" + "x-go-name": "MaskingType", + "example": "\"MASK_DIGIT\"" }, "reference_fields": { + "description": "reference fields", "type": "array", "items": { "type": "string" @@ -11603,6 +12499,72 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "ListMaskingTemplatesData": { + "type": "object", + "properties": { + "id": { + "description": "masking template id", + "type": "integer", + "format": "int64", + "x-go-name": "Id", + "example": 1 + }, + "name": { + "description": "masking template name", + "type": "string", + "x-go-name": "Name", + "example": "\"Standard Template\"" + }, + "rule_count": { + "description": "count of rules in the template", + "type": "integer", + "format": "int64", + "x-go-name": "RuleCount", + "example": 5 + }, + "rule_names": { + "description": "preview of rule name in the template, up to 3 items", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "RuleNames" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "ListMaskingTemplatesReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "description": "list masking templates reply", + "type": "array", + "items": { + "$ref": "#/definitions/ListMaskingTemplatesData" + }, + "x-go-name": "Data" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + }, + "total_nums": { + "description": "total count of masking templates", + "type": "integer", + "format": "int64", + "x-go-name": "Total", + "example": 100 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "ListMember": { "description": "A dms member", "type": "object", @@ -11811,6 +12773,17 @@ "ListMemberRoleWithOpRange": { "type": "object", "properties": { + "member_group": { + "$ref": "#/definitions/ProjectMemberGroup" + }, + "op_permissions": { + "description": "member op permissions", + "type": "array", + "items": { + "$ref": "#/definitions/UidWithName" + }, + "x-go-name": "OpPermissions" + }, "op_range_type": { "description": "op permission range type, only support db service now\nunknown OpRangeTypeUnknown\nglobal OpRangeTypeGlobal 全局权限: 该权限只能被用户使用\nproject OpRangeTypeProject 项目权限: 该权限只能被成员使用\ndb_service OpRangeTypeDBService 项目内的数据源权限: 该权限只能被成员使用", "type": "string", @@ -11835,7 +12808,7 @@ "$ref": "#/definitions/UidWithName" } }, - "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, "ListMemberTipsItem": { "type": "object", @@ -11997,6 +12970,38 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "ListPendingApprovalRequestsReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "description": "pending approval requests reply", + "type": "array", + "items": { + "$ref": "#/definitions/PendingApprovalRequestData" + }, + "x-go-name": "Data" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + }, + "total_nums": { + "description": "total count of pending approval requests", + "type": "integer", + "format": "int64", + "x-go-name": "Total", + "example": 100 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "ListProjectReply": { "type": "object", "properties": { @@ -12262,6 +13267,161 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "ListSensitiveDataDiscoveryTaskHistoriesData": { + "type": "object", + "properties": { + "executed_at": { + "description": "execution time in RFC3339 format\nFormat: date-time (RFC3339)", + "type": "string", + "x-go-name": "ExecutedAt", + "example": "\"2024-01-15T10:30:00Z\"" + }, + "new_sensitive_field_count": { + "description": "newly discovered sensitive field count", + "type": "integer", + "format": "int64", + "x-go-name": "NewSensitiveFieldCount", + "example": 10 + }, + "remark": { + "description": "remark", + "type": "string", + "x-go-name": "Remark", + "example": "\"scan completed successfully\"" + }, + "status": { + "description": "execution status\nPENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm\nNORMAL SensitiveDataDiscoveryTaskStatusNormal\nCOMPLETED SensitiveDataDiscoveryTaskStatusCompleted", + "type": "string", + "enum": [ + "[PENDING_CHANGE_CONFIRM", + " NORMAL", + " COMPLETED]" + ], + "x-go-enum-desc": "PENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm\nNORMAL SensitiveDataDiscoveryTaskStatusNormal\nCOMPLETED SensitiveDataDiscoveryTaskStatusCompleted", + "x-go-name": "Status", + "example": "\"NORMAL\"" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "ListSensitiveDataDiscoveryTaskHistoriesReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "description": "sensitive data discovery task histories reply", + "type": "array", + "items": { + "$ref": "#/definitions/ListSensitiveDataDiscoveryTaskHistoriesData" + }, + "x-go-name": "Data" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + }, + "total_nums": { + "description": "total count of sensitive data discovery task histories", + "type": "integer", + "format": "int64", + "x-go-name": "Total", + "example": 100 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "ListSensitiveDataDiscoveryTasksData": { + "type": "object", + "properties": { + "db_service_name": { + "description": "database instance name", + "type": "string", + "x-go-name": "DBServiceName", + "example": "\"mysql-01\"" + }, + "id": { + "description": "sensitive data discovery task id", + "type": "integer", + "format": "int64", + "x-go-name": "ID", + "example": 1 + }, + "masking_template_name": { + "description": "related masking template name", + "type": "string", + "x-go-name": "MaskingTemplateName", + "example": "\"Standard Template\"" + }, + "next_execution_at": { + "description": "next run time, periodic task returns RFC3339 time, one-time task returns N/A\nFormat: date-time (RFC3339)", + "type": "string", + "x-go-name": "NextExecutionAt", + "example": "\"2024-01-15T10:30:00Z\"" + }, + "status": { + "description": "task status\nPENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm\nNORMAL SensitiveDataDiscoveryTaskStatusNormal\nCOMPLETED SensitiveDataDiscoveryTaskStatusCompleted", + "type": "string", + "enum": [ + "[PENDING_CHANGE_CONFIRM", + " NORMAL", + " COMPLETED]" + ], + "x-go-enum-desc": "PENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm\nNORMAL SensitiveDataDiscoveryTaskStatusNormal\nCOMPLETED SensitiveDataDiscoveryTaskStatusCompleted", + "x-go-name": "Status", + "example": "\"NORMAL\"" + }, + "task_type": { + "description": "task type\nPERIODIC SensitiveDataDiscoveryTaskTypePeriodic\nONE_TIME SensitiveDataDiscoveryTaskTypeOneTime", + "type": "string", + "enum": [ + "[PERIODIC", + " ONE_TIME]" + ], + "x-go-enum-desc": "PERIODIC SensitiveDataDiscoveryTaskTypePeriodic\nONE_TIME SensitiveDataDiscoveryTaskTypeOneTime", + "x-go-name": "TaskType", + "example": "\"PERIODIC\"" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "ListSensitiveDataDiscoveryTasksReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "description": "sensitive data discovery tasks list reply", + "type": "array", + "items": { + "$ref": "#/definitions/ListSensitiveDataDiscoveryTasksData" + }, + "x-go-name": "Data" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + }, + "total_nums": { + "description": "total count of sensitive data discovery tasks", + "type": "integer", + "format": "int64", + "x-go-name": "Total", + "example": 100 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "ListUser": { "description": "A dms user", "type": "object", @@ -12468,56 +13628,211 @@ }, "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" }, - "LoginConfiguration": { + "LoginConfiguration": { + "type": "object", + "properties": { + "disable_user_pwd_login": { + "type": "boolean", + "x-go-name": "DisableUserPwdLogin" + }, + "login_button_text": { + "type": "string", + "x-go-name": "LoginButtonText" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "LoginTipsResData": { + "type": "object", + "properties": { + "disable_user_pwd_login": { + "type": "boolean", + "x-go-name": "DisableUserPwdLogin" + }, + "login_button_text": { + "type": "string", + "x-go-name": "LoginButtonText" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "MIMEHeader": { + "description": "A MIMEHeader represents a MIME-style header mapping\nkeys to sets of values.", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + }, + "x-go-package": "net/textproto" + }, + "MaintenanceTime": { + "type": "object", + "properties": { + "maintenance_start_time": { + "$ref": "#/definitions/Time" + }, + "maintenance_stop_time": { + "$ref": "#/definitions/Time" + } + }, + "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" + }, + "MaskingOverviewDashboard": { + "type": "object", + "properties": { + "configured_masking_columns": { + "description": "total count of columns with configured masking", + "type": "integer", + "format": "int64", + "x-go-name": "ConfiguredMaskingColumns", + "example": 120 + }, + "pending_confirm_masking_columns": { + "description": "total count of columns pending masking confirmation", + "type": "integer", + "format": "int64", + "x-go-name": "PendingConfirmMaskingColumns", + "example": 5 + }, + "total_sensitive_tables": { + "description": "total count of tables that contain sensitive data", + "type": "integer", + "format": "int64", + "x-go-name": "TotalSensitiveTables", + "example": 50 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "MaskingOverviewDatabaseNode": { "type": "object", "properties": { - "disable_user_pwd_login": { - "type": "boolean", - "x-go-name": "DisableUserPwdLogin" - }, - "login_button_text": { - "type": "string", - "x-go-name": "LoginButtonText" + "tables": { + "description": "table_name -\u003e table overview data", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/MaskingOverviewTableData" + }, + "x-go-name": "Tables" } }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, - "LoginTipsResData": { + "MaskingOverviewTableData": { "type": "object", "properties": { - "disable_user_pwd_login": { - "type": "boolean", - "x-go-name": "DisableUserPwdLogin" + "configured_masking_columns": { + "description": "configured masking column count for this table", + "type": "integer", + "format": "int64", + "x-go-name": "ConfiguredMaskingColumns", + "example": 3 }, - "login_button_text": { - "type": "string", - "x-go-name": "LoginButtonText" + "pending_confirm_masking_columns": { + "description": "pending masking confirmation column count for this table", + "type": "integer", + "format": "int64", + "x-go-name": "PendingConfirmMaskingColumns", + "example": 1 + }, + "table_id": { + "description": "table id", + "type": "integer", + "format": "int64", + "x-go-name": "TableID", + "example": 1 } }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, - "MIMEHeader": { - "description": "A MIMEHeader represents a MIME-style header mapping\nkeys to sets of values.", + "MaskingPreviewData": { "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" + "properties": { + "columns": { + "description": "preview columns", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Columns", + "example": [ + "id", + "name", + "email" + ] + }, + "rows": { + "description": "preview rows", + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + }, + "x-go-name": "Rows", + "example": [ + [ + "1", + "John", + "j***@example.com" + ], + [ + "2", + "Alice", + "a***@example.com" + ] + ] } }, - "x-go-package": "net/textproto" + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, - "MaintenanceTime": { + "MaskingRuleConfig": { "type": "object", + "required": [ + "db_service_id", + "table_name", + "column_name", + "masking_rule_id", + "is_masking_enabled" + ], "properties": { - "maintenance_start_time": { - "$ref": "#/definitions/Time" + "column_name": { + "description": "column name", + "type": "string", + "x-go-name": "ColumnName", + "example": "\"email\"" }, - "maintenance_stop_time": { - "$ref": "#/definitions/Time" + "db_service_id": { + "description": "data source id", + "type": "integer", + "format": "int64", + "x-go-name": "DBServiceID", + "example": 1 + }, + "is_masking_enabled": { + "description": "whether to enable masking for this column", + "type": "boolean", + "x-go-name": "IsMaskingEnabled", + "example": true + }, + "masking_rule_id": { + "description": "masking rule id", + "type": "integer", + "format": "int64", + "x-go-name": "MaskingRuleID", + "example": 1 + }, + "table_name": { + "description": "table name", + "type": "string", + "x-go-name": "TableName", + "example": "\"users\"" } }, - "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, "Member": { "description": "A member", @@ -13006,6 +14321,43 @@ }, "x-go-package": "github.com/actiontech/dms/pkg/params" }, + "PendingApprovalRequestData": { + "type": "object", + "properties": { + "applicant_name": { + "description": "applicant name", + "type": "string", + "x-go-name": "ApplicantName", + "example": "\"admin\"" + }, + "applied_at": { + "description": "application time in RFC3339 format\nFormat: date-time (RFC3339)", + "type": "string", + "x-go-name": "AppliedAt", + "example": "\"2024-01-15T10:30:00Z\"" + }, + "data_scope": { + "description": "data scope", + "type": "string", + "x-go-name": "DataScope", + "example": "\"database 'db1', table 'users'\"" + }, + "id": { + "description": "approval request id", + "type": "integer", + "format": "int64", + "x-go-name": "ID", + "example": 1 + }, + "reason": { + "description": "application reason", + "type": "string", + "x-go-name": "Reason", + "example": "\"data analysis\"" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "PersonalizationReq": { "type": "object", "properties": { @@ -13138,6 +14490,55 @@ "x-go-name": "PreviewImportProjects", "x-go-package": "github.com/actiontech/dms/api/dms/service/v2" }, + "ProcessApprovalRequestReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "ProcessApprovalRequestReq": { + "type": "object", + "required": [ + "action" + ], + "properties": { + "action": { + "description": "process action\nAPPROVE ApprovalActionApprove\nREJECT ApprovalActionReject", + "type": "string", + "enum": [ + "[APPROVE", + " REJECT]" + ], + "x-go-enum-desc": "APPROVE ApprovalActionApprove\nREJECT ApprovalActionReject", + "x-go-name": "Action", + "example": "\"APPROVE\"" + }, + "approve_remark": { + "description": "approval remark, optional when action is APPROVE", + "type": "string", + "x-go-name": "ApproveRemark", + "example": "\"approved for one-time access\"" + }, + "reject_reason": { + "description": "reject reason, required when action is REJECT", + "type": "string", + "x-go-name": "RejectReason", + "example": "\"insufficient reason\"" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "ProjectInfo": { "type": "object", "properties": { @@ -13840,6 +15241,66 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "SensitiveFieldScanResult": { + "type": "object", + "properties": { + "recommended_masking_rule_name": { + "description": "recommended masking rules", + "type": "string", + "x-go-name": "RecommendedMaskingRuleName", + "example": "\"Email Masking\"" + }, + "scan_info": { + "description": "scan information for the field", + "type": "string", + "x-go-name": "ScanInfo", + "example": "\"matched by field name 'email'\"" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "SuspectedSensitiveDatabaseNode": { + "type": "object", + "properties": { + "tables": { + "description": "table_name -\u003e table node", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SuspectedSensitiveTableNode" + }, + "x-go-name": "Tables" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "SuspectedSensitiveFieldsTree": { + "type": "object", + "properties": { + "databases": { + "description": "database_name -\u003e database node", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SuspectedSensitiveDatabaseNode" + }, + "x-go-name": "Databases" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "SuspectedSensitiveTableNode": { + "type": "object", + "properties": { + "fields": { + "description": "field_name -\u003e scan result", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SensitiveFieldScanResult" + }, + "x-go-name": "Fields" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "SyncGatewayReq": { "type": "object", "properties": { @@ -13887,6 +15348,24 @@ }, "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" }, + "TableColumnMaskingDetail": { + "type": "object", + "properties": { + "column_name": { + "description": "column name", + "type": "string", + "x-go-name": "ColumnName", + "example": "\"email\"" + }, + "masking_rule_name": { + "description": "current masking rule name", + "type": "string", + "x-go-name": "MaskingRuleName", + "example": "\"Email Masking\"" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "Task": { "type": "object", "properties": { @@ -14220,7 +15699,7 @@ "x-go-name": "Uid" } }, - "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + "x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1" }, "UpdateBusinessTagReq": { "type": "object", @@ -14638,6 +16117,66 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "UpdateMaskingTemplate": { + "type": "object", + "required": [ + "rule_ids" + ], + "properties": { + "rule_ids": { + "description": "masking rule id list", + "type": "array", + "minLength": 1, + "items": { + "type": "integer", + "format": "int64" + }, + "x-go-name": "RuleIDs", + "example": [ + 1, + 2 + ] + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "UpdateMaskingTemplateReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "UpdateMaskingTemplateReq": { + "type": "object", + "required": [ + "template_id", + "masking_template" + ], + "properties": { + "masking_template": { + "$ref": "#/definitions/UpdateMaskingTemplate" + }, + "template_id": { + "description": "masking template id\nin: path", + "type": "integer", + "format": "int64", + "x-go-name": "TemplateID", + "example": 1 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "UpdateMember": { "type": "object", "properties": { @@ -14875,6 +16414,101 @@ }, "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" }, + "UpdateSensitiveDataDiscoveryTask": { + "type": "object", + "required": [ + "masking_template_id", + "identification_method", + "execution_plan" + ], + "properties": { + "cron_expression": { + "description": "cron expression, required when execution_plan is PERIODIC", + "type": "string", + "x-go-name": "CronExpression", + "example": "\"0 0 * * *\"" + }, + "execution_plan": { + "description": "execution plan\nIMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate\nPERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic", + "type": "string", + "enum": [ + "[IMMEDIATE", + " PERIODIC]" + ], + "x-go-enum-desc": "IMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate\nPERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic", + "x-go-name": "ExecutionPlan", + "example": "\"PERIODIC\"" + }, + "identification_method": { + "description": "sensitive data identification method\nBY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName\nBY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData", + "type": "string", + "enum": [ + "[BY_FIELD_NAME", + " BY_SAMPLE_DATA]" + ], + "x-go-enum-desc": "BY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName\nBY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData", + "x-go-name": "IdentificationMethod", + "example": "\"BY_FIELD_NAME\"" + }, + "masking_template_id": { + "description": "masking template id", + "type": "integer", + "format": "int64", + "x-go-name": "MaskingTemplateID", + "example": 1 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "UpdateSensitiveDataDiscoveryTaskData": { + "type": "object", + "properties": { + "suspected_sensitive_fields_tree": { + "$ref": "#/definitions/SuspectedSensitiveFieldsTree" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "UpdateSensitiveDataDiscoveryTaskReply": { + "type": "object", + "properties": { + "code": { + "description": "code", + "type": "integer", + "format": "int64", + "x-go-name": "Code" + }, + "data": { + "$ref": "#/definitions/UpdateSensitiveDataDiscoveryTaskData" + }, + "message": { + "description": "message", + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, + "UpdateSensitiveDataDiscoveryTaskReq": { + "type": "object", + "required": [ + "task_id", + "task" + ], + "properties": { + "task": { + "$ref": "#/definitions/UpdateSensitiveDataDiscoveryTask" + }, + "task_id": { + "description": "sensitive data discovery task id\nin: path", + "type": "integer", + "format": "int64", + "x-go-name": "TaskID", + "example": 1 + } + }, + "x-go-package": "github.com/actiontech/dms/api/dms/service/v1" + }, "UpdateSmsConfiguration": { "type": "object", "properties": { diff --git a/api/swagger.yaml b/api/swagger.yaml index 59088b16..bf10c901 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -158,6 +158,51 @@ definitions: $ref: '#/definitions/Gateway' type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddMaskingTemplate: + properties: + name: + description: masking template name + example: '"New Template"' + type: string + x-go-name: Name + rule_ids: + description: masking rule id list + example: + - 1 + - 2 + - 3 + items: + format: int64 + type: integer + minLength: 1 + type: array + x-go-name: RuleIDs + required: + - name + - rule_ids + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddMaskingTemplateReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddMaskingTemplateReq: + properties: + masking_template: + $ref: '#/definitions/AddMaskingTemplate' + required: + - masking_template + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 AddMemberGroupReply: properties: code: @@ -319,6 +364,89 @@ definitions: $ref: '#/definitions/Role' type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddSensitiveDataDiscoveryTask: + properties: + cron_expression: + description: cron expression, required when execution_plan is PERIODIC + example: '"0 0 * * *"' + type: string + x-go-name: CronExpression + db_service_id: + description: database instance id + example: 1 + format: int64 + type: integer + x-go-name: DBServiceID + execution_plan: + description: |- + execution plan + IMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate + PERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic + enum: + - '[IMMEDIATE' + - ' PERIODIC]' + example: '"IMMEDIATE"' + type: string + x-go-enum-desc: |- + IMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate + PERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic + x-go-name: ExecutionPlan + identification_method: + description: |- + sensitive data identification method + BY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName + BY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData + enum: + - '[BY_FIELD_NAME' + - ' BY_SAMPLE_DATA]' + example: '"BY_FIELD_NAME"' + type: string + x-go-enum-desc: |- + BY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName + BY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData + x-go-name: IdentificationMethod + masking_template_id: + description: masking template id + example: 1 + format: int64 + type: integer + x-go-name: MaskingTemplateID + required: + - db_service_id + - masking_template_id + - identification_method + - execution_plan + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddSensitiveDataDiscoveryTaskData: + properties: + suspected_sensitive_fields_tree: + $ref: '#/definitions/SuspectedSensitiveFieldsTree' + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddSensitiveDataDiscoveryTaskReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + $ref: '#/definitions/AddSensitiveDataDiscoveryTaskData' + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + AddSensitiveDataDiscoveryTaskReq: + properties: + task: + $ref: '#/definitions/AddSensitiveDataDiscoveryTask' + required: + - task + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 AddSession: description: Use this struct to add a new session properties: @@ -921,6 +1049,32 @@ definitions: x-go-name: Version type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ConfigureMaskingRulesReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ConfigureMaskingRulesReq: + properties: + masking_rule_configs: + description: masking rule configurations for batch create or update + items: + $ref: '#/definitions/MaskingRuleConfig' + minLength: 1 + type: array + x-go-name: MaskingRuleConfigs + required: + - masking_rule_configs + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 CreateBusinessTagReq: properties: business_tag: @@ -1417,6 +1571,19 @@ definitions: x-go-name: Message type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + DeleteMaskingTemplateReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 EnvironmentTag: properties: name: @@ -1825,6 +1992,33 @@ definitions: x-go-name: Message type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + GetMaskingOverviewTreeData: + properties: + dashboard: + $ref: '#/definitions/MaskingOverviewDashboard' + databases: + additionalProperties: + $ref: '#/definitions/MaskingOverviewDatabaseNode' + description: database_name -> database node + type: object + x-go-name: Databases + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + GetMaskingOverviewTreeReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + $ref: '#/definitions/GetMaskingOverviewTreeData' + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 GetMemberGroup: properties: is_project_admin: @@ -1851,7 +2045,7 @@ definitions: type: array x-go-name: Users type: object - x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1 + x-go-package: github.com/actiontech/dms/api/dms/service/v1 GetMemberGroupReply: properties: code: @@ -1993,6 +2187,36 @@ definitions: x-go-name: TotalNums type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + GetPlaintextAccessRequestDetailReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + description: plaintext access request detail reply + properties: + masking_preview: + $ref: '#/definitions/MaskingPreviewData' + query_sql: + description: query sql statement + example: '"SELECT * FROM users"' + type: string + x-go-name: QuerySQL + reason: + description: application reason + example: '"troubleshooting"' + type: string + x-go-name: Reason + type: object + x-go-name: Data + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 GetProjectTipsReply: properties: code: @@ -2104,6 +2328,25 @@ definitions: x-go-name: Message type: object x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1 + GetTableColumnMaskingDetailsReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + description: table column masking details reply + items: + $ref: '#/definitions/TableColumnMaskingDetail' + type: array + x-go-name: Data + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 GetUser: description: A dms user properties: @@ -3676,19 +3919,28 @@ definitions: ListMaskingRulesData: properties: description: + description: description + example: '"mask digits"' type: string x-go-name: Description effect: + description: effect + example: '"******"' type: string x-go-name: Effect id: + description: masking rule id + example: 1 format: int64 type: integer x-go-name: Id masking_type: + description: masking type + example: '"MASK_DIGIT"' type: string x-go-name: MaskingType reference_fields: + description: reference fields items: type: string type: array @@ -3714,6 +3966,58 @@ definitions: x-go-name: Message type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListMaskingTemplatesData: + properties: + id: + description: masking template id + example: 1 + format: int64 + type: integer + x-go-name: Id + name: + description: masking template name + example: '"Standard Template"' + type: string + x-go-name: Name + rule_count: + description: count of rules in the template + example: 5 + format: int64 + type: integer + x-go-name: RuleCount + rule_names: + description: preview of rule name in the template, up to 3 items + items: + type: string + type: array + x-go-name: RuleNames + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListMaskingTemplatesReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + description: list masking templates reply + items: + $ref: '#/definitions/ListMaskingTemplatesData' + type: array + x-go-name: Data + message: + description: message + type: string + x-go-name: Message + total_nums: + description: total count of masking templates + example: 100 + format: int64 + type: integer + x-go-name: Total + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 ListMember: description: A dms member properties: @@ -3871,6 +4175,14 @@ definitions: x-go-package: github.com/actiontech/dms/api/dms/service/v1 ListMemberRoleWithOpRange: properties: + member_group: + $ref: '#/definitions/ProjectMemberGroup' + op_permissions: + description: member op permissions + items: + $ref: '#/definitions/UidWithName' + type: array + x-go-name: OpPermissions op_range_type: description: |- op permission range type, only support db service now @@ -3899,7 +4211,7 @@ definitions: role_uid: $ref: '#/definitions/UidWithName' type: object - x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1 + x-go-package: github.com/actiontech/dms/api/dms/service/v1 ListMemberTipsItem: properties: user_id: @@ -4027,6 +4339,31 @@ definitions: x-go-name: Total type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListPendingApprovalRequestsReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + description: pending approval requests reply + items: + $ref: '#/definitions/PendingApprovalRequestData' + type: array + x-go-name: Data + message: + description: message + type: string + x-go-name: Message + total_nums: + description: total count of pending approval requests + example: 100 + format: int64 + type: integer + x-go-name: Total + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 ListProjectReply: properties: code: @@ -4264,37 +4601,184 @@ definitions: x-go-name: Total type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 - ListUser: - description: A dms user + ListSensitiveDataDiscoveryTaskHistoriesData: properties: - authentication_type: + executed_at: description: |- - user authentication type - ldap UserAuthenticationTypeLDAP - dms UserAuthenticationTypeDMS - oauth2 UserAuthenticationTypeOAUTH2 - unknown UserAuthenticationTypeUnknown + execution time in RFC3339 format + Format: date-time (RFC3339) + example: '"2024-01-15T10:30:00Z"' + type: string + x-go-name: ExecutedAt + new_sensitive_field_count: + description: newly discovered sensitive field count + example: 10 + format: int64 + type: integer + x-go-name: NewSensitiveFieldCount + remark: + description: remark + example: '"scan completed successfully"' + type: string + x-go-name: Remark + status: + description: |- + execution status + PENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm + NORMAL SensitiveDataDiscoveryTaskStatusNormal + COMPLETED SensitiveDataDiscoveryTaskStatusCompleted enum: - - ldap - - dms - - oauth2 - - unknown + - '[PENDING_CHANGE_CONFIRM' + - ' NORMAL' + - ' COMPLETED]' + example: '"NORMAL"' type: string x-go-enum-desc: |- - ldap UserAuthenticationTypeLDAP - dms UserAuthenticationTypeDMS - oauth2 UserAuthenticationTypeOAUTH2 - unknown UserAuthenticationTypeUnknown - x-go-name: AuthenticationType - email: - description: user email + PENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm + NORMAL SensitiveDataDiscoveryTaskStatusNormal + COMPLETED SensitiveDataDiscoveryTaskStatusCompleted + x-go-name: Status + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListSensitiveDataDiscoveryTaskHistoriesReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + description: sensitive data discovery task histories reply + items: + $ref: '#/definitions/ListSensitiveDataDiscoveryTaskHistoriesData' + type: array + x-go-name: Data + message: + description: message type: string - x-go-name: Email - is_deleted: - description: user is deleted - type: boolean - x-go-name: IsDeleted - name: + x-go-name: Message + total_nums: + description: total count of sensitive data discovery task histories + example: 100 + format: int64 + type: integer + x-go-name: Total + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListSensitiveDataDiscoveryTasksData: + properties: + db_service_name: + description: database instance name + example: '"mysql-01"' + type: string + x-go-name: DBServiceName + id: + description: sensitive data discovery task id + example: 1 + format: int64 + type: integer + x-go-name: ID + masking_template_name: + description: related masking template name + example: '"Standard Template"' + type: string + x-go-name: MaskingTemplateName + next_execution_at: + description: |- + next run time, periodic task returns RFC3339 time, one-time task returns N/A + Format: date-time (RFC3339) + example: '"2024-01-15T10:30:00Z"' + type: string + x-go-name: NextExecutionAt + status: + description: |- + task status + PENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm + NORMAL SensitiveDataDiscoveryTaskStatusNormal + COMPLETED SensitiveDataDiscoveryTaskStatusCompleted + enum: + - '[PENDING_CHANGE_CONFIRM' + - ' NORMAL' + - ' COMPLETED]' + example: '"NORMAL"' + type: string + x-go-enum-desc: |- + PENDING_CHANGE_CONFIRM SensitiveDataDiscoveryTaskStatusPendingChangeConfirm + NORMAL SensitiveDataDiscoveryTaskStatusNormal + COMPLETED SensitiveDataDiscoveryTaskStatusCompleted + x-go-name: Status + task_type: + description: |- + task type + PERIODIC SensitiveDataDiscoveryTaskTypePeriodic + ONE_TIME SensitiveDataDiscoveryTaskTypeOneTime + enum: + - '[PERIODIC' + - ' ONE_TIME]' + example: '"PERIODIC"' + type: string + x-go-enum-desc: |- + PERIODIC SensitiveDataDiscoveryTaskTypePeriodic + ONE_TIME SensitiveDataDiscoveryTaskTypeOneTime + x-go-name: TaskType + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListSensitiveDataDiscoveryTasksReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + description: sensitive data discovery tasks list reply + items: + $ref: '#/definitions/ListSensitiveDataDiscoveryTasksData' + type: array + x-go-name: Data + message: + description: message + type: string + x-go-name: Message + total_nums: + description: total count of sensitive data discovery tasks + example: 100 + format: int64 + type: integer + x-go-name: Total + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ListUser: + description: A dms user + properties: + authentication_type: + description: |- + user authentication type + ldap UserAuthenticationTypeLDAP + dms UserAuthenticationTypeDMS + oauth2 UserAuthenticationTypeOAUTH2 + unknown UserAuthenticationTypeUnknown + enum: + - ldap + - dms + - oauth2 + - unknown + type: string + x-go-enum-desc: |- + ldap UserAuthenticationTypeLDAP + dms UserAuthenticationTypeDMS + oauth2 UserAuthenticationTypeOAUTH2 + unknown UserAuthenticationTypeUnknown + x-go-name: AuthenticationType + email: + description: user email + type: string + x-go-name: Email + is_deleted: + description: user is deleted + type: boolean + x-go-name: IsDeleted + name: description: user name type: string x-go-name: Name @@ -4504,6 +4988,126 @@ definitions: $ref: '#/definitions/Time' type: object x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1 + MaskingOverviewDashboard: + properties: + configured_masking_columns: + description: total count of columns with configured masking + example: 120 + format: int64 + type: integer + x-go-name: ConfiguredMaskingColumns + pending_confirm_masking_columns: + description: total count of columns pending masking confirmation + example: 5 + format: int64 + type: integer + x-go-name: PendingConfirmMaskingColumns + total_sensitive_tables: + description: total count of tables that contain sensitive data + example: 50 + format: int64 + type: integer + x-go-name: TotalSensitiveTables + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + MaskingOverviewDatabaseNode: + properties: + tables: + additionalProperties: + $ref: '#/definitions/MaskingOverviewTableData' + description: table_name -> table overview data + type: object + x-go-name: Tables + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + MaskingOverviewTableData: + properties: + configured_masking_columns: + description: configured masking column count for this table + example: 3 + format: int64 + type: integer + x-go-name: ConfiguredMaskingColumns + pending_confirm_masking_columns: + description: pending masking confirmation column count for this table + example: 1 + format: int64 + type: integer + x-go-name: PendingConfirmMaskingColumns + table_id: + description: table id + example: 1 + format: int64 + type: integer + x-go-name: TableID + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + MaskingPreviewData: + properties: + columns: + description: preview columns + example: + - id + - name + - email + items: + type: string + type: array + x-go-name: Columns + rows: + description: preview rows + example: + - - "1" + - John + - j***@example.com + - - "2" + - Alice + - a***@example.com + items: + items: + type: string + type: array + type: array + x-go-name: Rows + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + MaskingRuleConfig: + properties: + column_name: + description: column name + example: '"email"' + type: string + x-go-name: ColumnName + db_service_id: + description: data source id + example: 1 + format: int64 + type: integer + x-go-name: DBServiceID + is_masking_enabled: + description: whether to enable masking for this column + example: true + type: boolean + x-go-name: IsMaskingEnabled + masking_rule_id: + description: masking rule id + example: 1 + format: int64 + type: integer + x-go-name: MaskingRuleID + table_name: + description: table name + example: '"users"' + type: string + x-go-name: TableName + required: + - db_service_id + - table_name + - column_name + - masking_rule_id + - is_masking_enabled + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 Member: description: A member properties: @@ -4968,6 +5572,38 @@ definitions: $ref: '#/definitions/Param' type: array x-go-package: github.com/actiontech/dms/pkg/params + PendingApprovalRequestData: + properties: + applicant_name: + description: applicant name + example: '"admin"' + type: string + x-go-name: ApplicantName + applied_at: + description: |- + application time in RFC3339 format + Format: date-time (RFC3339) + example: '"2024-01-15T10:30:00Z"' + type: string + x-go-name: AppliedAt + data_scope: + description: data scope + example: '"database ''db1'', table ''users''"' + type: string + x-go-name: DataScope + id: + description: approval request id + example: 1 + format: int64 + type: integer + x-go-name: ID + reason: + description: application reason + example: '"data analysis"' + type: string + x-go-name: Reason + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 PersonalizationReq: properties: file: @@ -5071,6 +5707,49 @@ definitions: type: object x-go-name: PreviewImportProjects x-go-package: github.com/actiontech/dms/api/dms/service/v2 + ProcessApprovalRequestReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + ProcessApprovalRequestReq: + properties: + action: + description: |- + process action + APPROVE ApprovalActionApprove + REJECT ApprovalActionReject + enum: + - '[APPROVE' + - ' REJECT]' + example: '"APPROVE"' + type: string + x-go-enum-desc: |- + APPROVE ApprovalActionApprove + REJECT ApprovalActionReject + x-go-name: Action + approve_remark: + description: approval remark, optional when action is APPROVE + example: '"approved for one-time access"' + type: string + x-go-name: ApproveRemark + reject_reason: + description: reject reason, required when action is REJECT + example: '"insufficient reason"' + type: string + x-go-name: RejectReason + required: + - action + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 ProjectInfo: properties: project_name: @@ -5622,6 +6301,50 @@ definitions: x-go-name: Username type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + SensitiveFieldScanResult: + properties: + recommended_masking_rule_name: + description: recommended masking rules + example: '"Email Masking"' + type: string + x-go-name: RecommendedMaskingRuleName + scan_info: + description: scan information for the field + example: '"matched by field name ''email''"' + type: string + x-go-name: ScanInfo + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + SuspectedSensitiveDatabaseNode: + properties: + tables: + additionalProperties: + $ref: '#/definitions/SuspectedSensitiveTableNode' + description: table_name -> table node + type: object + x-go-name: Tables + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + SuspectedSensitiveFieldsTree: + properties: + databases: + additionalProperties: + $ref: '#/definitions/SuspectedSensitiveDatabaseNode' + description: database_name -> database node + type: object + x-go-name: Databases + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + SuspectedSensitiveTableNode: + properties: + fields: + additionalProperties: + $ref: '#/definitions/SensitiveFieldScanResult' + description: field_name -> scan result + type: object + x-go-name: Fields + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 SyncGatewayReq: properties: gateways: @@ -5657,6 +6380,20 @@ definitions: x-go-name: Url type: object x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1 + TableColumnMaskingDetail: + properties: + column_name: + description: column name + example: '"email"' + type: string + x-go-name: ColumnName + masking_rule_name: + description: current masking rule name + example: '"Email Masking"' + type: string + x-go-name: MaskingRuleName + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 Task: properties: task_uid: @@ -5900,7 +6637,7 @@ definitions: type: string x-go-name: Uid type: object - x-go-package: github.com/actiontech/dms/api/dms/service/v1 + x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1 UpdateBusinessTagReq: properties: business_tag: @@ -6218,6 +6955,53 @@ definitions: $ref: '#/definitions/LoginConfiguration' type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateMaskingTemplate: + properties: + rule_ids: + description: masking rule id list + example: + - 1 + - 2 + items: + format: int64 + type: integer + minLength: 1 + type: array + x-go-name: RuleIDs + required: + - rule_ids + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateMaskingTemplateReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateMaskingTemplateReq: + properties: + masking_template: + $ref: '#/definitions/UpdateMaskingTemplate' + template_id: + description: |- + masking template id + in: path + example: 1 + format: int64 + type: integer + x-go-name: TemplateID + required: + - template_id + - masking_template + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 UpdateMember: properties: is_project_admin: @@ -6410,6 +7194,91 @@ definitions: $ref: '#/definitions/UpdateSMTPConfiguration' type: object x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateSensitiveDataDiscoveryTask: + properties: + cron_expression: + description: cron expression, required when execution_plan is PERIODIC + example: '"0 0 * * *"' + type: string + x-go-name: CronExpression + execution_plan: + description: |- + execution plan + IMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate + PERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic + enum: + - '[IMMEDIATE' + - ' PERIODIC]' + example: '"PERIODIC"' + type: string + x-go-enum-desc: |- + IMMEDIATE SensitiveDataDiscoveryExecutionPlanImmediate + PERIODIC SensitiveDataDiscoveryExecutionPlanPeriodic + x-go-name: ExecutionPlan + identification_method: + description: |- + sensitive data identification method + BY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName + BY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData + enum: + - '[BY_FIELD_NAME' + - ' BY_SAMPLE_DATA]' + example: '"BY_FIELD_NAME"' + type: string + x-go-enum-desc: |- + BY_FIELD_NAME SensitiveDataIdentificationMethodByFieldName + BY_SAMPLE_DATA SensitiveDataIdentificationMethodBySampleData + x-go-name: IdentificationMethod + masking_template_id: + description: masking template id + example: 1 + format: int64 + type: integer + x-go-name: MaskingTemplateID + required: + - masking_template_id + - identification_method + - execution_plan + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateSensitiveDataDiscoveryTaskData: + properties: + suspected_sensitive_fields_tree: + $ref: '#/definitions/SuspectedSensitiveFieldsTree' + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateSensitiveDataDiscoveryTaskReply: + properties: + code: + description: code + format: int64 + type: integer + x-go-name: Code + data: + $ref: '#/definitions/UpdateSensitiveDataDiscoveryTaskData' + message: + description: message + type: string + x-go-name: Message + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 + UpdateSensitiveDataDiscoveryTaskReq: + properties: + task: + $ref: '#/definitions/UpdateSensitiveDataDiscoveryTask' + task_id: + description: |- + sensitive data discovery task id + in: path + example: 1 + format: int64 + type: integer + x-go-name: TaskID + required: + - task_id + - task + type: object + x-go-package: github.com/actiontech/dms/api/dms/service/v1 UpdateSmsConfiguration: properties: configuration: @@ -7946,6 +8815,162 @@ paths: summary: Get gateway tips. tags: - Gateway + /v1/dms/masking/approval-requests/{request_id}: + get: + operationId: GetPlaintextAccessRequestDetail + parameters: + - description: approval request id + example: 1 + format: int64 + in: path + name: request_id + required: true + type: integer + x-go-name: RequestID + responses: + "200": + description: Get plaintext access request detail successfully + schema: + $ref: '#/definitions/GetPlaintextAccessRequestDetailReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Get plaintext access request detail. + tags: + - Masking + /v1/dms/masking/approval-requests/{request_id}/decisions: + post: + operationId: ProcessApprovalRequest + parameters: + - description: approval request id + in: path + name: request_id + required: true + type: integer + - description: process action info + in: body + name: action + required: true + schema: + $ref: '#/definitions/ProcessApprovalRequestReq' + responses: + "200": + description: Process approval request successfully + schema: + $ref: '#/definitions/ProcessApprovalRequestReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Process approval request. + tags: + - Masking + /v1/dms/masking/approval-requests/pending: + get: + operationId: ListPendingApprovalRequests + parameters: + - description: the maximum count of requests to be returned, default is 20 + example: "20" + format: uint32 + in: query + name: page_size + type: integer + x-go-name: PageSize + - description: the offset of requests to be returned, default is 0 + example: "0" + format: uint32 + in: query + name: page_index + type: integer + x-go-name: PageIndex + responses: + "200": + description: List pending approval requests successfully + schema: + $ref: '#/definitions/ListPendingApprovalRequestsReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: List pending approval requests. + tags: + - Masking + /v1/dms/masking/overview: + get: + operationId: GetMaskingOverviewTree + parameters: + - description: project id + example: 1 + format: int64 + in: query + name: project_id + required: true + type: integer + x-go-name: ProjectID + - description: data source id + example: 1 + format: int64 + in: query + name: db_service_id + required: true + type: integer + x-go-name: DBServiceID + - description: fuzzy search keyword for database name, table name, and column name + example: '"user"' + in: query + name: search + type: string + x-go-name: Search + - description: 'masking config status filters, enum: CONFIGURED/PENDING_CONFIRM' + enum: + - '[CONFIGURED' + - ' PENDING_CONFIRM]' + in: query + items: + type: string + name: masking_config_statuses + type: array + x-go-name: MaskingConfigStatuses + responses: + "200": + description: Get masking overview tree successfully + schema: + $ref: '#/definitions/GetMaskingOverviewTreeReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Get masking overview tree. + tags: + - Masking + /v1/dms/masking/rule-configs: + put: + operationId: ConfigureMaskingRules + parameters: + - description: masking rule configurations + in: body + name: masking_rule_configs + required: true + schema: + properties: + masking_rule_configs: + items: + $ref: '#/definitions/MaskingRuleConfig' + type: array + type: object + responses: + "200": + description: Configure masking rules successfully + schema: + $ref: '#/definitions/ConfigureMaskingRulesReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Configure masking rules in batch. + tags: + - Masking /v1/dms/masking/rules: get: operationId: ListMaskingRules @@ -7961,6 +8986,245 @@ paths: summary: List masking rules. tags: - Masking + /v1/dms/masking/sensitive-data-discovery-tasks: + get: + operationId: ListSensitiveDataDiscoveryTasks + parameters: + - description: the maximum count of tasks to be returned, default is 20 + example: "20" + format: uint32 + in: query + name: page_size + type: integer + x-go-name: PageSize + - description: the offset of tasks to be returned, default is 0 + example: "0" + format: uint32 + in: query + name: page_index + type: integer + x-go-name: PageIndex + responses: + "200": + description: List sensitive data discovery tasks successfully + schema: + $ref: '#/definitions/ListSensitiveDataDiscoveryTasksReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: List sensitive data discovery tasks. + tags: + - Masking + post: + operationId: AddSensitiveDataDiscoveryTask + parameters: + - description: sensitive data discovery task info + in: body + name: task + required: true + schema: + $ref: '#/definitions/AddSensitiveDataDiscoveryTask' + responses: + "200": + description: Add sensitive data discovery task successfully + schema: + $ref: '#/definitions/AddSensitiveDataDiscoveryTaskReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Add sensitive data discovery task. + tags: + - Masking + /v1/dms/masking/sensitive-data-discovery-tasks/{task_id}: + put: + operationId: UpdateSensitiveDataDiscoveryTask + parameters: + - description: sensitive data discovery task id + in: path + name: task_id + required: true + type: integer + - description: sensitive data discovery task info + in: body + name: task + required: true + schema: + $ref: '#/definitions/UpdateSensitiveDataDiscoveryTask' + responses: + "200": + description: Update sensitive data discovery task successfully + schema: + $ref: '#/definitions/UpdateSensitiveDataDiscoveryTaskReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Update sensitive data discovery task. + tags: + - Masking + /v1/dms/masking/sensitive-data-discovery-tasks/{task_id}/histories: + get: + operationId: ListSensitiveDataDiscoveryTaskHistories + parameters: + - description: sensitive data discovery task id + example: 1 + format: int64 + in: path + name: task_id + required: true + type: integer + x-go-name: TaskID + - description: the maximum count of histories to be returned, default is 20 + example: "20" + format: uint32 + in: query + name: page_size + type: integer + x-go-name: PageSize + - description: the offset of histories to be returned, default is 0 + example: "0" + format: uint32 + in: query + name: page_index + type: integer + x-go-name: PageIndex + responses: + "200": + description: List sensitive data discovery task histories successfully + schema: + $ref: '#/definitions/ListSensitiveDataDiscoveryTaskHistoriesReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: List sensitive data discovery task histories. + tags: + - Masking + /v1/dms/masking/tables/{table_id}/column-masking-details: + get: + operationId: GetTableColumnMaskingDetails + parameters: + - description: table id from masking overview tree + example: 1 + format: int64 + in: path + name: table_id + required: true + type: integer + x-go-name: TableID + responses: + "200": + description: Get table column masking details successfully + schema: + $ref: '#/definitions/GetTableColumnMaskingDetailsReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Get table column masking details. + tags: + - Masking + /v1/dms/masking/templates: + get: + operationId: ListMaskingTemplates + parameters: + - description: the maximum count of masking templates to be returned, default is 20 + format: uint32 + in: query + name: page_size + type: integer + x-go-name: PageSize + - description: the offset of masking templates to be returned, default is 0 + format: uint32 + in: query + name: page_index + type: integer + x-go-name: PageIndex + responses: + "200": + description: List masking templates successfully + schema: + $ref: '#/definitions/ListMaskingTemplatesReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: List masking templates. + tags: + - Masking + post: + operationId: AddMaskingTemplate + parameters: + - description: masking template info + in: body + name: masking_template + required: true + schema: + $ref: '#/definitions/AddMaskingTemplate' + responses: + "200": + description: Add masking template successfully + schema: + $ref: '#/definitions/AddMaskingTemplateReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Add masking template. + tags: + - Masking + /v1/dms/masking/templates/{template_id}: + delete: + operationId: DeleteMaskingTemplate + parameters: + - description: masking template id + example: 1 + format: int64 + in: path + name: template_id + required: true + type: integer + x-go-name: TemplateID + responses: + "200": + description: Delete masking template successfully + schema: + $ref: '#/definitions/DeleteMaskingTemplateReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Delete masking template. + tags: + - Masking + put: + operationId: UpdateMaskingTemplate + parameters: + - description: masking template id + in: path + name: template_id + required: true + type: integer + - description: masking template info + in: body + name: masking_template + required: true + schema: + $ref: '#/definitions/UpdateMaskingTemplate' + responses: + "200": + description: Update masking template successfully + schema: + $ref: '#/definitions/UpdateMaskingTemplateReply' + default: + description: Generic error response + schema: + $ref: '#/definitions/GenericResp' + summary: Update masking template. + tags: + - Masking /v1/dms/notifications: post: operationId: Notification diff --git a/internal/apiserver/service/data_masking_controllers.go b/internal/apiserver/service/data_masking_controllers.go new file mode 100644 index 00000000..b227c7b5 --- /dev/null +++ b/internal/apiserver/service/data_masking_controllers.go @@ -0,0 +1,475 @@ +package service + +import ( + aV1 "github.com/actiontech/dms/api/dms/service/v1" + apiError "github.com/actiontech/dms/internal/apiserver/pkg/error" + "github.com/labstack/echo/v4" +) + +// swagger:operation GET /v1/dms/masking/templates Masking ListMaskingTemplates +// +// List masking templates. +// +// --- +// parameters: +// - name: page_size +// description: the maximum count of masking templates to be returned, default is 20 +// in: query +// required: false +// type: integer +// format: uint32 +// - name: page_index +// description: the offset of masking templates to be returned, default is 0 +// in: query +// required: false +// type: integer +// format: uint32 +// responses: +// '200': +// description: List masking templates successfully +// schema: +// "$ref": "#/definitions/ListMaskingTemplatesReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) ListMaskingTemplates(c echo.Context) error { + req := &aV1.ListMaskingTemplatesReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.ListMaskingTemplatesReply{}) +} + +// swagger:operation POST /v1/dms/masking/templates Masking AddMaskingTemplate +// +// Add masking template. +// +// --- +// parameters: +// - name: masking_template +// description: masking template info +// in: body +// required: true +// schema: +// "$ref": "#/definitions/AddMaskingTemplate" +// responses: +// '200': +// description: Add masking template successfully +// schema: +// "$ref": "#/definitions/AddMaskingTemplateReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) AddMaskingTemplate(c echo.Context) error { + req := &aV1.AddMaskingTemplateReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.AddMaskingTemplateReply{}) +} + +// swagger:operation PUT /v1/dms/masking/templates/{template_id} Masking UpdateMaskingTemplate +// +// Update masking template. +// +// --- +// parameters: +// - name: template_id +// description: masking template id +// in: path +// required: true +// type: integer +// - name: masking_template +// description: masking template info +// in: body +// required: true +// schema: +// "$ref": "#/definitions/UpdateMaskingTemplate" +// responses: +// '200': +// description: Update masking template successfully +// schema: +// "$ref": "#/definitions/UpdateMaskingTemplateReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) UpdateMaskingTemplate(c echo.Context) error { + req := &aV1.UpdateMaskingTemplateReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.UpdateMaskingTemplateReply{}) +} + +// swagger:operation DELETE /v1/dms/masking/templates/{template_id} Masking DeleteMaskingTemplate +// +// Delete masking template. +// +// --- +// parameters: +// - name: template_id +// description: masking template id +// in: path +// required: true +// type: integer +// responses: +// '200': +// description: Delete masking template successfully +// schema: +// "$ref": "#/definitions/DeleteMaskingTemplateReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) DeleteMaskingTemplate(c echo.Context) error { + req := &aV1.DeleteMaskingTemplateReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.DeleteMaskingTemplateReply{}) +} + +// swagger:operation GET /v1/dms/masking/sensitive-data-discovery-tasks Masking ListSensitiveDataDiscoveryTasks +// +// List sensitive data discovery tasks. +// +// --- +// parameters: +// - name: page_size +// description: the maximum count of tasks to be returned, default is 20 +// in: query +// required: false +// type: integer +// format: uint32 +// - name: page_index +// description: the offset of tasks to be returned, default is 0 +// in: query +// required: false +// type: integer +// format: uint32 +// responses: +// '200': +// description: List sensitive data discovery tasks successfully +// schema: +// "$ref": "#/definitions/ListSensitiveDataDiscoveryTasksReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) ListSensitiveDataDiscoveryTasks(c echo.Context) error { + req := &aV1.ListSensitiveDataDiscoveryTasksReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.ListSensitiveDataDiscoveryTasksReply{}) +} + +// swagger:operation POST /v1/dms/masking/sensitive-data-discovery-tasks Masking AddSensitiveDataDiscoveryTask +// +// Add sensitive data discovery task. +// +// --- +// parameters: +// - name: task +// description: sensitive data discovery task info +// in: body +// required: true +// schema: +// "$ref": "#/definitions/AddSensitiveDataDiscoveryTask" +// responses: +// '200': +// description: Add sensitive data discovery task successfully +// schema: +// "$ref": "#/definitions/AddSensitiveDataDiscoveryTaskReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) AddSensitiveDataDiscoveryTask(c echo.Context) error { + req := &aV1.AddSensitiveDataDiscoveryTaskReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.AddSensitiveDataDiscoveryTaskReply{}) +} + +// swagger:operation PUT /v1/dms/masking/sensitive-data-discovery-tasks/{task_id} Masking UpdateSensitiveDataDiscoveryTask +// +// Update sensitive data discovery task. +// +// --- +// parameters: +// - name: task_id +// description: sensitive data discovery task id +// in: path +// required: true +// type: integer +// - name: task +// description: sensitive data discovery task info +// in: body +// required: true +// schema: +// "$ref": "#/definitions/UpdateSensitiveDataDiscoveryTask" +// responses: +// '200': +// description: Update sensitive data discovery task successfully +// schema: +// "$ref": "#/definitions/UpdateSensitiveDataDiscoveryTaskReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) UpdateSensitiveDataDiscoveryTask(c echo.Context) error { + req := &aV1.UpdateSensitiveDataDiscoveryTaskReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.UpdateSensitiveDataDiscoveryTaskReply{}) +} + +// swagger:operation GET /v1/dms/masking/sensitive-data-discovery-tasks/{task_id}/histories Masking ListSensitiveDataDiscoveryTaskHistories +// +// List sensitive data discovery task histories. +// +// --- +// parameters: +// - name: task_id +// description: sensitive data discovery task id +// in: path +// required: true +// type: integer +// - name: page_size +// description: the maximum count of histories to be returned, default is 20 +// in: query +// required: false +// type: integer +// format: uint32 +// - name: page_index +// description: the offset of histories to be returned, default is 0 +// in: query +// required: false +// type: integer +// format: uint32 +// responses: +// '200': +// description: List sensitive data discovery task histories successfully +// schema: +// "$ref": "#/definitions/ListSensitiveDataDiscoveryTaskHistoriesReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) ListSensitiveDataDiscoveryTaskHistories(c echo.Context) error { + req := &aV1.ListSensitiveDataDiscoveryTaskHistoriesReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.ListSensitiveDataDiscoveryTaskHistoriesReply{}) +} + +// swagger:operation PUT /v1/dms/masking/rule-configs Masking ConfigureMaskingRules +// +// Configure masking rules in batch. +// +// --- +// parameters: +// - name: masking_rule_configs +// description: masking rule configurations +// in: body +// required: true +// schema: +// type: object +// properties: +// masking_rule_configs: +// type: array +// items: +// "$ref": "#/definitions/MaskingRuleConfig" +// responses: +// '200': +// description: Configure masking rules successfully +// schema: +// "$ref": "#/definitions/ConfigureMaskingRulesReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) ConfigureMaskingRules(c echo.Context) error { + req := &aV1.ConfigureMaskingRulesReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.ConfigureMaskingRulesReply{}) +} + +// swagger:operation GET /v1/dms/masking/overview Masking GetMaskingOverviewTree +// +// Get masking overview tree. +// +// --- +// parameters: +// - name: project_id +// description: project id +// in: query +// required: true +// type: integer +// - name: db_service_id +// description: data source id +// in: query +// required: true +// type: integer +// - name: search +// description: fuzzy search keyword for database name, table name, and column name +// in: query +// required: false +// type: string +// - name: masking_config_statuses +// description: "masking config status filters, enum: CONFIGURED/PENDING_CONFIRM" +// in: query +// required: false +// type: array +// items: +// type: string +// responses: +// '200': +// description: Get masking overview tree successfully +// schema: +// "$ref": "#/definitions/GetMaskingOverviewTreeReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) GetMaskingOverviewTree(c echo.Context) error { + req := &aV1.GetMaskingOverviewTreeReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.GetMaskingOverviewTreeReply{}) +} + +// swagger:operation GET /v1/dms/masking/tables/{table_id}/column-masking-details Masking GetTableColumnMaskingDetails +// +// Get table column masking details. +// +// --- +// parameters: +// - name: table_id +// description: table id from masking overview tree +// in: path +// required: true +// type: integer +// responses: +// '200': +// description: Get table column masking details successfully +// schema: +// "$ref": "#/definitions/GetTableColumnMaskingDetailsReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) GetTableColumnMaskingDetails(c echo.Context) error { + req := &aV1.GetTableColumnMaskingDetailsReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.GetTableColumnMaskingDetailsReply{}) +} + +// swagger:operation GET /v1/dms/masking/approval-requests/pending Masking ListPendingApprovalRequests +// +// List pending approval requests. +// +// --- +// parameters: +// - name: page_size +// description: the maximum count of requests to be returned, default is 20 +// in: query +// required: false +// type: integer +// format: uint32 +// - name: page_index +// description: the offset of requests to be returned, default is 0 +// in: query +// required: false +// type: integer +// format: uint32 +// responses: +// '200': +// description: List pending approval requests successfully +// schema: +// "$ref": "#/definitions/ListPendingApprovalRequestsReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) ListPendingApprovalRequests(c echo.Context) error { + req := &aV1.ListPendingApprovalRequestsReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.ListPendingApprovalRequestsReply{}) +} + +// swagger:operation GET /v1/dms/masking/approval-requests/{request_id} Masking GetPlaintextAccessRequestDetail +// +// Get plaintext access request detail. +// +// --- +// parameters: +// - name: request_id +// description: approval request id +// in: path +// required: true +// type: integer +// responses: +// '200': +// description: Get plaintext access request detail successfully +// schema: +// "$ref": "#/definitions/GetPlaintextAccessRequestDetailReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) GetPlaintextAccessRequestDetail(c echo.Context) error { + req := &aV1.GetPlaintextAccessRequestDetailReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.GetPlaintextAccessRequestDetailReply{}) +} + +// swagger:operation POST /v1/dms/masking/approval-requests/{request_id}/decisions Masking ProcessApprovalRequest +// +// Process approval request. +// +// --- +// parameters: +// - name: request_id +// description: approval request id +// in: path +// required: true +// type: integer +// - name: action +// description: process action info +// in: body +// required: true +// schema: +// "$ref": "#/definitions/ProcessApprovalRequestReq" +// responses: +// '200': +// description: Process approval request successfully +// schema: +// "$ref": "#/definitions/ProcessApprovalRequestReply" +// default: +// description: Generic error response +// schema: +// "$ref": "#/definitions/GenericResp" +func (ctl *DMSController) ProcessApprovalRequest(c echo.Context) error { + req := &aV1.ProcessApprovalRequestReq{} + if err := bindAndValidateReq(c, req); err != nil { + return NewErrResp(c, err, apiError.BadRequestErr) + } + return NewOkRespWithReply(c, &aV1.ProcessApprovalRequestReply{}) +} diff --git a/internal/apiserver/service/router.go b/internal/apiserver/service/router.go index eaf20768..5c1c12a8 100644 --- a/internal/apiserver/service/router.go +++ b/internal/apiserver/service/router.go @@ -248,6 +248,20 @@ func (s *APIServer) initRouter() error { maskingV1 := v1.Group("/dms/masking") maskingV1.GET("/rules", s.DMSController.ListMaskingRules) + maskingV1.GET("/templates", s.DMSController.ListMaskingTemplates) + maskingV1.POST("/templates", s.DMSController.AddMaskingTemplate) + maskingV1.PUT("/templates/:template_id", s.DMSController.UpdateMaskingTemplate) + maskingV1.DELETE("/templates/:template_id", s.DMSController.DeleteMaskingTemplate) + maskingV1.GET("/sensitive-data-discovery-tasks", s.DMSController.ListSensitiveDataDiscoveryTasks) + maskingV1.POST("/sensitive-data-discovery-tasks", s.DMSController.AddSensitiveDataDiscoveryTask) + maskingV1.PUT("/sensitive-data-discovery-tasks/:task_id", s.DMSController.UpdateSensitiveDataDiscoveryTask) + maskingV1.GET("/sensitive-data-discovery-tasks/:task_id/histories", s.DMSController.ListSensitiveDataDiscoveryTaskHistories) + maskingV1.PUT("/rule-configs", s.DMSController.ConfigureMaskingRules) + maskingV1.GET("/overview", s.DMSController.GetMaskingOverviewTree) + maskingV1.GET("/tables/:table_id/column-masking-details", s.DMSController.GetTableColumnMaskingDetails) + maskingV1.GET("/approval-requests/pending", s.DMSController.ListPendingApprovalRequests) + maskingV1.GET("/approval-requests/:request_id", s.DMSController.GetPlaintextAccessRequestDetail) + maskingV1.POST("/approval-requests/:request_id/decisions", s.DMSController.ProcessApprovalRequest) gatewayV1 := v1.Group("/dms/gateways")