khota_handler

package
v0.0.0-...-f8061e0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package base62 provides utilities for working with base62 strings. base62 strings will only contain characters: 0-9, a-z, A-Z

Index

Constants

View Source
const (
	ApplicationCreationFailEvent eventType = `` /* 152-byte string literal not displayed */

	ApplicationCreationSuccessEvent eventType = `` /* 154-byte string literal not displayed */

)
View Source
const (
	ConfigGetFail string = "Config get failed for customer"
)

config

Variables

This section is empty.

Functions

func AddRemoveDataPlane

func AddRemoveDataPlane(w http.ResponseWriter, req *http.Request)

func Base62Random

func Base62Random(length int) (string, error)

Random generates a random string using base-62 characters. Resulting entropy is ~5.95 bits/character.

func CreateApplication

func CreateApplication(w http.ResponseWriter, req *http.Request)

func CreateCustomer

func CreateCustomer(w http.ResponseWriter, req *http.Request)

CreateCustomer handles creating a customer

func CreateDataPlane

func CreateDataPlane(w http.ResponseWriter, req *http.Request)

func CreateTenant

func CreateTenant(w http.ResponseWriter, req *http.Request)

func CreateTenantInfra

func CreateTenantInfra(w http.ResponseWriter, req *http.Request)

func DeleteApplicationStatus

func DeleteApplicationStatus(w http.ResponseWriter, req *http.Request)

func DeleteDataPlane

func DeleteDataPlane(w http.ResponseWriter, req *http.Request)

func GetAllTenantInCustomer

func GetAllTenantInCustomer(w http.ResponseWriter, req *http.Request)

func GetApplicationStatus

func GetApplicationStatus(w http.ResponseWriter, req *http.Request)

func GetDataPlaneStatus

func GetDataPlaneStatus(w http.ResponseWriter, req *http.Request)

func GetKubeConfig

func GetKubeConfig(w http.ResponseWriter, req *http.Request)

func GetTenantInfra

func GetTenantInfra(w http.ResponseWriter, req *http.Request)

func JsonWrap

func JsonWrap(data string) ([]byte, error)

func ListCustomer

func ListCustomer(w http.ResponseWriter, req *http.Request)

ListCustomer handles listing customers

func ListDataPlane

func ListDataPlane(w http.ResponseWriter, req *http.Request)

func NewPatchValue

func NewPatchValue(op, path string, value interface{}) []byte

constructor for patchValue{}

func NewRouter

func NewRouter() *mux.Router

NewRouter returns a new router

func Ptr

func Ptr[T any](v T) *T

func RandomWithReader

func RandomWithReader(length int, reader io.Reader) (string, error)

RandomWithReader generates a random string using base-62 characters and a given reader. Resulting entropy is ~5.95 bits/character.

func String

func String(length int) string

func UpdateCustomer

func UpdateCustomer(w http.ResponseWriter, req *http.Request)

UpdateCustomer handles updating a customer

func UpdateDataPlane

func UpdateDataPlane(w http.ResponseWriter, req *http.Request)

Types

type CustomMsg

type CustomMsg string
const (
	ServerUnmarshallError CustomMsg = "Server json unmarshal error"
	ServerBodyCloseError  CustomMsg = "Server body close error"
	ServerReqSizeExceed   CustomMsg = "Server req size exceed error"
)

Server

const (
	CustomerNamespaceExists          CustomMsg = "Customer namespace exists"
	CustomerNamespaceDoesNotExists   CustomMsg = "Customer namespace doesn't exist"
	CustomerNamespaceSuccess         CustomMsg = "Customer namespace create success"
	CustomerNamespaceGetFail         CustomMsg = "Customer namespace get fail"
	CustomerNamespaceUpdateSuccess   CustomMsg = "Customer namespace update success"
	CustomerNamespaceUpdateFail      CustomMsg = "Customer namespace update failed"
	CustomerNamespaceCreateFail      CustomMsg = "Customer namespace create failed"
	CustomerNamespaceListEmpty       CustomMsg = "Customer namespace list empty"
	CustomerNamespaceList            CustomMsg = "Customer namespace list"
	CustomerServiceAccountCreateFail CustomMsg = "Customer service account creation failed."
	CustomerNotExistInDataplane      CustomMsg = "Customer not exist in dataplane"
)

