model

package
v0.0.0-...-4c0ca3f Latest Latest
Warning

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

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

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

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]*dpv1alpha1.ResolvedBackend) string

GetBackendBasePath gets basePath of the the Backend

func ResolveDisableSecurity

func ResolveDisableSecurity(vendorExtensions map[string]interface{}) bool

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

func ResolveThrottlingTier(vendorExtensions map[string]interface{}) string

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 APIKey

type APIKey struct {
	In                  string
	Name                string
	SendTokenToUpstream bool
}

APIKey holds API Key related configurations

type AdapterInternalAPI

type AdapterInternalAPI struct {
	UUID string

	OrganizationID  string
	IsPrototyped    bool
	EndpointType    string
	LifecycleStatus string

	IsDefaultVersion bool

	EnvType string

	APIProperties []dpv1alpha2.Property
	// GraphQLSchema              string
	// GraphQLComplexities        GraphQLComplexityYaml
	IsSystemAPI     bool
	RateLimitPolicy *RateLimitPolicy

	Endpoints        *EndpointCluster
	EndpointSecurity []*EndpointSecurity
	// 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) 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) 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) 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) GetXWSO2ApplicationSecurity

func (adapterInternalAPI *AdapterInternalAPI) GetXWSO2ApplicationSecurity() bool

GetXWSO2ApplicationSecurity returns true if application security is mandatory, and false if optional

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) 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) 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 dpv1alpha2.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) SetInfoHTTPRouteCR

func (adapterInternalAPI *AdapterInternalAPI) SetInfoHTTPRouteCR(httpRoute *gwapiv1.HTTPRoute, resourceParams ResourceParams) 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) 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) SetXWSO2ApplicationSecurity

func (adapterInternalAPI *AdapterInternalAPI) SetXWSO2ApplicationSecurity(applicationSecurity bool)

SetXWSO2ApplicationSecurity sets the optional or mandatory application security

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

type Authentication struct {
	Disabled bool
	JWT      *JWT
	APIKey   []APIKey
	Oauth2   *Oauth2
}

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

type Certificate struct {
	Alias   string
	Content []byte
}

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

type ClaimMapping struct {
	Claim string
	Value ClaimVal
}

ClaimMapping represents the object structure holding the information related to the JWT Generator Claims

type ClaimVal

type ClaimVal struct {
	Value string
	Type  string
}

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 dpv1alpha1.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 GetEndpoints

func GetEndpoints(backendName types.NamespacedName, backendMapping map[string]*dpv1alpha1.ResolvedBackend) []Endpoint

GetEndpoints creates endpoints using resolved backends in backendMapping

func (*Endpoint) GetAuthorityHeader

func (endpoint *Endpoint) GetAuthorityHeader() string

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 JWT

type JWT struct {
	Header              string
	SendTokenToUpstream bool
	Audience            []string
}

JWT holds JWT related configurations

type Oauth2

type Oauth2 struct {
	Header              string
	SendTokenToUpstream bool
}

Oauth2 holds Oauth2 related configurations

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{}) *Operation

NewOperation Creates and returns operation type object

func NewOperationWithPolicies

func NewOperationWithPolicies(method string, policies OperationPolicies) *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

func (operation *Operation) GetID() string

GetID returns the id of a given resource. This is a randomly generated UUID

func (*Operation) GetMethod

func (operation *Operation) GetMethod() string

GetMethod returns the http method name of the give API operation

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) GetScopes

func (operation *Operation) GetScopes() []string

GetScopes returns the security schemas defined for the http opeartion

func (*Operation) GetTier

func (operation *Operation) GetTier() string

GetTier returns the operation level throttling tier

func (*Operation) GetVendorExtensions

func (operation *Operation) GetVendorExtensions() map[string]interface{}

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

func (p *Policy) GetFullName() string

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 PolicyList

type PolicyList []Policy

PolicyList holds list of Polices in a flow of operation

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

type RateLimitPolicy struct {
	Count    uint32
	SpanUnit string
}

RateLimitPolicy information related to the rate limiting policy

type Resource

type Resource struct {
	// 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) 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, pathMatchType gwapiv1.PathMatchType) Resource

CreateMinimalResource create a resource object with minimal required set of values

func SortResources

func SortResources(resources []*Resource) []*Resource

SortResources Sort the list of resources provided based on the resource path.

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) GetID

func (resource *Resource) GetID() string

GetID returns the id of a given resource. This is a randomly generated UUID

func (*Resource) GetMethod

func (resource *Resource) GetMethod() []*Operation

GetMethod returns an array of http method operations which are explicitly defined under a given resource.

func (*Resource) GetMethodList

func (resource *Resource) GetMethodList() []string

GetMethodList returns a list of http Methods as strings which are explicitly defined under a given resource.

func (*Resource) GetOperations

func (resource *Resource) GetOperations() []*Operation

GetOperations returns the array of operations of the resource.

func (*Resource) GetPath

func (resource *Resource) GetPath() string

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

func (resource *Resource) GetVendorExtensions() map[string]interface{}

GetVendorExtensions returns vendor extensions which are explicitly defined under a given resource.

func (*Resource) HasPolicies

func (resource *Resource) HasPolicies() bool

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]dpv1alpha2.APIPolicy
	ResourceAPIPolicies       map[string]dpv1alpha2.APIPolicy
	InterceptorServiceMapping map[string]dpv1alpha1.InterceptorService
	BackendJWTMapping         map[string]dpv1alpha1.BackendJWT
	BackendMapping            map[string]*dpv1alpha1.ResolvedBackend
	ResourceScopes            map[string]dpv1alpha1.Scope
	RateLimitPolicies         map[string]dpv1alpha1.RateLimitPolicy
	ResourceRateLimitPolicies map[string]dpv1alpha1.RateLimitPolicy
}

ResourceParams contains httproute related parameters

type RetryConfig

type RetryConfig struct {
	Count                int32
	StatusCodes          []uint32
	BaseIntervalInMillis int32
}

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.

Jump to

Keyboard shortcuts

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