本文整理汇总了Golang中github.com/contiv/cluster/management/src/clusterm/manager.Client类的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: configGet
func configGet(c *manager.Client, noop string, flags parsedFlags) error {
out, err := c.GetConfig()
if err != nil {
return err
}
if !flags.jsonOutput {
return printTemplate(out, configTemplate, &configInfo{})
}
return ppJSON(out)
}
示例2: globalsGet
func globalsGet(c *manager.Client, noop string, flags parsedFlags) error {
out, err := c.GetGlobals()
if err != nil {
return err
}
if !flags.jsonOutput {
return printTemplate(out, globalTemplate, &globalInfo{})
}
return ppJSON(out)
}
示例3: nodesGet
func nodesGet(c *manager.Client, noop string, flags parsedFlags) error {
out, err := c.GetAllNodes()
if err != nil {
return err
}
if !flags.jsonOutput {
return printTemplate(out, multiNodeTemplate, &nodesInfo{})
}
return ppJSON(out)
}
示例4: nodeGet
func nodeGet(c *manager.Client, nodeName string, flags parsedFlags) error {
if nodeName == "" {
return errUnexpectedArgCount("1", 0)
}
out, err := c.GetNode(nodeName)
if err != nil {
return err
}
if !flags.jsonOutput {
return printTemplate(out, oneNodeTemplate, &nodeInfo{})
}
return ppJSON(out)
}
示例5: configSet
func configSet(c *manager.Client, args []string, noop parsedFlags) error {
var reader io.Reader
if args[0] == "-" {
reader = bufio.NewReader(os.Stdin)
} else {
f, err := os.Open(args[0])
if err != nil {
return errored.Errorf("failed to open config file. Error: %v", err)
}
defer func() { f.Close() }()
reader = bufio.NewReader(f)
}
config, err := (&manager.Config{}).MergeFromReader(reader)
if err != nil {
return err
}
return c.PostConfig(config)
}
示例6: jobGet
func jobGet(c *manager.Client, job string, flags parsedFlags) error {
if job == "" {
return errUnexpectedArgCount("1", 0)
}
out, err := c.GetJob(job)
if err != nil {
return err
}
// if streaming logs then we just print a short job info followed by the
// log stream
if flags.streamLogs {
if err := printTemplate(out, shortJobTemplate, &jobInfo{}); err != nil {
return err
}
logs, err := c.StreamLogs(job)
if err != nil {
return err
}
defer logs.Close()
log := make([]byte, 128)
for {
n, err := logs.Read(log)
if n > 0 {
fmt.Printf("%s", log[:n])
}
if err != nil {
break
}
}
return nil
}
if !flags.jsonOutput {
return printTemplate(out, jobTemplate, &jobInfo{})
}
return ppJSON(out)
}
示例7: nodesDiscover
func nodesDiscover(c *manager.Client, args []string, flags parsedFlags) error {
return c.PostNodesDiscover(args, flags.extraVars)
}
示例8: nodesUpdate
func nodesUpdate(c *manager.Client, args []string, flags parsedFlags) error {
return c.PostNodesUpdate(args, flags.extraVars, flags.hostGroup)
}
示例9: nodesDecommission
func nodesDecommission(c *manager.Client, args []string, flags parsedFlags) error {
return c.PostNodesDecommission(args, flags.extraVars)
}
示例10: nodeUpdate
func nodeUpdate(c *manager.Client, args []string, flags parsedFlags) error {
nodeName := args[0]
return c.PostNodeUpdate(nodeName, flags.extraVars, flags.hostGroup)
}
示例11: nodeDecommission
func nodeDecommission(c *manager.Client, args []string, flags parsedFlags) error {
nodeName := args[0]
return c.PostNodeDecommission(nodeName, flags.extraVars)
}
示例12: globalsSet
func globalsSet(c *manager.Client, noop []string, flags parsedFlags) error {
return c.PostGlobals(flags.extraVars)
}