line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Marathon::App; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
123
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
125
|
|
5
|
4
|
|
|
4
|
|
1738
|
use parent 'Net::Marathon::Remote'; |
|
4
|
|
|
|
|
1256
|
|
|
4
|
|
|
|
|
17
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @rw_values = qw( |
8
|
|
|
|
|
|
|
id |
9
|
|
|
|
|
|
|
labels |
10
|
|
|
|
|
|
|
dependencies |
11
|
|
|
|
|
|
|
healthchecks |
12
|
|
|
|
|
|
|
requirePorts |
13
|
|
|
|
|
|
|
cpus |
14
|
|
|
|
|
|
|
backoffSeconds |
15
|
|
|
|
|
|
|
upgradeStrategy |
16
|
|
|
|
|
|
|
ports |
17
|
|
|
|
|
|
|
constraints |
18
|
|
|
|
|
|
|
cmd |
19
|
|
|
|
|
|
|
args |
20
|
|
|
|
|
|
|
env |
21
|
|
|
|
|
|
|
container |
22
|
|
|
|
|
|
|
executor |
23
|
|
|
|
|
|
|
mem |
24
|
|
|
|
|
|
|
maxLaunchDelaySeconds |
25
|
|
|
|
|
|
|
backoffFactor |
26
|
|
|
|
|
|
|
instances |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
2
|
|
|
2
|
0
|
18
|
my ($class, $conf, $parent) = @_; |
31
|
2
|
|
|
|
|
3
|
my $self = bless {}; |
32
|
2
|
50
|
33
|
|
|
14
|
$conf = {} unless $conf && ref $conf eq 'HASH'; |
33
|
2
|
|
|
|
|
9
|
$self->{data} = $conf; |
34
|
2
|
|
|
|
|
4
|
$self->{parent} = $parent; |
35
|
2
|
|
|
|
|
4
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub create { |
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
40
|
0
|
0
|
|
|
|
|
$self->_bail unless defined $self->{parent}; |
41
|
0
|
|
|
|
|
|
return $self->{parent}->_post('/v2/apps', $self->get_updateable_values); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub update { |
45
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
46
|
0
|
0
|
0
|
|
|
|
my $param = $args && $args->{force} && $args->{force} && $args->{force} !~ /false/i ? '?force=true' : ''; #default is false |
47
|
0
|
0
|
|
|
|
|
$self->_bail unless defined $self->{parent}; |
48
|
0
|
|
|
|
|
|
return $self->{parent}->_put('/v2/apps/' . $self->id . $param, $self->get_updateable_values); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub delete { |
52
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
53
|
0
|
0
|
|
|
|
|
$self->_bail unless defined $self->{parent}; |
54
|
0
|
|
|
|
|
|
return $self->{parent}->_delete('/v2/apps/' . $self->id); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub restart { |
58
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
59
|
0
|
0
|
|
|
|
|
$self->_bail unless defined $self->{parent}; |
60
|
0
|
|
|
|
|
|
return $self->{parent}->_post('/v2/apps/' . $self->id . '/restart' ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub versions { |
64
|
0
|
|
|
0
|
0
|
|
my ( $self, $extra ) = @_; |
65
|
0
|
0
|
|
|
|
|
if ( defined $extra ) { |
66
|
0
|
|
|
|
|
|
return $self->get_version( $extra ); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
0
|
|
|
|
|
$self->_bail unless defined $self->{parent}; |
69
|
0
|
|
|
|
|
|
return $self->{parent}->_get_obj('/v2/apps/' . $self->id . '/versions' ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub get_version { |
73
|
0
|
|
|
0
|
0
|
|
my ( $self, $version ) = @_; |
74
|
0
|
0
|
|
|
|
|
$self->_bail unless defined $self->{parent}; |
75
|
0
|
|
|
|
|
|
return $self->{parent}->_get_obj('/v2/apps/' . $self->id . '/versions/' . $version ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub kill_tasks { |
79
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
80
|
|
|
|
|
|
|
my %real_args = map { |
81
|
|
|
|
|
|
|
$_ =~ m,^host|scale$, ? |
82
|
0
|
0
|
0
|
|
|
|
( $_ => $args->{$_} ) : print(STDERR "Extraoneous value `$_' to kill_tasks will be ignored\n") && () |
83
|
0
|
|
|
|
|
|
} keys %{$args}; |
|
0
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return $self->{parent}->_delete('/v2/apps/' . $self->id . '/tasks', \%real_args); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub kill_task { |
88
|
0
|
|
|
0
|
0
|
|
my ( $self, $task_id, $scale ) = @_; |
89
|
0
|
|
|
|
|
|
return $self->{parent}->_delete('/v2/apps/' . $self->id . '/tasks/' . $task_id, {scale => $scale}); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub get_updateable_values { |
93
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
94
|
0
|
0
|
|
|
|
|
my %kv = map { $self->{data}->{$_} ? ( $_ => $self->{data}->{$_} ) : () } @Net::Marathon::App::rw_values; |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return \%kv; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub labels { |
99
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
100
|
0
|
0
|
|
|
|
|
if ( $val ) { |
101
|
0
|
|
|
|
|
|
$self->{data}->{labels} = $val; |
102
|
|
|
|
|
|
|
} |
103
|
0
|
|
|
|
|
|
return $self->{data}->{labels}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub healthChecks { |
107
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
108
|
0
|
0
|
|
|
|
|
if ( $val ) { |
109
|
0
|
|
|
|
|
|
$self->{data}->{healthChecks} = $val; |
110
|
|
|
|
|
|
|
} |
111
|
0
|
|
|
|
|
|
return $self->{data}->{healthChecks}; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub requirePorts { |
115
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
116
|
0
|
0
|
|
|
|
|
if ( $val ) { |
117
|
0
|
|
|
|
|
|
$self->{data}->{requirePorts} = $val; |
118
|
|
|
|
|
|
|
} |
119
|
0
|
|
|
|
|
|
return $self->{data}->{requirePorts}; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub cpus { |
123
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
124
|
0
|
0
|
|
|
|
|
if ( $val ) { |
125
|
0
|
|
|
|
|
|
$self->{data}->{cpus} = $val; |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
|
|
|
return $self->{data}->{cpus}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub backoffSeconds { |
131
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
132
|
0
|
0
|
|
|
|
|
if ( $val ) { |
133
|
0
|
|
|
|
|
|
$self->{data}->{backoffSeconds} = $val; |
134
|
|
|
|
|
|
|
} |
135
|
0
|
|
|
|
|
|
return $self->{data}->{backoffSeconds}; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub upgradeStrategy { |
139
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
140
|
0
|
0
|
|
|
|
|
if ( $val ) { |
141
|
0
|
|
|
|
|
|
$self->{data}->{upgradeStrategy} = $val; |
142
|
|
|
|
|
|
|
} |
143
|
0
|
|
|
|
|
|
return $self->{data}->{upgradeStrategy}; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub ports { |
147
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
148
|
0
|
0
|
|
|
|
|
if ( $val ) { |
149
|
0
|
|
|
|
|
|
$self->{data}->{ports} = $val; |
150
|
|
|
|
|
|
|
} |
151
|
0
|
|
|
|
|
|
return $self->{data}->{ports}; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub constraints { |
155
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
156
|
0
|
0
|
|
|
|
|
if ( $val ) { |
157
|
0
|
|
|
|
|
|
$self->{data}->{constraints} = $val; |
158
|
|
|
|
|
|
|
} |
159
|
0
|
|
|
|
|
|
return $self->{data}->{constraints}; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub cmd { |
163
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
164
|
0
|
0
|
|
|
|
|
if ( $val ) { |
165
|
0
|
|
|
|
|
|
$self->{data}->{cmd} = $val; |
166
|
|
|
|
|
|
|
} |
167
|
0
|
|
|
|
|
|
return $self->{data}->{cmd}; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub args { |
171
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
172
|
0
|
0
|
|
|
|
|
if ( $val ) { |
173
|
0
|
|
|
|
|
|
$self->{data}->{args} = $val; |
174
|
|
|
|
|
|
|
} |
175
|
0
|
|
|
|
|
|
return $self->{data}->{args}; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub executor { |
179
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
180
|
0
|
0
|
|
|
|
|
if ( $val ) { |
181
|
0
|
|
|
|
|
|
$self->{data}->{executor} = $val; |
182
|
|
|
|
|
|
|
} |
183
|
0
|
|
|
|
|
|
return $self->{data}->{executor}; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub container { |
187
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
188
|
0
|
0
|
|
|
|
|
if ( $val ) { |
189
|
0
|
|
|
|
|
|
$self->{data}->{container} = $val; |
190
|
|
|
|
|
|
|
} |
191
|
0
|
|
|
|
|
|
return $self->{data}->{container}; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub env { |
195
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
196
|
0
|
0
|
|
|
|
|
if ( $val ) { |
197
|
0
|
|
|
|
|
|
$self->{data}->{env} = $val; |
198
|
|
|
|
|
|
|
} |
199
|
0
|
|
|
|
|
|
return $self->{data}->{env}; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub maxLaunchDelaySeconds { |
203
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
204
|
0
|
0
|
|
|
|
|
if ( $val ) { |
205
|
0
|
|
|
|
|
|
$self->{data}->{maxLaunchDelaySeconds} = $val; |
206
|
|
|
|
|
|
|
} |
207
|
0
|
|
|
|
|
|
return $self->{data}->{maxLaunchDelaySeconds}; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub backoffFactor { |
211
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
212
|
0
|
0
|
|
|
|
|
if ( $val ) { |
213
|
0
|
|
|
|
|
|
$self->{data}->{backoffFactor} = $val; |
214
|
|
|
|
|
|
|
} |
215
|
0
|
|
|
|
|
|
return $self->{data}->{backoffFactor}; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub mem { |
219
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
220
|
0
|
0
|
|
|
|
|
if ( $val ) { |
221
|
0
|
|
|
|
|
|
$self->{data}->{mem} = $val; |
222
|
|
|
|
|
|
|
} |
223
|
0
|
|
|
|
|
|
return $self->{data}->{mem}; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub instances { |
227
|
0
|
|
|
0
|
0
|
|
my ($self, $val) = @_; |
228
|
0
|
0
|
|
|
|
|
if ( $val ) { |
229
|
0
|
|
|
|
|
|
$self->{data}->{instances} = $val; |
230
|
|
|
|
|
|
|
} |
231
|
0
|
|
|
|
|
|
return $self->{data}->{instances}; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub tasksUnhealthy { |
235
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
236
|
0
|
|
|
|
|
|
return $self->{data}->{tasksUnhealthy}; |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub tasksStaged { |
240
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
241
|
0
|
|
|
|
|
|
return $self->{data}->{tasksStaged}; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub deployments { |
245
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
246
|
0
|
|
|
|
|
|
return $self->{data}->{deployments}; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub tasks { |
250
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
251
|
0
|
|
|
|
|
|
return $self->{data}->{tasks}; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub uris { |
255
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
256
|
0
|
|
|
|
|
|
return $self->{data}->{uris}; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub user { |
260
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
261
|
0
|
|
|
|
|
|
return $self->{data}->{user}; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub storeUrls { |
265
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
266
|
0
|
|
|
|
|
|
return $self->{data}->{storeUrls}; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub disk { |
270
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
271
|
0
|
|
|
|
|
|
return $self->{data}->{disk}; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub tasksHealthy { |
275
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
276
|
0
|
|
|
|
|
|
return $self->{data}->{tasksHealthy}; |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub tasksRunning { |
280
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
281
|
0
|
|
|
|
|
|
return $self->{data}->{tasksRunning}; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub acceptedResourceRoles { |
285
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
286
|
0
|
|
|
|
|
|
return $self->{data}->{acceptedResourceRoles}; |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
sub lastTaskFailure { |
290
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
291
|
0
|
|
|
|
|
|
return $self->{data}->{lastTaskFailure}; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
return 1; |