controlplane

package
v0.0.0-...-23e6e85 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToEventQueue

func AddToEventQueue(data APICPEvent)

AddToEventQueue adds the api event to queue

func GetLabelQueue

func GetLabelQueue() *chan APICRLabelsUpdate

GetLabelQueue adds the label change to queue

func IsAPIHashQueued

func IsAPIHashQueued(dpHash string) bool

IsAPIHashQueued check whether the API related to the dpHash already in the queue for the update

Types

type AIConfiguration

type AIConfiguration struct {
	LLMProviderID         string `json:"llmProviderID"`
	LLMProviderName       string `json:"llmProviderName"`
	LLMProviderAPIVersion string `json:"llmProviderAPIVersion"`
}

AIConfiguration holds the AI configuration

type AIRL

type AIRL struct {
	PromptTokenCount     *uint32 `json:"promptTokenCount"`
	CompletionTokenCount *uint32 `json:"CompletionTokenCount"`
	TotalTokenCount      *uint32 `json:"totalTokenCount"`
	TimeUnit             string  `json:"timeUnit"`
	RequestCount         *uint32 `json:"requestCount"`
}

AIRL holds AI ratelimit related data

type API

type API struct {
	APIUUID              string            `json:"apiUUID"`
	APIName              string            `json:"apiName"`
	APIVersion           string            `json:"apiVersion"`
	IsDefaultVersion     bool              `json:"isDefaultVersion"`
	Definition           string            `json:"definition"`
	APIType              string            `json:"apiType"`
	APISubType           string            `json:"apiSubType"`
	BasePath             string            `json:"basePath"`
	Organization         string            `json:"organization"`
	SystemAPI            bool              `json:"systemAPI"`
	APIProperties        map[string]string `json:"apiProperties,omitempty"`
	Environment          string            `json:"environment,omitempty"`
	RevisionID           string            `json:"revisionID"`
	SandEndpoint         string            `json:"sandEndpoint"`
	SandEndpointSecurity EndpointSecurity  `json:"sandEndpointSecurity"`
	ProdEndpoint         string            `json:"prodEndpoint"`
	ProdEndpointSecurity EndpointSecurity  `json:"prodEndpointSecurity"`
	EndpointProtocol     string            `json:"endpointProtocol"`
	CORSPolicy           *CORSPolicy       `json:"cORSPolicy,omitempty"`
	Vhost                string            `json:"vhost"`
	SandVhost            string            `json:"sandVhost"`
	SecurityScheme       []string          `json:"securityScheme"`
	AuthHeader           string            `json:"authHeader"`
	APIKeyHeader         string            `json:"apiKeyHeader"`
	Operations           []Operation       `json:"operations"`
	AIConfiguration      AIConfiguration   `json:"aiConfiguration"`
	APIHash              string            `json:"-"`
	SandAIRL             *AIRL             `json:"sandAIRL"`
	ProdAIRL             *AIRL             `json:"prodAIRL"`
}

API holds the data that needs to be sent to agent

type APICPEvent

type APICPEvent struct {
	Event       EventType `json:"event"`
	API         API       `json:"payload"`
	CRName      string    `json:"-"`
	CRNamespace string    `json:"-"`
}

APICPEvent represents data for the control plane API.

type APICRLabelsUpdate

type APICRLabelsUpdate struct {
	Namespace string
	Name      string
	Labels    map[string]string
}

APICRLabelsUpdate hold the label update required for a specific API CR

type CORSPolicy

type CORSPolicy struct {
	AccessControlAllowCredentials bool     `json:"accessControlAllowCredentials,omitempty"`
	AccessControlAllowHeaders     []string `json:"accessControlAllowHeaders,omitempty"`
	AccessControlAllowOrigins     []string `json:"accessControlAllowOrigins,omitempty"`
	AccessControlExposeHeaders    []string `json:"accessControlExposeHeaders,omitempty"`
	AccessControlMaxAge           *int     `json:"accessControlMaxAge,omitempty"`
	AccessControlAllowMethods     []string `json:"accessControlAllowMethods,omitempty"`
}

CORSPolicy hold cors configs

type EndpointSecurity

type EndpointSecurity struct {
	Enabled       bool   `json:"enabled"`
	SecurityType  string `json:"securityType"`
	APIKeyName    string `json:"apiKeyName"`
	APIKeyValue   string `json:"apiKeyValue"`
	APIKeyIn      string `json:"apiKeyIn"`
	BasicUsername string `json:"basicUsername"`
	BasicPassword string `json:"basicPassword"`
}

EndpointSecurity holds the endpoint security information

type EventType

type EventType string

EventType represents the type of event.

const (
	// EventTypeCreate signifies a create event.
	EventTypeCreate EventType = "CREATE"
	// EventTypeUpdate signifies an update event.
	EventTypeUpdate EventType = "UPDATE"
	// EventTypeDelete signifies a delete event.
	EventTypeDelete EventType = "DELETE"
)
type Header struct {
	Name  string `json:"headerName"`
	Value string `json:"headerValue,omitempty"`
}

Header contains the header information

type HeaderModifier

type HeaderModifier struct {
	AddHeaders    []Header `json:"addHeaders"`
	RemoveHeaders []string `json:"removeHeaders"`
}

HeaderModifier contains header modifier values

type Headers

type Headers struct {
	RequestHeaders  HeaderModifier `json:"requestHeaders"`
	ResponseHeaders HeaderModifier `json:"responseHeaders"`
}

Headers contains the request and response header modifier information

type Operation

type Operation struct {
	Path    string   `json:"path"`
	Verb    string   `json:"verb"`
	Scopes  []string `json:"scopes"`
	Headers Headers  `json:"headers"`
}

Operation holds the path, verb, throttling and interceptor policy

Jump to

Keyboard shortcuts

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