types

package
v0.0.0-...-cd00529 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Hostname of cluster
	AttributeHost = "Host"

	// Port of cluster
	AttributePort = "Port"

	// Timeout for new network connections to cluster
	AttributeConnectTimeout = "ConnectTimeout"

	// Tdle timeout for connections, for the period in which there are no active requests
	AttributeIdleTimeout = "IdleTimeout"

	// Determines whether to enable TLS or not, HTTP/2 always uses TLS
	AttributeTLS = "TLS"

	// Holds hostname to send during TLS handshake (if not set a cluster's hostname will be used)
	AttributeSNIHostName = "SNIHostName"

	// Sets network protocol to use for health check
	AttributeHealthCheckProtocol = "HealthCheckProtocol"

	// Determines host header to use for health check
	AttributeHealthHostHeader = "HealthCheckHostHeader"

	// Determines http path of health check probe
	AttributeHealthCheckPath = "HealthCheckPath"

	// Health check interval for probes
	AttributeHealthCheckInterval = "HealthCheckInterval"

	// Health check timeout
	AttributeHealthCheckTimeout = "HealthCheckTimeout"

	// Threshold of attempts before declaring cluster unhealthly
	AttributeHealthCheckUnhealthyThreshold = "HealthCheckUnhealthyThreshold"

	// Threshold of attempts before declaring cluster healthly
	AttributeHealthCheckHealthyThreshold = "HealthCheckHealthyThreshold"

	// Logfile name for healthcheck probes
	AttributeHealthCheckLogFile = "HealthCheckLogFile"

	// Maximum number of connects to cluster
	AttributeMaxConnections = "MaxConnections"

	// Maximum number of pending cluster requests
	AttributeMaxPendingRequests = "MaxPendingRequests"

	// Maximum number of parallel requests to cluster
	AttributeMaxRequests = "MaxRequests"

	// Maximum number of retries to cluster
	AttributeMaxRetries = "MaxRetries"

	// IP network address family to use for contacting cluster
	AttributeDNSLookupFamily = "DNSLookupFamily"

	// dns resolving using v4 only
	AttributeValueDNSIPV4Only = "V4_ONLY"

	// dns resolving using v6 only
	AttributeValueDNSIPV6Only = "V6_ONLY"

	// dns resolving via both v4 & v6
	AttributeValueDNSAUTO = "AUTO"

	// Refresh rate for resolving cluster hostname
	AttributeDNSRefreshRate = "DNSRefreshRate"

	// Resolver ip address(es) to use for dns resolution (multiple can be comma separated)
	AttributeDNSResolvers = "DNSResolvers"

	AttributeLbPolicy            = "LbPolicy"
	AttributeValueLBRoundRobin   = "ROUND_ROBIN"
	AttributeValueLBLeastRequest = "LEAST_REQUEST"
	AttributeValueLBRingHash     = "RING_HASH"
	AttributeValueLBRandom       = "RANDOM"
	AttributeValueLBMaglev       = "MAGLEV"

	// Default connection timeout
	DefaultClusterConnectTimeout = 5 * time.Second

	// Default cluster connect idle timeout
	DefaultClusterIdleTimeout = 15 * time.Minute

	// Default health check interval
	DefaultHealthCheckInterval = 5 * time.Second

	// Default health check timeout
	DefaultHealthCheckTimeout = 10 * time.Second

	// Default unhealthy threshold
	DefaultHealthCheckUnhealthyThreshold = 2

	// Default healthy threshold
	DefaultHealthCheckHealthyThreshold = 2

	// Default dns resolution interval of cluster hostname
	DefaultDNSRefreshRate = 5 * time.Second
)

Cluster specific attributes

