Documentation
¶
Overview ¶
Package fake implements fake switches with different position counts.
Index ¶
- func NewSwitch(ctx context.Context, deps resource.Dependencies, conf resource.Config, ...) (toggleswitch.Switch, error)
- type Config
- type Switch
- func (s *Switch) GetNumberOfPositions(ctx context.Context, extra map[string]interface{}) (uint32, error)
- func (s *Switch) GetPosition(ctx context.Context, extra map[string]interface{}) (uint32, error)
- func (s *Switch) SetPosition(ctx context.Context, position uint32, extra map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { resource.TriviallyValidateConfig // PositionCount is the number of positions that the switch can be in. // If omitted, the switch will have two positions. PositionCount *uint32 `json:"position_count"` }
Config is the config for a fake switch.
type Switch ¶
type Switch struct { resource.Named resource.TriviallyCloseable resource.AlwaysRebuild // contains filtered or unexported fields }
Switch is a fake switch that can be set to different positions.
func (*Switch) GetNumberOfPositions ¶
func (s *Switch) GetNumberOfPositions(ctx context.Context, extra map[string]interface{}) (uint32, error)
GetNumberOfPositions returns the total number of valid positions for this switch.
func (*Switch) GetPosition ¶
GetPosition returns the current position of the switch.
Click to show internal directories.
Click to hide internal directories.