Move api-specific code to the api package

This facilitates the refactoring of commands.go.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
pkg/opts: a collection of custom value parsers implementing flag.Value

This facilitates the refactoring of commands.go.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Merge pull request #4083 from shykes/api-validate-host

Move api-specific code to the api package