Documentation ¶
Index ¶
- func CreateNamespace(client client.Client) http.HandlerFunc
- func DeleteNamespace(client client.Client) http.HandlerFunc
- func GetQueryHandler(c proxy.QueryClient, ct ChannType) http.HandlerFunc
- func GetSampleDataset(client client.Client) http.HandlerFunc
- func ListNamespaces(client client.Client) http.HandlerFunc
- func Run(router *chi.Mux, client client.Client, agent proxy.QueryClient)
- type ChannType
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNamespace ¶
func CreateNamespace(client client.Client) http.HandlerFunc
CreateNamespace returns an HTTP handler function that handles POST requests to create a new namespace. The handler function reads the namespace parameter from the request URL. It calls the proxy.CreateNamespace function to create the namespace using the provided client and namespace name. If the namespace already exists, it writes an error response with the status code 409. If the creation fails, it writes an error response with the corresponding status code and error message. If successful, it writes a response with the status code 200.
func DeleteNamespace ¶
func DeleteNamespace(client client.Client) http.HandlerFunc
DeleteNamespace returns an HTTP handler function that handles DELETE requests to delete a namespace. The handler function reads the namespace parameter from the request URL. It calls the proxy.DeleteNamespace function to delete the namespace using the provided client and namespace name. If the namespace is not found, it writes an error response with the status code 404. If the deletion fails, it writes an error response with the corresponding status code and error message. If successful, it writes a response with the status code 200.
func GetQueryHandler ¶
func GetQueryHandler(c proxy.QueryClient, ct ChannType) http.HandlerFunc
func GetSampleDataset ¶
func GetSampleDataset(client client.Client) http.HandlerFunc
GetSampleDataset returns an HTTP handler function for retrieving a sample dataset. It takes a client object of type client.Client for interacting with the Kubernetes API. The handler function retrieves the sample dataset based on the provided namespace and dataset name. It calls the proxy.GetSampleDataset function and writes the dataset to the response. If there is an error during the retrieval process, it returns an HTTP 500 status with an error message.
func ListNamespaces ¶
func ListNamespaces(client client.Client) http.HandlerFunc
ListNamespaces returns an HTTP handler function that handles GET requests to fetch a list of namespaces. The handler function calls the proxy.ListNamespaces function to retrieve the namespaces using the provided client. If successful, it encodes the namespace list as JSON and writes it to the response. If an error occurs, it writes an error response with the corresponding status code and error message.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message,omitempty"`
}