| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
8001
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
175
|
|
|
2
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
55
|
|
|
3
|
|
|
|
|
|
|
package CPAN::Testers::Metabase::AWS; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: Metabase backend on Amazon Web Services |
|
5
|
|
|
|
|
|
|
our $VERSION = '1.999002'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
436
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Metabase::Archive::S3 1.000; |
|
9
|
|
|
|
|
|
|
use Metabase::Index::SimpleDB 1.000; |
|
10
|
|
|
|
|
|
|
use Metabase::Librarian 1.000; |
|
11
|
|
|
|
|
|
|
use Net::Amazon::Config; |
|
12
|
|
|
|
|
|
|
use namespace::autoclean; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Metabase::Gateway'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'bucket' => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
isa => 'Str', |
|
19
|
|
|
|
|
|
|
required => 1, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'namespace' => ( |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
isa => 'Str', |
|
25
|
|
|
|
|
|
|
required => 1, |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'amazon_config' => ( |
|
29
|
|
|
|
|
|
|
is => 'ro', |
|
30
|
|
|
|
|
|
|
isa => 'Net::Amazon::Config', |
|
31
|
|
|
|
|
|
|
default => sub { return Net::Amazon::Config->new }, |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has 'profile_name' => ( |
|
35
|
|
|
|
|
|
|
is => 'ro', |
|
36
|
|
|
|
|
|
|
isa => 'Str', |
|
37
|
|
|
|
|
|
|
default => 'cpantesters' |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has '_profile' => ( |
|
41
|
|
|
|
|
|
|
is => 'ro', |
|
42
|
|
|
|
|
|
|
isa => 'Net::Amazon::Config::Profile', |
|
43
|
|
|
|
|
|
|
lazy => 1, |
|
44
|
|
|
|
|
|
|
builder => '_build__profile', |
|
45
|
|
|
|
|
|
|
handles => [ qw/access_key_id secret_access_key/ ], |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _build__profile { |
|
49
|
|
|
|
|
|
|
my $self = shift; |
|
50
|
|
|
|
|
|
|
return $self->amazon_config->get_profile( $self->profile_name ); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _build_fact_classes { return [qw/CPAN::Testers::Report/] } |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _build_public_librarian { return $_[0]->__build_librarian("public") } |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _build_private_librarian { return $_[0]->__build_librarian("private") } |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub __build_librarian { |
|
60
|
|
|
|
|
|
|
my ($self, $subspace) = @_; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $bucket = $self->bucket; |
|
63
|
|
|
|
|
|
|
my $namespace = $self->namespace; |
|
64
|
|
|
|
|
|
|
my $s3_prefix = "metabase/${namespace}/${subspace}/"; |
|
65
|
|
|
|
|
|
|
my $sdb_domain = "${bucket}.metabase.${namespace}.${subspace}"; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
return Metabase::Librarian->new( |
|
68
|
|
|
|
|
|
|
archive => Metabase::Archive::S3->new( |
|
69
|
|
|
|
|
|
|
access_key_id => $self->access_key_id, |
|
70
|
|
|
|
|
|
|
secret_access_key => $self->secret_access_key, |
|
71
|
|
|
|
|
|
|
bucket => $self->bucket, |
|
72
|
|
|
|
|
|
|
prefix => $s3_prefix, |
|
73
|
|
|
|
|
|
|
compressed => 1, |
|
74
|
|
|
|
|
|
|
retry => 1, |
|
75
|
|
|
|
|
|
|
), |
|
76
|
|
|
|
|
|
|
index => Metabase::Index::SimpleDB->new( |
|
77
|
|
|
|
|
|
|
access_key_id => $self->access_key_id, |
|
78
|
|
|
|
|
|
|
secret_access_key => $self->secret_access_key, |
|
79
|
|
|
|
|
|
|
domain => $sdb_domain, |
|
80
|
|
|
|
|
|
|
), |
|
81
|
|
|
|
|
|
|
); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
85
|
|
|
|
|
|
|
1; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=pod |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 NAME |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
CPAN::Testers::Metabase::AWS - Metabase backend on Amazon Web Services |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 VERSION |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
version 1.999002 |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 Direct usage |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
use CPAN::Testers::Metabase::AWS; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my $mb = CPAN::Testers::Metabase::AWS->new( |
|
106
|
|
|
|
|
|
|
bucket => 'myS3bucket', |
|
107
|
|
|
|
|
|
|
namespace => 'prod' |
|
108
|
|
|
|
|
|
|
); |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
$mb->public_librarian->search( %search spec ); |
|
111
|
|
|
|
|
|
|
... |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 Metabase::Web config |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
--- |
|
116
|
|
|
|
|
|
|
Model::Metabase: |
|
117
|
|
|
|
|
|
|
class: CPAN::Testers::Metabase::AWS |
|
118
|
|
|
|
|
|
|
args: |
|
119
|
|
|
|
|
|
|
bucket: myS3bucket |
|
120
|
|
|
|
|
|
|
namespace: prod |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This class instantiates a Metabase backend on the S3 and SimpleDB Amazon |
|
125
|
|
|
|
|
|
|
Web Services (AWS). It uses L<Net::Amazon::Config> to provide user credentials |
|
126
|
|
|
|
|
|
|
and the L<Metabase::Gateway> Role to provide actual functionality. As such, |
|
127
|
|
|
|
|
|
|
it is mostly glue to get the right credentials to setup AWS clients and provide |
|
128
|
|
|
|
|
|
|
them with standard resource names. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
For example, given the C<<< bucket >>> "example" and the C<<< namespace >>> "alpha", |
|
131
|
|
|
|
|
|
|
the following resource names would be used: |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Public S3: http://example.s3.amazonaws.com/metabase/alpha/public/* |
|
134
|
|
|
|
|
|
|
Public SDB domain: example.metabase.alpha.public |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Private S3: http://example.s3.amazonaws.com/metabase/alpha/private/* |
|
137
|
|
|
|
|
|
|
Private SDB domain: example.metabase.alpha.private |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 USAGE |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 new |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my $mb = CPAN::Testers::Metabase::AWS->new( |
|
144
|
|
|
|
|
|
|
bucket => 'myS3bucket', |
|
145
|
|
|
|
|
|
|
namespace => 'prod', |
|
146
|
|
|
|
|
|
|
profile_name => 'cpantesters', |
|
147
|
|
|
|
|
|
|
); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Arguments for C<<< new >>>: |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
C<<< bucket >>> -- required -- the Amazon S3 bucket name to hold both public and private |
|
156
|
|
|
|
|
|
|
fact content. Bucket names must be unique across all of AWS. The bucket |
|
157
|
|
|
|
|
|
|
name is also used as part of the SimpleDB namespace for consistency. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
C<<< namespace >>> -- required -- a short phrase that uniquely identifies this |
|
162
|
|
|
|
|
|
|
metabase. E.g. "dev", "test" or "prod". It is used to specify |
|
163
|
|
|
|
|
|
|
specific locations within the S3 bucket and to uniquely identify a SimpleDB |
|
164
|
|
|
|
|
|
|
domain for indexing. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item * |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
C<<< amazon_config >>> -- optional -- a L<Net::Amazon::Config> object containing |
|
169
|
|
|
|
|
|
|
Amazon Web Service credentials. If not provided, one will be created using |
|
170
|
|
|
|
|
|
|
the default location for the config file. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
C<<< profile_name >>> -- optional -- the name of a profile for use with |
|
175
|
|
|
|
|
|
|
Net::Amazon::Config. If not provided, it defaults to 'cpantesters'. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 access_key_id |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Returns the AWS Access Key ID. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 secret_access_key |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Returns the AWS Secret Access Key |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 Metabase::Gateway Role |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This class does the L<Metabase::Gateway> role, including the following |
|
190
|
|
|
|
|
|
|
methods: |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=over |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
C<<< handle_submission >>> |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
C<<< handle_registration >>> |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
C<<< enqueue >>> |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=back |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
see L<Metabase::Gateway> for more. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=over |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
L<CPAN::Testers::Metabase> |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item * |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
L<Metabase::Gateway> |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item * |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
L<Metabase::Web> |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item * |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
L<Net::Amazon::Config> |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=back |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 SUPPORT |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
|
239
|
|
|
|
|
|
|
at L<http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Testers-Metabase-AWS>. |
|
240
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head2 Source Code |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
|
245
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
L<https://github.com/dagolden/cpan-testers-metabase-aws> |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
git clone https://github.com/dagolden/cpan-testers-metabase-aws.git |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head1 AUTHOR |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
David Golden <dagolden@cpan.org> |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by David Golden. |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
This is free software, licensed under: |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=cut |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
__END__ |
|
267
|
|
|
|
|
|
|
|