appprotect

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PolicyGVR is the group version resource of the appprotect policy
	PolicyGVR = schema.GroupVersionResource{
		Group:    "appprotect.f5.com",
		Version:  "v1beta1",
		Resource: "appolicies",
	}
	// PolicyGVK is the group version kind of the appprotect policy
	PolicyGVK = schema.GroupVersionKind{
		Group:   "appprotect.f5.com",
		Version: "v1beta1",
		Kind:    "APPolicy",
	}

	// LogConfGVR is the group version resource of the appprotect policy
	LogConfGVR = schema.GroupVersionResource{
		Group:    "appprotect.f5.com",
		Version:  "v1beta1",
		Resource: "aplogconfs",
	}
	// LogConfGVK is the group version kind of the appprotect policy
	LogConfGVK = schema.GroupVersionKind{
		Group:   "appprotect.f5.com",
		Version: "v1beta1",
		Kind:    "APLogConf",
	}

	// UserSigGVR is the group version resource of the appprotect policy
	UserSigGVR = schema.GroupVersionResource{
		Group:    "appprotect.f5.com",
		Version:  "v1beta1",
		Resource: "apusersigs",
	}
	// UserSigGVK is the group version kind of the appprotect policy
	UserSigGVK = schema.GroupVersionKind{
		Group:   "appprotect.f5.com",
		Version: "v1beta1",
		Kind:    "APUserSig",
	}
)

Functions

func GetNsName

func GetNsName(obj *unstructured.Unstructured) string

GetNsName gets the key of a resource in the format: "resNamespace/resName"

func ParseResourceReferenceAnnotation

func ParseResourceReferenceAnnotation(ns, antn string) string

ParseResourceReferenceAnnotation returns a namespace/name string

func ParseResourceReferenceAnnotationList added in v1.12.0

func ParseResourceReferenceAnnotationList(ns, annotations string) []string

ParseResourceReferenceAnnotationList returns a slice of ns/names strings

func ValidateAppProtectLogDestination

func ValidateAppProtectLogDestination(dstAntn string) error

ValidateAppProtectLogDestination validates destination for log configuration

Types

type Change

type Change struct {
	// Op is an operation that needs be performed on the resource.
	Op Operation
	// Resource is the target resource.
	Resource interface{}
}

Change represents a change in an App Protect resource

type Configuration

type Configuration interface {
	AddOrUpdatePolicy(policyObj *unstructured.Unstructured) (changes []Change, problems []Problem)
	AddOrUpdateLogConf(logConfObj *unstructured.Unstructured) (changes []Change, problems []Problem)
	AddOrUpdateUserSig(userSigObj *unstructured.Unstructured) (change UserSigChange, problems []Problem)
	GetAppResource(kind, key string) (*unstructured.Unstructured, error)
	DeletePolicy(key string) (changes []Change, problems []Problem)
	DeleteLogConf(key string) (changes []Change, problems []Problem)
	DeleteUserSig(key string) (change UserSigChange, problems []Problem)
}

Configuration configures App Protect resources that the Ingress Controller uses.

func NewConfiguration

func NewConfiguration() Configuration

NewConfiguration creates a new App Protect Configuration

func NewFakeConfiguration

func NewFakeConfiguration() Configuration

NewFakeConfiguration creates a new App Protect Configuration

type ConfigurationImpl

type ConfigurationImpl struct {
	Policies map[string]*PolicyEx
	LogConfs map[string]*LogConfEx
	UserSigs map[string]*UserSigEx
}

ConfigurationImpl holds representations of App Protect cluster resources

func (*ConfigurationImpl) AddOrUpdateLogConf

func (ci *ConfigurationImpl) AddOrUpdateLogConf(logconfObj *unstructured.Unstructured) (changes []Change, problems []Problem)

AddOrUpdateLogConf adds or updates App Protect Log Configuration to App Protect Configuration

func (*ConfigurationImpl) AddOrUpdatePolicy

func (ci *ConfigurationImpl) AddOrUpdatePolicy(policyObj *unstructured.Unstructured) (changes []Change, problems []Problem)

AddOrUpdatePolicy adds or updates an App Protect Policy to App Protect Configuration

func (*ConfigurationImpl) AddOrUpdateUserSig

func (ci *ConfigurationImpl) AddOrUpdateUserSig(userSigObj *unstructured.Unstructured) (change UserSigChange, problems []Problem)

AddOrUpdateUserSig adds or updates App Protect User Defined Signature to App Protect Configuration

func (*ConfigurationImpl) DeleteLogConf

func (ci *ConfigurationImpl) DeleteLogConf(key string) (changes []Change, problems []Problem)

DeleteLogConf deletes an App Protect Log Configuration from App Protect Configuration

