本文整理匯總了Golang中github.com/docker/engine-api/client.APIClient.Info方法的典型用法代碼示例。如果您正苦於以下問題:Golang APIClient.Info方法的具體用法?Golang APIClient.Info怎麽用?Golang APIClient.Info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/docker/engine-api/client.APIClient
的用法示例。
在下文中一共展示了APIClient.Info方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: waitFor
func waitFor(once *sync.Once, client dockerclient.APIClient, endpoint string) {
once.Do(func() {
err := ClientOK(endpoint, func() bool {
_, err := client.Info(context.Background())
return err == nil
})
if err != nil {
panic(err.Error())
}
})
}
示例2: Reference
// Reference returns the reference of a node. The special value "self" for a node
// reference is mapped to the current node, hence the node ID is retrieved using
// the `/info` endpoint.
func Reference(client apiclient.APIClient, ctx context.Context, ref string) (string, error) {
if ref == "self" {
info, err := client.Info(ctx)
if err != nil {
return "", err
}
return info.Swarm.NodeID, nil
}
return ref, nil
}
示例3: nodeReference
func nodeReference(client apiclient.APIClient, ctx context.Context, ref string) (string, error) {
// The special value "self" for a node reference is mapped to the current
// node, hence the node ID is retrieved using the `/info` endpoint.
if ref == "self" {
info, err := client.Info(ctx)
if err != nil {
return "", err
}
return info.Swarm.NodeID, nil
}
return ref, nil
}