Documentation
¶
Index ¶
- func FindDeletePostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- func FindPostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- func FindPutPostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- func GetPostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- func GetPutPostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- func PutPostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- func PutStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
- type Auth
- type AuthType
- type StrategyConfig
- type StrategyFunc
- type StrategyRestSeeder
- func (s *StrategyRestSeeder) Execute() []error
- func (s *StrategyRestSeeder) WithActions(actions map[string]rest.Action) *StrategyRestSeeder
- func (s *StrategyRestSeeder) WithLogger(w io.Writer, lvl log.LogLevel) *StrategyRestSeeder
- func (s *StrategyRestSeeder) WithRestClient(rc rest.Client) *StrategyRestSeeder
- type StrategyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindDeletePostStrategyFunc ¶
func FindDeletePostStrategyFunc(ctx context.Context, action *rest.Action, rest *rest.SeederImpl) error
FindDeletePostStrategyFunc
func FindPostStrategyFunc ¶
FindPostStrategyFunc 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 FindPutPostStrategyFunc ¶
FindPutPostStrategyFunc unknown ID and only know a name or other indicator the pathExpression must not evaluate to an empty string in order to for the PUT to be called else POST will be called as item was not present
func GetPostStrategyFunc ¶
FindPostStrategyFunc 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 GetPutPostStrategyFunc ¶
GetPutPostStrategyFunc known ID and only know a name or other indicator the pathExpression must not evaluate to an empty string in order to for the PUT to be called else POST will be called as item was not present
func PutPostStrategyFunc ¶
PutPostStrategyFunc known id to update
func PutStrategyFunc ¶
PutStrategyFunc
Types ¶
type Auth ¶
type Auth struct {
AuthStrategy AuthType `yaml:"type"`
// contains filtered or unexported fields
}
Auth holds the auth strategy for
type StrategyConfig ¶
type StrategyConfig struct {
AuthConfig Auth `yaml:"auth"`
Seeders map[string]rest.Action `yaml:"seed"`
}
StrategyConfig defines top level
type StrategyFunc ¶
type StrategyRestSeeder ¶
type StrategyRestSeeder struct {
Auth Auth
Strategy map[StrategyType]StrategyFunc
// contains filtered or unexported fields
}
func New ¶
func New() *StrategyRestSeeder
New initializes a default StrategySeeder with error log level and os.StdErr as log writer uses standard http.Client as rest client for rest SeederImplementation
func (*StrategyRestSeeder) Execute ¶
func (s *StrategyRestSeeder) Execute() []error
Execute the built actions list TODO: create a custom error object
func (*StrategyRestSeeder) WithActions ¶
func (s *StrategyRestSeeder) WithActions(actions map[string]rest.Action) *StrategyRestSeeder
WithActions builds the actions list empty actions will result in no restActions executing
func (*StrategyRestSeeder) WithLogger ¶
func (s *StrategyRestSeeder) WithLogger(w io.Writer, lvl log.LogLevel) *StrategyRestSeeder
WithLogger overwrites the default logger and passes it down to rest.SeederImpl
func (*StrategyRestSeeder) WithRestClient ¶
func (s *StrategyRestSeeder) WithRestClient(rc rest.Client) *StrategyRestSeeder
WithRestClient overwrites the default RestClient
type StrategyType ¶
type StrategyType string
const ( GET_POST StrategyType = "GET/POST" FIND_POST StrategyType = "FIND/POST" POST_PUT StrategyType = "POST/PUT" GET_PUT_POST StrategyType = "GET/PUT/POST" FIND_PUT_POST StrategyType = "FIND/PUT/POST" FIND_DELETE StrategyType = "FIND/DELETE" FIND_DELETE_POST StrategyType = "FIND/DELETE/POST" PUT StrategyType = "PUT" )