From 9384f8f32fe62a7337f1816507f77b274021146d Mon Sep 17 00:00:00 2001 From: testA113 Date: Tue, 8 Oct 2024 12:05:29 +1300 Subject: [PATCH] update deletion docs --- api/http/handler/kubernetes/cluster_role_bindings.go | 10 +++++++--- api/http/handler/kubernetes/cluster_roles.go | 10 +++++++--- api/http/handler/kubernetes/role_bindings.go | 10 +++++++--- api/http/handler/kubernetes/roles.go | 10 +++++++--- api/http/handler/kubernetes/service_accounts.go | 10 +++++++--- 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/api/http/handler/kubernetes/cluster_role_bindings.go b/api/http/handler/kubernetes/cluster_role_bindings.go index 8e681e5cf..de98025b8 100644 --- a/api/http/handler/kubernetes/cluster_role_bindings.go +++ b/api/http/handler/kubernetes/cluster_role_bindings.go @@ -56,8 +56,12 @@ func (handler *Handler) getAllKubernetesClusterRoleBindings(w http.ResponseWrite // @produce text/plain // @param id path int true "Environment(Endpoint) identifier" // @param payload body kubernetes.K8sClusterRoleBindingDeleteRequests true "Cluster role bindings to delete" -// @success 200 "Success" -// @failure 500 "Server error" +// @success 204 "Success" +// @failure 400 "Invalid request payload, such as missing required fields or fields not meeting validation criteria." +// @failure 401 "Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions." +// @failure 403 "Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions." +// @failure 404 "Unable to find an environment with the specified identifier or unable to find a specific service." +// @failure 500 "Server error occurred while attempting to delete services." // @router /kubernetes/{id}/cluster_role_bindings/delete [POST] func (handler *Handler) deleteClusterRoleBindings(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { var payload models.K8sClusterRoleBindingDeleteRequests @@ -76,5 +80,5 @@ func (handler *Handler) deleteClusterRoleBindings(w http.ResponseWriter, r *http return httperror.InternalServerError("Failed to delete cluster role bindings", err) } - return nil + return response.Empty(w) } diff --git a/api/http/handler/kubernetes/cluster_roles.go b/api/http/handler/kubernetes/cluster_roles.go index 4ea5b09da..1cbe674f1 100644 --- a/api/http/handler/kubernetes/cluster_roles.go +++ b/api/http/handler/kubernetes/cluster_roles.go @@ -56,8 +56,12 @@ func (handler *Handler) getAllKubernetesClusterRoles(w http.ResponseWriter, r *h // @produce text/plain // @param id path int true "Environment(Endpoint) identifier" // @param payload body kubernetes.K8sClusterRoleDeleteRequests true "Cluster roles to delete" -// @success 200 "Success" -// @failure 500 "Server error" +// @success 204 "Success" +// @failure 400 "Invalid request payload, such as missing required fields or fields not meeting validation criteria." +// @failure 401 "Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions." +// @failure 403 "Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions." +// @failure 404 "Unable to find an environment with the specified identifier or unable to find a specific service." +// @failure 500 "Server error occurred while attempting to delete services." // @router /kubernetes/{id}/cluster_roles/delete [POST] func (handler *Handler) deleteClusterRoles(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { var payload models.K8sClusterRoleDeleteRequests @@ -76,5 +80,5 @@ func (handler *Handler) deleteClusterRoles(w http.ResponseWriter, r *http.Reques return httperror.InternalServerError("Failed to delete cluster roles", err) } - return nil + return response.Empty(w) } diff --git a/api/http/handler/kubernetes/role_bindings.go b/api/http/handler/kubernetes/role_bindings.go index ae7c163fa..208799815 100644 --- a/api/http/handler/kubernetes/role_bindings.go +++ b/api/http/handler/kubernetes/role_bindings.go @@ -51,8 +51,12 @@ func (handler *Handler) getAllKubernetesRoleBindings(w http.ResponseWriter, r *h // @produce text/plain // @param id path int true "Environment(Endpoint) identifier" // @param payload body models.K8sRoleDeleteRequests true "Role bindings to delete" -// @success 200 "Success" -// @failure 500 "Server error" +// @success 204 "Success" +// @failure 400 "Invalid request payload, such as missing required fields or fields not meeting validation criteria." +// @failure 401 "Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions." +// @failure 403 "Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions." +// @failure 404 "Unable to find an environment with the specified identifier or unable to find a specific service." +// @failure 500 "Server error occurred while attempting to delete services." // @router /kubernetes/{id}/role_bindings/delete [POST] func (h *Handler) deleteRoleBindings(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { var payload models.K8sRoleBindingDeleteRequests @@ -70,5 +74,5 @@ func (h *Handler) deleteRoleBindings(w http.ResponseWriter, r *http.Request) *ht return httperror.InternalServerError("Failed to delete role bindings", err) } - return nil + return response.Empty(w) } diff --git a/api/http/handler/kubernetes/roles.go b/api/http/handler/kubernetes/roles.go index ee8fcdf59..088d327ef 100644 --- a/api/http/handler/kubernetes/roles.go +++ b/api/http/handler/kubernetes/roles.go @@ -51,8 +51,12 @@ func (handler *Handler) getAllKubernetesRoles(w http.ResponseWriter, r *http.Req // @produce text/plain // @param id path int true "Environment(Endpoint) identifier" // @param payload body kubernetes.K8sRoleDeleteRequests true "Roles to delete " -// @success 200 "Success" -// @failure 500 "Server error" +// @success 204 "Success" +// @failure 400 "Invalid request payload, such as missing required fields or fields not meeting validation criteria." +// @failure 401 "Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions." +// @failure 403 "Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions." +// @failure 404 "Unable to find an environment with the specified identifier or unable to find a specific service." +// @failure 500 "Server error occurred while attempting to delete services." // @router /kubernetes/{id}/roles/delete [POST] func (h *Handler) deleteRoles(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { var payload models.K8sRoleDeleteRequests @@ -71,5 +75,5 @@ func (h *Handler) deleteRoles(w http.ResponseWriter, r *http.Request) *httperror return httperror.InternalServerError("Failed to delete roles", err) } - return nil + return response.Empty(w) } diff --git a/api/http/handler/kubernetes/service_accounts.go b/api/http/handler/kubernetes/service_accounts.go index c5ade6bd8..3647a7c2d 100644 --- a/api/http/handler/kubernetes/service_accounts.go +++ b/api/http/handler/kubernetes/service_accounts.go @@ -51,8 +51,12 @@ func (handler *Handler) getAllKubernetesServiceAccounts(w http.ResponseWriter, r // @produce text/plain // @param id path int true "Environment(Endpoint) identifier" // @param payload body kubernetes.K8sServiceAccountDeleteRequests true "Service accounts to delete " -// @success 200 "Success" -// @failure 500 "Server error" +// @success 204 "Success" +// @failure 400 "Invalid request payload, such as missing required fields or fields not meeting validation criteria." +// @failure 401 "Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions." +// @failure 403 "Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions." +// @failure 404 "Unable to find an environment with the specified identifier or unable to find a specific service." +// @failure 500 "Server error occurred while attempting to delete services." // @router /kubernetes/{id}/service_accounts/delete [POST] func (handler *Handler) deleteKubernetesServiceAccounts(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { var payload models.K8sServiceAccountDeleteRequests @@ -71,5 +75,5 @@ func (handler *Handler) deleteKubernetesServiceAccounts(w http.ResponseWriter, r return httperror.InternalServerError("Unable to delete service accounts", err) } - return nil + return response.Empty(w) }