// @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 a configmap with the specified name in the given namespace."
// @failure 500 "Server error occurred while attempting to retrieve a configmap by name within the specified namespace."
log.Error().Err(err).Str("context","getKubernetesConfigMap").Str("namespace",namespace).Msg("Unable to retrieve configMap identifier route variable")
returnhttperror.BadRequest("Unable to retrieve configMap identifier route variable",err)
}
cli,httpErr:=handler.getProxyKubeClient(r)
ifhttpErr!=nil{
log.Error().Err(httpErr).Str("context","getKubernetesConfigMap").Str("namespace",namespace).Str("configMap",configMapName).Msg("Unable to get a Kubernetes client for the user")
returnhttperror.InternalServerError("Unable to get a Kubernetes client for the user",httpErr)
log.Error().Err(err).Str("context","getKubernetesConfigMap").Str("namespace",namespace).Str("configMap",configMapName).Msg("Unauthorized access to the Kubernetes API")
returnhttperror.Forbidden("Unauthorized access to the Kubernetes API",err)
}
ifk8serrors.IsNotFound(err){
log.Error().Err(err).Str("context","getKubernetesConfigMap").Str("namespace",namespace).Str("configMap",configMapName).Msg("Unable to retrieve configMap")
returnhttperror.NotFound("Unable to retrieve configMap",err)
}
log.Error().Err(err).Str("context","getKubernetesConfigMap").Str("namespace",namespace).Str("configMap",configMapName).Msg("Unable to retrieve configMap")
returnhttperror.InternalServerError("Unable to retrieve configMap",err)
log.Error().Err(err).Str("context","getKubernetesConfigMap").Str("namespace",namespace).Str("configMap",configMapName).Msg("Unable to combine configMap with applications")
returnhttperror.InternalServerError("Unable to combine configMap with applications",err)
}
returnresponse.JSON(w,configMapWithApplications)
}
// @id GetAllKubernetesConfigMaps
// @summary Get a list of ConfigMaps
// @description Get a list of ConfigMaps across all namespaces in the cluster. For non-admin users, it will only return ConfigMaps based on the namespaces that they have access to.
// @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."
// @failure 500 "Server error occurred while attempting to retrieve all configmaps from the cluster."
// @description Get the count of ConfigMaps across all namespaces in the cluster. For non-admin users, it will only return the count of ConfigMaps based on the namespaces that they have access to.
// @param id path int true "Environment identifier"
// @success 200 {integer} integer "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."
// @failure 500 "Server error occurred while attempting to retrieve the count of all configmaps from the cluster."