forked from influxdata/influxdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstatus.go
More file actions
31 lines (26 loc) · 646 Bytes
/
status.go
File metadata and controls
31 lines (26 loc) · 646 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package influxdb
import "fmt"
// Status defines if a resource is active or inactive.
type Status string
const (
// Active status means that the resource can be used.
Active Status = "active"
// Inactive status means that the resource cannot be used.
Inactive Status = "inactive"
)
// Valid determines if a Status value matches the enum.
func (s Status) Valid() error {
switch s {
case Active, Inactive:
return nil
default:
return &Error{
Code: EInvalid,
Msg: fmt.Sprintf("invalid status: must be %v or %v", Active, Inactive),
}
}
}
// Ptr returns the pointer of that status.
func (s Status) Ptr() *Status {
return &s
}