Class: DockerEngineAPI::Resources::Networks
- Inherits:
-
Object
- Object
- DockerEngineAPI::Resources::Networks
- Defined in:
- lib/docker_engine_api/resources/networks.rb
Instance Method Summary collapse
-
#connect(id, container:, endpoint_config: nil, request_options: {}) ⇒ nil
The network must be either a local-scoped network or a swarm-scoped network with the
attachableoption set. -
#create(name:, attachable: nil, config_from: nil, config_only: nil, driver: nil, enable_i_pv4: nil, enable_i_pv6: nil, ingress: nil, internal: nil, ipam: nil, labels: nil, options: nil, scope: nil, request_options: {}) ⇒ DockerEngineAPI::Models::CreateResponse
Some parameter documentations has been truncated, see Models::NetworkCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Remove a network.
-
#disconnect(id, container:, force: nil, request_options: {}) ⇒ nil
Disconnect a container from a network.
-
#initialize(client:) ⇒ Networks
constructor
private
A new instance of Networks.
-
#inspect_(id, scope: nil, verbose: nil, request_options: {}) ⇒ DockerEngineAPI::Models::NetworkInspectResponse
Inspect a network.
-
#list(filters: nil, request_options: {}) ⇒ Array<DockerEngineAPI::Models::Summary>
Some parameter documentations has been truncated, see Models::NetworkListParams for more details.
-
#prune(filters: nil, request_options: {}) ⇒ DockerEngineAPI::Models::NetworkPruneResponse
Some parameter documentations has been truncated, see Models::NetworkPruneParams for more details.
Constructor Details
#initialize(client:) ⇒ Networks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Networks.
213 214 215 |
# File 'lib/docker_engine_api/resources/networks.rb', line 213 def initialize(client:) @client = client end |
Instance Method Details
#connect(id, container:, endpoint_config: nil, request_options: {}) ⇒ nil
The network must be either a local-scoped network or a swarm-scoped network with the attachable option set. A network cannot be re-attached to a running container
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/docker_engine_api/resources/networks.rb', line 122 def connect(id, params) parsed, = DockerEngineAPI::NetworkConnectParams.dump_request(params) @client.request( method: :post, path: ["networks/%1$s/connect", id], body: parsed, model: NilClass, options: ) end |
#create(name:, attachable: nil, config_from: nil, config_only: nil, driver: nil, enable_i_pv4: nil, enable_i_pv6: nil, ingress: nil, internal: nil, ipam: nil, labels: nil, options: nil, scope: nil, request_options: {}) ⇒ DockerEngineAPI::Models::CreateResponse
Some parameter documentations has been truncated, see Models::NetworkCreateParams for more details.
Create a network
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/docker_engine_api/resources/networks.rb', line 44 def create(params) parsed, = DockerEngineAPI::NetworkCreateParams.dump_request(params) @client.request( method: :post, path: "networks/create", body: parsed, model: DockerEngineAPI::CreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Remove a network
96 97 98 99 100 101 102 103 |
# File 'lib/docker_engine_api/resources/networks.rb', line 96 def delete(id, params = {}) @client.request( method: :delete, path: ["networks/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#disconnect(id, container:, force: nil, request_options: {}) ⇒ nil
Disconnect a container from a network
148 149 150 151 152 153 154 155 156 157 |
# File 'lib/docker_engine_api/resources/networks.rb', line 148 def disconnect(id, params) parsed, = DockerEngineAPI::NetworkDisconnectParams.dump_request(params) @client.request( method: :post, path: ["networks/%1$s/disconnect", id], body: parsed, model: NilClass, options: ) end |
#inspect_(id, scope: nil, verbose: nil, request_options: {}) ⇒ DockerEngineAPI::Models::NetworkInspectResponse
Inspect a network
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/docker_engine_api/resources/networks.rb', line 174 def inspect_(id, params = {}) parsed, = DockerEngineAPI::NetworkInspectParams.dump_request(params) @client.request( method: :get, path: ["networks/%1$s", id], query: parsed, model: DockerEngineAPI::Models::NetworkInspectResponse, options: ) end |
#list(filters: nil, request_options: {}) ⇒ Array<DockerEngineAPI::Models::Summary>
Some parameter documentations has been truncated, see Models::NetworkListParams for more details.
Returns a list of networks. For details on the format, see the [network inspect endpoint](#operation/NetworkInspect).
Note that it uses a different, smaller representation of a network than inspecting a single network. For example, the list of containers attached to the network is not propagated in API versions 1.28 and up.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/docker_engine_api/resources/networks.rb', line 74 def list(params = {}) parsed, = DockerEngineAPI::NetworkListParams.dump_request(params) @client.request( method: :get, path: "networks", query: parsed, model: DockerEngineAPI::Internal::Type::ArrayOf[DockerEngineAPI::Summary], options: ) end |
#prune(filters: nil, request_options: {}) ⇒ DockerEngineAPI::Models::NetworkPruneResponse
Some parameter documentations has been truncated, see Models::NetworkPruneParams for more details.
Delete unused networks
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/docker_engine_api/resources/networks.rb', line 199 def prune(params = {}) parsed, = DockerEngineAPI::NetworkPruneParams.dump_request(params) @client.request( method: :post, path: "networks/prune", query: parsed, model: DockerEngineAPI::Models::NetworkPruneResponse, options: ) end |