diff --git a/cmd/server/main.go b/cmd/server/main.go index 1d2cc060..d5e62bde 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -44,7 +44,7 @@ func init() { flag.String("console-address", "https://tks-console-dev.taco-cat.xyz", "service address for console") // app-serve-apps - flag.String("image-registry-url", "harbor-dev.taco-cat.xyz/appserving", "URL of image registry") + flag.String("image-registry-url", "harbor.taco-cat.xyz/appserving", "URL of image registry") flag.String("harbor-pw-secret", "harbor-core", "name of harbor password secret") flag.String("git-repository-url", "github.com/openinfradev", "URL of git repository") diff --git a/internal/delivery/api/generated_endpoints.go.go b/internal/delivery/api/generated_endpoints.go.go index c593692a..363c80c1 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,228 +371,228 @@ var ApiMap = map[Endpoint]EndpointInfo{ 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: { @@ -603,220 +603,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: { @@ -827,79 +827,80 @@ 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: diff --git a/internal/delivery/http/app-serve-app.go b/internal/delivery/http/app-serve-app.go index 04fd8e95..cd9536d5 100644 --- a/internal/delivery/http/app-serve-app.go +++ b/internal/delivery/http/app-serve-app.go @@ -70,12 +70,14 @@ var ( ) type AppServeAppHandler struct { - usecase usecase.IAppServeAppUsecase + usecase usecase.IAppServeAppUsecase + prjUsecase usecase.IProjectUsecase } -func NewAppServeAppHandler(h usecase.Usecase) *AppServeAppHandler { +func NewAppServeAppHandler(u usecase.Usecase) *AppServeAppHandler { return &AppServeAppHandler{ - usecase: h.AppServeApp, + usecase: u.AppServeApp, + prjUsecase: u.Project, } } @@ -111,7 +113,7 @@ func (h *AppServeAppHandler) CreateAppServeApp(w http.ResponseWriter, r *http.Re appReq := domain.CreateAppServeAppRequest{} err := UnmarshalRequestInput(r, &appReq) if err != nil { - ErrorJSON(w, r, err) + ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("Error while unmarshalling request"), "C_INTERNAL_ERROR", "")) return } @@ -125,6 +127,18 @@ func (h *AppServeAppHandler) CreateAppServeApp(w http.ResponseWriter, r *http.Re log.Infof(r.Context(), "Processing CREATE request for app '%s'...", app.Name) + // Namespace validation + exist, err := h.prjUsecase.IsProjectNamespaceExist(r.Context(), organizationId, projectId, app.TargetClusterId, app.Namespace) + if err != nil { + ErrorJSON(w, r, httpErrors.NewInternalServerError(fmt.Errorf("Error while checking namespace record: %s", err), "", "")) + return + } + + if !exist { + ErrorJSON(w, r, httpErrors.NewInternalServerError(fmt.Errorf("Namespace '%s' doesn't exist", app.Namespace), "", "")) + return + } + now := time.Now() app.OrganizationId = organizationId app.ProjectId = projectId @@ -153,7 +167,7 @@ func (h *AppServeAppHandler) CreateAppServeApp(w http.ResponseWriter, r *http.Re return } - exist, err := h.usecase.IsAppServeAppNameExist(r.Context(), organizationId, app.Name) + exist, err = h.usecase.IsAppServeAppNameExist(r.Context(), organizationId, app.Name) if err != nil { ErrorJSON(w, r, httpErrors.NewInternalServerError(err, "", "")) return @@ -237,13 +251,21 @@ func (h *AppServeAppHandler) CreateAppServeApp(w http.ResponseWriter, r *http.Re // @Security JWT func (h *AppServeAppHandler) GetAppServeApps(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) + organizationId, ok := vars["organizationId"] - fmt.Printf("organizationId = [%v]\n", organizationId) + log.Debugf(r.Context(), "organizationId = [%v]\n", organizationId) if !ok { ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("invalid organizationId"), "C_INVALID_ORGANIZATION_ID", "")) return } + projectId, ok := vars["projectId"] + log.Debugf(r.Context(), "projectId = [%v]\n", projectId) + if !ok { + ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("Invalid projectId"), "C_INVALID_PROJECT_ID", "")) + return + } + urlParams := r.URL.Query() showAllParam := urlParams.Get("showAll") @@ -257,8 +279,9 @@ func (h *AppServeAppHandler) GetAppServeApps(w http.ResponseWriter, r *http.Requ ErrorJSON(w, r, err) return } + pg := pagination.NewPagination(&urlParams) - apps, err := h.usecase.GetAppServeApps(r.Context(), organizationId, showAll, pg) + apps, err := h.usecase.GetAppServeApps(r.Context(), organizationId, projectId, showAll, pg) if err != nil { log.Error(r.Context(), "Failed to get Failed to get app-serve-apps ", err) ErrorJSON(w, r, err) @@ -459,6 +482,12 @@ func (h *AppServeAppHandler) GetAppServeAppTasksByAppId(w http.ResponseWriter, r return } + projectId, ok := vars["projectId"] + if !ok { + ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("Invalid projectId: %s", projectId), "C_INVALID_PROJECT_ID", "")) + return + } + appId, ok := vars["appId"] if !ok { ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("Invalid appId: %s", appId), "C_INVALID_ASA_ID", "")) @@ -468,6 +497,15 @@ func (h *AppServeAppHandler) GetAppServeAppTasksByAppId(w http.ResponseWriter, r urlParams := r.URL.Query() pg := pagination.NewPagination(&urlParams) + // Check if projectId exists + prj, err := h.prjUsecase.GetProject(r.Context(), organizationId, projectId) + if err != nil { + ErrorJSON(w, r, httpErrors.NewInternalServerError(fmt.Errorf("Error while checking project record: %v", err), "", "")) + return + } else if prj == nil { + ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("projectId not found: %s", projectId), "C_INVALID_PROJECT_ID", "")) + } + tasks, err := h.usecase.GetAppServeAppTasks(r.Context(), appId, pg) if err != nil { log.Error(r.Context(), "Failed to get app-serve-app-tasks ", err) @@ -536,6 +574,15 @@ func (h *AppServeAppHandler) GetAppServeAppTaskDetail(w http.ResponseWriter, r * return } + // Check if projectId exists + prj, err := h.prjUsecase.GetProject(r.Context(), organizationId, projectId) + if err != nil { + ErrorJSON(w, r, httpErrors.NewInternalServerError(fmt.Errorf("Error while checking project record: %s", err), "", "")) + return + } else if prj == nil { + ErrorJSON(w, r, httpErrors.NewBadRequestError(fmt.Errorf("projectId not found: %s", projectId), "C_INVALID_PROJECT_ID", "")) + } + task, app, err := h.usecase.GetAppServeAppTaskById(r.Context(), taskId) if err != nil { ErrorJSON(w, r, httpErrors.NewInternalServerError(err, "", "")) diff --git a/internal/model/app-serve-app.go b/internal/model/app-serve-app.go index 4a9b2186..5291cd7c 100644 --- a/internal/model/app-serve-app.go +++ b/internal/model/app-serve-app.go @@ -2,6 +2,8 @@ package model import ( "time" + "github.com/google/uuid" + "gorm.io/gorm" ) type AppServeApp struct { @@ -52,3 +54,8 @@ type AppServeAppTask struct { UpdatedAt *time.Time `gorm:"autoUpdateTime:false" json:"updatedAt"` DeletedAt *time.Time `json:"deletedAt"` } + +func (t *AppServeAppTask) BeforeCreate(tx *gorm.DB) (err error) { + t.ID = uuid.New().String() + return nil +} diff --git a/internal/repository/app-serve-app.go b/internal/repository/app-serve-app.go index a37559ca..175fec41 100644 --- a/internal/repository/app-serve-app.go +++ b/internal/repository/app-serve-app.go @@ -15,7 +15,7 @@ import ( type IAppServeAppRepository interface { CreateAppServeApp(ctx context.Context, app *model.AppServeApp) (appId string, taskId string, err error) - GetAppServeApps(ctx context.Context, organizationId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error) + GetAppServeApps(ctx context.Context, organizationId string, projectId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error) GetAppServeAppById(ctx context.Context, appId string) (*model.AppServeApp, error) GetAppServeAppTasksByAppId(ctx context.Context, appId string, pg *pagination.Pagination) ([]model.AppServeAppTask, error) @@ -63,7 +63,7 @@ func (r *AppServeAppRepository) CreateTask(ctx context.Context, task *model.AppS return task.ID, nil } -func (r *AppServeAppRepository) GetAppServeApps(ctx context.Context, organizationId string, showAll bool, pg *pagination.Pagination) (apps []model.AppServeApp, err error) { +func (r *AppServeAppRepository) GetAppServeApps(ctx context.Context, organizationId string, projectId string, showAll bool, pg *pagination.Pagination) (apps []model.AppServeApp, err error) { var clusters []model.Cluster if pg == nil { pg = pagination.NewPagination(nil) @@ -71,9 +71,9 @@ func (r *AppServeAppRepository) GetAppServeApps(ctx context.Context, organizatio // TODO: should return different records based on showAll param _, res := pg.Fetch(r.db.WithContext(ctx).Model(&model.AppServeApp{}). - Where("app_serve_apps.organization_id = ? AND status <> 'DELETE_SUCCESS'", organizationId), &apps) + Where("app_serve_apps.project_id = ? AND status <> 'DELETE_SUCCESS'", projectId), &apps) if res.Error != nil { - return nil, fmt.Errorf("error while finding appServeApps with organizationId: %s", organizationId) + return nil, fmt.Errorf("error while finding appServeApps with projectId: %s", projectId) } // If no record is found, just return empty array. @@ -100,6 +100,10 @@ func (r *AppServeAppRepository) GetAppServeApps(ctx context.Context, organizatio return } +// //////////////////////////////////////////////////////////////////////////////////////// +// TODO: this API will'be deprecated soon once the new task-related API's are verified. +// Until then, this is available (except for stage info) just for backward compatibility. +// //////////////////////////////////////////////////////////////////////////////////////// func (r *AppServeAppRepository) GetAppServeAppById(ctx context.Context, appId string) (*model.AppServeApp, error) { var app model.AppServeApp var cluster model.Cluster diff --git a/internal/usecase/app-serve-app.go b/internal/usecase/app-serve-app.go index 28e76385..fa6efe24 100644 --- a/internal/usecase/app-serve-app.go +++ b/internal/usecase/app-serve-app.go @@ -25,7 +25,7 @@ import ( type IAppServeAppUsecase interface { CreateAppServeApp(ctx context.Context, app *model.AppServeApp) (appId string, taskId string, err error) - GetAppServeApps(ctx context.Context, organizationId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error) + GetAppServeApps(ctx context.Context, organizationId string, projectId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error) GetAppServeAppById(ctx context.Context, appId string) (*model.AppServeApp, error) GetAppServeAppTasks(ctx context.Context, appId string, pg *pagination.Pagination) ([]model.AppServeAppTask, error) GetAppServeAppTaskById(ctx context.Context, taskId string) (*model.AppServeAppTask, *model.AppServeApp, error) @@ -144,6 +144,7 @@ func (u *AppServeAppUsecase) CreateAppServeApp(ctx context.Context, app *model.A "strategy=" + app.AppServeAppTasks[0].Strategy, "app_type=" + app.AppType, "organization_id=" + app.OrganizationId, + "project_id=" + app.ProjectId, "target_cluster_id=" + app.TargetClusterId, "app_name=" + app.Name, "namespace=" + app.Namespace, @@ -180,10 +181,10 @@ func (u *AppServeAppUsecase) CreateAppServeApp(ctx context.Context, app *model.A return appId, app.Name, nil } -func (u *AppServeAppUsecase) GetAppServeApps(ctx context.Context, organizationId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error) { - apps, err := u.repo.GetAppServeApps(ctx, organizationId, showAll, pg) +func (u *AppServeAppUsecase) GetAppServeApps(ctx context.Context, organizationId string, projectId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error) { + apps, err := u.repo.GetAppServeApps(ctx, organizationId, projectId, showAll, pg) if err != nil { - fmt.Println(apps) + log.Debugf(ctx, "Apps: [%v]", apps) } return apps, nil @@ -398,6 +399,7 @@ func (u *AppServeAppUsecase) DeleteAppServeApp(ctx context.Context, appId string "asa_id=" + app.ID, "asa_task_id=" + taskId, "organization_id=" + app.OrganizationId, + "project_id=" + app.ProjectId, "tks_api_url=" + viper.GetString("external-address"), }, }) @@ -505,6 +507,7 @@ func (u *AppServeAppUsecase) UpdateAppServeApp(ctx context.Context, app *model.A "strategy=" + appTask.Strategy, "app_type=" + app.AppType, "organization_id=" + app.OrganizationId, + "project_id=" + app.ProjectId, "target_cluster_id=" + app.TargetClusterId, "app_name=" + app.Name, "namespace=" + app.Namespace, @@ -578,6 +581,7 @@ func (u *AppServeAppUsecase) PromoteAppServeApp(ctx context.Context, appId strin workflowId, err := u.argo.SumbitWorkflowFromWftpl(ctx, workflow, argowf.SubmitOptions{ Parameters: []string{ "organization_id=" + app.OrganizationId, + "project_id=" + app.ProjectId, "target_cluster_id=" + app.TargetClusterId, "app_name=" + app.Name, "namespace=" + app.Namespace, @@ -609,10 +613,7 @@ func (u *AppServeAppUsecase) AbortAppServeApp(ctx context.Context, appId string) // Get the latest task ID so that the task status can be modified inside workflow once the abort process is done. latestTaskId := app.AppServeAppTasks[0].ID - strategy := app.AppServeAppTasks[0].Strategy log.Info(ctx, "latestTaskId = ", latestTaskId) - log.Info(ctx, "strategy = ", strategy) - log.Info(ctx, "Updating app status to 'ABORTING'..") err = u.repo.UpdateStatus(ctx, appId, latestTaskId, "ABORTING", "") @@ -631,12 +632,12 @@ func (u *AppServeAppUsecase) AbortAppServeApp(ctx context.Context, appId string) workflowId, err := u.argo.SumbitWorkflowFromWftpl(ctx, workflow, argowf.SubmitOptions{ Parameters: []string{ "organization_id=" + app.OrganizationId, + "project_id=" + app.ProjectId, "target_cluster_id=" + app.TargetClusterId, "app_name=" + app.Name, "namespace=" + app.Namespace, "asa_id=" + app.ID, "asa_task_id=" + latestTaskId, - "strategy=" + strategy, "tks_api_url=" + viper.GetString("external-address"), }, })