Documentation ¶
Overview ¶
Package model contains the implementation of DTOs to convert OpenAPI/Swagger files and create a common model which can represent both types.
Package model contains the implementation of DTOs to convert OpenAPI/Swagger files and create a common model which can represent both types.
Index ¶
- func GenerateInterceptorIncludes(includes []dpv1alpha1.InterceptorInclusion) *interceptor.RequestInclusions
- func GetBackendBasePath(backendName types.NamespacedName, ...) string
- func ResolveDisableSecurity(vendorExtensions map[string]interface{}) bool
- func ResolveThrottlingTier(vendorExtensions map[string]interface{}) string
- type APIKey
- type AdapterInternalAPI
- func (adapterInternalAPI *AdapterInternalAPI) GetAIProvider() InternalAIProvider
- func (adapterInternalAPI *AdapterInternalAPI) GetAPIDefinitionEndpoint() string
- func (adapterInternalAPI *AdapterInternalAPI) GetAPIDefinitionFile() []byte
- func (adapterInternalAPI *AdapterInternalAPI) GetAPIType() string
- func (adapterInternalAPI *AdapterInternalAPI) GetApplicationSecurity() map[string]bool
- func (adapterInternalAPI *AdapterInternalAPI) GetBackendJWTTokenInfo() *BackendJWTTokenInfo
- func (adapterInternalAPI *AdapterInternalAPI) GetClientCerts() []Certificate
- func (adapterInternalAPI *AdapterInternalAPI) GetCorsConfig() *CorsConfig
- func (adapterInternalAPI *AdapterInternalAPI) GetDescription() string
- func (adapterInternalAPI *AdapterInternalAPI) GetDisableAuthentications() bool
- func (adapterInternalAPI *AdapterInternalAPI) GetDisableMtls() bool
- func (adapterInternalAPI *AdapterInternalAPI) GetDisableScopes() bool
- func (adapterInternalAPI *AdapterInternalAPI) GetEnvironment() string
- func (adapterInternalAPI *AdapterInternalAPI) GetInterceptor(vendorExtensions map[string]interface{}, extensionName string, level string) InterceptEndpoint
- func (adapterInternalAPI *AdapterInternalAPI) GetModelBasedRoundRobin() dpv1alpha4.ModelBasedRoundRobin
- func (adapterInternalAPI *AdapterInternalAPI) GetMutualSSL() string
- func (adapterInternalAPI *AdapterInternalAPI) GetOperationInterceptors(apiInterceptor InterceptEndpoint, resourceInterceptor InterceptEndpoint, ...) map[string]InterceptEndpoint
- func (adapterInternalAPI *AdapterInternalAPI) GetOrganizationID() string
- func (adapterInternalAPI *AdapterInternalAPI) GetResources() []*Resource
- func (adapterInternalAPI *AdapterInternalAPI) GetSubscriptionValidation() bool
- func (adapterInternalAPI *AdapterInternalAPI) GetTitle() string
- func (adapterInternalAPI *AdapterInternalAPI) GetVendorExtensions() map[string]interface{}
- func (adapterInternalAPI *AdapterInternalAPI) GetVersion() string
- func (adapterInternalAPI *AdapterInternalAPI) GetXWSO2AuthHeader() string
- func (adapterInternalAPI *AdapterInternalAPI) GetXWso2Basepath() string
- func (adapterInternalAPI *AdapterInternalAPI) GetXWso2HTTP2BackendEnabled() bool
- func (adapterInternalAPI *AdapterInternalAPI) GetXWso2RequestBodyPass() bool
- func (adapterInternalAPI *AdapterInternalAPI) GetXWso2ThrottlingTier() string
- func (adapterInternalAPI *AdapterInternalAPI) SetAIProvider(aiProvider dpv1alpha4.AIProvider)
- func (adapterInternalAPI *AdapterInternalAPI) SetAPIDefinitionEndpoint(endpoint string)
- func (adapterInternalAPI *AdapterInternalAPI) SetAPIDefinitionFile(file []byte)
- func (adapterInternalAPI *AdapterInternalAPI) SetApplicationSecurity(key string, value bool)
- func (adapterInternalAPI *AdapterInternalAPI) SetClientCerts(apiName string, certs []string)
- func (adapterInternalAPI *AdapterInternalAPI) SetDisableMtls(disableMtls bool)
- func (adapterInternalAPI *AdapterInternalAPI) SetEnvironment(environment string)
- func (swagger *AdapterInternalAPI) SetInfoAPICR(api dpv1alpha3.API)
- func (adapterInternalAPI *AdapterInternalAPI) SetInfoGQLRouteCR(gqlRoute *dpv1alpha2.GQLRoute, resourceParams ResourceParams) error
- func (adapterInternalAPI *AdapterInternalAPI) SetInfoGRPCRouteCR(grpcRoute *gwapiv1.GRPCRoute, resourceParams ResourceParams) error
- func (adapterInternalAPI *AdapterInternalAPI) SetInfoHTTPRouteCR(httpRoute *gwapiv1.HTTPRoute, resourceParams ResourceParams, ...) error
- func (adapterInternalAPI *AdapterInternalAPI) SetIsDefaultVersion(isDefaultVersion bool)
- func (adapterInternalAPI *AdapterInternalAPI) SetModelBasedRoundRobin(modelBasedRoundRobin dpv1alpha4.ModelBasedRoundRobin)
- func (adapterInternalAPI *AdapterInternalAPI) SetMutualSSL(mutualSSL string)
- func (adapterInternalAPI *AdapterInternalAPI) SetName(name string)
- func (adapterInternalAPI *AdapterInternalAPI) SetSubscriptionValidation(subscriptionValidation bool)
- func (adapterInternalAPI *AdapterInternalAPI) SetVersion(version string)
- func (adapterInternalAPI *AdapterInternalAPI) SetXWso2AuthHeader(authHeader string)
- func (adapterInternalAPI *AdapterInternalAPI) SetXWso2RequestBodyPass(passBody bool)
- func (adapterInternalAPI *AdapterInternalAPI) Validate() error
- type Authentication
- type BackendJWTTokenInfo
- type Certificate
- type CircuitBreakers
- type ClaimMapping
- type ClaimVal
- type CorsConfig
- type CustomRateLimitPolicy
- type Endpoint
- type EndpointCluster
- type EndpointConfig
- type EndpointSecurity
- type HealthCheck
- type InterceptEndpoint
- type InternalAIProvider
- type JWT
- type Oauth2
- type Operation
- func (operation *Operation) GetAuthentication() *Authentication
- func (operation *Operation) GetCallInterceptorService(isIn bool) InterceptEndpoint
- func (operation *Operation) GetID() string
- func (operation *Operation) GetMatchID() string
- func (operation *Operation) GetMethod() string
- func (operation *Operation) GetMirrorEndpointClusters() []*EndpointCluster
- func (operation *Operation) GetMockedAPIConfig() *api.MockedApiConfig
- func (operation *Operation) GetPolicies() *OperationPolicies
- func (operation *Operation) GetRateLimitPolicy() *RateLimitPolicy
- func (operation *Operation) GetScopes() []string
- func (operation *Operation) GetTier() string
- func (operation *Operation) GetVendorExtensions() map[string]interface{}
- func (operation *Operation) SetAuthentication(authentication *Authentication)
- type OperationPolicies
- type Policy
- type PolicyContainer
- type PolicyContainerMap
- type PolicyDefinition
- type PolicyFlow
- type PolicyList
- type PolicySpecification
- type RateLimit
- type RateLimitPolicy
- type Resource
- func (resource *Resource) GetAIModelBasedRoundRobin() *dpv1alpha4.ModelBasedRoundRobin
- func (resource *Resource) GetBackendBasedAIRatelimitDescriptorValue() string
- func (resource *Resource) GetEnableBackendBasedAIRatelimit() bool
- func (resource *Resource) GetEndpointSecurity() []*EndpointSecurity
- func (resource *Resource) GetEndpoints() *EndpointCluster
- func (resource *Resource) GetExtractTokenFromValue() string
- func (resource *Resource) GetID() string
- func (resource *Resource) GetMethod() []*Operation
- func (resource *Resource) GetMethodList() []string
- func (resource *Resource) GetOperations() []*Operation
- func (resource *Resource) GetPath() string
- func (resource *Resource) GetPathMatchType() gwapiv1.PathMatchType
- func (resource *Resource) GetVendorExtensions() map[string]interface{}
- func (resource *Resource) HasPolicies() bool
- type ResourceParams
- type RetryConfig
- type SecurityScheme
- type ValueDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateInterceptorIncludes ¶
func GenerateInterceptorIncludes(includes []dpv1alpha1.InterceptorInclusion) *interceptor.RequestInclusions
GenerateInterceptorIncludes generate includes
func GetBackendBasePath ¶
func GetBackendBasePath(backendName types.NamespacedName, backendMapping map[string]*dpv1alpha2.ResolvedBackend) string
GetBackendBasePath gets basePath of the the Backend
func ResolveDisableSecurity ¶
ResolveDisableSecurity extracts the value of x-auth-type extension. if the property is not available, false is returned. If the API definition is fed from API manager, then API definition contains x-auth-type as "None" for non secured APIs. Then the return value would be true. If the API definition is fed through apictl, the users can use either x-wso2-disable-security : true/false to enable and disable security.
func ResolveThrottlingTier ¶
ResolveThrottlingTier extracts the value of x-wso2-throttling-tier and x-throttling-tier extension. if x-wso2-throttling-tier is available it will be prioritized. if both the properties are not available, an empty string is returned.
Types ¶
type AdapterInternalAPI ¶
type AdapterInternalAPI struct { UUID string OrganizationID string IsPrototyped bool EndpointType string LifecycleStatus string IsDefaultVersion bool EnvType string APIProperties []dpv1alpha3.Property // GraphQLSchema string // GraphQLComplexities GraphQLComplexityYaml IsSystemAPI bool RateLimitPolicy *RateLimitPolicy Endpoints *EndpointCluster EndpointSecurity []*EndpointSecurity AIProvider InternalAIProvider AIModelBasedRoundRobin dpv1alpha4.ModelBasedRoundRobin HTTPRouteIDs []string // contains filtered or unexported fields }
AdapterInternalAPI represents the object structure holding the information related to the adapter internal representation. The values are populated from the operator. The pathItem level information is represented by the resources array which contains the Resource entries.
func CreateDummyAdapterInternalAPIForTests ¶
func CreateDummyAdapterInternalAPIForTests(title, version, basePath string, resources []*Resource) *AdapterInternalAPI
CreateDummyAdapterInternalAPIForTests creates a dummy AdapterInternalAPI struct to be used for unit tests
func (*AdapterInternalAPI) GetAIProvider ¶
func (adapterInternalAPI *AdapterInternalAPI) GetAIProvider() InternalAIProvider
GetAIProvider returns the AIProvider of the API
func (*AdapterInternalAPI) GetAPIDefinitionEndpoint ¶
func (adapterInternalAPI *AdapterInternalAPI) GetAPIDefinitionEndpoint() string
GetAPIDefinitionEndpoint returns the API Definition Endpoint.
func (*AdapterInternalAPI) GetAPIDefinitionFile ¶
func (adapterInternalAPI *AdapterInternalAPI) GetAPIDefinitionFile() []byte
GetAPIDefinitionFile returns the API Definition File.
func (*AdapterInternalAPI) GetAPIType ¶
func (adapterInternalAPI *AdapterInternalAPI) GetAPIType() string
GetAPIType returns the openapi version
func (*AdapterInternalAPI) GetApplicationSecurity ¶
func (adapterInternalAPI *AdapterInternalAPI) GetApplicationSecurity() map[string]bool
GetApplicationSecurity returns true if application security is mandatory, and false if optional
func (*AdapterInternalAPI) GetBackendJWTTokenInfo ¶
func (adapterInternalAPI *AdapterInternalAPI) GetBackendJWTTokenInfo() *BackendJWTTokenInfo
GetBackendJWTTokenInfo returns the BackendJWTTokenInfo Object.
func (*AdapterInternalAPI) GetClientCerts ¶
func (adapterInternalAPI *AdapterInternalAPI) GetClientCerts() []Certificate
GetClientCerts returns the client certificates of the API
func (*AdapterInternalAPI) GetCorsConfig ¶
func (adapterInternalAPI *AdapterInternalAPI) GetCorsConfig() *CorsConfig
GetCorsConfig returns the CorsConfiguration Object.
func (*AdapterInternalAPI) GetDescription ¶
func (adapterInternalAPI *AdapterInternalAPI) GetDescription() string
GetDescription returns the description of the openapi
func (*AdapterInternalAPI) GetDisableAuthentications ¶
func (adapterInternalAPI *AdapterInternalAPI) GetDisableAuthentications() bool
GetDisableAuthentications returns the authType via the vendor extension.
func (*AdapterInternalAPI) GetDisableMtls ¶
func (adapterInternalAPI *AdapterInternalAPI) GetDisableMtls() bool
GetDisableMtls returns whether mTLS is disabled or not
func (*AdapterInternalAPI) GetDisableScopes ¶
func (adapterInternalAPI *AdapterInternalAPI) GetDisableScopes() bool
GetDisableScopes returns the authType via the vendor extension.
func (*AdapterInternalAPI) GetEnvironment ¶
func (adapterInternalAPI *AdapterInternalAPI) GetEnvironment() string
GetEnvironment returns the environment of the API
func (*AdapterInternalAPI) GetInterceptor ¶
func (adapterInternalAPI *AdapterInternalAPI) GetInterceptor(vendorExtensions map[string]interface{}, extensionName string, level string) InterceptEndpoint
GetInterceptor returns interceptors
func (*AdapterInternalAPI) GetModelBasedRoundRobin ¶
func (adapterInternalAPI *AdapterInternalAPI) GetModelBasedRoundRobin() dpv1alpha4.ModelBasedRoundRobin
GetModelBasedRoundRobin returns the ModelBasedRoundRobin of the API
func (*AdapterInternalAPI) GetMutualSSL ¶
func (adapterInternalAPI *AdapterInternalAPI) GetMutualSSL() string
GetMutualSSL returns the optional or mandatory mTLS
func (*AdapterInternalAPI) GetOperationInterceptors ¶
func (adapterInternalAPI *AdapterInternalAPI) GetOperationInterceptors(apiInterceptor InterceptEndpoint, resourceInterceptor InterceptEndpoint, operations []*Operation, isIn bool) map[string]InterceptEndpoint
GetOperationInterceptors returns operation interceptors
func (*AdapterInternalAPI) GetOrganizationID ¶
func (adapterInternalAPI *AdapterInternalAPI) GetOrganizationID() string
GetOrganizationID returns OrganizationID
func (*AdapterInternalAPI) GetResources ¶
func (adapterInternalAPI *AdapterInternalAPI) GetResources() []*Resource
GetResources returns the array of resources (openAPI path level info)
func (*AdapterInternalAPI) GetSubscriptionValidation ¶
func (adapterInternalAPI *AdapterInternalAPI) GetSubscriptionValidation() bool
GetSubscriptionValidation returns the subscription validation status.
func (*AdapterInternalAPI) GetTitle ¶
func (adapterInternalAPI *AdapterInternalAPI) GetTitle() string
GetTitle returns the API Title
func (*AdapterInternalAPI) GetVendorExtensions ¶
func (adapterInternalAPI *AdapterInternalAPI) GetVendorExtensions() map[string]interface{}
GetVendorExtensions returns the map of vendor extensions which are defined at openAPI's root level.
func (*AdapterInternalAPI) GetVersion ¶
func (adapterInternalAPI *AdapterInternalAPI) GetVersion() string
GetVersion returns the API version
func (*AdapterInternalAPI) GetXWSO2AuthHeader ¶
func (adapterInternalAPI *AdapterInternalAPI) GetXWSO2AuthHeader() string
GetXWSO2AuthHeader returns the auth header set via the vendor extension.
func (*AdapterInternalAPI) GetXWso2Basepath ¶
func (adapterInternalAPI *AdapterInternalAPI) GetXWso2Basepath() string
GetXWso2Basepath returns the basepath set via the vendor extension.
func (*AdapterInternalAPI) GetXWso2HTTP2BackendEnabled ¶
func (adapterInternalAPI *AdapterInternalAPI) GetXWso2HTTP2BackendEnabled() bool
GetXWso2HTTP2BackendEnabled returns the http2 backend enabled set via the vendor extension.
func (*AdapterInternalAPI) GetXWso2RequestBodyPass ¶
func (adapterInternalAPI *AdapterInternalAPI) GetXWso2RequestBodyPass() bool
GetXWso2RequestBodyPass returns boolean value to indicate whether it is allowed to pass request body to the enforcer or not.
func (*AdapterInternalAPI) GetXWso2ThrottlingTier ¶
func (adapterInternalAPI *AdapterInternalAPI) GetXWso2ThrottlingTier() string
GetXWso2ThrottlingTier returns the Throttling tier via the vendor extension.
func (*AdapterInternalAPI) SetAIProvider ¶
func (adapterInternalAPI *AdapterInternalAPI) SetAIProvider(aiProvider dpv1alpha4.AIProvider)
SetAIProvider sets the AIProvider of the API.
func (*AdapterInternalAPI) SetAPIDefinitionEndpoint ¶
func (adapterInternalAPI *AdapterInternalAPI) SetAPIDefinitionEndpoint(endpoint string)
SetAPIDefinitionEndpoint sets the API Definition Endpoint.
func (*AdapterInternalAPI) SetAPIDefinitionFile ¶
func (adapterInternalAPI *AdapterInternalAPI) SetAPIDefinitionFile(file []byte)
SetAPIDefinitionFile sets the API Definition File.
func (*AdapterInternalAPI) SetApplicationSecurity ¶
func (adapterInternalAPI *AdapterInternalAPI) SetApplicationSecurity(key string, value bool)
SetApplicationSecurity sets the optional or mandatory application security for each security type true means mandatory
func (*AdapterInternalAPI) SetClientCerts ¶
func (adapterInternalAPI *AdapterInternalAPI) SetClientCerts(apiName string, certs []string)
SetClientCerts set the client certificates of the API
func (*AdapterInternalAPI) SetDisableMtls ¶
func (adapterInternalAPI *AdapterInternalAPI) SetDisableMtls(disableMtls bool)
SetDisableMtls returns whether mTLS is disabled or not
func (*AdapterInternalAPI) SetEnvironment ¶
func (adapterInternalAPI *AdapterInternalAPI) SetEnvironment(environment string)
SetEnvironment sets the environment of the API.
func (*AdapterInternalAPI) SetInfoAPICR ¶
func (swagger *AdapterInternalAPI) SetInfoAPICR(api dpv1alpha3.API)
SetInfoAPICR populates ID, ApiType, Version and XWso2BasePath of adapterInternalAPI.
func (*AdapterInternalAPI) SetInfoGQLRouteCR ¶
func (adapterInternalAPI *AdapterInternalAPI) SetInfoGQLRouteCR(gqlRoute *dpv1alpha2.GQLRoute, resourceParams ResourceParams) error
SetInfoGQLRouteCR populates resources and endpoints of adapterInternalAPI. httpRoute.Spec.Rules.Matches are used to create resources and httpRoute.Spec.Rules.BackendRefs are used to create EndpointClusters.
func (*AdapterInternalAPI) SetInfoGRPCRouteCR ¶
func (adapterInternalAPI *AdapterInternalAPI) SetInfoGRPCRouteCR(grpcRoute *gwapiv1.GRPCRoute, resourceParams ResourceParams) error
SetInfoGRPCRouteCR populates resources and endpoints of adapterInternalAPI. httpRoute.Spec.Rules.Matches are used to create resources and httpRoute.Spec.Rules.BackendRefs are used to create EndpointClusters.
func (*AdapterInternalAPI) SetInfoHTTPRouteCR ¶
func (adapterInternalAPI *AdapterInternalAPI) SetInfoHTTPRouteCR(httpRoute *gwapiv1.HTTPRoute, resourceParams ResourceParams, ruleIdxToAiRatelimitPolicyMapping map[int]*dpv1alpha3.AIRateLimitPolicy, extractTokenFrom string) error
SetInfoHTTPRouteCR populates resources and endpoints of adapterInternalAPI. httpRoute.Spec.Rules.Matches are used to create resources and httpRoute.Spec.Rules.BackendRefs are used to create EndpointClusters.
func (*AdapterInternalAPI) SetIsDefaultVersion ¶
func (adapterInternalAPI *AdapterInternalAPI) SetIsDefaultVersion(isDefaultVersion bool)
SetIsDefaultVersion sets whether this API is the default
func (*AdapterInternalAPI) SetModelBasedRoundRobin ¶
func (adapterInternalAPI *AdapterInternalAPI) SetModelBasedRoundRobin(modelBasedRoundRobin dpv1alpha4.ModelBasedRoundRobin)
SetModelBasedRoundRobin sets the ModelBasedRoundRobin of the API.
func (*AdapterInternalAPI) SetMutualSSL ¶
func (adapterInternalAPI *AdapterInternalAPI) SetMutualSSL(mutualSSL string)
SetMutualSSL sets the optional or mandatory mTLS
func (*AdapterInternalAPI) SetName ¶
func (adapterInternalAPI *AdapterInternalAPI) SetName(name string)
SetName sets the name of the API
func (*AdapterInternalAPI) SetSubscriptionValidation ¶
func (adapterInternalAPI *AdapterInternalAPI) SetSubscriptionValidation(subscriptionValidation bool)
SetSubscriptionValidation sets the subscription validation status.
func (*AdapterInternalAPI) SetVersion ¶
func (adapterInternalAPI *AdapterInternalAPI) SetVersion(version string)
SetVersion sets the version of the API
func (*AdapterInternalAPI) SetXWso2AuthHeader ¶
func (adapterInternalAPI *AdapterInternalAPI) SetXWso2AuthHeader(authHeader string)
SetXWso2AuthHeader sets the authHeader of the API
func (*AdapterInternalAPI) SetXWso2RequestBodyPass ¶
func (adapterInternalAPI *AdapterInternalAPI) SetXWso2RequestBodyPass(passBody bool)
SetXWso2RequestBodyPass returns boolean value to indicate whether it is allowed to pass request body to the enforcer or not.
func (*AdapterInternalAPI) Validate ¶
func (adapterInternalAPI *AdapterInternalAPI) Validate() error
Validate method confirms that the adapterInternalAPI has all required fields in the required format. This needs to be checked prior to generate router/enforcer related resources.
type Authentication ¶
Authentication holds authentication related configurations
type BackendJWTTokenInfo ¶
type BackendJWTTokenInfo struct { Enabled bool Encoding string Header string SigningAlgorithm string TokenTTL uint32 CustomClaims []ClaimMapping }
BackendJWTTokenInfo represents the object structure holding the information related to the JWT Generator
type Certificate ¶
Certificate contains information of a client certificate
type CircuitBreakers ¶
type CircuitBreakers struct { MaxConnections int32 MaxRequests int32 MaxPendingRequests int32 MaxRetries int32 MaxConnectionPools int32 }
CircuitBreakers holds the parameters for retries done by apk to the EndpointCluster
type ClaimMapping ¶
ClaimMapping represents the object structure holding the information related to the JWT Generator Claims
type ClaimVal ¶
ClaimVal represents the object structure holding the information related to the JWT Generator Claim Values
type CorsConfig ¶
type CorsConfig struct { Enabled bool AccessControlAllowCredentials bool AccessControlAllowHeaders []string AccessControlAllowMethods []string AccessControlAllowOrigins []string AccessControlExposeHeaders []string AccessControlMaxAge *int }
CorsConfig represents the API level Cors Configuration
type CustomRateLimitPolicy ¶
type CustomRateLimitPolicy struct { Key string `json:"key,omitempty"` Value string `json:"value,omitempty"` RateLimit RateLimit `json:"rateLimit,omitempty"` Organization string `json:"organization,omitempty"` }
CustomRateLimitPolicy defines the desired state of CustomPolicy
func ParseCustomRateLimitPolicy ¶
func ParseCustomRateLimitPolicy(customRateLimitCR dpv1alpha3.RateLimitPolicy) *CustomRateLimitPolicy
ParseCustomRateLimitPolicy parses the custom rate limit policy
type Endpoint ¶
type Endpoint struct { // Host name Host string // BasePath (which would be added as prefix to the path mentioned in openapi definition) // In openAPI v2, it is determined from the basePath property // In openAPi v3, it is determined from the server object's suffix Basepath string // https, http, ws, wss // In openAPI v2, it is fetched from the schemes entry // In openAPI v3, it is extracted from the server property under servers object // only https and http are supported at the moment. URLType string // Port of the endpoint. // If the port is not specified, 80 is assigned if URLType is http // 443 is assigned if URLType is https Port uint32 RawURL string // Trusted CA Cerificate for the endpoint Certificate []byte // Subject Alternative Names to verify in the public certificate AllowedSANs []string }
Endpoint represents the structure of an endpoint.
func GETHTTPEndpoint ¶
GETHTTPEndpoint returns the endpoint object for the given rawURL
func GetEndpoints ¶
func GetEndpoints(backendName types.NamespacedName, backendMapping map[string]*dpv1alpha2.ResolvedBackend) []Endpoint
GetEndpoints creates endpoints using resolved backends in backendMapping
func (*Endpoint) GetAuthorityHeader ¶
GetAuthorityHeader creates the authority header using Host and Port in the form of Host [ ":" Port ]
type EndpointCluster ¶
type EndpointCluster struct { EndpointPrefix string Endpoints []Endpoint // EndpointType enum {failover, loadbalance}. if any other value provided, consider as the default value; which is loadbalance EndpointType string Config *EndpointConfig HealthCheck *HealthCheck // Is http2 protocol enabled HTTP2BackendEnabled bool }
EndpointCluster represent an upstream cluster
type EndpointConfig ¶
type EndpointConfig struct { RetryConfig *RetryConfig TimeoutInMillis uint32 IdleTimeoutInSeconds uint32 CircuitBreakers *CircuitBreakers }
EndpointConfig holds the configs such as timeout, retry, etc. for the EndpointCluster
type EndpointSecurity ¶
type EndpointSecurity struct { Password string Type string Enabled bool Username string CustomParameters map[string]string }
EndpointSecurity contains parameters of endpoint security at api.json
type HealthCheck ¶
type HealthCheck struct { Timeout uint32 Interval uint32 UnhealthyThreshold uint32 HealthyThreshold uint32 }
HealthCheck holds the parameters for health check done by apk to the EndpointCluster
type InterceptEndpoint ¶
type InterceptEndpoint struct { Enable bool EndpointCluster EndpointCluster ClusterName string ClusterTimeout time.Duration RequestTimeout time.Duration // Level this is an enum allowing only values {api, resource, operation} // to indicate from which level interceptor is added Level string // Includes this is an enum allowing only values in // {"request_headers", "request_body", "request_trailer", "response_headers", "response_body", "response_trailer", //"invocation_context" } Includes *interceptor.RequestInclusions }
InterceptEndpoint contains the parameters of endpoint security
type InternalAIProvider ¶
type InternalAIProvider struct { Enabled bool ProviderName string ProviderAPIVersion string Organization string SupportedModels []string Model ValueDetails PromptTokens ValueDetails CompletionToken ValueDetails TotalToken ValueDetails }
InternalAIProvider represents the object structure holding the information related to the AI Provider
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
Operation type object holds data about each http method in the REST API.
func NewOperation ¶
func NewOperation(method string, security []string, extensions map[string]interface{}, matchID string) *Operation
NewOperation Creates and returns operation type object
func NewOperationWithPolicies ¶
func NewOperationWithPolicies(method string, policies OperationPolicies, matchID string) *Operation
NewOperationWithPolicies Creates and returns operation with given method and policies
func (*Operation) GetAuthentication ¶
func (operation *Operation) GetAuthentication() *Authentication
GetAuthentication get authentication configurations
func (*Operation) GetCallInterceptorService ¶
func (operation *Operation) GetCallInterceptorService(isIn bool) InterceptEndpoint
GetCallInterceptorService returns the interceptor configs for a given operation.
func (*Operation) GetID ¶
GetID returns the id of a given resource. This is a randomly generated UUID
func (*Operation) GetMatchID ¶
func (*Operation) GetMirrorEndpointClusters ¶
func (operation *Operation) GetMirrorEndpointClusters() []*EndpointCluster
GetMirrorEndpointClusters returns the endpoints if a mirror filter has been applied.
func (*Operation) GetMockedAPIConfig ¶
func (operation *Operation) GetMockedAPIConfig() *api.MockedApiConfig
GetMockedAPIConfig returns the operation level mocked API implementation configs
func (*Operation) GetPolicies ¶
func (operation *Operation) GetPolicies() *OperationPolicies
GetPolicies returns if the resouce is secured.
func (*Operation) GetRateLimitPolicy ¶
func (operation *Operation) GetRateLimitPolicy() *RateLimitPolicy
GetRateLimitPolicy returns the operation level throttling policy
func (*Operation) GetVendorExtensions ¶
GetVendorExtensions returns vendor extensions which are explicitly defined under a given resource.
func (*Operation) SetAuthentication ¶
func (operation *Operation) SetAuthentication(authentication *Authentication)
SetAuthentication set authentication configurations
type OperationPolicies ¶
type OperationPolicies struct { Request PolicyList `json:"request,omitempty"` Response PolicyList `json:"response,omitempty"` Fault PolicyList `json:"fault,omitempty"` }
OperationPolicies holds policies of the APIM operations
type Policy ¶
type Policy struct { PolicyName string `json:"policyName,omitempty"` PolicyVersion string `json:"policyVersion,omitempty"` Action string `json:"-"` // This is a meta value used in APK, not included in API YAML IsPassToEnforcer bool `json:"-"` // This is a meta value used in APK, not included in API YAML Parameters interface{} `json:"parameters,omitempty"` }
Policy holds APIM policies
func (*Policy) GetFullName ¶
GetFullName returns the fully qualified name of the policy This should be equal to the policy spec/def file name
type PolicyContainer ¶
type PolicyContainer struct { Specification PolicySpecification Definition PolicyDefinition }
PolicyContainer holds the definition and specification of policy
type PolicyContainerMap ¶
type PolicyContainerMap map[string]PolicyContainer
PolicyContainerMap maps PolicyName -> PolicyContainer
func (PolicyContainerMap) GetFormattedOperationalPolicies ¶
func (p PolicyContainerMap) GetFormattedOperationalPolicies(policies OperationPolicies, swagger *AdapterInternalAPI) (OperationPolicies, error)
GetFormattedOperationalPolicies returns formatted, policy from a user templated policy here, the struct swagger is only used for logging purpose, in case if we introduce logger context to get org ID, API ID, we can remove it from here
type PolicyDefinition ¶
type PolicyDefinition struct { Definition struct { Action string `yaml:"action"` Parameters map[string]interface{} `yaml:"parameters"` } `yaml:"definition"` RawData []byte `yaml:"-"` }
PolicyDefinition holds the content of policy definition which is rendered from ./Policy/<policy>.gotmpl files
type PolicyFlow ¶
type PolicyFlow string
PolicyFlow holds list of Policies in a operation (in one flow: In, Out or Fault)
type PolicySpecification ¶
type PolicySpecification struct { Type string `yaml:"type" json:"type"` Version string `yaml:"version" json:"version"` Data struct { Name string `yaml:"name"` Version string `yaml:"version"` ApplicableFlows []string `yaml:"applicableFlows"` SupportedGateways []string `yaml:"supportedGateways"` SupportedAPITypes []string `yaml:"supportedApiTypes"` MultipleAllowed bool `yaml:"multipleAllowed"` PolicyAttributes []struct { Name string `yaml:"name"` ValidationRegex string `yaml:"validationRegex,omitempty"` Type string `yaml:"type"` DefaultValue string `yaml:"defaultValue"` Required bool `yaml:"required,omitempty"` } `yaml:"policyAttributes"` } }
PolicySpecification holds policy specification from ./Policy/<policy>.yaml files
type RateLimit ¶
type RateLimit struct { // RequestPerUnit is the number of requests allowed per unit time // RequestsPerUnit uint32 `json:"requestsPerUnit,omitempty"` // Unit is the unit of the requestPerUnit // Unit string `json:"unit,omitempty"` }
RateLimit is the rate limit values for a policy
type RateLimitPolicy ¶
RateLimitPolicy information related to the rate limiting policy
type Resource ¶
type Resource struct { AIModelBasedRoundRobin *dpv1alpha4.ModelBasedRoundRobin // contains filtered or unexported fields }
Resource represents the object structure holding the information related to the pathItem object in OpenAPI definition. This is the most granular level in which the information can be stored as envoy architecture does not support having an operation level granularity out of the box.
Each resource can contain the path, the http methods that support, security schemas, endpoints. These values are populated from extensions/properties mentioned under pathItem.
func CreateMinimalDummyResourceForTests ¶
func CreateMinimalDummyResourceForTests(path string, methods []*Operation, id string, urls []Endpoint, hasPolicies bool, hasRequestRedirectPolicy bool) Resource
CreateMinimalDummyResourceForTests create a resource object with minimal required set of values which could be used for unit tests.
func CreateMinimalResource ¶
func CreateMinimalResource(path string, methods []*Operation, id string, endpoints *EndpointCluster, hasPolicies bool, hasRequestRedirectPolicy bool, pathMatchType gwapiv1.PathMatchType) Resource
CreateMinimalResource create a resource object with minimal required set of values
func SortResources ¶
SortResources Sort the list of resources provided based on the resource path.
func (*Resource) GetAIModelBasedRoundRobin ¶
func (resource *Resource) GetAIModelBasedRoundRobin() *dpv1alpha4.ModelBasedRoundRobin
GetAIModelBasedRoundRobin returns the AIModelBasedRoundRobin object of a given resource.
func (*Resource) GetBackendBasedAIRatelimitDescriptorValue ¶
GetBackendBasedAIRatelimitDescriptorValue returns the value of backendBasedAIRatelimitDescriptorValue.
func (*Resource) GetEnableBackendBasedAIRatelimit ¶
GetEnableBackendBasedAIRatelimit returns the value of enableBackendBasedAIRatelimit.
func (*Resource) GetEndpointSecurity ¶
func (resource *Resource) GetEndpointSecurity() []*EndpointSecurity
GetEndpointSecurity returns the endpoint security object of a given resource.
func (*Resource) GetEndpoints ¶
func (resource *Resource) GetEndpoints() *EndpointCluster
GetEndpoints returns the endpoints object of a given resource.
func (*Resource) GetExtractTokenFromValue ¶
GetExtractTokenFromValue returns the value of extractTokenFrom
func (*Resource) GetID ¶
GetID returns the id of a given resource. This is a randomly generated UUID
func (*Resource) GetMethod ¶
GetMethod returns an array of http method operations which are explicitly defined under a given resource.
func (*Resource) GetMethodList ¶
GetMethodList returns a list of http Methods as strings which are explicitly defined under a given resource.
func (*Resource) GetOperations ¶
GetOperations returns the array of operations of the resource.
func (*Resource) GetPath ¶
GetPath returns the pathItem name (of openAPI definition) corresponding to a given resource
func (*Resource) GetPathMatchType ¶
func (resource *Resource) GetPathMatchType() gwapiv1.PathMatchType
GetPathMatchType returns the path match type of the resource. https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.PathMatchType
func (*Resource) GetVendorExtensions ¶
GetVendorExtensions returns vendor extensions which are explicitly defined under a given resource.
func (*Resource) HasPolicies ¶
HasPolicies returns whether the resource has operations that includes policies.
type ResourceParams ¶
type ResourceParams struct { AuthSchemes map[string]dpv1alpha2.Authentication ResourceAuthSchemes map[string]dpv1alpha2.Authentication APIPolicies map[string]dpv1alpha4.APIPolicy ResourceAPIPolicies map[string]dpv1alpha4.APIPolicy InterceptorServiceMapping map[string]dpv1alpha1.InterceptorService BackendJWTMapping map[string]dpv1alpha1.BackendJWT BackendMapping map[string]*dpv1alpha2.ResolvedBackend ResourceScopes map[string]dpv1alpha1.Scope RateLimitPolicies map[string]dpv1alpha3.RateLimitPolicy ResourceRateLimitPolicies map[string]dpv1alpha3.RateLimitPolicy }
ResourceParams contains httproute related parameters
type RetryConfig ¶
RetryConfig holds the parameters for retries done by apk to the EndpointCluster
type SecurityScheme ¶
type SecurityScheme struct { DefinitionName string // Arbitrary name used to define the security scheme. ex: default, myApikey Type string // Type of the security scheme. Valid: apiKey, api_key, oauth2 Name string // Used for API key. Name of header or query. ex: x-api-key, apikey In string // Where the api key found in. Valid: query, header }
SecurityScheme represents the structure of an security scheme.
type ValueDetails ¶
ValueDetails defines the value details