diff --git a/discovery/discovery.go b/discovery/discovery.go index 56c488f..65eebcb 100644 --- a/discovery/discovery.go +++ b/discovery/discovery.go @@ -5,37 +5,37 @@ import ( "encoding/json" ) -type DiscoveryModeEnum int +type DiscoveryModeType int const ( - DiscoveryModeEnumPrivileged DiscoveryModeEnum = iota + 1 - DiscoveryModeEnumUnprivileged + DiscoveryModeTypePrivileged DiscoveryModeType = iota + 1 + DiscoveryModeTypeUnprivileged ) var ( - discoveryModeEnumID = map[DiscoveryModeEnum]string{ - DiscoveryModeEnumPrivileged: "Privileged", - DiscoveryModeEnumUnprivileged: "Unprivileged", + discoveryModeTypeID = map[DiscoveryModeType]string{ + DiscoveryModeTypePrivileged: "Privileged", + DiscoveryModeTypeUnprivileged: "Unprivileged", } - discoveryModeEnumName = map[string]DiscoveryModeEnum{ - "Privileged": DiscoveryModeEnumPrivileged, - "Unprivileged": DiscoveryModeEnumUnprivileged, + discoveryModeTypeName = map[string]DiscoveryModeType{ + "Privileged": DiscoveryModeTypePrivileged, + "Unprivileged": DiscoveryModeTypeUnprivileged, } ) -func (e DiscoveryModeEnum) String() string { - return discoveryModeEnumID[e] +func (e DiscoveryModeType) String() string { + return discoveryModeTypeID[e] } -func (e *DiscoveryModeEnum) MarshalJSON() ([]byte, error) { +func (e *DiscoveryModeType) MarshalJSON() ([]byte, error) { buffer := bytes.NewBufferString(`"`) - buffer.WriteString(discoveryModeEnumID[*e]) + buffer.WriteString(discoveryModeTypeID[*e]) buffer.WriteString(`"`) return buffer.Bytes(), nil } -func (e *DiscoveryModeEnum) UnmarshalJSON(b []byte) error { +func (e *DiscoveryModeType) UnmarshalJSON(b []byte) error { // unmarshal as string var s string err := json.Unmarshal(b, &s) @@ -43,6 +43,6 @@ func (e *DiscoveryModeEnum) UnmarshalJSON(b []byte) error { return err } // lookup value - *e = discoveryModeEnumName[s] + *e = discoveryModeTypeName[s] return nil }