Documentation
¶
Index ¶
- type DockerRegistryURL
- func (u *DockerRegistryURL) AddLibraryNamespace()
- func (u *DockerRegistryURL) BaseURL() string
- func (u *DockerRegistryURL) BaseURLNoCredentials() string
- func (u *DockerRegistryURL) ClearUserCredentials()
- func (u *DockerRegistryURL) HostPort() string
- func (u *DockerRegistryURL) MarshalJSON() ([]byte, error)
- func (u *DockerRegistryURL) Path() string
- func (u *DockerRegistryURL) String() string
- func (u *DockerRegistryURL) StringNoCredentials() string
- func (u *DockerRegistryURL) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerRegistryURL ¶
type DockerRegistryURL struct {
// Scheme can be http or https.
Scheme string `json:",omitempty"`
// Userinfo holds basic auth credentials. If you want to use a preformed
// token for authentication, it should be decoded from base64 and parsed
// into the url.Userinfo type.
Userinfo *url.Userinfo `json:",omitempty"`
// Host is a Fully Qualified Domain Name.
Host string `json:",omitempty"`
// Port is optional, and may not be present.
Port string `json:",omitempty"`
// ImageName is an image repository. The ImageName can be just the Repo name,
// or can also have arbitrary nesting of namespaces (e.g. namespace1/namespace2/repo).
// This field is optional when specifying Docker registry source whitelists.
ImageName string `json:",omitempty"`
// Tag specifies a desired version of the docker image. For instance, to
// specify ubuntu 14.04, the tag is 14.04.
Tag string `json:",omitempty"`
}
DockerRegistryURL represents all components of a Docker V1 Registry URL. See this link for more information about the DockerHub and V1 registry API:
https://docs.docker.com/reference/api/docker-io_api/
Mandatory fields for a valid RegistryURL: Scheme, Host
Possible formats:
<scheme>://[user:password@]<host>[:<port>][/<namespace>/<repo>[:<tag>]]
func ParseDockerRegistryURL ¶
func ParseDockerRegistryURL(s string) (*DockerRegistryURL, error)
ParseDockerRegistryURL parses a Docker Registry URL. It does not need to be a full URL. If the url starts with either http or https, the input path will be passed to ParseFullDockerRegistryURL. If not, it will try to parse the URL as if it is a (namespace/)*repo(:tag)?
func ParseFullDockerRegistryURL ¶
func ParseFullDockerRegistryURL(s string) (*DockerRegistryURL, error)
ParseFullDockerRegistryURL validates an input string URL to make sure that it conforms to the Docker V1 registry URL schema.
func (*DockerRegistryURL) AddLibraryNamespace ¶
func (u *DockerRegistryURL) AddLibraryNamespace()
AddLibraryNamespace explicitly appends the `library` namespace used for official images.
func (*DockerRegistryURL) BaseURL ¶
func (u *DockerRegistryURL) BaseURL() string
BaseURL returns a string of the format: <scheme>://(<creds>@)?<host>(:<port>)?
func (*DockerRegistryURL) BaseURLNoCredentials ¶
func (u *DockerRegistryURL) BaseURLNoCredentials() string
BaseURLNoCredentials returns a string of the format: <scheme://host(:port)?
func (*DockerRegistryURL) ClearUserCredentials ¶
func (u *DockerRegistryURL) ClearUserCredentials()
ClearUserCredentials will remove any Userinfo from a provided DockerRegistryURL object.
func (*DockerRegistryURL) HostPort ¶
func (u *DockerRegistryURL) HostPort() string
HostPort returns the HostPort of the registry URL. If there is no port, then it returns just the host.
func (*DockerRegistryURL) MarshalJSON ¶
func (u *DockerRegistryURL) MarshalJSON() ([]byte, error)
MarshalJSON implements marshalling which will maintain the url.Userinfo details which are normally lost due to lack of exported fields.
func (*DockerRegistryURL) Path ¶
func (u *DockerRegistryURL) Path() string
Path returns the string path segment of a DockerRegistryURL. The full format of a path is [namespace/]repo[:tag].
func (*DockerRegistryURL) String ¶
func (u *DockerRegistryURL) String() string
String returns the full form of a registryURL.
func (*DockerRegistryURL) StringNoCredentials ¶
func (u *DockerRegistryURL) StringNoCredentials() string
StringNoCredentials returns the full form of a registryURL without credentials.
func (*DockerRegistryURL) UnmarshalJSON ¶
func (u *DockerRegistryURL) UnmarshalJSON(data []byte) error
UnmarshalJSON implements unmarshalling which will maintain the url.Userinfo details which are normally lost due to lack of exported fields.