View Source
const (
	AttributeListenerFilters = "Filters"

	// File for storing access logs
	AttributeAccessLogFile = "AccessLogFile"

	// Field configuration for access logging to file
	AttributeAccessLogFileFields = "AccessLogFileFields"

	// Cluster to send access logs to
	AttributeAccessLogCluster = "AccessLogCluster"

	// In memory buffer size for access logs
	AttributeAccessLogClusterBufferSize = "AccessLogClusterBufferSize"

	// Server name to respond with
	AttributeServerName = "ServerName"

	// HTTP/2 max concurrent streams per connection
	AttributeMaxConcurrentStreams = "MaxConcurrentStreams"

	// HTTP/2 initial connection window size
	AttributeInitialConnectionWindowSize = "InitialConnectionWindowSize"

	// HTTP/2 initial window size
	AttributeInitialStreamWindowSize = "InitialStreamWindowSize"

	// Name of extzauth cluster
	AttributeExtAuthzCluster = "ExtAuthzCluster"

	// Extauthz cluster request timeout
	AttributeExtAuthzTimeout = "ExtAuthzTimeout"

	// Are requests allowed in case authentication times out
	AttributeExtAuthzFailureModeAllow = "ExtAuthzFailureModeAllow"

	// Number of bytes of POST request to include in authentication request
	AttributeExtAuthzRequestBodySize = "ExtAuthzRequestBodySize"

	// Organization to be used for lookups by envoyauth when authentication requests
	AttributeOrganization = "Organization"

	// Ratelimiting
	AttributeRateLimitingCluster = "RateLimitingCluster"

	//
	AttributeRateLimitingTimeout = "RateLimitingTimeout"

	//
	AttributeRateLimitingDomain = "RateLimitingDomain"

	//
	AttributeRateLimitingFailureModeAllow = "RateLimitingFailureModeAllow"
)

listener specific attributes

View Source
const (
	// AttributeTLSCertificate holds pem encoded certicate
	AttributeTLSCertificate = "TLSCertificate"

	// AttributeTLSCertificateKey holds certicate key
	AttributeTLSCertificateKey = "TLSCertificateKey"

	// AttributeTLSCertificateFile holds filename of pem encoded certicate
	AttributeTLSCertificateFile = "TLSCertificateFile"

	// AttributeTLSCertificateKeyFile holds filename of certicate key
	AttributeTLSCertificateKeyFile = "TLSCertificateKeyFile"

	// AttributeTLSMinimumVersion determines minimum TLS version accepted
	AttributeTLSMinimumVersion = "TLSMinimumVersion"

	// AttributeTLSMaximumVersion determines maximum TLS version accepted
	AttributeTLSMaximumVersion = "TLSMaximumVersion"

	// AttributeTLSCipherSuites determines set of allowed TLS ciphers
	AttributeTLSCipherSuites = "TLSCipherSuites"

	// AttributeTLSCipherSuites sets HTTP protocol to accept
	AttributeHTTPProtocol = "HTTPProtocol"

	AttributeValueTrue                    = "true"
	AttributeValueFalse                   = "false"
	AttributeValueTLSVersion10            = "TLS1.0"
	AttributeValueTLSVersion11            = "TLS1.1"
	AttributeValueTLSVersion12            = "TLS1.2"
	AttributeValueTLSVersion13            = "TLS1.3"
	AttributeValueHTTPProtocol11          = "HTTP/1.1"
	AttributeValueHTTPProtocol2           = "HTTP/2"
	AttributeValueHTTPProtocol3           = "HTTP/3"
	AttributeValueHealthCheckProtocolHTTP = "HTTP"
)

Attributes which are shared amongst listener, route and cluster

