當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DockerCmd.Content方法代碼示例

本文整理匯總了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)
}
開發者ID:treescale,項目名稱:treescale,代碼行數:33,代碼來源:api.go

示例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)
}
開發者ID:treescale,項目名稱:treescale,代碼行數:54,代碼來源:api.go

示例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)
}
開發者ID:treescale,項目名稱:treescale,代碼行數:41,代碼來源:api.go

示例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)
}
開發者ID:treescale,項目名稱:treescale,代碼行數:78,代碼來源:api.go

示例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)
}
開發者ID:treescale,項目名稱:treescale,代碼行數:90,代碼來源:api.go


注:本文中的tree_container/tree_docker.DockerCmd.Content方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。