traefik/provider/ecs/cluster.go

33 lines
666 B
Go
Raw Normal View History

2017-08-22 09:46:03 +00:00
package ecs
import (
"fmt"
"strings"
)
// Clusters holds ecs clusters name
type Clusters []string
// Set adds strings elem into the the parser
// it splits str on , and ;
func (c *Clusters) Set(str string) error {
fargs := func(c rune) bool {
return c == ',' || c == ';'
}
// get function
slice := strings.FieldsFunc(str, fargs)
*c = append(*c, slice...)
return nil
}
// Get Clusters
2017-12-18 08:14:03 +00:00
func (c *Clusters) Get() interface{} { return *c }
2017-08-22 09:46:03 +00:00
// String return slice in a string
func (c *Clusters) String() string { return fmt.Sprintf("%v", *c) }
// SetValue sets Clusters into the parser
func (c *Clusters) SetValue(val interface{}) {
2017-12-18 08:14:03 +00:00
*c = val.(Clusters)
2017-08-22 09:46:03 +00:00
}