Documentation ¶
Index ¶
- func K8sLabelValueValidation(value string, maxLen int, fixup bool) (string, []error)
- func K8sResourceNameValidation(value string, maxLen int, fixup bool) (string, []error)
- func ParseURL(uri string) (*url.URL, error)
- func UidGenerator(url *url.URL, svcID string) (string, error)
- type AuthenticationMethod
- type ConfigGenerator
- func (cg ConfigGenerator) GetDefaultMatchConditions() []string
- func (cg ConfigGenerator) GetHost() string
- func (cg ConfigGenerator) GetServiceID() string
- func (cg ConfigGenerator) GetUID() string
- func (cg ConfigGenerator) OutputAll(w io.Writer) error
- func (cg ConfigGenerator) OutputHandler(w io.Writer) error
- func (cg ConfigGenerator) OutputInstance(w io.Writer) error
- func (cg ConfigGenerator) OutputRule(w io.Writer) error
- func (cg ConfigGenerator) OutputUID(w io.Writer) error
- type CredentialsLocation
- type Handler
- type Instance
- type MatchConditions
- type Rule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func K8sLabelValueValidation ¶ added in v0.5.0
Validate and potentially fix up k8s label values https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
The rules as of March 2019 are:
- Maximum 63 characters long
- Must be empty or start and end with an alphanumeric character (caps included), with alphanumerics, dashes, underscores and dots allowed in between.
Parameters:
- value: the label value string to validate
- maxLen: the maximum length in case you have extra constraints, or use a negative value to indicate that a value up to the spec's maximum length is validated.
- fixup: set to true to try to correct any deviation from the spec.
Returned values: - string: the validated and possibly corrected value - []error: array of errors describing the issues found
func K8sResourceNameValidation ¶ added in v0.5.0
Validate and potentially fix up k8s resource names https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
The rules as of March 2019 are: * Must be a DNS SUBDOMAIN by the rules of RFC 1123, consisting of:
- Maximum 253 characters long, minimum 1
- One or more lowercase RFC 1123 labels separated by '.'
Parameters:
- value: the resource name string to validate
- maxLen: the maximum length in case you have extra constraints, or use a negative value to indicate that a value up to the spec's maximum length is validated.
- fixup: set to true to try to correct any deviation from the spec.
Returned values: - string: the validated and possibly corrected value - []error: array of errors describing the issues found
Types ¶
type AuthenticationMethod ¶
type AuthenticationMethod int
AuthenticationMethod specifies the authentication pattern that should be used to generate the templates
const ( // Generate templates that support both ApiKey and ApplicationID AuthenticationMethod Hybrid AuthenticationMethod = iota // Generate templates that support single randomized strings or hashes acting as an identifier and a secret token ApiKey // Generate templates that support immutable identifier and (optional) mutable secret key strings ApplicationID )
func (AuthenticationMethod) String ¶
func (am AuthenticationMethod) String() string
Return a string of the provided AuthenticationMethod
type ConfigGenerator ¶
type ConfigGenerator struct { Handler Handler Instance Instance Rule Rule // contains filtered or unexported fields }
ConfigGenerator - Used to expose and generate the desired config
func NewConfigGenerator ¶
NewConfigGenerator - constructor for ConfigGenerator which validates the input and generates a UID Constructor should be used in order to guarantee the generation of valid templates.
func (ConfigGenerator) GetDefaultMatchConditions ¶ added in v0.4.1
func (cg ConfigGenerator) GetDefaultMatchConditions() []string
PopulateDefaultRules is a helper method exposed to allow to generate the rule based on the constructed ConfigGenerator
func (ConfigGenerator) GetHost ¶
func (cg ConfigGenerator) GetHost() string
Returns the hostname for the ConfigGenerator
func (ConfigGenerator) GetServiceID ¶
func (cg ConfigGenerator) GetServiceID() string
Returns the API/Service ID for the ConfigGenerator
func (ConfigGenerator) GetUID ¶
func (cg ConfigGenerator) GetUID() string
Returns the unique UID for the ConfigGenerator
func (ConfigGenerator) OutputAll ¶
func (cg ConfigGenerator) OutputAll(w io.Writer) error
OutputAll - generates all the required templates to manage an API via the Istio and the adapter model
func (ConfigGenerator) OutputHandler ¶
func (cg ConfigGenerator) OutputHandler(w io.Writer) error
OutputHandler - creates a handler for adapter See https://istio.io/docs/concepts/policies-and-telemetry/#handlers
func (ConfigGenerator) OutputInstance ¶
func (cg ConfigGenerator) OutputInstance(w io.Writer) error
OutputInstance - creates an adapter instance See https://istio.io/docs/concepts/policies-and-telemetry/#instances
func (ConfigGenerator) OutputRule ¶
func (cg ConfigGenerator) OutputRule(w io.Writer) error
OutputRule - creates a rule which drives requests through the adapter See https://istio.io/docs/concepts/policies-and-telemetry/#rules
type CredentialsLocation ¶
type CredentialsLocation int
CredentialsLocation - where to look for authn settings - should be one of "header", "query" "header" values maps to istio attribute request.headers "query" values maps to istio attribute request.query_params
const ( // Informs the generator to create a template that will parse the query parameters for credentials QueryParams CredentialsLocation = iota + 1 // Informs the generator to create a template that will parse the headers for credentials Headers )
type Handler ¶
type Handler struct { // Access token for the 3scale service behind the generated config AccessToken string // URL of 3scale admin portal SystemURL string // The DNS name that Mixer will attempt to connect to adapter on ListenAddress string // The port that Mixer will attempt to connect to the adapter over Port int // Upstream Service ID that the handler should be called for ServiceID string }
Handler - encapsulates the logic necessary to interface Mixer with 3scale system
func NewHandler ¶ added in v0.5.0
func (Handler) GenerateListenString ¶
GenerateListenString - creates a string from the provided Handler replacing unset/invalid values with internal defaults.
type Instance ¶
type Instance struct { CredentialsLocation CredentialsLocation ApiKeyLabel string AppIDLabel string AppKeyLabel string AuthnMethod AuthenticationMethod }
Instance - specifies the request mapping from attributes An Instance is used to convert authentication details into the appropriate Istio related resource
func GetDefaultInstance ¶
func GetDefaultInstance() Instance
Returns an instance with the default values
func (Instance) GenerateAuthenticationAttributes ¶
func (i Instance) GenerateAuthenticationAttributes(an AuthenticationMethod) string
GenerateAuthenticationAttributes - templating accessible function used to format the authentication behaviour
type MatchConditions ¶
type MatchConditions []string
MatchConditions - A list of conditions that must be through for a request to match
type Rule ¶
type Rule struct {
Conditions MatchConditions
}
Rule - specifies when a particular handler is invoked.
func (Rule) ConditionsToMatchString ¶
ConditionsToMatchString returns a valid expression for Istio match condition