utils

package
v0.0.0-...-e46bc45 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package tlsutils contains the utility functions related to tls communication of the adapter

Package common includes the common functions shared between enforcer and router callbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddClientConnection

func AddClientConnection(clientID string, stream apkmgt.EventStreamService_StreamEventsServer)

AddClientConnection adds a client connection to the map

func DeleteClientConnection

func DeleteClientConnection(clientID string)

DeleteClientConnection deletes a client connection from the map

func FilterByNamespaces

func FilterByNamespaces(namespaces []string) func(object k8client.Object) bool

FilterByNamespaces takes a list of namespaces and returns a filter function which return true if the input object is in the given namespaces list, and returns false otherwise

func GetAllClientConnections

func GetAllClientConnections() map[string]apkmgt.EventStreamService_StreamEventsServer

GetAllClientConnections returns all client connections

func GetEnvironment

func GetEnvironment(environment string) string

GetEnvironment takes the environment of the API. If the value is empty, it will return the default environment that is set in the config of the common controller.

func GetKeyLocations

func GetKeyLocations() (string, string, string)

GetKeyLocations function returns the public key path and private key path

func GetNodeIdentifier

func GetNodeIdentifier(request *discovery.DiscoveryRequest) string

GetNodeIdentifier constructs the nodeIdentifier from discovery request's node property, label:<instanceIdentifierProperty>

func GetOperatorPodNamespace

func GetOperatorPodNamespace() string

GetOperatorPodNamespace returns the namesapce of the operator pod

func GetServerCertificate

func GetServerCertificate(tlsCertificate string, tlsCertificateKey string) (tls.Certificate, error)

GetServerCertificate returns the certificate (used for the restAPI server and xds server) created based on configuration values. Move to pkg. remove config and read from a file path

func GetTrustedCertPool

func GetTrustedCertPool(truststoreLocation string) *x509.CertPool

GetTrustedCertPool returns the trusted certificate (used for the restAPI server and xds server) created based on the provided directory/file path. Move to pkg

func InvokeControlPlane

func InvokeControlPlane(req *http.Request, skipSSL bool) (*http.Response, error)

InvokeControlPlane sends request to the control plane and returns the response

func IsPublicCertificate

func IsPublicCertificate(certContent []byte) bool

IsPublicCertificate checks if the file content represents valid public certificate in PEM format. Move to pkg

func NamespacedName

func NamespacedName(obj k8client.Object) types.NamespacedName

NamespacedName generates namespaced name for Kubernetes objects

func SendAddApplicationEvent

func SendAddApplicationEvent(application cpv1alpha2.Application)

SendAddApplicationEvent sends an application creation event to the enforcer

func SendAddSubscriptionEvent

func SendAddSubscriptionEvent(sub cpv1alpha2.Subscription)

SendAddSubscriptionEvent sends an subscription creation event to the enforcer

func SendAppDeletionEvent

func SendAppDeletionEvent(applicationUUID string, applicationSpec cpv1alpha2.ApplicationSpec)

SendAppDeletionEvent sends an application creation event to the enforcer

func SendAppUpdateEvent

func SendAppUpdateEvent(applicationUUID string, oldApplicationSpec cpv1alpha2.ApplicationSpec, newApplicationSpec cpv1alpha2.ApplicationSpec)

SendAppUpdateEvent sends an application update event to the enforcer

func SendApplicationEvent

func SendApplicationEvent(eventType, applicationUUID, applicationName, applicationOwner, organization string, appAttribute map[string]string)

SendApplicationEvent sends an application deletion event to the enforcer

func SendApplicationKeyMappingEvent

func SendApplicationKeyMappingEvent(eventType, applicationUUID, securityScheme, applicationIdentifier, keyType, envID,
	organization string)

SendApplicationKeyMappingEvent sends an application key mapping event to the enforcer

func SendApplicationMappingEvent

func SendApplicationMappingEvent(eventType, id, applicationRef, subscriptionRef, organization string)

SendApplicationMappingEvent sends an application mapping event to the enforcer

func SendCreateApplicationMappingEvent

func SendCreateApplicationMappingEvent(applicationMapping cpv1alpha2.ApplicationMapping, application cpv1alpha2.Application, subscriptionCr cpv1alpha2.Subscription)

SendCreateApplicationMappingEvent sends an application mapping event to the enforcer

func SendDeleteApplicationMappingEvent

func SendDeleteApplicationMappingEvent(applicationMappingUUID string,
	applicationMappingSpec cpv1alpha2.ApplicationMappingSpec, organization string)

SendDeleteApplicationMappingEvent sends an application mapping deletion event to the enforcer

func SendDeleteSubscriptionEvent

func SendDeleteSubscriptionEvent(subscriptionUUID string, subscriptionSpec cpv1alpha2.SubscriptionSpec)

SendDeleteSubscriptionEvent sends an subscription deletion event to the enforcer

func SendResetEvent

func SendResetEvent()

SendResetEvent sends initial event to the enforcer

func SendSubscriptionEvent

func SendSubscriptionEvent(eventType, subscriptionID, subscriptionStatus, organization, apiName, apiVersion string)

SendSubscriptionEvent sends an subscription creation event to the enforcer

Types

type NodeQueue

type NodeQueue struct {
	// contains filtered or unexported fields
}

NodeQueue struct is used to keep track of the nodes connected via the XDS.

func GenerateNodeQueue

func GenerateNodeQueue() *NodeQueue

GenerateNodeQueue creates an instance of nodeQueue with a mutex and a string array assigned.

func (*NodeQueue) IsNewNode

func (nodeQueue *NodeQueue) IsNewNode(nodeIdentifier string) bool

IsNewNode returns true if the provided nodeID does not exist in the nodeQueue

Jump to

Keyboard shortcuts

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