View Source
const (
	// Name of upstream cluster to forward requests to
	AttributeCluster = "Cluster"

	// Weighted list of clusters to load balance requests across
	AttributeWeightedClusters = "WeightedClusters"

	// Enable/disable authentication via extauthz
	AttributeRouteExtAuthz = "ExtAuthz"

	// // Enable ratelimiting
	AttributeRouteRateLimiting = "RateLimiting"

	// Return an arbitrary HTTP response directly, without proxying
	AttributeDirectResponseStatusCode = "DirectResponseStatusCode"

	// Responsebody to return when direct response is done
	AttributeDirectResponseBody = "DirectResponseBody"

	// Return an HTTP redirect
	AttributeRedirectStatusCode = "RedirectStatusCode"

	// HTTP scheme when generating a redirect
	AttributeRedirectScheme = "RedirectScheme"

	// Hostname when generating a redirect
	AttributeRedirectHostName = "RedirectHostName"

	// Port when generating a redirect
	AttributeRedirectPort = "RedirectPort"

	// Path when generating a redirect
	AttributeRedirectPath = "RedirectPath"

	// Enable removal of query parameters when redirecting
	AttributeRedirectStripQuery = "RedirectStripQuery"

	// Rewrites path when contacting upstream
	AttributePrefixRewrite = "PrefixRewrite"

	// Whether the resource allows credentials
	AttributeCORSAllowCredentials = "CORSAllowCredentials"

	// Value of Access-Control-Allow-Methods header
	AttributeCORSAllowMethods = "CORSAllowMethods"

	// Value of Access-Control-Allow-Headers header
	AttributeCORSAllowHeaders = "CORSAllowHeaders"

	// Value of Access-Control-Expose-Headers header
	AttributeCORSExposeHeaders = "CORSExposeHeaders"

	// Value of Access-Control-Expose-Headers header
	AttributeCORSMaxAge = "CORSMaxAge"

	// Host header to set when forwarding to upstream cluster
	AttributeHostHeader = "HostHeader"

	// Additional header 1 to set before forwarding upstream
	AttributeRequestHeaderToAdd1 = "RequestHeaderToAdd1"

	// Additional header 2 to set before forwarding upstream
	AttributeRequestHeaderToAdd2 = "RequestHeaderToAdd2"

	// Additional header 3 to set before forwarding upstream
	AttributeRequestHeaderToAdd3 = "RequestHeaderToAdd3"

	// Additional header 4 to set before forwarding upstream
	AttributeRequestHeaderToAdd4 = "RequestHeaderToAdd4"

	// Additional header 5 to set before forwarding upstream
	AttributeRequestHeaderToAdd5 = "RequestHeaderToAdd5"

	// Optional header(s) to remove before forwarding upstream
	AttributeRequestHeadersToRemove = "RequestHeadersToRemove"

	// Basic authentication header to set before forwarding upstream
	AttributeBasicAuth = "BasicAuth"

	// Conditions under which retry takes place
	AttributeRetryOn = "RetryOn"

	// Upstream timeout per retry attempt
	AttributePerTryTimeout = "PerTryTimeout"

	// Max number of retry attempts
	AttributeNumRetries = "NumRetries"

	// Upstream status codes which are to be retried
	AttributeRetryOnStatusCodes = "RetryOnStatusCodes"

	// Cluster to mirror requests to
	AttributeRequestMirrorCluster = "RequestMirrorCluster"

	// Percentage of traffic traffic to mirror requests to
	AttributeRequestMirrorPercentage = "RequestMirrorPercentage"

	// Tineout for cluster communication
	AttributeTimeout = "Timeout"

	// RouteType path will check for an exact match
	AttributeValuePathTypePath = "path"

	// RouteType prefix will match path starting with prefix
	AttributeValuePathTypePrefix = "prefix"

	// RouteType regexp will path regexp match
	AttributeValuePathTypeRegexp = "regexp"

	// Default route timeout
	DefaultRouteTimeout = 20 * time.Second

	// Default per retry timeout
	DefaultPerRetryTimeout = 500 * time.Millisecond

	// Default retry count
	DefaultNumRetries = 2

	// Default retry-on status codes
	DefaultRetryStatusCodes = "500,503,504"
)

Attributes supported on a route