func (*ConfigurationImpl) DeletePolicy

func (ci *ConfigurationImpl) DeletePolicy(key string) (changes []Change, problems []Problem)

DeletePolicy deletes an App Protect Policy from App Protect Configuration

func (*ConfigurationImpl) DeleteUserSig

func (ci *ConfigurationImpl) DeleteUserSig(key string) (change UserSigChange, problems []Problem)

DeleteUserSig deletes an App Protect User Defined Signature from App Protect Configuration

func (*ConfigurationImpl) GetAppResource

func (ci *ConfigurationImpl) GetAppResource(kind, key string) (*unstructured.Unstructured, error)

GetAppResource returns a pointer to an App Protect resource

type FakeConfiguration

type FakeConfiguration struct {
	Policies map[string]*PolicyEx
	LogConfs map[string]*LogConfEx
	UserSigs map[string]*UserSigEx
}

FakeConfiguration holds representations of fake App Protect cluster resources

func (*FakeConfiguration) AddOrUpdateLogConf

func (fc *FakeConfiguration) AddOrUpdateLogConf(logConfObj *unstructured.Unstructured) (changes []Change, problems []Problem)

AddOrUpdateLogConf adds or updates App Protect Log Configuration to App Protect Configuration

func (*FakeConfiguration) AddOrUpdatePolicy

func (fc *FakeConfiguration) AddOrUpdatePolicy(policyObj *unstructured.Unstructured) (changes []Change, problems []Problem)

AddOrUpdatePolicy adds or updates an App Protect Policy to App Protect Configuration

func (*FakeConfiguration) AddOrUpdateUserSig

func (fc *FakeConfiguration) AddOrUpdateUserSig(userSigObj *unstructured.Unstructured) (change UserSigChange, problems []Problem)

AddOrUpdateUserSig adds or updates App Protect User Defined Signature to App Protect Configuration

func (*FakeConfiguration) DeleteLogConf

func (fc *FakeConfiguration) DeleteLogConf(key string) (changes []Change, problems []Problem)

DeleteLogConf deletes an App Protect Log Configuration from App Protect Configuration

func (*FakeConfiguration) DeletePolicy

func (fc *FakeConfiguration) DeletePolicy(key string) (changes []Change, problems []Problem)

DeletePolicy deletes an App Protect Policy from App Protect Configuration

func (*FakeConfiguration) DeleteUserSig

func (fc *FakeConfiguration) DeleteUserSig(key string) (change UserSigChange, problems []Problem)

DeleteUserSig deletes an App Protect User Defined Signature from App Protect Configuration

func (*FakeConfiguration) GetAppResource

func (fc *FakeConfiguration) GetAppResource(kind, key string) (*unstructured.Unstructured, error)

GetAppResource returns a pointer to an App Protect resource

type LogConfEx

type LogConfEx struct {
	Obj      *unstructured.Unstructured
	IsValid  bool
	ErrorMsg string
}

LogConfEx represents an App Protect Log Configuration cluster resource

type Operation

type Operation int

Operation defines an operation to perform for an App Protect resource.

const (
	// Delete the config of the resource
	Delete Operation = iota
	// AddOrUpdate the config of the resource
	AddOrUpdate
)

type PolicyEx

type PolicyEx struct {
	Obj           *unstructured.Unstructured
	SignatureReqs []SignatureReq
	IsValid       bool
	ErrorMsg      string
}

PolicyEx represents an App Protect policy cluster resource

type Problem

type Problem struct {
	// Object is a configuration object.
	Object *unstructured.Unstructured
	// Reason tells the reason. It matches the reason in the events of our configuration objects.
	Reason string
	// Message gives the details about the problem. It matches the message in the events of our configuration objects.
	Message string
}

Problem represents a problem with an App Protect resource

type RevTimes

type RevTimes struct {
	MinRevTime *time.Time
	MaxRevTime *time.Time
}

RevTimes are requirements for signature revision time

type SignatureReq

type SignatureReq struct {
	Tag      string
	RevTimes *RevTimes
}

SignatureReq describes a signature that is required by the policy

type UserSigChange

type UserSigChange struct {
	PolicyDeletions     []*unstructured.Unstructured
	PolicyAddsOrUpdates []*unstructured.Unstructured
	UserSigs            []*unstructured.Unstructured
}

UserSigChange holds resources that are affected by changes in UserSigs

type UserSigEx

type UserSigEx struct {
	Obj      *unstructured.Unstructured
	Tag      string
	RevTime  *time.Time
	IsValid  bool
	ErrorMsg string
}

UserSigEx represents an App Protect User Defined Signature cluster resource

Jump to

Keyboard shortcuts

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