Documentation
¶
Overview ¶
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *
Index ¶
- Constants
- func AddToEventQueue(data APICPEvent)
- func GetLabelQueue() *chan APICRLabelsUpdate
- func InvokeControlPlane(req *http.Request, skipSSL bool) (*http.Response, error)
- func InvokeService(endpoint string, responseType interface{}, queryParamMap map[string]string, ...)
- type AIConfiguration
- type AIModelBasedRoundRobin
- type AIModelWeight
- type AIRL
- type API
- type APICPEvent
- type APICRLabelsUpdate
- type APIEndpoints
- type Agent
- type Application
- type ApplicationList
- type ApplicationMapping
- type ApplicationMappingList
- type ArtifactDeployer
- type CORSPolicy
- type EndpointConfig
- type EndpointSecurity
- type EventType
- type Header
- type HeaderModifier
- type Headers
- type K8sArtifactDeployer
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteAllApplicationMappings() error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteAllKeyMappings() error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteAllSubscriptions() error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteApplication(applicationID string) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteApplicationMappings(applicationMapping string) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteKeyMappings(keyMapping model.ApplicationKeyMapping) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeleteSubscription(subscriptionID string) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllApplicationMappings(applicationMappings model.ApplicationMappingList) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllApplications(applications model.ApplicationList) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllKeyMappings(keyMappings model.ApplicationKeyMappingList) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllSubscriptions(subscriptions model.SubscriptionList) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployApplication(application model.Application) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployApplicationMappings(applicationMapping model.ApplicationMapping) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeployKeyMappings(keyMapping model.ApplicationKeyMapping) error
- func (k8sArtifactDeployer K8sArtifactDeployer) DeploySubscription(subscription model.Subscription) error
- func (k8sArtifactDeployer K8sArtifactDeployer) GetAllApplicationMappings() (model.ApplicationMappingList, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetAllApplications() (model.ApplicationList, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetAllKeyMappings() (model.ApplicationKeyMappingList, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetAllSubscriptions() (model.SubscriptionList, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetApplication(applicationID string) (model.Application, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetApplicationMappings(applicationID string) (model.ApplicationMapping, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetKeyMappings(applicationID string) (model.ApplicationKeyMapping, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) GetSubscription(subscriptionID string) (model.Subscription, error)
- func (k8sArtifactDeployer K8sArtifactDeployer) UpdateApplication(application model.Application) error
- func (k8sArtifactDeployer K8sArtifactDeployer) UpdateApplicationMappings(applicationMapping model.ApplicationMapping) error
- func (k8sArtifactDeployer K8sArtifactDeployer) UpdateKeyMappings(keyMapping model.ApplicationKeyMapping) error
- func (k8sArtifactDeployer K8sArtifactDeployer) UpdateSubscription(subscription model.Subscription) error
- type Operation
- type Property
- type SecurityScheme
- type SubscribedAPI
- type Subscription
- type SubscriptionList
Constants ¶
const (
// CreationTimeStamp constant for annotation creationTimeStamp
CreationTimeStamp = "creationTimeStamp"
)
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 InvokeControlPlane ¶
InvokeControlPlane sends request to the control plane and returns the response
Types ¶
type AIConfiguration ¶
type AIConfiguration struct { LLMProviderID string `json:"llmProviderID"` LLMProviderName string `json:"llmProviderName"` LLMProviderAPIVersion string `json:"llmProviderAPIVersion"` }
AIConfiguration holds the AI configuration
type AIModelBasedRoundRobin ¶
type AIModelBasedRoundRobin struct { OnQuotaExceedSuspendDuration int `json:"onQuotaExceedSuspendDuration,omitempty"` ProductionModels []AIModelWeight `json:"productionModels"` SandboxModels []AIModelWeight `json:"sandboxModels"` }
AIModelBasedRoundRobin holds the model based round robin configurations
type AIModelWeight ¶
type AIModelWeight struct { Model string `json:"model"` Endpoint string `json:"endpoint"` Weight int `json:"weight,omitempty"` }
AIModelWeight holds the model configurations
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"` MultiEndpoints APIEndpoints `json:"multiEndpoints"` AIModelBasedRoundRobin *AIModelBasedRoundRobin `json:"modelBasedRoundRobin"` }
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 ¶
APICRLabelsUpdate hold the label update required for a specific API CR
type APIEndpoints ¶
type APIEndpoints struct { Protocol string ProdEndpoints []EndpointConfig SandEndpoints []EndpointConfig }
APIEndpoints holds the common protocol and a list of endpoint configurations.
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is a struct that implements Agent interface
func NewControlPlaneAgent ¶
func NewControlPlaneAgent(hostname string, port int, controlPlaneID string, artifactDeployer ArtifactDeployer) *Agent
NewControlPlaneAgent creates a new ControlPlaneAgent
func (*Agent) StartEventStreaming ¶
func (controlPlaneGrpcClient *Agent) StartEventStreaming()
StartEventStreaming starts event streaming
type Application ¶
type Application struct { UUID string `json:"uuid,omitempty"` Name string `json:"name,omitempty"` Owner string `json:"owner,omitempty"` Organization string `json:"organization,omitempty"` Attributes map[string]string `json:"attributes,omitempty"` TimeStamp int64 `json:"timeStamp,omitempty"` SecuritySchemes []SecurityScheme `json:"securitySchemes,omitempty"` }
Application for struct application
type ApplicationList ¶
type ApplicationList struct {
List []Application `json:"list"`
}
ApplicationList for struct list of application
type ApplicationMapping ¶
type ApplicationMapping struct { UUID string `json:"uuid,omitempty"` ApplicationRef string `json:"applicationRef,omitempty"` SubscriptionRef string `json:"subscriptionRef,omitempty"` Organization string `json:"organization,omitempty"` }
ApplicationMapping for struct applicationMapping
type ApplicationMappingList ¶
type ApplicationMappingList struct {
List []ApplicationMapping `json:"list"`
}
ApplicationMappingList for struct list of applicationMapping
type ArtifactDeployer ¶
type ArtifactDeployer interface { DeployApplication(application model.Application) error UpdateApplication(application model.Application) error DeploySubscription(subscription model.Subscription) error UpdateSubscription(subscription model.Subscription) error DeployApplicationMappings(applicationMapping model.ApplicationMapping) error UpdateApplicationMappings(applicationMapping model.ApplicationMapping) error DeployKeyMappings(keyMapping model.ApplicationKeyMapping) error UpdateKeyMappings(keyMapping model.ApplicationKeyMapping) error GetApplication(applicationID string) (model.Application, error) GetSubscription(subscriptionID string) (model.Subscription, error) GetApplicationMappings(applicationID string) (model.ApplicationMapping, error) GetKeyMappings(applicationID string) (model.ApplicationKeyMapping, error) GetAllApplications() (model.ApplicationList, error) GetAllSubscriptions() (model.SubscriptionList, error) GetAllApplicationMappings() (model.ApplicationMappingList, error) GetAllKeyMappings() (model.ApplicationKeyMappingList, error) DeleteApplication(applicationID string) error DeleteSubscription(subscriptionID string) error DeleteApplicationMappings(applicationID string) error DeleteKeyMappings(keyMapping model.ApplicationKeyMapping) error DeployAllApplications(applications model.ApplicationList) error DeployAllSubscriptions(subscriptions model.SubscriptionList) error DeployAllApplicationMappings(applicationMappings model.ApplicationMappingList) error DeployAllKeyMappings(keyMappings model.ApplicationKeyMappingList) error }
ArtifactDeployer is an interface that defines the methods that should be implemented by an artifact deployer
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 EndpointConfig ¶
type EndpointConfig struct { URL string SecurityType string SecurityEnabled bool APIKeyName string APIKeyIn string APIKeyValue string BasicUsername string BasicPassword string }
EndpointConfig holds endpoint-specific settings.
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 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 K8sArtifactDeployer ¶
type K8sArtifactDeployer struct {
// contains filtered or unexported fields
}
K8sArtifactDeployer is a struct that implements ArtifactDeployer interface
func NewK8sArtifactDeployer ¶
func NewK8sArtifactDeployer(mgr manager.Manager) K8sArtifactDeployer
NewK8sArtifactDeployer creates a new K8sArtifactDeployer
func (K8sArtifactDeployer) DeleteAllApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteAllApplicationMappings() error
DeleteAllApplicationMappings deletes all application mappings
func (K8sArtifactDeployer) DeleteAllKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteAllKeyMappings() error
DeleteAllKeyMappings deletes all key mappings
func (K8sArtifactDeployer) DeleteAllSubscriptions ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteAllSubscriptions() error
DeleteAllSubscriptions deletes all subscriptions
func (K8sArtifactDeployer) DeleteApplication ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteApplication(applicationID string) error
DeleteApplication deletes an application
func (K8sArtifactDeployer) DeleteApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteApplicationMappings(applicationMapping string) error
DeleteApplicationMappings deletes an application mapping
func (K8sArtifactDeployer) DeleteKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteKeyMappings(keyMapping model.ApplicationKeyMapping) error
DeleteKeyMappings deletes a key mapping
func (K8sArtifactDeployer) DeleteSubscription ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeleteSubscription(subscriptionID string) error
DeleteSubscription deletes a subscription
func (K8sArtifactDeployer) DeployAllApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllApplicationMappings(applicationMappings model.ApplicationMappingList) error
DeployAllApplicationMappings deploys all application mappings
func (K8sArtifactDeployer) DeployAllApplications ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllApplications(applications model.ApplicationList) error
DeployAllApplications deploys all key mappings
func (K8sArtifactDeployer) DeployAllKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllKeyMappings(keyMappings model.ApplicationKeyMappingList) error
DeployAllKeyMappings deploys all key mappings
func (K8sArtifactDeployer) DeployAllSubscriptions ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllSubscriptions(subscriptions model.SubscriptionList) error
DeployAllSubscriptions deploys all subscriptions
func (K8sArtifactDeployer) DeployApplication ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployApplication(application model.Application) error
DeployApplication deploys an application
func (K8sArtifactDeployer) DeployApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployApplicationMappings(applicationMapping model.ApplicationMapping) error
DeployApplicationMappings deploys an application mapping
func (K8sArtifactDeployer) DeployKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeployKeyMappings(keyMapping model.ApplicationKeyMapping) error
DeployKeyMappings deploys a key mapping
func (K8sArtifactDeployer) DeploySubscription ¶
func (k8sArtifactDeployer K8sArtifactDeployer) DeploySubscription(subscription model.Subscription) error
DeploySubscription deploys a subscription
func (K8sArtifactDeployer) GetAllApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetAllApplicationMappings() (model.ApplicationMappingList, error)
GetAllApplicationMappings returns all application mappings
func (K8sArtifactDeployer) GetAllApplications ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetAllApplications() (model.ApplicationList, error)
GetAllApplications returns all applications
func (K8sArtifactDeployer) GetAllKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetAllKeyMappings() (model.ApplicationKeyMappingList, error)
GetAllKeyMappings returns all key mappings
func (K8sArtifactDeployer) GetAllSubscriptions ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetAllSubscriptions() (model.SubscriptionList, error)
GetAllSubscriptions returns all subscriptions
func (K8sArtifactDeployer) GetApplication ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetApplication(applicationID string) (model.Application, error)
GetApplication returns an application
func (K8sArtifactDeployer) GetApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetApplicationMappings(applicationID string) (model.ApplicationMapping, error)
GetApplicationMappings returns an application mapping
func (K8sArtifactDeployer) GetKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetKeyMappings(applicationID string) (model.ApplicationKeyMapping, error)
GetKeyMappings returns a key mapping
func (K8sArtifactDeployer) GetSubscription ¶
func (k8sArtifactDeployer K8sArtifactDeployer) GetSubscription(subscriptionID string) (model.Subscription, error)
GetSubscription returns a subscription
func (K8sArtifactDeployer) UpdateApplication ¶
func (k8sArtifactDeployer K8sArtifactDeployer) UpdateApplication(application model.Application) error
UpdateApplication updates an application
func (K8sArtifactDeployer) UpdateApplicationMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) UpdateApplicationMappings(applicationMapping model.ApplicationMapping) error
UpdateApplicationMappings updates an application mapping
func (K8sArtifactDeployer) UpdateKeyMappings ¶
func (k8sArtifactDeployer K8sArtifactDeployer) UpdateKeyMappings(keyMapping model.ApplicationKeyMapping) error
UpdateKeyMappings updates a key mapping
func (K8sArtifactDeployer) UpdateSubscription ¶
func (k8sArtifactDeployer K8sArtifactDeployer) UpdateSubscription(subscription model.Subscription) error
UpdateSubscription updates a subscription
type Operation ¶
type Operation struct { Path string `json:"path"` Verb string `json:"verb"` Scopes []string `json:"scopes"` Headers Headers `json:"headers"` AIModelBasedRoundRobin *AIModelBasedRoundRobin `json:"modelBasedRoundRobin"` }
Operation holds the path, verb, throttling and interceptor policy
type SecurityScheme ¶
type SecurityScheme struct { SecurityScheme string `json:"securityScheme,omitempty"` ApplicationIdentifier string `json:"applicationIdentifier,omitempty"` KeyType string `json:"keyType,omitempty"` EnvID string `json:"envID,omitempty"` }
SecurityScheme for struct securityScheme
type SubscribedAPI ¶
type SubscribedAPI struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` }
SubscribedAPI for struct subscribedAPI
type Subscription ¶
type Subscription struct { SubStatus string `json:"subStatus,omitempty"` UUID string `json:"uuid,omitempty"` Organization string `json:"organization,omitempty"` SubscribedAPI *SubscribedAPI `json:"subscribedApi,omitempty"` TimeStamp int64 `json:"timeStamp,omitempty"` }
Subscription for struct subscription
type SubscriptionList ¶
type SubscriptionList struct {
List []Subscription `json:"list"`
}
SubscriptionList for struct list of applications