View Source
const (
	TypeListenerName     = "listener"
	TypeRouteName        = "route"
	TypeClusterName      = "cluster"
	TypeOrganizationName = "organization"
	TypeCompanyName      = "company"
	TypeDeveloperName    = "developer"
	TypeDeveloperAppName = "developerapp"
	TypeAPIProductName   = "apiproduct"
	TypeKeyName          = "key"
	TypeOAuthName        = "oauth"
	TypeUserName         = "user"
	TypeRoleName         = "role"
)

Entity types we handle

Variables

View Source
var (
	// NullAPIProduct is an empty apiproduct type
	NullAPIProduct = APIProduct{}

	// NullAPIProducts is an empty apiproduct slice
	NullAPIProducts = APIProducts{}
)
View Source
var (
	// NullAttribute is an empty attribute type
	NullAttribute = Attribute{}

	// NullAttributes is an empty attributes slice
	NullAttributes = Attributes{}

	// Maximum number of attributes allowed in set
	MaximumNumberofAttributesAllowed = 100
)
View Source
var (
	// NullAudit is an empty audit type
	NullAudit = Audit{}

	// NullAudits is an empty audit slice
	NullAudits = Audits{}
)
View Source
var (
	// NullCluster is an empty cluster type
	NullCluster = Cluster{}

	// NullClusters is an empty cluster slice
	NullClusters = Clusters{}
)
View Source
var (
	// NullCompany is an empty company type
	NullCompany = Company{}

	// NullCompanies is an empty company slice
	NullCompanies = Companies{}
)
View Source
var (
	// NullDeveloper is an empty developer type
	NullDeveloper = Developer{}

	// NullDevelopers is an empty developer slice
	NullDevelopers = Developers{}
)
View Source
var (
	// NullDeveloperApp is an empty developer app type
	NullDeveloperApp = DeveloperApp{}

	// NullDeveloperApps is an empty developer app slice
	NullDeveloperApps = DeveloperApps{}
)
View Source
var (
	// NullDeveloperAppKey is an empty key type
	NullDeveloperAppKey = Key{}

	// NullDeveloperAppKeys is an empty key slice
	NullDeveloperAppKeys = Keys{}
)
View Source
var (
	// NullListener is an empty listener type
	NullListener = Listener{}

	// NullListeners is an empty listener slice
	NullListeners = Listeners{}
)
View Source
var (
	// NullOrganization is an empty organization type
	NullOrganization = Organization{}

	// NullOrganizations is an empty organization slice
	NullOrganizations = Organizations{}
)
View Source
var (
	// NullRole is an empty role type
	NullRole = Role{}

	// NullRoles is an empty role slice
	NullRoles = Roles{}

	// NullPermission is an allow type
	NullPermission = Permission{}

	// NullPermissions is an allows type
	NullPermissions = Permissions{}
)
View Source
var (
	// NullRoute is an empty route type
	NullRoute = Route{}

	// NullRoutes is an empty route slice
	NullRoutes = Routes{}
)
View Source
var (
	// NullUser is an empty user type
	NullUser = User{}

	// NullUsers is an empty user slice
	NullUsers = Users{}
)

Functions

func HTTPStatusCode

func HTTPStatusCode(e Error) int

HTTPStatusCode returns HTTP status code for Error type

func IDOf

func IDOf(entity interface{}) string

IDOf returns the id of an object (e.g. developer.Email in case of Developer)

func NameOf

func NameOf(entity interface{}) string

NameOf returns the name of an object

Types

type APIProduct

type APIProduct struct {
	// Name of apiproduct (not changable)
	Name string `validate:"required,min=1"`

	// Routegroup this apiproduct should match to
	RouteGroup string

	// List of paths this apiproduct applies to
	APIResources []string `binding:"required,min=1"`

	// List of scopes that apply to this product
	Scopes []string

	// Approval type of this apiproduct
	ApprovalType string

	// Attributes of this apiproduct
	Attributes Attributes

	// Friendly display name of route
	DisplayName string

	// Full description of this api product
	Description string

	// Comma separated list of policynames, to apply to requests
	Policies string

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this apiproduct
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this apiproduct
	LastModifiedBy string
}

APIProduct type contains everything about an API product

Field validation (binding) is done using https://godoc.org/github.com/go-playground/validator

func (*APIProduct) Validate

func (a *APIProduct) Validate() error

Validate checks if field values are set correct and are allowed

type APIProducts

type APIProducts []APIProduct

APIProducts holds one or more apiproducts

type Attribute

type Attribute struct {
	// Attribute name, minimum required length is 1
	Name string `validate:"required,min=1"`

	// Attribute value
	Value string `validate:"required"`
}

Attribute is an array with attributes

Field validation settings (binding) are validated with https://godoc.org/github.com/go-playground/validator

func NewAttribute

func NewAttribute(name, value string) *Attribute

NewAttribute creates a new attribute

func (*Attribute) Validate

func (a *Attribute) Validate() error

Validate checks if field values are set correct and are allowed

type Attributes

type Attributes []Attribute

Attributes holds one or more attributes

func (*Attributes) Delete

func (a *Attributes) Delete(name string) (valueOfDeletedAttribute string, e Error)

Delete removes attribute from slice. Returns delete status and deleted attribute's value

func (*Attributes) Get

func (a *Attributes) Get(name string) (string, Error)

Get return one named attribute from attributes

func (*Attributes) GetAsDuration

func (a *Attributes) GetAsDuration(name string, defaultDuration time.Duration) time.Duration

GetAsDuration returns attribute value (or provided default) as type time.Duration

func (*Attributes) GetAsString

func (a *Attributes) GetAsString(name, defaultValue string) string

GetAsString returns attribute value (or provided default if not found) as type string

func (*Attributes) GetAsUInt32

func (a *Attributes) GetAsUInt32(name string, defaultValue uint32) uint32

GetAsUInt32 returns attribute value (or provided default) as type integer

func (*Attributes) Set

func (a *Attributes) Set(attributeValue *Attribute) Error

Set updates or adds attribute in slice. Returns old value if attribute already existed.

func (*Attributes) SetMultiple

func (a *Attributes) SetMultiple(attributeValues Attributes) Error

SetMultiple updates or adds multiple attribute. Returns error in case of isses

func (Attributes) Sort

func (a Attributes) Sort()

Sort slice by attribute name

func (*Attributes) Tidy

func (a *Attributes) Tidy()

Tidy removes duplicate, trims all names & values and sorts attribute by name

func (Attributes) Validate

func (a Attributes) Validate() error

Validate checks if field values are set correct and are allowed

type Audit

type Audit struct {
	// Unique id
	ID string

	// Event timestamp in epoch milliseconds
	Timestamp int64
	AuditType string

	IPaddress string
	RequestID string
	Role      string
	User      string
	UserAgent string

	Organization string
	Company      string
	DeveloperID  string
	AppID        string

	EntityType string
	EntityID   string
	OldValue   map[string]interface{}
	NewValue   map[string]interface{}
}

Audit holds an audit

type Audits

type Audits []Audit

Audits holds one or more audits

type Cluster

type Cluster struct {
	// Name of cluster (not changable)
	Name string `validate:"required,min=1"`

	// Friendly display name of cluster
	DisplayName string

	// Attributes of this cluster
	Attributes Attributes

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this cluster
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this cluster
	LastModifiedBy string
}

Cluster holds configuration of an upstream cluster

Field validation (binding) is done using https://godoc.org/github.com/go-playground/validator

func (*Cluster) Validate

func (c *Cluster) Validate() error

Validate checks if a cluster's configuration is correct

type Clusters

type Clusters []Cluster

Clusters holds one or more clusters

func (Clusters) Sort

func (clusters Clusters) Sort()

Sort orders a slice of clusters

type Companies

type Companies []Company

Companies holds one or more Companies

type Company

type Company struct {
	// Name of company (not changable)
	Name string `validate:"required,min=1,max=100"`

	// Friendly display name of company
	DisplayName string

	// Attributes of company
	Attributes Attributes

	// Status of company
	Status string

	// Name of applications of this company
	Apps []string

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this company
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this company
	LastModifiedBy string
}

Company holds details of a company

func (*Company) Activate

func (c *Company) Activate()

Activate marks a company as active

func (*Company) Deactivate

func (c *Company) Deactivate()

Deactivate marks a developer as inactive

func (*Company) IsActive

func (c *Company) IsActive() bool

IsActive returns true in case company's status is active

func (*Company) Validate

func (o *Company) Validate() error

Validate checks if field values are set correct and are allowed

type Developer

type Developer struct {
	// Id of developer (not changable)
	DeveloperID string

	// Status of developer (should be "approved" to allow access)
	Status string

	// Name of developer applications of this developer
	Apps []string

	// Attributes of developer
	Attributes Attributes

	// Email address
	Email string `validate:"required,email"`

	// Username
	UserName string

	// First name
	FirstName string

	// Last name
	LastName string

	// Organization name
	OrganizationName string

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this organiz
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this developer
	LastModifiedBy string
}

Developer contains everything about a Developer

func (*Developer) Activate

func (d *Developer) Activate()

Activate marks a developer as approved

func (*Developer) Deactivate

func (d *Developer) Deactivate()

Deactivate marks a developer as inactive

func (*Developer) IsActive

func (d *Developer) IsActive() bool

IsActive returns true in case developer's status is active

func (*Developer) Validate

func (d *Developer) Validate() error

Validate checks if field values are set correct and are allowed

type DeveloperApp

type DeveloperApp struct {
	// Id of developer app (not changable)
	AppID string

	// Id of developer (not changable)
	DeveloperID string

	// Activation status of developer application
	Status string

	// Attributes of developer application
	Attributes Attributes

	// Name of developer application
	Name string `validate:"required,min=1"`

	// Friendly name of developer app
	DisplayName string

	// OAuth scopes
	Scopes []string

	// OAuth call back URL
	CallbackURL string

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this app
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this app
	LastModifiedBy string
}

DeveloperApp contains everything about a Developer Application

func (*DeveloperApp) Approve

func (d *DeveloperApp) Approve()

Activate marks a developer as approved

func (*DeveloperApp) IsActive

func (d *DeveloperApp) IsActive() bool

IsActive returns true in case developer's status is active

func (*DeveloperApp) Revoke

func (d *DeveloperApp) Revoke()

Deactivate marks a developer as inactive

func (*DeveloperApp) Validate

func (d *DeveloperApp) Validate() error

Validate checks if field values are set correct and are allowed

type DeveloperApps

type DeveloperApps []DeveloperApp

DeveloperApps holds one or more developer apps

type Developers

type Developers []Developer

Developers holds one or more developers

type Error

type Error interface {
	Error() string
	ErrorDetails() string
	Type() error
	TypeString() string
}

Error is our error type providing additional (internal error detail

func NewBadRequestError

func NewBadRequestError(details error) Error

NewBadRequestError returns a bad request error

func NewDatabaseError

func NewDatabaseError(details error) Error

NewDatabaseError returns a database error

func NewForbiddenError

func NewForbiddenError(details error) Error

NewForbiddenError returns a forbidden action error

func NewItemNotFoundError

func NewItemNotFoundError(details error) Error

NewItemNotFoundError returns a item not found error

func NewNotAcceptable

func NewNotAcceptable(details error) Error

NewNotAcceptable returns a not acceptable error

func NewUnauthorizedError

func NewUnauthorizedError(details error) Error

NewUnauthorizedError returns an unauthorized error

func NewUpdateFailureError

func NewUpdateFailureError(details error) Error

NewUpdateFailureError returns a item not found error

type Key

type Key struct {
	// ConsumerKey is the key required for authentication
	ConsumerKey string `validate:"required,min=1"`

	// ConsumerSecret is secretid of this key, needed to request OAuth2 access token
	ConsumerSecret string `validate:"required,min=1"`

	// List of apiproducts which can be accessed using this key
	APIProducts KeyAPIProductStatuses

	// List of scopes this key has
	Scopes []string

	// Expiry date in epoch milliseconds
	ExpiresAt int64

	// Issue date in epoch milliseconds
	IssuedAt int64

	// Attributes of key
	Attributes Attributes

	// Developer app id this key belongs to
	AppID string

	// Status (should be "approved" to allow access)
	Status string
}

Key contains an apikey entitlement

Field validation (binding) is done using https://godoc.org/github.com/go-playground/validator

func (*Key) Approved

func (k *Key) Approved()

Approve changes this key's status to approved

func (*Key) IsApproved

func (k *Key) IsApproved() bool

IsApproved returns true in case key's status is approved

func (*Key) IsExpired

func (k *Key) IsExpired(now int64) bool

IsExpired returns true in case key is expired

func (*Key) Revoke

func (k *Key) Revoke()

Revoke change this key's status to revoked

func (*Key) Validate

func (k *Key) Validate() error

Validate checks if field values are set correct and are allowed

type KeyAPIProductStatus

type KeyAPIProductStatus struct {
	// Name of apiproduct
	Apiproduct string `json:"apiProduct"`

	// Status (should be "approved" to allow access)
	Status string `json:"status"`
}

KeyAPIProductStatus contains whether an apikey's assigned apiproduct has been approved

func (*KeyAPIProductStatus) IsApproved

func (p *KeyAPIProductStatus) IsApproved() bool

IsApproved returns true in case key's apiproduct status is approved

func (*KeyAPIProductStatus) SetApproved

func (p *KeyAPIProductStatus) SetApproved()

SetApproved marks a key's apiproduct as approved

type KeyAPIProductStatuses

type KeyAPIProductStatuses []KeyAPIProductStatus

KeyAPIProductStatuses contains list of apiproducts

func (KeyAPIProductStatuses) AddProducts

func (p KeyAPIProductStatuses) AddProducts(apiproductNames *[]string) KeyAPIProductStatuses

AddProducts adds one or more apiproduct to a key's assigned products and returns an updated slice

func (KeyAPIProductStatuses) ChangeStatus

func (p KeyAPIProductStatuses) ChangeStatus(apiproductName, newProductStatus string) KeyAPIProductStatuses

ChangeStatus changes the status of one apiproduct and returns an updated slice

func (KeyAPIProductStatuses) RemoveProduct

func (p KeyAPIProductStatuses) RemoveProduct(apiproductName string) KeyAPIProductStatuses

RemoveProduct removes one apiproduct from a key's assigned products and returns an updated slice

type Keys

type Keys []Key

Keys holds one or more apikeys

type Listener

type Listener struct {
	// Name of listener (not changable)
	Name string `validate:"required,min=1"`

	// Friendly display name of listener
	DisplayName string

	// Virtual hosts of this listener (at least one, each value must be a fqdn)
	VirtualHosts []string `validate:"required,min=1,dive,fqdn"`

	// tcp port to listen on
	Port int `validate:"required,min=1,max=65535"`

	// Routegroup to forward traffic to
	RouteGroup string `validate:"required"`

	// Comma separated list of policynames, to apply to requests
	Policies string

	// Attributes of this listener
	Attributes Attributes

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this listener
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this listener
	LastModifiedBy string
}

Listener contains everything about downstream configuration of listener and http virtual hosts

func (*Listener) Validate

func (l *Listener) Validate() error

Validate checks if a listener's configuration is correct

type Listeners

type Listeners []Listener

Listeners holds one or more Listeners

func (Listeners) Sort

func (listeners Listeners) Sort()

Sort a slice of listeners

type OAuthAccessToken

type OAuthAccessToken struct {
	ClientID         string `json:"client_id"`
	UserID           string `json:"user_id"`
	RedirectURI      string `json:"redirect_uri"`
	Scope            string `json:"scope"`
	Code             string `json:"code"`
	CodeCreatedAt    int64  `json:"code_created_at"`
	CodeExpiresIn    int64  `json:"code_expires_in"`
	Access           string `json:"access"`
	AccessCreatedAt  int64  `json:"access_created_at"`
	AccessExpiresIn  int64  `json:"access_expires_in"`
	Refresh          string `json:"refresh"`
	RefreshCreatedAt int64  `json:"refresh_created_at"`
	RefreshExpiresIn int64  `json:"refresh_expires_in"`
}

OAuthAccessToken holds details of an issued OAuth token

type Organization

type Organization struct {
	// Name of organization (not changable)
	Name string `validate:"required,min=1,max=100"`

	// Friendly display name of organization
	DisplayName string

	// Attributes of this organization
	Attributes Attributes

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this organization
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this organization
	LastModifiedBy string
}

Organization holds details of an organization

func (*Organization) Validate

func (o *Organization) Validate() error

Validate checks if field values are set correct and are allowed

type Organizations

type Organizations []Organization

Organizations holds one or more Organizations

type Permission

type Permission struct {
	// Request methods which are allowed
	// FIXME these bindings settings do not get used...
	Methods []string `validate:"dive,oneof=GET POST PUT PATCH DELETE,required"`

	// Request paths (regexp) which are allowed
	Paths []string `validate:"dive,startswith=/,required"`
}

Permission holds the criteria a role will allow request

type Permissions

type Permissions []Permission

Permissions holds one or more allow

type Role

type Role struct {
	// Name of role (not changable)
	Name string `validate:"required,min=1,max=100"`

	// Display name
	DisplayName string

	// Allowed methods & paths
	Permissions `validate:"required"`

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this role
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this role
	LastModifiedBy string
}

Role holds an role

func (*Role) IsPathAllowed

func (r *Role) IsPathAllowed(requestMethod, requestPath string) bool

IsPathAllowed checks whether role is allowed to access a path

func (*Role) Validate

func (r *Role) Validate() error

Validate checks if field values are set correct and are allowed

type Roles

type Roles []Role

Roles holds one or more roles

func (Roles) Sort

func (roles Roles) Sort()

Sort a slice of users

type Route

type Route struct {
	// Name of route (not changable)
	Name string `binding:"required,min=4"`

	// Friendly display name of route
	DisplayName string

	// Routegroup this route is part of
	RouteGroup string `binding:"required,min=4"`

	// Path of route (should always start with a /)
	Path string `binding:"required,min=1,startswith=/"`

	// Type of pathmatching: path, prefix, regexp
	PathType string `binding:"required,oneof=path prefix regexp"`

	// Attributes of this route
	Attributes Attributes

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this route
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this route
	LastModifiedBy string
}

Route holds configuration of a route

Field validation (binding) is done using https://godoc.org/github.com/go-playground/validator

func (*Route) Validate

func (r *Route) Validate() error

Validate checks if a route's configuration is correct

type Routes

type Routes []Route

Routes holds one or more routes

func (Routes) Sort

func (routes Routes) Sort()

Sort orders a slice of routes

type User

type User struct {
	// Name of user (not changable)
	Name string `validate:"required,min=1,max=100"`

	// Display name
	DisplayName string

	// Password
	Password string

	// Status of this user
	Status string

	// Role of this user
	Roles []string

	// Created at timestamp in epoch milliseconds
	CreatedAt int64

	// Name of user who created this user
	CreatedBy string

	// Last modified at timestamp in epoch milliseconds
	LastModifiedAt int64

	// Name of user who last updated this user
	LastModifiedBy string
}

User holds an user

func (*User) Validate

func (u *User) Validate() error

Validate checks if field values are set correct and are allowed

type Users

type Users []User

Users holds one or more users

func (Users) Sort

func (users Users) Sort()

Sort a slice of users

Jump to

Keyboard shortcuts

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