From 8a9c3ff8291e0f65323675b8480ab9c5356f4508 Mon Sep 17 00:00:00 2001 From: Seungkyu Ahn Date: Wed, 17 Apr 2024 15:24:34 +0900 Subject: [PATCH 1/3] policy violation log skeleton code --- internal/delivery/api/endpoint.go | 1 + internal/delivery/http/dashboard.go | 33 ++++++++++++++++++++++++++++- internal/route/route.go | 1 + internal/usecase/dashboard.go | 6 ++++++ pkg/domain/dashboard.go | 4 ++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/internal/delivery/api/endpoint.go b/internal/delivery/api/endpoint.go index 9fb9f17b..f8ddc546 100644 --- a/internal/delivery/api/endpoint.go +++ b/internal/delivery/api/endpoint.go @@ -121,6 +121,7 @@ const ( GetPolicyUpdateDashboard GetPolicyEnforcementDashboard GetPolicyViolationDashboard + GetPolicyViolationLogDashboard // SystemNotificationTemplate Admin_CreateSystemNotificationTemplate diff --git a/internal/delivery/http/dashboard.go b/internal/delivery/http/dashboard.go index 5676f14a..370368b5 100644 --- a/internal/delivery/http/dashboard.go +++ b/internal/delivery/http/dashboard.go @@ -28,6 +28,7 @@ type IDashboardHandler interface { GetPolicyUpdate(w http.ResponseWriter, r *http.Request) GetPolicyEnforcement(w http.ResponseWriter, r *http.Request) GetPolicyViolation(w http.ResponseWriter, r *http.Request) + GetPolicyViolationLog(w http.ResponseWriter, r *http.Request) } type DashboardHandler struct { @@ -583,7 +584,7 @@ func (h *DashboardHandler) GetPolicyEnforcement(w http.ResponseWriter, r *http.R // @Param duration query string true "duration" // @Param interval query string true "interval" // @Success 200 {object} domain.GetDashboardPolicyViolationResponse -// @Router /organizations/{organizationId}/dashboards/policy-enforcement [get] +// @Router /organizations/{organizationId}/dashboards/policy-violation [get] // @Security JWT func (h *DashboardHandler) GetPolicyViolation(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) @@ -621,3 +622,33 @@ func (h *DashboardHandler) GetPolicyViolation(w http.ResponseWriter, r *http.Req out.UpdatedAt = time.Now() ResponseJSON(w, r, http.StatusOK, out) } + +// GetPolicyViolationLog godoc +// +// @Tags Dashboard Widgets +// @Summary Get policy violation log +// @Description Get policy violation log +// @Accept json +// @Produce json +// @Param organizationId path string true "Organization ID" +// @Success 200 {object} domain.GetDashboardPolicyViolationLogResponse +// @Router /organizations/{organizationId}/dashboards/policy-violation-log [get] +// @Security JWT +func (h *DashboardHandler) GetPolicyViolationLog(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + organizationId, ok := vars["organizationId"] + if !ok { + ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("%s: invalid organizationId", organizationId), + "C_INVALID_ORGANIZATION_ID", "")) + return + } + + out, err := h.usecase.GetPolicyViolationLog(r.Context(), organizationId) + if err != nil { + log.Error(r.Context(), "Failed to make policy violation log", err) + ErrorJSON(w, r, err) + return + } + + ResponseJSON(w, r, http.StatusOK, out) +} diff --git a/internal/route/route.go b/internal/route/route.go index 2ae34fd1..4ac45ede 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -209,6 +209,7 @@ func SetupRouter(db *gorm.DB, argoClient argowf.ArgoClient, kc keycloak.IKeycloa r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards/policy-update", customMiddleware.Handle(internalApi.GetPolicyUpdateDashboard, http.HandlerFunc(dashboardHandler.GetPolicyUpdate))).Methods(http.MethodGet) r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards/policy-enforcement", customMiddleware.Handle(internalApi.GetPolicyEnforcementDashboard, http.HandlerFunc(dashboardHandler.GetPolicyEnforcement))).Methods(http.MethodGet) r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards/policy-violation", customMiddleware.Handle(internalApi.GetPolicyViolationDashboard, http.HandlerFunc(dashboardHandler.GetPolicyViolation))).Methods(http.MethodGet) + r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards/policy-violation-log", customMiddleware.Handle(internalApi.GetPolicyViolationLogDashboard, http.HandlerFunc(dashboardHandler.GetPolicyViolationLog))).Methods(http.MethodGet) r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards", customMiddleware.Handle(internalApi.CreateDashboard, http.HandlerFunc(dashboardHandler.CreateDashboard))).Methods(http.MethodPost) r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards", customMiddleware.Handle(internalApi.GetDashboard, http.HandlerFunc(dashboardHandler.GetDashboard))).Methods(http.MethodGet) r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboards", customMiddleware.Handle(internalApi.UpdateDashboard, http.HandlerFunc(dashboardHandler.UpdateDashboard))).Methods(http.MethodPut) diff --git a/internal/usecase/dashboard.go b/internal/usecase/dashboard.go index 4c5494ba..25853cc9 100644 --- a/internal/usecase/dashboard.go +++ b/internal/usecase/dashboard.go @@ -38,6 +38,7 @@ type IDashboardUsecase interface { GetPolicyUpdate(ctx context.Context, policyTemplates []policytemplate.TKSPolicyTemplate, policies []policytemplate.TKSPolicy) (domain.DashboardPolicyUpdate, error) GetPolicyEnforcement(ctx context.Context, organizationId string, primaryClusterId string) (*domain.BarChartData, error) GetPolicyViolation(ctx context.Context, organizationId string, duration string, interval string) (*domain.BarChartData, error) + GetPolicyViolationLog(ctx context.Context, organizationId string) (*domain.GetDashboardPolicyViolationLogResponse, error) } type DashboardUsecase struct { @@ -852,6 +853,11 @@ func (u *DashboardUsecase) GetPolicyViolation(ctx context.Context, organizationI } +func (u *DashboardUsecase) GetPolicyViolationLog(ctx context.Context, organizationId string) (*domain.GetDashboardPolicyViolationLogResponse, error) { + // TODO Implement me + return nil, nil +} + func (u *DashboardUsecase) GetThanosClient(ctx context.Context, organizationId string) (thanos.ThanosClient, error) { thanosUrl, err := u.getThanosUrl(ctx, organizationId) if err != nil { diff --git a/pkg/domain/dashboard.go b/pkg/domain/dashboard.go index f9a2ac34..abd8c152 100644 --- a/pkg/domain/dashboard.go +++ b/pkg/domain/dashboard.go @@ -210,6 +210,10 @@ type GetDashboardPolicyViolationResponse struct { UpdatedAt time.Time `json:"updatedAt"` } +type GetDashboardPolicyViolationLogResponse struct { + // TODO implement me +} + type BarChart struct { ChartType string `json:"chartType"` OrganizationId string `json:"organizationId"` From 1c001bdfe208e9ebebdfbf69b3b8d28fb975c665 Mon Sep 17 00:00:00 2001 From: Seungkyu Ahn Date: Wed, 17 Apr 2024 15:24:59 +0900 Subject: [PATCH 2/3] policy violation log skeleton code\n endpoint generation --- .../delivery/api/generated_endpoints.go.go | 879 +++++++++--------- 1 file changed, 443 insertions(+), 436 deletions(-) diff --git a/internal/delivery/api/generated_endpoints.go.go b/internal/delivery/api/generated_endpoints.go.go index f4b0cde2..3d9408fe 100644 --- a/internal/delivery/api/generated_endpoints.go.go +++ b/internal/delivery/api/generated_endpoints.go.go @@ -1,362 +1,362 @@ -// This is generated code. DO NOT EDIT. + // This is generated code. DO NOT EDIT. package api var ApiMap = map[Endpoint]EndpointInfo{ - Login: { - Name: "Login", + Login: { + Name: "Login", Group: "Auth", }, - Logout: { - Name: "Logout", + Logout: { + Name: "Logout", Group: "Auth", }, - RefreshToken: { - Name: "RefreshToken", + RefreshToken: { + Name: "RefreshToken", Group: "Auth", }, - FindId: { - Name: "FindId", + FindId: { + Name: "FindId", Group: "Auth", }, - FindPassword: { - Name: "FindPassword", + FindPassword: { + Name: "FindPassword", Group: "Auth", }, - VerifyIdentityForLostId: { - Name: "VerifyIdentityForLostId", + VerifyIdentityForLostId: { + Name: "VerifyIdentityForLostId", Group: "Auth", }, - VerifyIdentityForLostPassword: { - Name: "VerifyIdentityForLostPassword", + VerifyIdentityForLostPassword: { + Name: "VerifyIdentityForLostPassword", Group: "Auth", }, - VerifyToken: { - Name: "VerifyToken", + VerifyToken: { + Name: "VerifyToken", Group: "Auth", }, - CreateUser: { - Name: "CreateUser", + CreateUser: { + Name: "CreateUser", Group: "User", }, - ListUser: { - Name: "ListUser", + ListUser: { + Name: "ListUser", Group: "User", }, - GetUser: { - Name: "GetUser", + GetUser: { + Name: "GetUser", Group: "User", }, - DeleteUser: { - Name: "DeleteUser", + DeleteUser: { + Name: "DeleteUser", Group: "User", }, - UpdateUsers: { - Name: "UpdateUsers", + UpdateUsers: { + Name: "UpdateUsers", Group: "User", }, - UpdateUser: { - Name: "UpdateUser", + UpdateUser: { + Name: "UpdateUser", Group: "User", }, - ResetPassword: { - Name: "ResetPassword", + ResetPassword: { + Name: "ResetPassword", Group: "User", }, - CheckId: { - Name: "CheckId", + CheckId: { + Name: "CheckId", Group: "User", }, - CheckEmail: { - Name: "CheckEmail", + CheckEmail: { + Name: "CheckEmail", Group: "User", }, - GetPermissionsByAccountId: { - Name: "GetPermissionsByAccountId", + GetPermissionsByAccountId: { + Name: "GetPermissionsByAccountId", Group: "User", }, - GetMyProfile: { - Name: "GetMyProfile", + GetMyProfile: { + Name: "GetMyProfile", Group: "MyProfile", }, - UpdateMyProfile: { - Name: "UpdateMyProfile", + UpdateMyProfile: { + Name: "UpdateMyProfile", Group: "MyProfile", }, - UpdateMyPassword: { - Name: "UpdateMyPassword", + UpdateMyPassword: { + Name: "UpdateMyPassword", Group: "MyProfile", }, - RenewPasswordExpiredDate: { - Name: "RenewPasswordExpiredDate", + RenewPasswordExpiredDate: { + Name: "RenewPasswordExpiredDate", Group: "MyProfile", }, - DeleteMyProfile: { - Name: "DeleteMyProfile", + DeleteMyProfile: { + Name: "DeleteMyProfile", Group: "MyProfile", }, - Admin_CreateOrganization: { - Name: "Admin_CreateOrganization", + Admin_CreateOrganization: { + Name: "Admin_CreateOrganization", Group: "Organization", }, - Admin_DeleteOrganization: { - Name: "Admin_DeleteOrganization", + Admin_DeleteOrganization: { + Name: "Admin_DeleteOrganization", Group: "Organization", }, - GetOrganizations: { - Name: "GetOrganizations", + GetOrganizations: { + Name: "GetOrganizations", Group: "Organization", }, - GetOrganization: { - Name: "GetOrganization", + GetOrganization: { + Name: "GetOrganization", Group: "Organization", }, - CheckOrganizationName: { - Name: "CheckOrganizationName", + CheckOrganizationName: { + Name: "CheckOrganizationName", Group: "Organization", }, - UpdateOrganization: { - Name: "UpdateOrganization", + UpdateOrganization: { + Name: "UpdateOrganization", Group: "Organization", }, - UpdatePrimaryCluster: { - Name: "UpdatePrimaryCluster", + UpdatePrimaryCluster: { + Name: "UpdatePrimaryCluster", Group: "Organization", }, - CreateCluster: { - Name: "CreateCluster", + CreateCluster: { + Name: "CreateCluster", Group: "Cluster", }, - GetClusters: { - Name: "GetClusters", + GetClusters: { + Name: "GetClusters", Group: "Cluster", }, - ImportCluster: { - Name: "ImportCluster", + ImportCluster: { + Name: "ImportCluster", Group: "Cluster", }, - GetCluster: { - Name: "GetCluster", + GetCluster: { + Name: "GetCluster", Group: "Cluster", }, - DeleteCluster: { - Name: "DeleteCluster", + DeleteCluster: { + Name: "DeleteCluster", Group: "Cluster", }, - GetClusterSiteValues: { - Name: "GetClusterSiteValues", + GetClusterSiteValues: { + Name: "GetClusterSiteValues", Group: "Cluster", }, - InstallCluster: { - Name: "InstallCluster", + InstallCluster: { + Name: "InstallCluster", Group: "Cluster", }, - CreateBootstrapKubeconfig: { - Name: "CreateBootstrapKubeconfig", + CreateBootstrapKubeconfig: { + Name: "CreateBootstrapKubeconfig", Group: "Cluster", }, - GetBootstrapKubeconfig: { - Name: "GetBootstrapKubeconfig", + GetBootstrapKubeconfig: { + Name: "GetBootstrapKubeconfig", Group: "Cluster", }, - GetNodes: { - Name: "GetNodes", + GetNodes: { + Name: "GetNodes", Group: "Cluster", }, - CreateAppgroup: { - Name: "CreateAppgroup", + CreateAppgroup: { + Name: "CreateAppgroup", Group: "Appgroup", }, - GetAppgroups: { - Name: "GetAppgroups", + GetAppgroups: { + Name: "GetAppgroups", Group: "Appgroup", }, - GetAppgroup: { - Name: "GetAppgroup", + GetAppgroup: { + Name: "GetAppgroup", Group: "Appgroup", }, - DeleteAppgroup: { - Name: "DeleteAppgroup", + DeleteAppgroup: { + Name: "DeleteAppgroup", Group: "Appgroup", }, - GetApplications: { - Name: "GetApplications", + GetApplications: { + Name: "GetApplications", Group: "Appgroup", }, - CreateApplication: { - Name: "CreateApplication", + CreateApplication: { + Name: "CreateApplication", Group: "Appgroup", }, - GetAppServeAppTasksByAppId: { - Name: "GetAppServeAppTasksByAppId", + GetAppServeAppTasksByAppId: { + Name: "GetAppServeAppTasksByAppId", Group: "AppServeApp", }, - GetAppServeAppTaskDetail: { - Name: "GetAppServeAppTaskDetail", + GetAppServeAppTaskDetail: { + Name: "GetAppServeAppTaskDetail", Group: "AppServeApp", }, - CreateAppServeApp: { - Name: "CreateAppServeApp", + CreateAppServeApp: { + Name: "CreateAppServeApp", Group: "AppServeApp", }, - GetAppServeApps: { - Name: "GetAppServeApps", + GetAppServeApps: { + Name: "GetAppServeApps", Group: "AppServeApp", }, - GetNumOfAppsOnStack: { - Name: "GetNumOfAppsOnStack", + GetNumOfAppsOnStack: { + Name: "GetNumOfAppsOnStack", Group: "AppServeApp", }, - GetAppServeApp: { - Name: "GetAppServeApp", + GetAppServeApp: { + Name: "GetAppServeApp", Group: "AppServeApp", }, - GetAppServeAppLatestTask: { - Name: "GetAppServeAppLatestTask", + GetAppServeAppLatestTask: { + Name: "GetAppServeAppLatestTask", Group: "AppServeApp", }, - IsAppServeAppExist: { - Name: "IsAppServeAppExist", + IsAppServeAppExist: { + Name: "IsAppServeAppExist", Group: "AppServeApp", }, - IsAppServeAppNameExist: { - Name: "IsAppServeAppNameExist", + IsAppServeAppNameExist: { + Name: "IsAppServeAppNameExist", Group: "AppServeApp", }, - DeleteAppServeApp: { - Name: "DeleteAppServeApp", + DeleteAppServeApp: { + Name: "DeleteAppServeApp", Group: "AppServeApp", }, - UpdateAppServeApp: { - Name: "UpdateAppServeApp", + UpdateAppServeApp: { + Name: "UpdateAppServeApp", Group: "AppServeApp", }, - UpdateAppServeAppStatus: { - Name: "UpdateAppServeAppStatus", + UpdateAppServeAppStatus: { + Name: "UpdateAppServeAppStatus", Group: "AppServeApp", }, - UpdateAppServeAppEndpoint: { - Name: "UpdateAppServeAppEndpoint", + UpdateAppServeAppEndpoint: { + Name: "UpdateAppServeAppEndpoint", Group: "AppServeApp", }, - RollbackAppServeApp: { - Name: "RollbackAppServeApp", + RollbackAppServeApp: { + Name: "RollbackAppServeApp", Group: "AppServeApp", }, - GetCloudAccounts: { - Name: "GetCloudAccounts", + GetCloudAccounts: { + Name: "GetCloudAccounts", Group: "CloudAccount", }, - CreateCloudAccount: { - Name: "CreateCloudAccount", + CreateCloudAccount: { + Name: "CreateCloudAccount", Group: "CloudAccount", }, - CheckCloudAccountName: { - Name: "CheckCloudAccountName", + CheckCloudAccountName: { + Name: "CheckCloudAccountName", Group: "CloudAccount", }, - CheckAwsAccountId: { - Name: "CheckAwsAccountId", + CheckAwsAccountId: { + Name: "CheckAwsAccountId", Group: "CloudAccount", }, - GetCloudAccount: { - Name: "GetCloudAccount", + GetCloudAccount: { + Name: "GetCloudAccount", Group: "CloudAccount", }, - UpdateCloudAccount: { - Name: "UpdateCloudAccount", + UpdateCloudAccount: { + Name: "UpdateCloudAccount", Group: "CloudAccount", }, - DeleteCloudAccount: { - Name: "DeleteCloudAccount", + DeleteCloudAccount: { + Name: "DeleteCloudAccount", Group: "CloudAccount", }, - DeleteForceCloudAccount: { - Name: "DeleteForceCloudAccount", + DeleteForceCloudAccount: { + Name: "DeleteForceCloudAccount", Group: "CloudAccount", }, - GetResourceQuota: { - Name: "GetResourceQuota", + GetResourceQuota: { + Name: "GetResourceQuota", Group: "CloudAccount", }, - Admin_GetStackTemplates: { - Name: "Admin_GetStackTemplates", + Admin_GetStackTemplates: { + Name: "Admin_GetStackTemplates", Group: "StackTemplate", }, - Admin_GetStackTemplate: { - Name: "Admin_GetStackTemplate", + Admin_GetStackTemplate: { + Name: "Admin_GetStackTemplate", Group: "StackTemplate", }, - Admin_GetStackTemplateServices: { - Name: "Admin_GetStackTemplateServices", + Admin_GetStackTemplateServices: { + Name: "Admin_GetStackTemplateServices", Group: "StackTemplate", }, - Admin_CreateStackTemplate: { - Name: "Admin_CreateStackTemplate", + Admin_CreateStackTemplate: { + Name: "Admin_CreateStackTemplate", Group: "StackTemplate", }, - Admin_UpdateStackTemplate: { - Name: "Admin_UpdateStackTemplate", + Admin_UpdateStackTemplate: { + Name: "Admin_UpdateStackTemplate", Group: "StackTemplate", }, - Admin_DeleteStackTemplate: { - Name: "Admin_DeleteStackTemplate", + Admin_DeleteStackTemplate: { + Name: "Admin_DeleteStackTemplate", Group: "StackTemplate", }, - Admin_UpdateStackTemplateOrganizations: { - Name: "Admin_UpdateStackTemplateOrganizations", + Admin_UpdateStackTemplateOrganizations: { + Name: "Admin_UpdateStackTemplateOrganizations", Group: "StackTemplate", }, - Admin_CheckStackTemplateName: { - Name: "Admin_CheckStackTemplateName", + Admin_CheckStackTemplateName: { + Name: "Admin_CheckStackTemplateName", Group: "StackTemplate", }, - GetOrganizationStackTemplates: { - Name: "GetOrganizationStackTemplates", + GetOrganizationStackTemplates: { + Name: "GetOrganizationStackTemplates", Group: "StackTemplate", }, - GetOrganizationStackTemplate: { - Name: "GetOrganizationStackTemplate", + GetOrganizationStackTemplate: { + Name: "GetOrganizationStackTemplate", Group: "StackTemplate", }, - AddOrganizationStackTemplates: { - Name: "AddOrganizationStackTemplates", + AddOrganizationStackTemplates: { + Name: "AddOrganizationStackTemplates", Group: "StackTemplate", }, - RemoveOrganizationStackTemplates: { - Name: "RemoveOrganizationStackTemplates", + RemoveOrganizationStackTemplates: { + Name: "RemoveOrganizationStackTemplates", Group: "StackTemplate", }, - CreateDashboard: { - Name: "CreateDashboard", + CreateDashboard: { + Name: "CreateDashboard", Group: "Dashboard", }, - GetDashboard: { - Name: "GetDashboard", + GetDashboard: { + Name: "GetDashboard", Group: "Dashboard", }, - UpdateDashboard: { - Name: "UpdateDashboard", + UpdateDashboard: { + Name: "UpdateDashboard", Group: "Dashboard", }, - GetChartsDashboard: { - Name: "GetChartsDashboard", + GetChartsDashboard: { + Name: "GetChartsDashboard", Group: "Dashboard", }, - GetChartDashboard: { - Name: "GetChartDashboard", + GetChartDashboard: { + Name: "GetChartDashboard", Group: "Dashboard", }, - GetStacksDashboard: { - Name: "GetStacksDashboard", + GetStacksDashboard: { + Name: "GetStacksDashboard", Group: "Dashboard", }, - GetResourcesDashboard: { - Name: "GetResourcesDashboard", + GetResourcesDashboard: { + Name: "GetResourcesDashboard", Group: "Dashboard", }, - GetPolicyStatusDashboard: { - Name: "GetPolicyStatusDashboard", + GetPolicyStatusDashboard: { + Name: "GetPolicyStatusDashboard", Group: "Dashboard", }, GetPolicyUpdateDashboard: { @@ -371,232 +371,236 @@ var ApiMap = map[Endpoint]EndpointInfo{ Name: "GetPolicyViolationDashboard", Group: "Dashboard", }, + GetPolicyViolationLogDashboard: { + Name: "GetPolicyViolationLogDashboard", + Group: "Dashboard", + }, Admin_CreateSystemNotificationTemplate: { Name: "Admin_CreateSystemNotificationTemplate", Group: "SystemNotificationTemplate", }, - Admin_UpdateSystemNotificationTemplate: { - Name: "Admin_UpdateSystemNotificationTemplate", + Admin_UpdateSystemNotificationTemplate: { + Name: "Admin_UpdateSystemNotificationTemplate", Group: "SystemNotificationTemplate", }, - Admin_DeleteSystemNotificationTemplate: { - Name: "Admin_DeleteSystemNotificationTemplate", + Admin_DeleteSystemNotificationTemplate: { + Name: "Admin_DeleteSystemNotificationTemplate", Group: "SystemNotificationTemplate", }, - Admin_GetSystemNotificationTemplates: { - Name: "Admin_GetSystemNotificationTemplates", + Admin_GetSystemNotificationTemplates: { + Name: "Admin_GetSystemNotificationTemplates", Group: "SystemNotificationTemplate", }, - Admin_GetSystemNotificationTemplate: { - Name: "Admin_GetSystemNotificationTemplate", + Admin_GetSystemNotificationTemplate: { + Name: "Admin_GetSystemNotificationTemplate", Group: "SystemNotificationTemplate", }, - Admin_CheckSystemNotificationTemplateName: { - Name: "Admin_CheckSystemNotificationTemplateName", + Admin_CheckSystemNotificationTemplateName: { + Name: "Admin_CheckSystemNotificationTemplateName", Group: "SystemNotificationTemplate", }, - GetOrganizationSystemNotificationTemplates: { - Name: "GetOrganizationSystemNotificationTemplates", + GetOrganizationSystemNotificationTemplates: { + Name: "GetOrganizationSystemNotificationTemplates", Group: "SystemNotificationTemplate", }, - GetOrganizationSystemNotificationTemplate: { - Name: "GetOrganizationSystemNotificationTemplate", + GetOrganizationSystemNotificationTemplate: { + Name: "GetOrganizationSystemNotificationTemplate", Group: "SystemNotificationTemplate", }, - AddOrganizationSystemNotificationTemplates: { - Name: "AddOrganizationSystemNotificationTemplates", + AddOrganizationSystemNotificationTemplates: { + Name: "AddOrganizationSystemNotificationTemplates", Group: "SystemNotificationTemplate", }, - RemoveOrganizationSystemNotificationTemplates: { - Name: "RemoveOrganizationSystemNotificationTemplates", + RemoveOrganizationSystemNotificationTemplates: { + Name: "RemoveOrganizationSystemNotificationTemplates", Group: "SystemNotificationTemplate", }, - CreateSystemNotificationRule: { - Name: "CreateSystemNotificationRule", + CreateSystemNotificationRule: { + Name: "CreateSystemNotificationRule", Group: "SystemNotificationRule", }, - GetSystemNotificationRules: { - Name: "GetSystemNotificationRules", + GetSystemNotificationRules: { + Name: "GetSystemNotificationRules", Group: "SystemNotificationRule", }, - GetSystemNotificationRule: { - Name: "GetSystemNotificationRule", + GetSystemNotificationRule: { + Name: "GetSystemNotificationRule", Group: "SystemNotificationRule", }, - CheckSystemNotificationRuleName: { - Name: "CheckSystemNotificationRuleName", + CheckSystemNotificationRuleName: { + Name: "CheckSystemNotificationRuleName", Group: "SystemNotificationRule", }, - DeleteSystemNotificationRule: { - Name: "DeleteSystemNotificationRule", + DeleteSystemNotificationRule: { + Name: "DeleteSystemNotificationRule", Group: "SystemNotificationRule", }, - UpdateSystemNotificationRule: { - Name: "UpdateSystemNotificationRule", + UpdateSystemNotificationRule: { + Name: "UpdateSystemNotificationRule", Group: "SystemNotificationRule", }, - MakeDefaultSystemNotificationRules: { - Name: "MakeDefaultSystemNotificationRules", + MakeDefaultSystemNotificationRules: { + Name: "MakeDefaultSystemNotificationRules", Group: "SystemNotificationRule", }, - CreateSystemNotification: { - Name: "CreateSystemNotification", + CreateSystemNotification: { + Name: "CreateSystemNotification", Group: "SystemNotification", }, - GetSystemNotifications: { - Name: "GetSystemNotifications", + GetSystemNotifications: { + Name: "GetSystemNotifications", Group: "SystemNotification", }, - GetSystemNotification: { - Name: "GetSystemNotification", + GetSystemNotification: { + Name: "GetSystemNotification", Group: "SystemNotification", }, - DeleteSystemNotification: { - Name: "DeleteSystemNotification", + DeleteSystemNotification: { + Name: "DeleteSystemNotification", Group: "SystemNotification", }, - UpdateSystemNotification: { - Name: "UpdateSystemNotification", + UpdateSystemNotification: { + Name: "UpdateSystemNotification", Group: "SystemNotification", }, - CreateSystemNotificationAction: { - Name: "CreateSystemNotificationAction", + CreateSystemNotificationAction: { + Name: "CreateSystemNotificationAction", Group: "SystemNotification", }, - GetStacks: { - Name: "GetStacks", + GetStacks: { + Name: "GetStacks", Group: "Stack", }, - CreateStack: { - Name: "CreateStack", + CreateStack: { + Name: "CreateStack", Group: "Stack", }, - CheckStackName: { - Name: "CheckStackName", + CheckStackName: { + Name: "CheckStackName", Group: "Stack", }, - GetStack: { - Name: "GetStack", + GetStack: { + Name: "GetStack", Group: "Stack", }, - UpdateStack: { - Name: "UpdateStack", + UpdateStack: { + Name: "UpdateStack", Group: "Stack", }, - DeleteStack: { - Name: "DeleteStack", + DeleteStack: { + Name: "DeleteStack", Group: "Stack", }, - GetStackKubeConfig: { - Name: "GetStackKubeConfig", + GetStackKubeConfig: { + Name: "GetStackKubeConfig", Group: "Stack", }, - GetStackStatus: { - Name: "GetStackStatus", + GetStackStatus: { + Name: "GetStackStatus", Group: "Stack", }, - SetFavoriteStack: { - Name: "SetFavoriteStack", + SetFavoriteStack: { + Name: "SetFavoriteStack", Group: "Stack", }, - DeleteFavoriteStack: { - Name: "DeleteFavoriteStack", + DeleteFavoriteStack: { + Name: "DeleteFavoriteStack", Group: "Stack", }, - InstallStack: { - Name: "InstallStack", + InstallStack: { + Name: "InstallStack", Group: "Stack", }, - CreateProject: { - Name: "CreateProject", + CreateProject: { + Name: "CreateProject", Group: "Project", }, - GetProjectRoles: { - Name: "GetProjectRoles", + GetProjectRoles: { + Name: "GetProjectRoles", Group: "Project", }, - GetProjectRole: { - Name: "GetProjectRole", + GetProjectRole: { + Name: "GetProjectRole", Group: "Project", }, - GetProjects: { - Name: "GetProjects", + GetProjects: { + Name: "GetProjects", Group: "Project", }, - GetProject: { - Name: "GetProject", + GetProject: { + Name: "GetProject", Group: "Project", }, - UpdateProject: { - Name: "UpdateProject", + UpdateProject: { + Name: "UpdateProject", Group: "Project", }, - DeleteProject: { - Name: "DeleteProject", + DeleteProject: { + Name: "DeleteProject", Group: "Project", }, - AddProjectMember: { - Name: "AddProjectMember", + AddProjectMember: { + Name: "AddProjectMember", Group: "Project", }, - GetProjectMember: { - Name: "GetProjectMember", + GetProjectMember: { + Name: "GetProjectMember", Group: "Project", }, - GetProjectMembers: { - Name: "GetProjectMembers", + GetProjectMembers: { + Name: "GetProjectMembers", Group: "Project", }, - RemoveProjectMember: { - Name: "RemoveProjectMember", + RemoveProjectMember: { + Name: "RemoveProjectMember", Group: "Project", }, - UpdateProjectMemberRole: { - Name: "UpdateProjectMemberRole", + UpdateProjectMemberRole: { + Name: "UpdateProjectMemberRole", Group: "Project", }, - CreateProjectNamespace: { - Name: "CreateProjectNamespace", + CreateProjectNamespace: { + Name: "CreateProjectNamespace", Group: "Project", }, - GetProjectNamespaces: { - Name: "GetProjectNamespaces", + GetProjectNamespaces: { + Name: "GetProjectNamespaces", Group: "Project", }, - GetProjectNamespace: { - Name: "GetProjectNamespace", + GetProjectNamespace: { + Name: "GetProjectNamespace", Group: "Project", }, - UpdateProjectNamespace: { - Name: "UpdateProjectNamespace", + UpdateProjectNamespace: { + Name: "UpdateProjectNamespace", Group: "Project", }, - DeleteProjectNamespace: { - Name: "DeleteProjectNamespace", + DeleteProjectNamespace: { + Name: "DeleteProjectNamespace", Group: "Project", }, - SetFavoriteProject: { - Name: "SetFavoriteProject", + SetFavoriteProject: { + Name: "SetFavoriteProject", Group: "Project", }, - SetFavoriteProjectNamespace: { - Name: "SetFavoriteProjectNamespace", + SetFavoriteProjectNamespace: { + Name: "SetFavoriteProjectNamespace", Group: "Project", }, - UnSetFavoriteProject: { - Name: "UnSetFavoriteProject", + UnSetFavoriteProject: { + Name: "UnSetFavoriteProject", Group: "Project", }, - UnSetFavoriteProjectNamespace: { - Name: "UnSetFavoriteProjectNamespace", + UnSetFavoriteProjectNamespace: { + Name: "UnSetFavoriteProjectNamespace", Group: "Project", }, - GetProjectKubeconfig: { - Name: "GetProjectKubeconfig", + GetProjectKubeconfig: { + Name: "GetProjectKubeconfig", Group: "Project", }, - GetProjectNamespaceK8sResources: { - Name: "GetProjectNamespaceK8sResources", + GetProjectNamespaceK8sResources: { + Name: "GetProjectNamespaceK8sResources", Group: "Project", }, GetProjectNamespaceKubeconfig: { @@ -607,220 +611,220 @@ var ApiMap = map[Endpoint]EndpointInfo{ Name: "GetAudits", Group: "Audit", }, - GetAudit: { - Name: "GetAudit", + GetAudit: { + Name: "GetAudit", Group: "Audit", }, - DeleteAudit: { - Name: "DeleteAudit", + DeleteAudit: { + Name: "DeleteAudit", Group: "Audit", }, - CreateTksRole: { - Name: "CreateTksRole", + CreateTksRole: { + Name: "CreateTksRole", Group: "Role", }, - ListTksRoles: { - Name: "ListTksRoles", + ListTksRoles: { + Name: "ListTksRoles", Group: "Role", }, - GetTksRole: { - Name: "GetTksRole", + GetTksRole: { + Name: "GetTksRole", Group: "Role", }, - DeleteTksRole: { - Name: "DeleteTksRole", + DeleteTksRole: { + Name: "DeleteTksRole", Group: "Role", }, - UpdateTksRole: { - Name: "UpdateTksRole", + UpdateTksRole: { + Name: "UpdateTksRole", Group: "Role", }, - GetPermissionsByRoleId: { - Name: "GetPermissionsByRoleId", + GetPermissionsByRoleId: { + Name: "GetPermissionsByRoleId", Group: "Role", }, - UpdatePermissionsByRoleId: { - Name: "UpdatePermissionsByRoleId", + UpdatePermissionsByRoleId: { + Name: "UpdatePermissionsByRoleId", Group: "Role", }, - IsRoleNameExisted: { - Name: "IsRoleNameExisted", + IsRoleNameExisted: { + Name: "IsRoleNameExisted", Group: "Role", }, - AppendUsersToRole: { - Name: "AppendUsersToRole", + AppendUsersToRole: { + Name: "AppendUsersToRole", Group: "Role", }, - GetUsersInRoleId: { - Name: "GetUsersInRoleId", + GetUsersInRoleId: { + Name: "GetUsersInRoleId", Group: "Role", }, - RemoveUsersFromRole: { - Name: "RemoveUsersFromRole", + RemoveUsersFromRole: { + Name: "RemoveUsersFromRole", Group: "Role", }, - GetPermissionTemplates: { - Name: "GetPermissionTemplates", + GetPermissionTemplates: { + Name: "GetPermissionTemplates", Group: "Permission", }, - Admin_CreateUser: { - Name: "Admin_CreateUser", + Admin_CreateUser: { + Name: "Admin_CreateUser", Group: "Admin_User", }, - Admin_ListUser: { - Name: "Admin_ListUser", + Admin_ListUser: { + Name: "Admin_ListUser", Group: "Admin_User", }, - Admin_GetUser: { - Name: "Admin_GetUser", + Admin_GetUser: { + Name: "Admin_GetUser", Group: "Admin_User", }, - Admin_DeleteUser: { - Name: "Admin_DeleteUser", + Admin_DeleteUser: { + Name: "Admin_DeleteUser", Group: "Admin_User", }, - Admin_UpdateUser: { - Name: "Admin_UpdateUser", + Admin_UpdateUser: { + Name: "Admin_UpdateUser", Group: "Admin_User", }, - Admin_ListTksRoles: { - Name: "Admin_ListTksRoles", + Admin_ListTksRoles: { + Name: "Admin_ListTksRoles", Group: "Admin Role", }, - Admin_GetTksRole: { - Name: "Admin_GetTksRole", + Admin_GetTksRole: { + Name: "Admin_GetTksRole", Group: "Admin Role", }, - Admin_GetProjects: { - Name: "Admin_GetProjects", + Admin_GetProjects: { + Name: "Admin_GetProjects", Group: "Admin Project", }, - Admin_ListPolicyTemplate: { - Name: "Admin_ListPolicyTemplate", + Admin_ListPolicyTemplate: { + Name: "Admin_ListPolicyTemplate", Group: "PolicyTemplate", }, - Admin_CreatePolicyTemplate: { - Name: "Admin_CreatePolicyTemplate", + Admin_CreatePolicyTemplate: { + Name: "Admin_CreatePolicyTemplate", Group: "PolicyTemplate", }, - Admin_DeletePolicyTemplate: { - Name: "Admin_DeletePolicyTemplate", + Admin_DeletePolicyTemplate: { + Name: "Admin_DeletePolicyTemplate", Group: "PolicyTemplate", }, - Admin_GetPolicyTemplate: { - Name: "Admin_GetPolicyTemplate", + Admin_GetPolicyTemplate: { + Name: "Admin_GetPolicyTemplate", Group: "PolicyTemplate", }, - Admin_UpdatePolicyTemplate: { - Name: "Admin_UpdatePolicyTemplate", + Admin_UpdatePolicyTemplate: { + Name: "Admin_UpdatePolicyTemplate", Group: "PolicyTemplate", }, - Admin_GetPolicyTemplateDeploy: { - Name: "Admin_GetPolicyTemplateDeploy", + Admin_GetPolicyTemplateDeploy: { + Name: "Admin_GetPolicyTemplateDeploy", Group: "PolicyTemplate", }, - Admin_ListPolicyTemplateStatistics: { - Name: "Admin_ListPolicyTemplateStatistics", + Admin_ListPolicyTemplateStatistics: { + Name: "Admin_ListPolicyTemplateStatistics", Group: "PolicyTemplate", }, - Admin_ListPolicyTemplateVersions: { - Name: "Admin_ListPolicyTemplateVersions", + Admin_ListPolicyTemplateVersions: { + Name: "Admin_ListPolicyTemplateVersions", Group: "PolicyTemplate", }, - Admin_CreatePolicyTemplateVersion: { - Name: "Admin_CreatePolicyTemplateVersion", + Admin_CreatePolicyTemplateVersion: { + Name: "Admin_CreatePolicyTemplateVersion", Group: "PolicyTemplate", }, - Admin_DeletePolicyTemplateVersion: { - Name: "Admin_DeletePolicyTemplateVersion", + Admin_DeletePolicyTemplateVersion: { + Name: "Admin_DeletePolicyTemplateVersion", Group: "PolicyTemplate", }, - Admin_GetPolicyTemplateVersion: { - Name: "Admin_GetPolicyTemplateVersion", + Admin_GetPolicyTemplateVersion: { + Name: "Admin_GetPolicyTemplateVersion", Group: "PolicyTemplate", }, - Admin_ExistsPolicyTemplateKind: { - Name: "Admin_ExistsPolicyTemplateKind", + Admin_ExistsPolicyTemplateKind: { + Name: "Admin_ExistsPolicyTemplateKind", Group: "PolicyTemplate", }, - Admin_ExistsPolicyTemplateName: { - Name: "Admin_ExistsPolicyTemplateName", + Admin_ExistsPolicyTemplateName: { + Name: "Admin_ExistsPolicyTemplateName", Group: "PolicyTemplate", }, - Admin_ExtractParameters: { - Name: "Admin_ExtractParameters", + Admin_ExtractParameters: { + Name: "Admin_ExtractParameters", Group: "PolicyTemplate", }, - Admin_AddPermittedPolicyTemplatesForOrganization: { - Name: "Admin_AddPermittedPolicyTemplatesForOrganization", + Admin_AddPermittedPolicyTemplatesForOrganization: { + Name: "Admin_AddPermittedPolicyTemplatesForOrganization", Group: "PolicyTemplate", }, - Admin_DeletePermittedPolicyTemplatesForOrganization: { - Name: "Admin_DeletePermittedPolicyTemplatesForOrganization", + Admin_DeletePermittedPolicyTemplatesForOrganization: { + Name: "Admin_DeletePermittedPolicyTemplatesForOrganization", Group: "PolicyTemplate", }, - ListStackPolicyStatus: { - Name: "ListStackPolicyStatus", + ListStackPolicyStatus: { + Name: "ListStackPolicyStatus", Group: "StackPolicyStatus", }, - GetStackPolicyTemplateStatus: { - Name: "GetStackPolicyTemplateStatus", + GetStackPolicyTemplateStatus: { + Name: "GetStackPolicyTemplateStatus", Group: "StackPolicyStatus", }, - UpdateStackPolicyTemplateStatus: { - Name: "UpdateStackPolicyTemplateStatus", + UpdateStackPolicyTemplateStatus: { + Name: "UpdateStackPolicyTemplateStatus", Group: "StackPolicyStatus", }, - GetMandatoryPolicies: { - Name: "GetMandatoryPolicies", + GetMandatoryPolicies: { + Name: "GetMandatoryPolicies", Group: "Policy", }, - SetMandatoryPolicies: { - Name: "SetMandatoryPolicies", + SetMandatoryPolicies: { + Name: "SetMandatoryPolicies", Group: "Policy", }, - GetPolicyStatistics: { - Name: "GetPolicyStatistics", + GetPolicyStatistics: { + Name: "GetPolicyStatistics", Group: "Policy", }, - ListPolicy: { - Name: "ListPolicy", + ListPolicy: { + Name: "ListPolicy", Group: "Policy", }, - CreatePolicy: { - Name: "CreatePolicy", + CreatePolicy: { + Name: "CreatePolicy", Group: "Policy", }, - DeletePolicy: { - Name: "DeletePolicy", + DeletePolicy: { + Name: "DeletePolicy", Group: "Policy", }, - GetPolicy: { - Name: "GetPolicy", + GetPolicy: { + Name: "GetPolicy", Group: "Policy", }, - UpdatePolicy: { - Name: "UpdatePolicy", + UpdatePolicy: { + Name: "UpdatePolicy", Group: "Policy", }, - UpdatePolicyTargetClusters: { - Name: "UpdatePolicyTargetClusters", + UpdatePolicyTargetClusters: { + Name: "UpdatePolicyTargetClusters", Group: "Policy", }, - ExistsPolicyName: { - Name: "ExistsPolicyName", + ExistsPolicyName: { + Name: "ExistsPolicyName", Group: "Policy", }, - GetPolicyEdit: { - Name: "GetPolicyEdit", + GetPolicyEdit: { + Name: "GetPolicyEdit", Group: "Policy", }, - AddPoliciesForStack: { - Name: "AddPoliciesForStack", + AddPoliciesForStack: { + Name: "AddPoliciesForStack", Group: "Policy", }, - DeletePoliciesForStack: { - Name: "DeletePoliciesForStack", + DeletePoliciesForStack: { + Name: "DeletePoliciesForStack", Group: "Policy", }, StackPolicyStatistics: { @@ -831,80 +835,79 @@ var ApiMap = map[Endpoint]EndpointInfo{ Name: "ListPolicyTemplate", Group: "OrganizationPolicyTemplate", }, - CreatePolicyTemplate: { - Name: "CreatePolicyTemplate", + CreatePolicyTemplate: { + Name: "CreatePolicyTemplate", Group: "OrganizationPolicyTemplate", }, - DeletePolicyTemplate: { - Name: "DeletePolicyTemplate", + DeletePolicyTemplate: { + Name: "DeletePolicyTemplate", Group: "OrganizationPolicyTemplate", }, - GetPolicyTemplate: { - Name: "GetPolicyTemplate", + GetPolicyTemplate: { + Name: "GetPolicyTemplate", Group: "OrganizationPolicyTemplate", }, - UpdatePolicyTemplate: { - Name: "UpdatePolicyTemplate", + UpdatePolicyTemplate: { + Name: "UpdatePolicyTemplate", Group: "OrganizationPolicyTemplate", }, - GetPolicyTemplateDeploy: { - Name: "GetPolicyTemplateDeploy", + GetPolicyTemplateDeploy: { + Name: "GetPolicyTemplateDeploy", Group: "OrganizationPolicyTemplate", }, - ListPolicyTemplateStatistics: { - Name: "ListPolicyTemplateStatistics", + ListPolicyTemplateStatistics: { + Name: "ListPolicyTemplateStatistics", Group: "OrganizationPolicyTemplate", }, - ListPolicyTemplateVersions: { - Name: "ListPolicyTemplateVersions", + ListPolicyTemplateVersions: { + Name: "ListPolicyTemplateVersions", Group: "OrganizationPolicyTemplate", }, - CreatePolicyTemplateVersion: { - Name: "CreatePolicyTemplateVersion", + CreatePolicyTemplateVersion: { + Name: "CreatePolicyTemplateVersion", Group: "OrganizationPolicyTemplate", }, - DeletePolicyTemplateVersion: { - Name: "DeletePolicyTemplateVersion", + DeletePolicyTemplateVersion: { + Name: "DeletePolicyTemplateVersion", Group: "OrganizationPolicyTemplate", }, - GetPolicyTemplateVersion: { - Name: "GetPolicyTemplateVersion", + GetPolicyTemplateVersion: { + Name: "GetPolicyTemplateVersion", Group: "OrganizationPolicyTemplate", }, - ExistsPolicyTemplateKind: { - Name: "ExistsPolicyTemplateKind", + ExistsPolicyTemplateKind: { + Name: "ExistsPolicyTemplateKind", Group: "OrganizationPolicyTemplate", }, - ExistsPolicyTemplateName: { - Name: "ExistsPolicyTemplateName", + ExistsPolicyTemplateName: { + Name: "ExistsPolicyTemplateName", Group: "OrganizationPolicyTemplate", }, - ExtractParameters: { - Name: "ExtractParameters", + ExtractParameters: { + Name: "ExtractParameters", Group: "OrganizationPolicyTemplate", }, - ListPolicyTemplateExample: { - Name: "ListPolicyTemplateExample", + ListPolicyTemplateExample: { + Name: "ListPolicyTemplateExample", Group: "PolicyTemplateExample", }, - GetPolicyTemplateExample: { - Name: "GetPolicyTemplateExample", + GetPolicyTemplateExample: { + Name: "GetPolicyTemplateExample", Group: "PolicyTemplateExample", }, - UpdatePolicyTemplateExample: { - Name: "UpdatePolicyTemplateExample", + UpdatePolicyTemplateExample: { + Name: "UpdatePolicyTemplateExample", Group: "PolicyTemplateExample", }, - DeletePolicyTemplateExample: { - Name: "DeletePolicyTemplateExample", + DeletePolicyTemplateExample: { + Name: "DeletePolicyTemplateExample", Group: "PolicyTemplateExample", }, - CompileRego: { - Name: "CompileRego", + CompileRego: { + Name: "CompileRego", Group: "Utility", }, } - func (e Endpoint) String() string { switch e { case Login: @@ -1091,6 +1094,8 @@ func (e Endpoint) String() string { return "GetPolicyEnforcementDashboard" case GetPolicyViolationDashboard: return "GetPolicyViolationDashboard" + case GetPolicyViolationLogDashboard: + return "GetPolicyViolationLogDashboard" case Admin_CreateSystemNotificationTemplate: return "Admin_CreateSystemNotificationTemplate" case Admin_UpdateSystemNotificationTemplate: @@ -1547,6 +1552,8 @@ func GetEndpoint(name string) Endpoint { return GetPolicyEnforcementDashboard case "GetPolicyViolationDashboard": return GetPolicyViolationDashboard + case "GetPolicyViolationLogDashboard": + return GetPolicyViolationLogDashboard case "Admin_CreateSystemNotificationTemplate": return Admin_CreateSystemNotificationTemplate case "Admin_UpdateSystemNotificationTemplate": From b63b8fa23d3c2c9f669316191ae4bbaad9fa8472 Mon Sep 17 00:00:00 2001 From: Seungkyu Ahn Date: Wed, 17 Apr 2024 15:25:41 +0900 Subject: [PATCH 3/3] policy violation log skeleton code\n swagger generation --- api/swagger/docs.go | 142 ++++++++++++++++++++++++++++++++++----- api/swagger/swagger.json | 142 ++++++++++++++++++++++++++++++++++----- api/swagger/swagger.yaml | 95 ++++++++++++++++++++++---- 3 files changed, 329 insertions(+), 50 deletions(-) diff --git a/api/swagger/docs.go b/api/swagger/docs.go index 7284a6f2..417ada03 100644 --- a/api/swagger/docs.go +++ b/api/swagger/docs.go @@ -3435,7 +3435,7 @@ const docTemplate = `{ "JWT": [] } ], - "description": "Get the number of policy violation", + "description": "Get the number of policy enforcement", "consumes": [ "application/json" ], @@ -3445,7 +3445,7 @@ const docTemplate = `{ "tags": [ "Dashboard Widgets" ], - "summary": "Get the number of policy violation", + "summary": "Get the number of policy enforcement", "parameters": [ { "type": "string", @@ -3453,27 +3453,13 @@ const docTemplate = `{ "name": "organizationId", "in": "path", "required": true - }, - { - "type": "string", - "description": "duration", - "name": "duration", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "interval", - "name": "interval", - "in": "query", - "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyEnforcementResponse" } } } @@ -3553,6 +3539,94 @@ const docTemplate = `{ } } }, + "/organizations/{organizationId}/dashboards/policy-violation": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get the number of policy violation", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Dashboard Widgets" + ], + "summary": "Get the number of policy violation", + "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "duration", + "name": "duration", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "interval", + "name": "interval", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse" + } + } + } + } + }, + "/organizations/{organizationId}/dashboards/policy-violation-log": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get policy violation log", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Dashboard Widgets" + ], + "summary": "Get policy violation log", + "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationLogResponse" + } + } + } + } + }, "/organizations/{organizationId}/dashboards/resources": { "get": { "security": [ @@ -10637,7 +10711,7 @@ const docTemplate = `{ "type": "string" }, "user": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponseWithRoles" } } }, @@ -12440,6 +12514,9 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationLogResponse": { + "type": "object" + }, "github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse": { "type": "object", "properties": { @@ -14344,6 +14421,32 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponseWithRoles": { + "type": "object", + "properties": { + "accountId": { + "type": "string" + }, + "department": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.StackConfResponse": { "type": "object", "required": [ @@ -14820,6 +14923,9 @@ const docTemplate = `{ "notificationType": { "type": "string" }, + "status": { + "type": "string" + }, "systemNotificationCondition": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SystemNotificationConditionResponse" }, diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index 246aed8f..562ac8b3 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -3429,7 +3429,7 @@ "JWT": [] } ], - "description": "Get the number of policy violation", + "description": "Get the number of policy enforcement", "consumes": [ "application/json" ], @@ -3439,7 +3439,7 @@ "tags": [ "Dashboard Widgets" ], - "summary": "Get the number of policy violation", + "summary": "Get the number of policy enforcement", "parameters": [ { "type": "string", @@ -3447,27 +3447,13 @@ "name": "organizationId", "in": "path", "required": true - }, - { - "type": "string", - "description": "duration", - "name": "duration", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "interval", - "name": "interval", - "in": "query", - "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyEnforcementResponse" } } } @@ -3547,6 +3533,94 @@ } } }, + "/organizations/{organizationId}/dashboards/policy-violation": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get the number of policy violation", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Dashboard Widgets" + ], + "summary": "Get the number of policy violation", + "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "duration", + "name": "duration", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "interval", + "name": "interval", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse" + } + } + } + } + }, + "/organizations/{organizationId}/dashboards/policy-violation-log": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get policy violation log", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Dashboard Widgets" + ], + "summary": "Get policy violation log", + "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationLogResponse" + } + } + } + } + }, "/organizations/{organizationId}/dashboards/resources": { "get": { "security": [ @@ -10631,7 +10705,7 @@ "type": "string" }, "user": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponseWithRoles" } } }, @@ -12434,6 +12508,9 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationLogResponse": { + "type": "object" + }, "github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse": { "type": "object", "properties": { @@ -14338,6 +14415,32 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponseWithRoles": { + "type": "object", + "properties": { + "accountId": { + "type": "string" + }, + "department": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.StackConfResponse": { "type": "object", "required": [ @@ -14814,6 +14917,9 @@ "notificationType": { "type": "string" }, + "status": { + "type": "string" + }, "systemNotificationCondition": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SystemNotificationConditionResponse" }, diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 81edc270..a287656b 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -507,7 +507,7 @@ definitions: updatedAt: type: string user: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponse' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponseWithRoles' type: object github_com_openinfradev_tks-api_pkg_domain.Axis: properties: @@ -1712,6 +1712,8 @@ definitions: updatedResources: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.DashboardPolicyUpdate' type: object + github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationLogResponse: + type: object github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse: properties: chartData: @@ -2970,6 +2972,23 @@ definitions: name: type: string type: object + github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponseWithRoles: + properties: + accountId: + type: string + department: + type: string + email: + type: string + id: + type: string + name: + type: string + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array + type: object github_com_openinfradev_tks-api_pkg_domain.StackConfResponse: properties: tksCpNode: @@ -3288,6 +3307,8 @@ definitions: type: string notificationType: type: string + status: + type: string systemNotificationCondition: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SystemNotificationConditionResponse' systemNotificationTemplate: @@ -6396,33 +6417,23 @@ paths: get: consumes: - application/json - description: Get the number of policy violation + description: Get the number of policy enforcement parameters: - description: Organization ID in: path name: organizationId required: true type: string - - description: duration - in: query - name: duration - required: true - type: string - - description: interval - in: query - name: interval - required: true - type: string produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyEnforcementResponse' security: - JWT: [] - summary: Get the number of policy violation + summary: Get the number of policy enforcement tags: - Dashboard Widgets /organizations/{organizationId}/dashboards/policy-status: @@ -6471,6 +6482,62 @@ paths: summary: Get the number of policytemplates that need to be updated tags: - Dashboard Widgets + /organizations/{organizationId}/dashboards/policy-violation: + get: + consumes: + - application/json + description: Get the number of policy violation + parameters: + - description: Organization ID + in: path + name: organizationId + required: true + type: string + - description: duration + in: query + name: duration + required: true + type: string + - description: interval + in: query + name: interval + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationResponse' + security: + - JWT: [] + summary: Get the number of policy violation + tags: + - Dashboard Widgets + /organizations/{organizationId}/dashboards/policy-violation-log: + get: + consumes: + - application/json + description: Get policy violation log + parameters: + - description: Organization ID + in: path + name: organizationId + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetDashboardPolicyViolationLogResponse' + security: + - JWT: [] + summary: Get policy violation log + tags: + - Dashboard Widgets /organizations/{organizationId}/dashboards/resources: get: consumes: