Documentation ¶
Overview ¶
Package xds contains the implementation for the xds server cache updates
Index ¶
- Variables
- func CheckIfAPIMetadataIsAlreadyAvailable(apiUUID, label string) bool
- func DeleteAPIAndReturnList(apiUUID, organizationUUID string, gatewayLabel string) *subscription.APIList
- func DeleteAPIWithAPIMEvent(uuid, organizationID string, environments []string, revisionUUID string)
- func DeleteAPIs(vhost, apiName, version string, environments []string, organizationID string) error
- func DeleteAPIsWithUUID(vhost, uuid string, environments []string, organizationID string) error
- func DeployReadinessAPI(envs []string)
- func ExtractVhostFromAPIIdentifier(id string) (string, error)
- func GenerateAndUpdateKeyManagerList()
- func GenerateEnvoyResoucesForLabel(label string) ([]types.Resource, []types.Resource, []types.Resource, []types.Resource, ...)
- func GenerateGlobalClusters(label string)
- func GenerateHashedAPINameVersionIDWithoutVhost(name, version string) string
- func GenerateIdentifierForAPI(vhost, name, version string) string
- func GenerateIdentifierForAPIWithUUID(vhost, uuid string) string
- func GenerateIdentifierForAPIWithoutVhost(name, version string) string
- func GetAllEnvironments(apiUUID, vhost string, newEnvironments []string) []string
- func GetApplicationKeyMappingReference(keyMapping *types.ApplicationKeyMapping) string
- func GetDeployedEnvironments(apiUUID string) []string
- func GetEnforcerAPICache() wso2_cache.SnapshotCache
- func GetEnforcerApplicationCache() wso2_cache.SnapshotCache
- func GetEnforcerApplicationKeyMappingCache() wso2_cache.SnapshotCache
- func GetEnforcerApplicationPolicyCache() wso2_cache.SnapshotCache
- func GetEnforcerCache() wso2_cache.SnapshotCache
- func GetEnforcerKeyManagerCache() wso2_cache.SnapshotCache
- func GetEnforcerRevokedTokenCache() wso2_cache.SnapshotCache
- func GetEnforcerSubscriptionCache() wso2_cache.SnapshotCache
- func GetEnforcerSubscriptionPolicyCache() wso2_cache.SnapshotCache
- func GetEnforcerThrottleDataCache() wso2_cache.SnapshotCache
- func GetLastSuccessState(label string) (*EnforcerAPIState, *RouterResourceState)
- func GetRequestEventChannel() chan RequestEvent
- func GetVhostOfAPI(apiUUID, environment string) (vhost string, exists bool)
- func GetXdsCache() envoy_cachev3.SnapshotCache
- func IsAPIExist(vhost, uuid, apiName, apiVersion, organizationID string) (exists bool)
- func ListApis(apiType string, organizationID string, limit *int64) *apiModel.APIMeta
- func MarshalAPIForLifeCycleChangeEventAndReturnList(apiUUID, status, gatewayLabel string) *subscription.APIList
- func MarshalAPIMetataAndReturnList(apiList *types.APIList, initialAPIUUIDListMap map[string]int, ...) *subscription.APIList
- func MarshalApplicationEventAndReturnList(application *types.Application, eventType EventType) *subscription.ApplicationList
- func MarshalApplicationKeyMappingEventAndReturnList(keyMapping *types.ApplicationKeyMapping, eventType EventType) *subscription.ApplicationKeyMappingList
- func MarshalApplicationPolicyEventAndReturnList(policy *types.ApplicationPolicy, eventType EventType) *subscription.ApplicationPolicyList
- func MarshalConfig(config *config.Config) *enforcer.Config
- func MarshalKeyManager(keyManager *types.KeyManager) *keymgt.KeyManagerConfig
- func MarshalMultipleApplicationKeyMappings(keymappingList *types.ApplicationKeyMappingList) *subscription.ApplicationKeyMappingList
- func MarshalMultipleApplicationPolicies(policies *types.ApplicationPolicyList) *subscription.ApplicationPolicyList
- func MarshalMultipleApplications(appList *types.ApplicationList) *subscription.ApplicationList
- func MarshalMultipleSubscriptionPolicies(policies *types.SubscriptionPolicyList) *subscription.SubscriptionPolicyList
- func MarshalMultipleSubscriptions(subscriptionsList *types.SubscriptionList) *subscription.SubscriptionList
- func MarshalSubscriptionEventAndReturnList(sub *types.Subscription, eventType EventType) *subscription.SubscriptionList
- func MarshalSubscriptionPolicyEventAndReturnList(policy *types.SubscriptionPolicy, eventType EventType) *subscription.SubscriptionPolicyList
- func SetSuccessState(label string, enforerSuccessState EnforcerAPIState, ...)
- func UpdateAPI(vHost string, apiProject model.ProjectAPI, environments []string) (*notifier.DeployedAPIRevision, error)
- func UpdateEnforcerAPIList(label string, apis *subscription.APIList)
- func UpdateEnforcerApis(label string, apis []types.Resource, version string)
- func UpdateEnforcerApplicationKeyMappings(applicationKeyMappings *subscription.ApplicationKeyMappingList)
- func UpdateEnforcerApplicationPolicies(applicationPolicies *subscription.ApplicationPolicyList)
- func UpdateEnforcerApplications(applications *subscription.ApplicationList)
- func UpdateEnforcerConfig(configFile *config.Config)
- func UpdateEnforcerKeyManagers(keyManagerConfigList []types.Resource)
- func UpdateEnforcerRevokedTokens(revokedTokens []types.Resource)
- func UpdateEnforcerSubscriptionPolicies(subscriptionPolicies *subscription.SubscriptionPolicyList)
- func UpdateEnforcerSubscriptions(subscriptions *subscription.SubscriptionList)
- func UpdateEnforcerThrottleData(throttleData *throttle.ThrottleData)
- func UpdateXdsCacheWithLock(label string, endpoints []types.Resource, clusters []types.Resource, ...) bool
- type EnforcerAPIState
- type EventType
- type IDHash
- type RequestEvent
- type RouterResourceState
Constants ¶
This section is empty.
Variables ¶
var ( // APIListMap has the following mapping label -> apiUUID -> API (Metadata) APIListMap map[string]map[string]*subscription.APIs // SubscriptionMap contains the subscriptions recieved from API Manager Control Plane SubscriptionMap map[int32]*subscription.Subscription // ApplicationMap contains the applications recieved from API Manager Control Plane ApplicationMap map[string]*subscription.Application // ApplicationKeyMappingMap contains the application key mappings recieved from API Manager Control Plane ApplicationKeyMappingMap map[string]*subscription.ApplicationKeyMapping // ApplicationPolicyMap contains the application policies recieved from API Manager Control Plane ApplicationPolicyMap map[int32]*subscription.ApplicationPolicy // SubscriptionPolicyMap contains the subscription policies recieved from API Manager Control Plane SubscriptionPolicyMap map[int32]*subscription.SubscriptionPolicy )
var ( // KeyManagerList to store data KeyManagerList = make([]eventhubTypes.KeyManager, 0) )
var ( // RequestEventChannel is the channel which communicates between callback and the server RequestEventChannel chan RequestEvent )
Functions ¶
func CheckIfAPIMetadataIsAlreadyAvailable ¶
CheckIfAPIMetadataIsAlreadyAvailable returns true only if the API Metadata for the given API UUID is already available
func DeleteAPIAndReturnList ¶
func DeleteAPIAndReturnList(apiUUID, organizationUUID string, gatewayLabel string) *subscription.APIList
DeleteAPIAndReturnList removes the API from internal maps and returns the marshalled API List. If the apiUUID is not found in the internal map under the provided environment, then it would return a nil value. Hence it is required to check if the return value is nil, prior to updating the XDS cache.
func DeleteAPIWithAPIMEvent ¶
func DeleteAPIWithAPIMEvent(uuid, organizationID string, environments []string, revisionUUID string)
DeleteAPIWithAPIMEvent deletes API with the given UUID from the given gw environments
func DeleteAPIs ¶
DeleteAPIs deletes an API, its resources and updates the caches of given environments
func DeleteAPIsWithUUID ¶
DeleteAPIsWithUUID deletes an API, its resources and updates the caches of given environments
func DeployReadinessAPI ¶
func DeployReadinessAPI(envs []string)
DeployReadinessAPI Method to set the status after the last api is fected and updated in router.
func ExtractVhostFromAPIIdentifier ¶
ExtractVhostFromAPIIdentifier extracts vhost from the API identifier
func GenerateAndUpdateKeyManagerList ¶
func GenerateAndUpdateKeyManagerList()
GenerateAndUpdateKeyManagerList converts the data into KeyManager proto type
func GenerateEnvoyResoucesForLabel ¶
func GenerateEnvoyResoucesForLabel(label string) ([]types.Resource, []types.Resource, []types.Resource, []types.Resource, []types.Resource)
GenerateEnvoyResoucesForLabel generates envoy resources for a given label This method will list out all APIs mapped to the label. and generate envoy resources for all of these APIs.
func GenerateGlobalClusters ¶
func GenerateGlobalClusters(label string)
GenerateGlobalClusters generates the globally available clusters and endpoints.
func GenerateHashedAPINameVersionIDWithoutVhost ¶
GenerateHashedAPINameVersionIDWithoutVhost generates a hashed identifier unique to the API Name and Version
func GenerateIdentifierForAPI ¶
GenerateIdentifierForAPI generates an identifier unique to the API
func GenerateIdentifierForAPIWithUUID ¶
GenerateIdentifierForAPIWithUUID generates an identifier unique to the API
func GenerateIdentifierForAPIWithoutVhost ¶
GenerateIdentifierForAPIWithoutVhost generates an identifier unique to the API name and version
func GetAllEnvironments ¶
GetAllEnvironments returns all the environments merging new environments with already deployed environments of the given vhost of the API
func GetApplicationKeyMappingReference ¶
func GetApplicationKeyMappingReference(keyMapping *types.ApplicationKeyMapping) string
GetApplicationKeyMappingReference returns unique reference for each key Mapping event. It is the combination of consumerKey:keyManager
func GetDeployedEnvironments ¶
GetDeployedEnvironments returns all the environments the API with `apiUUID` is deployed to
func GetEnforcerAPICache ¶
func GetEnforcerAPICache() wso2_cache.SnapshotCache
GetEnforcerAPICache returns xds server cache.
func GetEnforcerApplicationCache ¶
func GetEnforcerApplicationCache() wso2_cache.SnapshotCache
GetEnforcerApplicationCache returns xds server cache.
func GetEnforcerApplicationKeyMappingCache ¶
func GetEnforcerApplicationKeyMappingCache() wso2_cache.SnapshotCache
GetEnforcerApplicationKeyMappingCache returns xds server cache.
func GetEnforcerApplicationPolicyCache ¶
func GetEnforcerApplicationPolicyCache() wso2_cache.SnapshotCache
GetEnforcerApplicationPolicyCache returns xds server cache.
func GetEnforcerCache ¶
func GetEnforcerCache() wso2_cache.SnapshotCache
GetEnforcerCache returns xds server cache.
func GetEnforcerKeyManagerCache ¶
func GetEnforcerKeyManagerCache() wso2_cache.SnapshotCache
GetEnforcerKeyManagerCache returns xds server cache.
func GetEnforcerRevokedTokenCache ¶
func GetEnforcerRevokedTokenCache() wso2_cache.SnapshotCache
GetEnforcerRevokedTokenCache return token cache
func GetEnforcerSubscriptionCache ¶
func GetEnforcerSubscriptionCache() wso2_cache.SnapshotCache
GetEnforcerSubscriptionCache returns xds server cache.
func GetEnforcerSubscriptionPolicyCache ¶
func GetEnforcerSubscriptionPolicyCache() wso2_cache.SnapshotCache
GetEnforcerSubscriptionPolicyCache returns xds server cache.
func GetEnforcerThrottleDataCache ¶
func GetEnforcerThrottleDataCache() wso2_cache.SnapshotCache
GetEnforcerThrottleDataCache return throttle data cache
func GetLastSuccessState ¶
func GetLastSuccessState(label string) (*EnforcerAPIState, *RouterResourceState)
GetLastSuccessState returns the successful enforcer state and router state which belongs to the provided label
func GetRequestEventChannel ¶
func GetRequestEventChannel() chan RequestEvent
GetRequestEventChannel returns the state change channel. RequestEventChannel should be a singleton object
func GetVhostOfAPI ¶
GetVhostOfAPI returns the vhost of API deployed in the given gateway environment
func GetXdsCache ¶
func GetXdsCache() envoy_cachev3.SnapshotCache
GetXdsCache returns xds server cache.
func IsAPIExist ¶
IsAPIExist returns whether a given API exists
func MarshalAPIForLifeCycleChangeEventAndReturnList ¶
func MarshalAPIForLifeCycleChangeEventAndReturnList(apiUUID, status, gatewayLabel string) *subscription.APIList
MarshalAPIForLifeCycleChangeEventAndReturnList updates the internal map's API instances lifecycle state only if stored API Instance's or input status event is a blocked event. If no change is applied, it would return nil. Hence the XDS cache should not be updated.
func MarshalAPIMetataAndReturnList ¶
func MarshalAPIMetataAndReturnList(apiList *types.APIList, initialAPIUUIDListMap map[string]int, gatewayLabel string) *subscription.APIList
MarshalAPIMetataAndReturnList updates the internal APIListMap and returns the XDS compatible APIList. apiList is the internal APIList object (For single API, this would contain a List with just one API) initialAPIUUIDListMap is assigned during startup when global adapter is associated. This would be empty otherwise. gatewayLabel is the environment.
func MarshalApplicationEventAndReturnList ¶
func MarshalApplicationEventAndReturnList(application *types.Application, eventType EventType) *subscription.ApplicationList
MarshalApplicationEventAndReturnList handles the Application Event corresponding to the event received from message broker. And then it returns the ApplicationList.
func MarshalApplicationKeyMappingEventAndReturnList ¶
func MarshalApplicationKeyMappingEventAndReturnList(keyMapping *types.ApplicationKeyMapping, eventType EventType) *subscription.ApplicationKeyMappingList
MarshalApplicationKeyMappingEventAndReturnList handles the Application Key Mapping Event corresponding to the event received from message broker. And then it returns the ApplicationKeyMappingList.
func MarshalApplicationPolicyEventAndReturnList ¶
func MarshalApplicationPolicyEventAndReturnList(policy *types.ApplicationPolicy, eventType EventType) *subscription.ApplicationPolicyList
MarshalApplicationPolicyEventAndReturnList handles the Application Policy Event corresponding to the event received from message broker. And then it returns the ApplicationPolicyList.
func MarshalConfig ¶
MarshalConfig will marshal a Config struct - read from the config toml - to enfocer's CDS resource representation.
func MarshalKeyManager ¶
func MarshalKeyManager(keyManager *types.KeyManager) *keymgt.KeyManagerConfig
MarshalKeyManager converts the data into KeyManager proto type
func MarshalMultipleApplicationKeyMappings ¶
func MarshalMultipleApplicationKeyMappings(keymappingList *types.ApplicationKeyMappingList) *subscription.ApplicationKeyMappingList
MarshalMultipleApplicationKeyMappings is used to update the application key mappings during the startup where multiple key mappings are pulled at once. And then it returns the ApplicationKeyMappingList.
func MarshalMultipleApplicationPolicies ¶
func MarshalMultipleApplicationPolicies(policies *types.ApplicationPolicyList) *subscription.ApplicationPolicyList
MarshalMultipleApplicationPolicies is used to update the applicationPolicies during the startup where multiple application policies are pulled at once. And then it returns the ApplicationPolicyList.
func MarshalMultipleApplications ¶
func MarshalMultipleApplications(appList *types.ApplicationList) *subscription.ApplicationList
MarshalMultipleApplications is used to update the applicationList during the startup where multiple applications are pulled at once. And then it returns the ApplicationList.
func MarshalMultipleSubscriptionPolicies ¶
func MarshalMultipleSubscriptionPolicies(policies *types.SubscriptionPolicyList) *subscription.SubscriptionPolicyList
MarshalMultipleSubscriptionPolicies is used to update the subscriptionPolicies during the startup where multiple subscription policies are pulled at once. And then it returns the SubscriptionPolicyList.
func MarshalMultipleSubscriptions ¶
func MarshalMultipleSubscriptions(subscriptionsList *types.SubscriptionList) *subscription.SubscriptionList
MarshalMultipleSubscriptions is used to update the subscriptions during the startup where multiple subscriptions are pulled at once. And then it returns the SubscriptionList.
func MarshalSubscriptionEventAndReturnList ¶
func MarshalSubscriptionEventAndReturnList(sub *types.Subscription, eventType EventType) *subscription.SubscriptionList
MarshalSubscriptionEventAndReturnList handles the Subscription Event corresponding to the event received from message broker. And then it returns the SubscriptionList.
func MarshalSubscriptionPolicyEventAndReturnList ¶
func MarshalSubscriptionPolicyEventAndReturnList(policy *types.SubscriptionPolicy, eventType EventType) *subscription.SubscriptionPolicyList
MarshalSubscriptionPolicyEventAndReturnList handles the Subscription Policy Event corresponding to the event received from message broker. And then it returns the subscriptionPolicyList.
func SetSuccessState ¶
func SetSuccessState(label string, enforerSuccessState EnforcerAPIState, routerSuccessState RouterResourceState)
SetSuccessState set the last successful state of enforcer and router
func UpdateAPI ¶
func UpdateAPI(vHost string, apiProject model.ProjectAPI, environments []string) (*notifier.DeployedAPIRevision, error)
UpdateAPI updates the Xds Cache when OpenAPI Json content is provided
func UpdateEnforcerAPIList ¶
func UpdateEnforcerAPIList(label string, apis *subscription.APIList)
UpdateEnforcerAPIList sets new update to the enforcer's Apis
func UpdateEnforcerApis ¶
UpdateEnforcerApis Sets new update to the enforcer's Apis
func UpdateEnforcerApplicationKeyMappings ¶
func UpdateEnforcerApplicationKeyMappings(applicationKeyMappings *subscription.ApplicationKeyMappingList)
UpdateEnforcerApplicationKeyMappings sets new update to the enforcer's Application Key Mappings
func UpdateEnforcerApplicationPolicies ¶
func UpdateEnforcerApplicationPolicies(applicationPolicies *subscription.ApplicationPolicyList)
UpdateEnforcerApplicationPolicies sets new update to the enforcer's Application Policies
func UpdateEnforcerApplications ¶
func UpdateEnforcerApplications(applications *subscription.ApplicationList)
UpdateEnforcerApplications sets new update to the enforcer's Applications
func UpdateEnforcerConfig ¶
UpdateEnforcerConfig Sets new update to the enforcer's configuration
func UpdateEnforcerKeyManagers ¶
UpdateEnforcerKeyManagers Sets new update to the enforcer's configuration
func UpdateEnforcerRevokedTokens ¶
UpdateEnforcerRevokedTokens method update the revoked tokens in the enforcer
func UpdateEnforcerSubscriptionPolicies ¶
func UpdateEnforcerSubscriptionPolicies(subscriptionPolicies *subscription.SubscriptionPolicyList)
UpdateEnforcerSubscriptionPolicies sets new update to the enforcer's Subscription Policies
func UpdateEnforcerSubscriptions ¶
func UpdateEnforcerSubscriptions(subscriptions *subscription.SubscriptionList)
UpdateEnforcerSubscriptions sets new update to the enforcer's Subscriptions
func UpdateEnforcerThrottleData ¶
func UpdateEnforcerThrottleData(throttleData *throttle.ThrottleData)
UpdateEnforcerThrottleData update the key template and blocking conditions data in the enforcer
Types ¶
type EnforcerAPIState ¶
type EnforcerAPIState struct { Apis map[string]oasModel.MgwSwagger OpenAPIEnforcerApisMap map[string]types.Resource APIUUIDToGatewayToVhosts map[string]map[string]string APIToVhostsMap map[string]map[string]struct{} Version string }
EnforcerAPIState Stores the last success state of the enforcer apis
type EventType ¶
type EventType int
EventType is a enum to distinguish Create, Update and Delete Events
type RequestEvent ¶
RequestEvent is the event that is published by the xds callback (onStreamRequest)
type RouterResourceState ¶
type RouterResourceState struct { APIRoutesMap map[string][]*routev3.Route // Envoy Routes map APIClustersMap map[string][]*clusterv3.Cluster // Envoy Clusters map APIEndpointsMap map[string][]*corev3.Address EnvoyListenerConfigMap map[string][]*listenerv3.Listener // Listener Configuration map EnvoyRouteConfigMap map[string]*routev3.RouteConfiguration Version string }
RouterResourceState Stores the last successful state of the router resources
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package common includes the common functions shared between enforcer and router callbacks.
|
Package common includes the common functions shared between enforcer and router callbacks. |