com.github.dockerjava.api.model
Class Link

java.lang.Object
  extended by com.github.dockerjava.api.model.Link

public class Link
extends Object

Represents a network link between two Docker containers. The container with the name getName() is made available in the target container with the aliased name getAlias(). This involves creating an entry in /etc/hosts and some environment variables in the target container as well as creating a network bridge between both containers.


Constructor Summary
Link(String name, String alias)
          Creates a Link for the container with the given name and an aliased name for use in the target container.
 
Method Summary
 boolean equals(Object obj)
           
 String getAlias()
           
 String getName()
           
 int hashCode()
           
static Link parse(String serialized)
          Parses a textual link specification (as used by the Docker CLI) to a Link.
 String toString()
          Returns a string representation of this Link suitable for inclusion in a JSON message.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Link

public Link(String name,
            String alias)
Creates a Link for the container with the given name and an aliased name for use in the target container.

Parameters:
name - the name of the container that you want to link into the target container
alias - the aliased name under which the linked container will be available in the target container
Method Detail

getName

public String getName()
Returns:
the name of the container that is linked into the target container

getAlias

public String getAlias()
Returns:
the aliased name under which the linked container will be available in the target container

parse

public static Link parse(String serialized)
                  throws IllegalArgumentException
Parses a textual link specification (as used by the Docker CLI) to a Link.

Parameters:
serialized - the specification, e.g. name:alias
Returns:
a Link matching the specification
Throws:
IllegalArgumentException - if the specification cannot be parsed

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of this Link suitable for inclusion in a JSON message. The format is name:alias, like the argument in parse(String).

Overrides:
toString in class Object
Returns:
a string representation of this Link


Copyright © 2014. All rights reserved.