Documentation
¶
Index ¶
- func Bool(v bool) *bool
- func Byte(v byte) *byte
- func Int(v int) *int
- func NewAuth(am *AuthMap) *actionAuthMap
- func String(v string) *string
- type Action
- type AuthConfig
- type AuthMap
- type AuthType
- type Client
- type ConfigOAuth
- type CustomFlowAuth
- func (c *CustomFlowAuth) Token(ctx context.Context, client Client, log log.Loggeriface) (CustomTokenResponse, error)
- func (cfa *CustomFlowAuth) WithAuthMap(v KvMapVarsAny) *CustomFlowAuth
- func (cfa *CustomFlowAuth) WithAuthUrl(v string) *CustomFlowAuth
- func (cfa *CustomFlowAuth) WithHeaderKey(v string) *CustomFlowAuth
- func (cfa *CustomFlowAuth) WithResponseKey(v string) *CustomFlowAuth
- func (cfa *CustomFlowAuth) WithSendInHeader() *CustomFlowAuth
- func (cfa *CustomFlowAuth) WithTokenPrefix(v string) *CustomFlowAuth
- type CustomToken
- type CustomTokenResponse
- type Diagnostic
- type KvMapVarsAny
- type SeederImpl
- func (r *SeederImpl) FindDeletePost(ctx context.Context, action *Action) error
- func (r *SeederImpl) FindPatchPost(ctx context.Context, action *Action) error
- func (r *SeederImpl) FindPathByExpression(resp []byte, pathExpression string) (string, error)
- func (r *SeederImpl) FindPost(ctx context.Context, action *Action) error
- func (r *SeederImpl) FindPutPost(ctx context.Context, action *Action) error
- func (r *SeederImpl) GetPost(ctx context.Context, action *Action) error
- func (r *SeederImpl) GetPutPost(ctx context.Context, action *Action) error
- func (r *SeederImpl) Put(ctx context.Context, action *Action) error
- func (r *SeederImpl) PutPost(ctx context.Context, action *Action) error
- func (r *SeederImpl) TemplatePayload(payload string, vars KvMapVarsAny) string
- func (r *SeederImpl) WithAuth(a *AuthMap) *SeederImpl
- func (r *SeederImpl) WithClient(c Client) *SeederImpl
- type Seeders
- type Status
- type StrategyConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
Strategy string `yaml:"strategy" json:"strategy"`
Order *int `yaml:"order,omitempty" json:"order,omitempty"`
Endpoint string `yaml:"endpoint" json:"endpoint"`
GetEndpointSuffix *string `yaml:"getEndpointSuffix,omitempty" json:"getEndpointSuffix,omitempty"`
PostEndpointSuffix *string `yaml:"postEndpointSuffix,omitempty" json:"postEndpointSuffix,omitempty"`
PatchEndpointSuffix *string `yaml:"patchEndpointSuffix,omitempty" json:"patchEndpointSuffix,omitempty"`
PutEndpointSuffix *string `yaml:"putEndpointSuffix,omitempty" json:"putEndpointSuffix,omitempty"`
DeleteEndpointSuffix *string `yaml:"deleteEndpointSuffix,omitempty" json:"deleteEndpointSuffix,omitempty"`
FindByJsonPathExpr string `yaml:"findByJsonPathExpr,omitempty" json:"findByJsonPathExpr,omitempty"`
PayloadTemplate string `yaml:"payloadTemplate" json:"payloadTemplate"`
PatchPayloadTemplate string `yaml:"patchPayloadTemplate,omitempty" json:"patchPayloadTemplate,omitempty"`
RuntimeVars *map[string]string `yaml:"runtimeVars,omitempty" json:"runtimeVars,omitempty"`
AuthMapRef string `yaml:"authMapRef" json:"authMapRef"`
HttpHeaders *map[string]string `yaml:"httpHeaders,omitempty" json:"httpHeaders,omitempty"`
Variables KvMapVarsAny `yaml:"variables" json:"variables"`
// contains filtered or unexported fields
}
+k8s:deepcopy-gen=true Action defines the single action to make agains an endpoint and selecting a strategy Endpoint is the base url to make the requests against GetEndpointSuffix can be used to specify a direct ID or query params PostEndpointSuffix
func (*Action) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Action.
func (*Action) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Action) WithHeader ¶
WithHeader allows the overwrite of default Accept and Content-Type headers both default to `application/json` and adding additional header params on per Action basis. NOTE: each rest call inside the action will inherit the same header
type AuthConfig ¶
type AuthConfig struct {
AuthStrategy AuthType `yaml:"type" json:"type"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
OAuth *ConfigOAuth `yaml:"oauth,omitempty" json:"oauth,omitempty"`
CustomToken *CustomToken `yaml:"custom,omitempty" json:"custom,omitempty"`
}
+k8s:deepcopy-gen=true Auth holds the auth strategy for all Seeders
func (*AuthConfig) DeepCopy ¶
func (in *AuthConfig) DeepCopy() *AuthConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthConfig.
func (*AuthConfig) DeepCopyInto ¶
func (in *AuthConfig) DeepCopyInto(out *AuthConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type AuthMap ¶
type AuthMap map[string]AuthConfig
+k8s:deepcopy-gen=true
func (AuthMap) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthMap.
func (AuthMap) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type AuthType ¶
type AuthType string
AuthType specifies the type of authentication to perform currently only a single authType per instance is allowed
type ConfigOAuth ¶
type ConfigOAuth struct {
ServerUrl string `yaml:"serverUrl"`
Scopes []string `yaml:"scopes"`
EndpointParams map[string][]string `yaml:"endpointParams"`
OAuthSendParamsInHeader bool `yaml:"oAuthSendParamsInHeader"`
// for grant_type=password use these for the addition RO auth
ResourceOwnerUser *string `yaml:"resourceOwnerUser,omitempty"`
ResourceOwnerPassword *string `yaml:"resourceOwnerPass,omitempty"`
}
+k8s:deepcopy-gen=true
func (*ConfigOAuth) DeepCopy ¶
func (in *ConfigOAuth) DeepCopy() *ConfigOAuth
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigOAuth.
func (*ConfigOAuth) DeepCopyInto ¶
func (in *ConfigOAuth) DeepCopyInto(out *ConfigOAuth)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CustomFlowAuth ¶ added in v0.9.1
type CustomFlowAuth struct {
// contains filtered or unexported fields
}
func NewCustomFlowAuth ¶ added in v0.9.1
func NewCustomFlowAuth() *CustomFlowAuth
func (*CustomFlowAuth) Token ¶ added in v0.9.1
func (c *CustomFlowAuth) Token(ctx context.Context, client Client, log log.Loggeriface) (CustomTokenResponse, error)
NOTE: for oauth an basicAuthToToken it might make sense to build a in-memory map of tokens to strategy name
func (*CustomFlowAuth) WithAuthMap ¶ added in v0.9.1
func (cfa *CustomFlowAuth) WithAuthMap(v KvMapVarsAny) *CustomFlowAuth
func (*CustomFlowAuth) WithAuthUrl ¶ added in v0.9.1
func (cfa *CustomFlowAuth) WithAuthUrl(v string) *CustomFlowAuth
func (*CustomFlowAuth) WithHeaderKey ¶ added in v0.9.1
func (cfa *CustomFlowAuth) WithHeaderKey(v string) *CustomFlowAuth
WithHeaderKey overwrites the detault `Authorization“
func (*CustomFlowAuth) WithResponseKey ¶ added in v0.9.1
func (cfa *CustomFlowAuth) WithResponseKey(v string) *CustomFlowAuth
WithResponseKey overwrites the default "$.access_token"
func (*CustomFlowAuth) WithSendInHeader ¶ added in v0.9.1
func (cfa *CustomFlowAuth) WithSendInHeader() *CustomFlowAuth
WithSendInHeader sends custom request in the header
as opposed to a in url encoded form in body POST
func (*CustomFlowAuth) WithTokenPrefix ¶ added in v0.9.1
func (cfa *CustomFlowAuth) WithTokenPrefix(v string) *CustomFlowAuth
WithTokenPrefix overwrites the detault `Bearer`
type CustomToken ¶
type CustomToken struct {
// Url to use to POST the customRequest
AuthUrl string `yaml:"authUrl" json:"authUrl"`
// holds the K/V credential pair. e.g.
//
// email: some@one.com
// password: pass123
//
// will post this body or send in header params that payload
CustomAuthMap KvMapVarsAny `yaml:"credential" json:"credential"`
// whether to send the values in the header as params
// defaults to false and CustomAuthMap
// is posted in the body as json post
SendInHeader bool `yaml:"inHeader" json:"inHeader"`
// JSONPath expression to use to get the token from response
//
// e.g. "$.token"
//
// empty will take the entire response as the token - raw response must be string
ResponseKey string `yaml:"responseKey" json:"responseKey" `
// if omitted `Authorization` will be used
// Could be X-API-Token etc..
HeaderKey string `yaml:"headerKey" json:"headerKey"`
// Token prefix - if omitted Bearer will be used
// e.g. Admin ==> `Authorization: "Admin [TOKEN]"`
TokenPrefix string `yaml:"tokenPrefix" json:"tokenPrefix"`
}
+k8s:deepcopy-gen=true customToken stores the required data to call and process custom auth Endpoints returning a token. the token will need to be extracted from the response it will then need adding to subsequent requests in the header under specified key and in specified format
func (*CustomToken) DeepCopy ¶
func (in *CustomToken) DeepCopy() *CustomToken
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomToken.
func (*CustomToken) DeepCopyInto ¶
func (in *CustomToken) DeepCopyInto(out *CustomToken)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CustomTokenResponse ¶
type Diagnostic ¶
type Diagnostic struct {
Status int
Name string
Message string
HostPathMethod string
ProceedFallback bool
IsFatal bool
}
func (*Diagnostic) Error ¶
func (d *Diagnostic) Error() string
func (*Diagnostic) WithIsFatal ¶
func (d *Diagnostic) WithIsFatal(v bool) *Diagnostic
func (*Diagnostic) WithMessage ¶
func (d *Diagnostic) WithMessage(m string) *Diagnostic
func (*Diagnostic) WithProceedFallback ¶
func (d *Diagnostic) WithProceedFallback(v bool) *Diagnostic
func (*Diagnostic) WithStatus ¶
func (d *Diagnostic) WithStatus(s int) *Diagnostic
type KvMapVarsAny ¶
+k8s:deepcopy-gen=false
func (*KvMapVarsAny) DeepCopy ¶
func (in *KvMapVarsAny) DeepCopy() *KvMapVarsAny
func (*KvMapVarsAny) DeepCopyInto ¶
func (in *KvMapVarsAny) DeepCopyInto(out *KvMapVarsAny)
type SeederImpl ¶
type SeederImpl struct {
// contains filtered or unexported fields
}
func NewSeederImpl ¶
func NewSeederImpl(log log.Loggeriface) *SeederImpl
func (*SeederImpl) FindDeletePost ¶
func (r *SeederImpl) FindDeletePost(ctx context.Context, action *Action) error
FindDeletePost
func (*SeederImpl) FindPatchPost ¶
func (r *SeederImpl) FindPatchPost(ctx context.Context, action *Action) error
FindPatchPost is same as FindPutPost strategy but uses PATCH
func (*SeederImpl) FindPathByExpression ¶ added in v0.9.1
func (r *SeederImpl) FindPathByExpression(resp []byte, pathExpression string) (string, error)
func (*SeederImpl) FindPost ¶
func (r *SeederImpl) FindPost(ctx context.Context, action *Action) error
FindPost strategy calls a GET endpoint and if item ***FOUND it does NOT do a POST*** this strategy should be used sparingly and only in cases where the service REST implementation does not support an update of existing item.
func (*SeederImpl) FindPutPost ¶
func (r *SeederImpl) FindPutPost(ctx context.Context, action *Action) error
FindPutPost strategy gets an item either by specifying a known ID in the endpoint suffix or by pathExpression. Get can look for a response in an array or in a single response object. once a single item that matches is found and the relevant ID is extracted it will do a PUT else it will do a POST as the item can be created
func (*SeederImpl) GetPost ¶
func (r *SeederImpl) GetPost(ctx context.Context, action *Action) error
GetPost strategy calls a GET endpoint and if item ***FOUND it does NOT do a POST*** this strategy should be used sparingly and only in cases where the service REST implementation does not support an update of existing item.
func (*SeederImpl) GetPutPost ¶
func (r *SeederImpl) GetPutPost(ctx context.Context, action *Action) error
GetPutPost strategy gets an item by specifying a known ID in the endpoint suffix If a non error or non empty response is found it will do a PUT else it will do a POST as the item can be created
func (*SeederImpl) Put ¶
func (r *SeederImpl) Put(ctx context.Context, action *Action) error
Put strategy calls a PUT endpoint if standards compliant this should be an idempotent operation
func (*SeederImpl) PutPost ¶
func (r *SeederImpl) PutPost(ctx context.Context, action *Action) error
Put strategy calls a PUT endpoint if standards compliant this should be an idempotent operation
func (*SeederImpl) TemplatePayload ¶ added in v0.9.1
func (r *SeederImpl) TemplatePayload(payload string, vars KvMapVarsAny) string
TemplatePayload parses input payload and replaces all $var ${var} with existing global env variable as well as injected from inside RestAction into the local context
func (*SeederImpl) WithAuth ¶
func (r *SeederImpl) WithAuth(a *AuthMap) *SeederImpl
WithAuth assigns auth options used by AuthMapRef within the actions
func (*SeederImpl) WithClient ¶
func (r *SeederImpl) WithClient(c Client) *SeederImpl
type Seeders ¶
+k8s:deepcopy-gen=true
func (Seeders) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Seeders.
func (Seeders) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type StrategyConfig ¶
type StrategyConfig struct {
AuthConfig AuthMap `yaml:"auth" json:"auth"`
Seeders Seeders `yaml:"seed" json:"seed"`
}
+k8s:deepcopy-gen=true StrategyConfig defines top level Spec
func (*StrategyConfig) DeepCopy ¶
func (in *StrategyConfig) DeepCopy() *StrategyConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyConfig.
func (*StrategyConfig) DeepCopyInto ¶
func (in *StrategyConfig) DeepCopyInto(out *StrategyConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.