forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make review changes to logstash input (influxdata#6299)
- Loading branch information
1 parent
5c8d0e3
commit 8b938f3
Showing
5 changed files
with
223 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
# Build and binaries | ||
/build | ||
/telegraf | ||
/telegraf.exe | ||
/telegraf.gz | ||
/vendor | ||
|
||
# Editor files | ||
*~ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Package choice provides basic functions for working with | ||
// plugin options that must be one of several values. | ||
package choice | ||
|
||
import "fmt" | ||
|
||
// Contains return true if the choice in the list of choices. | ||
func Contains(choice string, choices []string) bool { | ||
for _, item := range choices { | ||
if item == choice { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// CheckSContains returns an error if a choice is not one of | ||
// the available choices. | ||
func Check(choice string, available []string) error { | ||
if !Contains(choice, available) { | ||
return fmt.Errorf("unknown choice %s", choice) | ||
} | ||
return nil | ||
} | ||
|
||
// CheckSliceContains returns an error if the choices is not a subset of | ||
// available. | ||
func CheckSlice(choices, available []string) error { | ||
for _, choice := range choices { | ||
err := Check(choice, available) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.