Customer

const (
	DataPlaneCreateFail                   CustomMsg = "DataPlane create fail"
	DataPlaneCreateIntiated               CustomMsg = "DataPlane creation initiated"
	DataPlaneGetFail                      CustomMsg = "DataPlane get fail"
	DataPlaneListFail                     CustomMsg = "DataPlane list fail"
	DataplaneDeletionInitiated            CustomMsg = "Dataplane delete intiated"
	DataplaneDeletionFailed               CustomMsg = "Dataplane delete failed"
	DataplaneDeletionFailedCustomerExists CustomMsg = "Dataplane delete failed, customer exists on dataplane"
	DataplaneAddedSuccess                 CustomMsg = "Dataplane added success"
	DataplaneRemoveSuccess                CustomMsg = "Dataplane remove success"
	DataplanePatchFail                    CustomMsg = "Dataplane patch fail"
	DataplaneUpdateSuccess                CustomMsg = "Dataplane updated successfully"
	DataplaneUpdateFail                   CustomMsg = "Dataplane update fail"
)

DataPlane

const (
	TenantCreateFail                   CustomMsg = "Tenant creation  fail"
	TenantCreateIntiated               CustomMsg = "Tenant creation success"
	TenantCreateFailDataplaneNotActive CustomMsg = "Tenant creation failed, Dataplane is not Active"
	TenantGetFail                      CustomMsg = "Tenant get fail"
	TenantListFail                     CustomMsg = "Tenant list fail"
)

Tenant

const (
	TenantsInfraCreateFail                  CustomMsg = "TenantsInfra creation Failed"
	TenantsInfraGetFail                     CustomMsg = "TenantsInfra get Failed"
	TenantsInfraCreateSuccess               CustomMsg = "TenantsInfra creation Success"
	TenantInfraUpdateSuccess                CustomMsg = "TenantsInfra update Success"
	TenantInfraCreateFailDataplaneNotActive CustomMsg = "TenantsInfra creation Failed, Dataplane is not Active"
)

TenantsInfra

const (
	ApplicationCreateFail     CustomMsg = "Application creation fail"
	ApplicationCreateIntiated CustomMsg = "Application creation initiated"
	ApplicationGetFail        CustomMsg = "Application get fail"
	ApplicationDeleteFail     CustomMsg = "Application delete fail"
	ApplicationDeleteIntiated CustomMsg = "Application delete initiated"
	ApplicationUpdateSuccess  CustomMsg = "Application update success"
	ApplicationUpdateFail     CustomMsg = "Application update failed"
)

Application

const (
	JsonMarshallError CustomMsg = "Json Marshall Error"
)

Json

type CustomerListResponse

type CustomerListResponse struct {
	Name      string            `json:"name"`
	SaaSType  string            `json:"saas_type"`
	CloudType string            `json:"cloud_type"`
	Status    string            `json:"status"`
	Dataplane string            `json:"dataplane"`
	Labels    map[string]string `json:"labels"`
}

type KubeConfig

type KubeConfig struct {
	CurrentContext string `json:"current_context"`
	Customer       string `json:"customer"`
	Namespace      string `json:"namespace"`
	ClusterCA      string `json:"cluster_ca"`
	ClusterServer  string `json:"cluster_server"`
	UserTokenValue string `json:"user_token_value"`
}

func NewKubeConfig

func NewKubeConfig(
	customerName string,
	clientset *kubernetes.Clientset,
) (*KubeConfig, error)

type Response

type Response struct {
	Msg        CustomMsg
	Status     string
	StatusCode int
	Err        error
}

func NewResponse

func NewResponse(msg CustomMsg, status string, err error, statusCode int) *Response

func (*Response) LogResponse

func (res *Response) LogResponse()

func (*Response) SetMsgResponse

func (res *Response) SetMsgResponse(w *http.ResponseWriter)

func (*Response) SetResponse

func (res *Response) SetResponse(w *http.ResponseWriter)

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route object

type Routes

type Routes []Route

Routes is a slice of Route

Jump to

Keyboard shortcuts

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