Ad Checkpoint.MarshallJSON
This commit is contained in:
parent
79378fe268
commit
0a5fad1fde
1 changed files with 18 additions and 1 deletions
|
@ -1,6 +1,9 @@
|
||||||
package gonetworkmanager
|
package gonetworkmanager
|
||||||
|
|
||||||
import "github.com/godbus/dbus"
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/godbus/dbus"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CheckpointInterface = NetworkManagerInterface + ".Checkpoint"
|
CheckpointInterface = NetworkManagerInterface + ".Checkpoint"
|
||||||
|
@ -22,6 +25,8 @@ type Checkpoint interface {
|
||||||
|
|
||||||
// Timeout in seconds for automatic rollback, or zero.
|
// Timeout in seconds for automatic rollback, or zero.
|
||||||
GetPropertyRollbackTimeout() uint32
|
GetPropertyRollbackTimeout() uint32
|
||||||
|
|
||||||
|
MarshalJSON() ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCheckpoint(objectPath dbus.ObjectPath) (Checkpoint, error) {
|
func NewCheckpoint(objectPath dbus.ObjectPath) (Checkpoint, error) {
|
||||||
|
@ -59,3 +64,15 @@ func (c *checkpoint) GetPropertyRollbackTimeout() uint32 {
|
||||||
func (c *checkpoint) GetPath() dbus.ObjectPath {
|
func (c *checkpoint) GetPath() dbus.ObjectPath {
|
||||||
return c.obj.Path()
|
return c.obj.Path()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *checkpoint) marshalMap() map[string]interface{} {
|
||||||
|
return map[string]interface{}{
|
||||||
|
"Devices": c.GetPropertyDevices(),
|
||||||
|
"Created": c.GetPropertyCreated(),
|
||||||
|
"RollbackTimeout": c.GetPropertyRollbackTimeout(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *checkpoint) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(c.marshalMap())
|
||||||
|
}
|
||||||
|
|
Reference in a new issue