line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
2
|
|
|
|
|
|
|
# @class : Chef::Rest::Client::cookbook # |
3
|
|
|
|
|
|
|
# @author : Bhavin Patel # |
4
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Chef::REST::Client::cookbook; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2480
|
use Chef::REST::Client::cookbook_versions; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
9
|
1
|
|
|
1
|
|
8
|
use Chef::REST::Client::attributes; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
721
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$Chef::REST::Client::cookbook::VERSION = 1.0; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=pod |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Chef::REST::Client::cookbook |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1.0 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $obj = new Chef::REST::Client::cookbook( 'name' => $cookbook_name |
26
|
|
|
|
|
|
|
, 'url' => $cookbook_url |
27
|
|
|
|
|
|
|
, 'versions' => $versions |
28
|
|
|
|
|
|
|
, 'libraries' => $libraries |
29
|
|
|
|
|
|
|
, 'providers' => $providers |
30
|
|
|
|
|
|
|
, 'resources' => $resources |
31
|
|
|
|
|
|
|
, 'root_files' => $root_files |
32
|
|
|
|
|
|
|
, 'version' => $cookbook_version |
33
|
|
|
|
|
|
|
, 'templates' => $templates |
34
|
|
|
|
|
|
|
, 'files' => $files |
35
|
|
|
|
|
|
|
, 'attributes' => $attributes |
36
|
|
|
|
|
|
|
, 'recipes' => $recipes |
37
|
|
|
|
|
|
|
, 'metadata' => $metadata ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
used internally by other classes like L |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 Constructor |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
returns new Chef::REST::Client::cookbook object |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new { |
52
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
53
|
0
|
|
|
|
|
|
my $param = {@_}; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $self = {}; |
56
|
0
|
|
|
|
|
|
bless $self, $class; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->name( $param->{'name' }); |
59
|
0
|
|
|
|
|
|
$self->url( $param->{'url' }); |
60
|
0
|
|
|
|
|
|
$self->versions( $param->{'versions' }); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self->libraries( $param->{'libraries' }); |
63
|
0
|
|
|
|
|
|
$self->providers( $param->{'providers' }); |
64
|
0
|
|
|
|
|
|
$self->resources( $param->{'resources' }); |
65
|
0
|
|
|
|
|
|
$self->root_files( $param->{'root_files'}); |
66
|
0
|
|
|
|
|
|
$self->version ( $param->{'version' }); |
67
|
0
|
|
|
|
|
|
$self->templates ( $param->{'templates' }); |
68
|
0
|
|
|
|
|
|
$self->files ( $param->{'files' }); |
69
|
0
|
|
|
|
|
|
$self->attributes( $param->{'attributes'}); |
70
|
0
|
|
|
|
|
|
$self->recipes( $param->{'recipes' }); |
71
|
0
|
|
|
|
|
|
$self->metadata( $param->{'metadata' }); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $self; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=pod |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 url( $url ) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
set 'url' property value if speicfied else return previous value; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
0
|
1
|
|
sub url { $_[0]->{'url' } = $_[1] if defined $_[1]; return $_[0]->{'url' };} |
|
0
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 name( $name ) |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
set 'name' property value if speicfied else return previous value; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
0
|
1
|
|
sub name { $_[0]->{'name' } = $_[1] if defined $_[1]; return $_[0]->{'name' };} |
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 version( $version ) |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
set 'version' property value if speicfied else return previous value; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
0
|
0
|
|
0
|
1
|
|
sub version { $_[0]->{'version' } = $_[1] if defined $_[1]; return $_[0]->{'version' };} |
|
0
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=pod |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 libraries( $libraries ) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
set 'libraries' value if speicfied else return previous value; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub libraries |
115
|
|
|
|
|
|
|
{ |
116
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
117
|
0
|
|
|
|
|
|
my $libraries = shift; |
118
|
0
|
|
|
|
|
|
$self->{'libraries'} = $libraries; |
119
|
0
|
|
|
|
|
|
return $self->{'libraries'}; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 providers( $providers ) |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
set 'providers' value if speicfied else return previous value; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub providers |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
133
|
0
|
|
|
|
|
|
my $providers = shift; |
134
|
0
|
|
|
|
|
|
$self->{'providers'} = $providers; |
135
|
0
|
|
|
|
|
|
return $self->{'providers'}; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=pod |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 resources( $resources ) |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
set 'resources' value if speicfied else return previous value; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub resources |
147
|
|
|
|
|
|
|
{ |
148
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
149
|
0
|
|
|
|
|
|
my $resources = shift; |
150
|
0
|
|
|
|
|
|
$self->{'resources'} = $resources; |
151
|
0
|
|
|
|
|
|
return $self->{'resources'}; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=pod |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 root_files( $root_files ) |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
set 'root_files' value if speicfied else return previous value; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub root_files |
163
|
|
|
|
|
|
|
{ |
164
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
165
|
0
|
|
|
|
|
|
my $root_files = shift; |
166
|
0
|
|
|
|
|
|
$self->{'root_files'} = $root_files; |
167
|
0
|
|
|
|
|
|
return $self->{'root_files'}; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=pod |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 templates( $templates ) |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
set 'templates' value if speicfied else return previous value; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub templates |
179
|
|
|
|
|
|
|
{ |
180
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
181
|
0
|
|
|
|
|
|
my $templates = shift; |
182
|
0
|
|
|
|
|
|
$self->{'templates'} = $templates; |
183
|
0
|
|
|
|
|
|
return $self->{'templates'}; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=pod |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 files( $files ) |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
set 'filess' value if speicfied else return previous value; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub files |
195
|
|
|
|
|
|
|
{ |
196
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
197
|
0
|
|
|
|
|
|
my $files = shift; |
198
|
0
|
|
|
|
|
|
$self->{'files'} = $files; |
199
|
0
|
|
|
|
|
|
return $self->{'files'}; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=pod |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head2 attributes( $attributes ) |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
$attributes is converted to L class and is assigned to 'attributes' property |
207
|
|
|
|
|
|
|
returns values of 'attributes' property if no argument is given. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub attributes |
212
|
|
|
|
|
|
|
{ |
213
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
214
|
0
|
|
|
|
|
|
my $attributes = shift; |
215
|
0
|
0
|
|
|
|
|
$self->{'attributes'} = new Chef::REST::Client::attributes($attributes) if defined $attributes; |
216
|
0
|
|
|
|
|
|
return $self->{'attributes'}; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=pod |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head2 recipes( $recipes ) |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
set 'recipes' value if speicfied else return previous value; |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub recipes |
228
|
|
|
|
|
|
|
{ |
229
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
230
|
0
|
|
|
|
|
|
my $recipes = shift; |
231
|
0
|
0
|
|
|
|
|
$self->{'recipes'} = $recipes if defined $recipes; |
232
|
0
|
|
|
|
|
|
return $self->{'recipes'}; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=pod |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 metadata( $metadata ) |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
set 'metadata' value if speicfied else return previous value; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub metadata |
244
|
|
|
|
|
|
|
{ |
245
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
246
|
0
|
|
|
|
|
|
my $metadata = shift; |
247
|
0
|
|
|
|
|
|
$self->{'metadata'} = $metadata; |
248
|
0
|
|
|
|
|
|
return $self->{'metadata'}; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=pod |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head2 versions( $versions ) |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
set 'versions' value if speicfied else return previous value; |
256
|
|
|
|
|
|
|
$versions is converted to L class |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# move to seperate class if possible |
261
|
|
|
|
|
|
|
sub versions |
262
|
|
|
|
|
|
|
{ |
263
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
264
|
0
|
|
|
|
|
|
my $param = shift; |
265
|
0
|
0
|
0
|
|
|
|
$param = new Chef::REST::Client::cookbook_versions( $param ) |
266
|
|
|
|
|
|
|
unless ref $param eq 'ARRAY' |
267
|
|
|
|
|
|
|
&& ref $param->[0] eq 'Chef::REST::Client::cookbook_version'; |
268
|
|
|
|
|
|
|
|
269
|
0
|
0
|
|
|
|
|
$self->{'versions'} = $param if defined $param; |
270
|
0
|
|
|
|
|
|
return $self->{'version'}; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
1; |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head1 KNOWN BUGS |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head1 SUPPORT |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
open a github ticket or email comments to Bhavin Patel |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
This Software is free to use , licensed under : The Artisic License 2.0 (GPL Compatible) |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=cut |