routes

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2023 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

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.

func Run

func Run(router *chi.Mux, client client.Client, agent proxy.QueryClient)

Run starts the HTTP server with the provided router and client. It listens on port 5000 and handles incoming requests. If an error occurs while starting the server, it panics.

Types

type ChannType

type ChannType int8
const (
	BI_CHANN  ChannType = 0
	TRI_CHANN ChannType = 1
)

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL