本文整理汇总了Golang中github.com/lxc/lxd.Config.BriefState方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.BriefState方法的具体用法?Golang Config.BriefState怎么用?Golang Config.BriefState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxc/lxd.Config
的用法示例。
在下文中一共展示了Config.BriefState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: run
//.........这里部分代码省略.........
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
return d.CertificateRemove(args[len(args)-1])
default:
return fmt.Errorf(gettext.Gettext("Unkonwn config trust command %s"), args[1])
}
case "show":
remote := ""
container := ""
if len(args) > 1 {
remote, container = config.ParseRemoteAndContainer(args[1])
if container == "" {
return fmt.Errorf(gettext.Gettext("Show for remotes is not yet supported\n"))
}
}
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
var data []byte
if len(args) == 1 || container == "" {
config, err := d.ServerStatus()
if err != nil {
return err
}
brief := config.BriefState()
data, err = yaml.Marshal(&brief)
} else {
config, err := d.ContainerStatus(container, false)
if err != nil {
return err
}
brief := config.BriefState()
data, err = yaml.Marshal(&brief)
}
fmt.Printf("%s", data)
return nil
case "get":
if len(args) != 3 {
return errArgs
}
remote, container := config.ParseRemoteAndContainer(args[1])
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
resp, err := d.ContainerStatus(container, false)
if err != nil {
return err
}
fmt.Printf("%s: %s\n", args[2], resp.Config[args[2]])
return nil
示例2: run
//.........这里部分代码省略.........
remote = config.DefaultRemote
}
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
return d.CertificateRemove(args[len(args)-1])
default:
return fmt.Errorf(gettext.Gettext("Unkonwn config trust command %s"), args[1])
}
case "show":
remote := config.DefaultRemote
container := ""
if len(args) > 1 {
remote, container = config.ParseRemoteAndContainer(args[1])
}
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
var data []byte
if len(args) == 1 || container == "" {
config, err := d.ServerStatus()
if err != nil {
return err
}
brief := config.BriefState()
data, err = yaml.Marshal(&brief)
} else {
config, err := d.ContainerStatus(container, false)
if err != nil {
return err
}
brief := config.BriefState()
data, err = yaml.Marshal(&brief)
}
fmt.Printf("%s", data)
return nil
case "get":
if len(args) != 3 {
return errArgs
}
remote, container := config.ParseRemoteAndContainer(args[1])
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
resp, err := d.ContainerStatus(container, false)
if err != nil {
return err
}
fmt.Printf("%s: %s\n", args[2], resp.Config[args[2]])
return nil
示例3: run
//.........这里部分代码省略.........
remote = config.DefaultRemote
}
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
return d.CertificateRemove(args[len(args)-1])
default:
return errArgs
}
case "show":
remote := config.DefaultRemote
container := ""
if len(args) > 1 {
remote, container = config.ParseRemoteAndContainer(args[1])
}
d, err := lxd.NewClient(config, remote)
if err != nil {
return err
}
var data []byte
if len(args) == 1 || container == "" {
config, err := d.ServerStatus()
if err != nil {
return err
}
brief := config.BriefState()
data, err = yaml.Marshal(&brief)
} else {
config, err := d.ContainerStatus(container)
if err != nil {
return err
}
brief := config.BriefState()
if expanded {
brief = config.BriefStateExpanded()
}
data, err = yaml.Marshal(&brief)
}
fmt.Printf("%s", data)
return nil
case "get":
if len(args) > 3 || len(args) < 2 {
return errArgs
}
remote := config.DefaultRemote
container := ""
key := args[1]
if len(args) > 2 {
remote, container = config.ParseRemoteAndContainer(args[1])
key = args[2]
}
d, err := lxd.NewClient(config, remote)