com.github.dockerjava.api.command.ListNetworksCmd Java Examples

The following examples show how to use com.github.dockerjava.api.command.ListNetworksCmd. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContainerUtil.java    From presto with Apache License 2.0 5 votes vote down vote up
public static void removeNetworks(DockerClient dockerClient, Function<ListNetworksCmd, ListNetworksCmd> filter)
{
    ListNetworksCmd listNetworksCmd = filter.apply(dockerClient.listNetworksCmd());
    List<Network> networks = listNetworksCmd.exec();
    for (Network network : networks) {
        dockerClient.removeNetworkCmd(network.getId())
                .exec();
    }
}
 
Example #2
Source File: ListNetworksCmdExec.java    From docker-java with Apache License 2.0 5 votes vote down vote up
@Override
protected List<Network> execute(ListNetworksCmd command) {
    WebTarget webTarget = getBaseResource().path("/networks");

    if (command.getFilters() != null && !command.getFilters().isEmpty()) {
        webTarget = webTarget.queryParam("filters", FiltersEncoder.jsonEncode(command.getFilters()));
    }

    LOGGER.trace("GET: {}", webTarget);

    return webTarget.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<List<Network>>() {
    });
}
 
Example #3
Source File: DockerClientImpl.java    From docker-java with Apache License 2.0 4 votes vote down vote up
@Override
public ListNetworksCmd listNetworksCmd() {
    return new ListNetworksCmdImpl(getDockerCmdExecFactory().createListNetworksCmdExec());
}
 
Example #4
Source File: AbstractDockerCmdExecFactory.java    From docker-java with Apache License 2.0 4 votes vote down vote up
@Override
public ListNetworksCmd.Exec createListNetworksCmdExec() {
    return new ListNetworksCmdExec(getBaseResource(), getDockerClientConfig());
}
 
Example #5
Source File: ListNetworksCmdImpl.java    From docker-java with Apache License 2.0 4 votes vote down vote up
public ListNetworksCmdImpl(ListNetworksCmd.Exec exec) {
    super(exec);
}
 
Example #6
Source File: ListNetworksCmdImpl.java    From docker-java with Apache License 2.0 4 votes vote down vote up
@Override
public ListNetworksCmd withIdFilter(String... networkId) {
    this.filtersBuilder.withFilter("id", networkId);
    return this;
}
 
Example #7
Source File: ListNetworksCmdImpl.java    From docker-java with Apache License 2.0 4 votes vote down vote up
@Override
public ListNetworksCmd withNameFilter(String... networkName) {
    this.filtersBuilder.withFilter("name", networkName);
    return this;
}
 
Example #8
Source File: ListNetworksCmdImpl.java    From docker-java with Apache License 2.0 4 votes vote down vote up
@Override
public ListNetworksCmd withFilter(String filterName, Collection<String> filterValues) {
    checkNotNull(filterValues, filterName + " was not specified");
    this.filtersBuilder.withFilter(filterName, filterValues);
    return this;
}
 
Example #9
Source File: DelegatingDockerClient.java    From docker-plugin with MIT License 4 votes vote down vote up
@Override
public ListNetworksCmd listNetworksCmd() {
    return getDelegate().listNetworksCmd();
}
 
Example #10
Source File: DockerClient.java    From docker-java with Apache License 2.0 votes vote down vote up
ListNetworksCmd listNetworksCmd();