Class: Docker::API::Volumes
- Inherits:
-
Collection
- Object
- Collection
- Docker::API::Volumes
- Defined in:
- lib/docker/api/collections/volumes.rb
Overview
The volumes on a daemon.
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
- #all(filters: nil) ⇒ Array<Docker::API::Volume>
-
#create(name = nil, driver: nil, labels: nil, driver_opts: nil) ⇒ Docker::API::Volume
Create a volume.
- #get(name) ⇒ Docker::API::Volume
-
#prune(filters: nil) ⇒ Hash
What was deleted and how much space it freed.
-
#warnings(filters: nil) ⇒ Array<String>
Names of volumes the daemon could not inspect.
Methods inherited from Collection
#exist?, #find, #initialize, #to_s
Constructor Details
This class inherits a constructor from Docker::API::Collection
Instance Method Details
#all(filters: nil) ⇒ Array<Docker::API::Volume>
12 13 14 15 16 17 |
# File 'lib/docker/api/collections/volumes.rb', line 12 def all(filters: nil) payload = operations.volume_list(filters: filters).json! Array(payload["Volumes"]).map do |entry| Volume.new(client: client, raw: entry, partial: false) end end |
#create(name = nil, driver: nil, labels: nil, driver_opts: nil) ⇒ Docker::API::Volume
Create a volume.
38 39 40 41 42 43 44 45 |
# File 'lib/docker/api/collections/volumes.rb', line 38 def create(name = nil, driver: nil, labels: nil, driver_opts: nil) body = { "Name" => name, "Driver" => driver, "Labels" => labels, "DriverOpts" => driver_opts }.compact Volume.new(client: client, raw: operations.volume_create(body: body).json, partial: false) end |
#get(name) ⇒ Docker::API::Volume
27 28 29 |
# File 'lib/docker/api/collections/volumes.rb', line 27 def get(name) Volume.new(client: client, raw: operations.volume_inspect(name: name).json, partial: false) end |
#prune(filters: nil) ⇒ Hash
Returns what was deleted and how much space it freed.
49 50 51 |
# File 'lib/docker/api/collections/volumes.rb', line 49 def prune(filters: nil) operations.volume_prune(filters: filters).json end |
#warnings(filters: nil) ⇒ Array<String>
Returns names of volumes the daemon could not inspect.
20 21 22 |
# File 'lib/docker/api/collections/volumes.rb', line 20 def warnings(filters: nil) Array(operations.volume_list(filters: filters).json!["Warnings"]) end |