Skip to content

Latest commit

 

History

History
612 lines (473 loc) · 20.9 KB

NetworksApi.md

File metadata and controls

612 lines (473 loc) · 20.9 KB

NetworksApi

All URIs are relative to http://podman.io

Method HTTP request Description
networkConnectLibpod POST /libpod/networks/{name}/connect Connect container to network
networkCreateLibpod POST /libpod/networks/create Create network
networkDeleteLibpod DELETE /libpod/networks/{name} Remove a network
networkDisconnectLibpod POST /libpod/networks/{name}/disconnect Disconnect container from network
networkExistsLibpod GET /libpod/networks/{name}/exists Network exists
networkInspectLibpod GET /libpod/networks/{name}/json Inspect a network
networkListLibpod GET /libpod/networks/json List networks
networkPruneLibpod POST /libpod/networks/prune Delete unused networks
networkUpdateLibpod POST /libpod/networks/{name}/update Update existing podman network

networkConnectLibpod

networkConnectLibpod(name).create(create).execute();

Connect container to network

Connect a container to a network.

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String name = "name_example"; // String | the name of the network
    NetworkConnectOptions create = new NetworkConnectOptions(); // NetworkConnectOptions | attributes for connecting a container to a network
    try {
      apiInstance.networkConnectLibpod(name)
            .create(create)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkConnectLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String the name of the network
create NetworkConnectOptions attributes for connecting a container to a network [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-tar
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
404 No such network -
500 Internal server error -

networkCreateLibpod

Network networkCreateLibpod().create(create).execute();

Create network

Create a new network configuration

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    NetworkCreateLibpod create = new NetworkCreateLibpod(); // NetworkCreateLibpod | attributes for creating a network
    try {
      Network result = apiInstance.networkCreateLibpod()
            .create(create)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkCreateLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
create NetworkCreateLibpod attributes for creating a network [optional]

Return type

Network

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-tar
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Network create -
400 Bad parameter in request -
409 Conflict error in operation -
500 Internal server error -

networkDeleteLibpod

List<NetworkRmReport> networkDeleteLibpod(name).force(force).execute();

Remove a network

Remove a configured network

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String name = "name_example"; // String | the name of the network
    Boolean force = true; // Boolean | remove containers associated with network
    try {
      List<NetworkRmReport> result = apiInstance.networkDeleteLibpod(name)
            .force(force)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkDeleteLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String the name of the network
force Boolean remove containers associated with network [optional]

Return type

List<NetworkRmReport>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Network Delete -
404 No such network -
500 Internal server error -

networkDisconnectLibpod

networkDisconnectLibpod(name).create(create).execute();

Disconnect container from network

Disconnect a container from a network.

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String name = "name_example"; // String | the name of the network
    DisconnectOptions create = new DisconnectOptions(); // DisconnectOptions | attributes for disconnecting a container from a network
    try {
      apiInstance.networkDisconnectLibpod(name)
            .create(create)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkDisconnectLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String the name of the network
create DisconnectOptions attributes for disconnecting a container from a network [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-tar
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
404 No such network -
500 Internal server error -

networkExistsLibpod

networkExistsLibpod(name).execute();

Network exists

Check if network exists

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String name = "name_example"; // String | the name or ID of the network
    try {
      apiInstance.networkExistsLibpod(name)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkExistsLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String the name or ID of the network

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 network exists -
404 No such network -
500 Internal server error -

networkInspectLibpod

NetworkInspectReport networkInspectLibpod(name).execute();

Inspect a network

Display configuration for a network.

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String name = "name_example"; // String | the name of the network
    try {
      NetworkInspectReport result = apiInstance.networkInspectLibpod(name)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkInspectLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String the name of the network

Return type

NetworkInspectReport

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Network inspect -
404 No such network -
500 Internal server error -

networkListLibpod

List<Network> networkListLibpod().filters(filters).execute();

List networks

Display summary of network configurations. - In a 200 response, all of the fields named Bytes are returned as a Base64 encoded string.

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String filters = "filters_example"; // String | JSON encoded value of the filters (a `map[string][]string`) to process on the network list. Available filters:   - `name=[name]` Matches network name (accepts regex).   - `id=[id]` Matches for full or partial ID.   - `driver=[driver]` Only bridge is supported.   - `label=[key]` or `label=[key=value]` Matches networks based on the presence of a label alone or a label and a value.   - `until=[timestamp]` Matches all networks that were created before the given timestamp. 
    try {
      List<Network> result = apiInstance.networkListLibpod()
            .filters(filters)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkListLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
filters String JSON encoded value of the filters (a `map[string][]string`) to process on the network list. Available filters: - `name=[name]` Matches network name (accepts regex). - `id=[id]` Matches for full or partial ID. - `driver=[driver]` Only bridge is supported. - `label=[key]` or `label=[key=value]` Matches networks based on the presence of a label alone or a label and a value. - `until=[timestamp]` Matches all networks that were created before the given timestamp. [optional]

Return type

List<Network>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Network list -
500 Internal server error -

networkPruneLibpod

List<NetworkPruneReport> networkPruneLibpod().filters(filters).execute();

Delete unused networks

Remove networks that do not have containers

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String filters = "filters_example"; // String | Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters:   - `until=<timestamp>` Prune networks created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.   - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune networks with (or without, in case `label!=...` is used) the specified labels. 
    try {
      List<NetworkPruneReport> result = apiInstance.networkPruneLibpod()
            .filters(filters)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkPruneLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
filters String Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters: - `until=<timestamp>` Prune networks created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune networks with (or without, in case `label!=...` is used) the specified labels. [optional]

Return type

List<NetworkPruneReport>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Network prune -
500 Internal server error -

networkUpdateLibpod

networkUpdateLibpod(name).update(update).execute();

Update existing podman network

Update existing podman network

Example

// Import classes:
import io.github.pod4dev.libpodj.ApiClient;
import io.github.pod4dev.libpodj.ApiException;
import io.github.pod4dev.libpodj.Configuration;
import io.github.pod4dev.libpodj.models.*;
import io.github.pod4dev.libpodj.api.NetworksApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://podman.io");

    NetworksApi apiInstance = new NetworksApi(defaultClient);
    String name = "name_example"; // String | the name or ID of the network
    NetworkUpdateOptions update = new NetworkUpdateOptions(); // NetworkUpdateOptions | attributes for updating a netavark network
    try {
      apiInstance.networkUpdateLibpod(name)
            .update(update)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling NetworksApi#networkUpdateLibpod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String the name or ID of the network
update NetworkUpdateOptions attributes for updating a netavark network [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-tar
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad parameter in request -
500 Internal server error -