本文整理汇总了Golang中tree_container/tree_docker.DockerCmd.Content方法的典型用法代码示例。如果您正苦于以下问题:Golang DockerCmd.Content方法的具体用法?Golang DockerCmd.Content怎么用?Golang DockerCmd.Content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tree_container/tree_docker.DockerCmd
的用法示例。
在下文中一共展示了DockerCmd.Content方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: HandleDelete
func HandleDelete(cmd *cobra.Command, args []string) {
var (
node string
target []string
tag []string
group []string
container string
err tree_lib.TreeError
)
err.From = tree_lib.FROM_HANDLE_DELETE
node, err.Err = cmd.Flags().GetString("node")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
target, err.Err = cmd.Flags().GetStringSlice("target")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
container, err.Err = cmd.Flags().GetString("container")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
var (
docker_cmd = tree_docker.DockerCmd{}
)
docker_cmd.Content = make(map[string]string)
docker_cmd.Command = tree_docker.COMMAND_DOCKER_CONTAINER_DELETE
docker_cmd.Content["container"] = container
SendDockerCommand(docker_cmd, node, target, tag, group)
}
示例2: HandleImageDelete
func HandleImageDelete(cmd *cobra.Command, args []string) {
var (
node string
target []string
tag []string
group []string
force bool
image string
err tree_lib.TreeError
)
err.From = tree_lib.FROM_HANDLE_IMAGE_DELETE
node, err.Err = cmd.Flags().GetString("node")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
target, err.Err = cmd.Flags().GetStringSlice("target")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
tag, err.Err = cmd.Flags().GetStringSlice("tag")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
group, err.Err = cmd.Flags().GetStringSlice("group")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
image, err.Err = cmd.Flags().GetString("image")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
force, err.Err = cmd.Flags().GetBool("force")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
var (
docker_cmd = tree_docker.DockerCmd{}
)
docker_cmd.Content = make(map[string]string)
docker_cmd.Command = tree_docker.COMMAND_DOCKER_IMAGE_DELETE
docker_cmd.Content["image"] = image
if force {
docker_cmd.Content["force"] = "yes"
} else {
docker_cmd.Content["force"] = "no"
}
SendDockerCommand(docker_cmd, node, target, tag, group)
}
示例3: HandleList
func HandleList(cmd *cobra.Command, args []string) {
var (
node string
target []string
tag []string
group []string
err tree_lib.TreeError
)
err.From = tree_lib.FROM_HANDLE_LIST
node, err.Err = cmd.Flags().GetString("node")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
target, err.Err = cmd.Flags().GetStringSlice("target")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
tag, err.Err = cmd.Flags().GetStringSlice("tag")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
group, err.Err = cmd.Flags().GetStringSlice("group")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
var (
docker_cmd = tree_docker.DockerCmd{}
)
docker_cmd.Content = make(map[string]string)
if cmd.Parent().Name() == "container" {
docker_cmd.Command = tree_docker.COMMAND_DOCKER_CONTAINER_LIST
} else {
docker_cmd.Command = tree_docker.COMMAND_DOCKER_IMAGE_LIST
}
docker_cmd.Content["all"] = "yes"
SendDockerCommand(docker_cmd, node, target, tag, group)
}
示例4: HandleImagePull
func HandleImagePull(cmd *cobra.Command, args []string) {
var (
node string
target []string
tag []string
group []string
image string
registry string
username string
address string
password string
email string
err tree_lib.TreeError
)
err.From = tree_lib.FROM_HANDLE_IMAGE_PULL
node, err.Err = cmd.Flags().GetString("node")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
target, err.Err = cmd.Flags().GetStringSlice("target")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
tag, err.Err = cmd.Flags().GetStringSlice("tag")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
group, err.Err = cmd.Flags().GetStringSlice("group")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
registry, err.Err = cmd.Flags().GetString("registry")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
image, err.Err = cmd.Flags().GetString("image")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
address, err.Err = cmd.Flags().GetString("address")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
password, err.Err = cmd.Flags().GetString("password")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
username, err.Err = cmd.Flags().GetString("username")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
email, err.Err = cmd.Flags().GetString("email")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
var (
docker_cmd = tree_docker.DockerCmd{}
)
docker_cmd.Content = make(map[string]string)
docker_cmd.Command = tree_docker.COMMAND_DOCKER_IMAGE_PULL
docker_cmd.Content["image"] = image
docker_cmd.Content["registry"] = registry
docker_cmd.Content["registry_username"] = username
docker_cmd.Content["registry_password"] = password
docker_cmd.Content["registry_address"] = address
docker_cmd.Content["registry_email"] = email
SendDockerCommand(docker_cmd, node, target, tag, group)
}
示例5: HandleCreate
func HandleCreate(cmd *cobra.Command, args []string) {
var (
node string
target []string
tag []string
group []string
image string
command string
ram string
cpu string
container string
count string
start bool
err tree_lib.TreeError
)
err.From = tree_lib.FROM_HANDLE_CREATE
node, err.Err = cmd.Flags().GetString("node")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
target, err.Err = cmd.Flags().GetStringSlice("target")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
tag, err.Err = cmd.Flags().GetStringSlice("tag")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
group, err.Err = cmd.Flags().GetStringSlice("group")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
image, err.Err = cmd.Flags().GetString("image")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
command, err.Err = cmd.Flags().GetString("command")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
container, err.Err = cmd.Flags().GetString("container")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
ram, err.Err = cmd.Flags().GetString("ram")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
cpu, err.Err = cmd.Flags().GetString("cpu")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
count, err.Err = cmd.Flags().GetString("count")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
start, err.Err = cmd.Flags().GetBool("start")
if !err.IsNull() {
tree_log.Error(err.From, err.Error())
return
}
var (
docker_cmd = tree_docker.DockerCmd{}
)
docker_cmd.Content = make(map[string]string)
docker_cmd.Command = tree_docker.COMMAND_DOCKER_CONTAINER_CREATE
docker_cmd.Content["cmd"] = command
docker_cmd.Content["ram"] = ram
docker_cmd.Content["cpu"] = cpu
docker_cmd.Content["image"] = image
docker_cmd.Content["container"] = container
docker_cmd.Content["count"] = count
if start {
docker_cmd.Content["start"] = "yes"
} else {
docker_cmd.Content["start"] = "no"
}
SendDockerCommand(docker_cmd, node, target, tag, group)
}