File Coverage

blib/lib/WWW/Docker/Volume.pm
Criterion Covered Total %
statement 6 10 60.0
branch n/a
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 16 50.0


line stmt bran cond sub pod time code
1             package WWW::Docker::Volume;
2             # ABSTRACT: Docker volume entity
3              
4 10     10   80 use Moo;
  10         21  
  10         70  
5 10     10   3855 use namespace::clean;
  10         24  
  10         108  
6              
7             our $VERSION = '0.101';
8              
9             =head1 SYNOPSIS
10              
11             my $docker = WWW::Docker->new;
12             my $volumes = $docker->volumes->list;
13             my $volume = $volumes->[0];
14              
15             say $volume->Name;
16             say $volume->Driver;
17             say $volume->Mountpoint;
18              
19             $volume->remove;
20              
21             =head1 DESCRIPTION
22              
23             This class represents a Docker volume. Instances are returned by
24             L methods.
25              
26             =cut
27              
28             has client => (
29             is => 'ro',
30             weak_ref => 1,
31             );
32              
33             =attr client
34              
35             Reference to L client.
36              
37             =cut
38              
39             has Name => (is => 'ro');
40              
41             =attr Name
42              
43             Volume name.
44              
45             =cut
46              
47             has Driver => (is => 'ro');
48              
49             =attr Driver
50              
51             Volume driver (usually C).
52              
53             =cut
54              
55             has Mountpoint => (is => 'ro');
56              
57             =attr Mountpoint
58              
59             Filesystem path where the volume is mounted on the host.
60              
61             =cut
62              
63             has CreatedAt => (is => 'ro');
64             has Status => (is => 'ro');
65             has Labels => (is => 'ro');
66             has Scope => (is => 'ro');
67             has Options => (is => 'ro');
68             has UsageData => (is => 'ro');
69              
70             sub inspect {
71 0     0 0   my ($self) = @_;
72 0           return $self->client->volumes->inspect($self->Name);
73             }
74              
75             =method inspect
76              
77             my $updated = $volume->inspect;
78              
79             Get fresh volume information.
80              
81             =cut
82              
83             sub remove {
84 0     0 0   my ($self, %opts) = @_;
85 0           return $self->client->volumes->remove($self->Name, %opts);
86             }
87              
88             =method remove
89              
90             $volume->remove(force => 1);
91              
92             Remove the volume.
93              
94             =cut
95              
96             =seealso
97              
98             =over
99              
100             =item * L - Volume API operations
101              
102             =item * L - Main Docker client
103              
104             =back
105              
106             =cut
107              
108             1;