line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ceph::RadosGW::Admin::User; |
2
|
|
|
|
|
|
|
$Ceph::RadosGW::Admin::User::VERSION = '0.3'; |
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
140
|
|
4
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
88
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
15
|
use Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
15
|
|
7
|
2
|
|
|
2
|
|
59022
|
use namespace::autoclean; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
31
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Ceph::RadosGW::Admin::User - A Rados Gateway User |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
version 0.3 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This class provides objects that represent users on a rados gateway object |
20
|
|
|
|
|
|
|
store. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has user_id => (is => 'ro', required => 1, isa => 'Str'); |
25
|
|
|
|
|
|
|
has display_name => (is => 'rw', required => 1, isa => 'Str'); |
26
|
|
|
|
|
|
|
has suspended => (is => 'rw', required => 1, isa => 'Bool'); |
27
|
|
|
|
|
|
|
has max_buckets => (is => 'rw', required => 1, isa => 'Int'); |
28
|
|
|
|
|
|
|
has subusers => (is => 'rw', required => 1, isa => 'ArrayRef[Ceph::RadosGW::Admin::User]'); |
29
|
|
|
|
|
|
|
has keys => (is => 'rw', required => 1, isa => 'ArrayRef[HashRef[Str]]'); |
30
|
|
|
|
|
|
|
has swift_keys => (is => 'rw', required => 1, isa => 'ArrayRef[Str]'); |
31
|
|
|
|
|
|
|
has caps => (is => 'rw', required => 1, isa => 'ArrayRef[Str]'); |
32
|
|
|
|
|
|
|
has _client => (is => 'ro', required => 1, isa => 'Ceph::RadosGW::Admin'); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 delete |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Removes the user from the rados system. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Dies on failure. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub delete { |
47
|
14
|
|
|
14
|
1
|
290
|
my ($self) = @_; |
48
|
|
|
|
|
|
|
|
49
|
14
|
|
|
|
|
80
|
$self->_request(DELETE => 'user'); |
50
|
|
|
|
|
|
|
|
51
|
14
|
|
|
|
|
320
|
return 1; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 save |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Save changes to the user. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Dies on failure. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub save { |
63
|
1
|
|
|
1
|
1
|
8
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
46
|
return $self->_request( |
66
|
|
|
|
|
|
|
POST => 'user', |
67
|
|
|
|
|
|
|
display_name => $self->display_name, |
68
|
|
|
|
|
|
|
suspended => $self->suspended, |
69
|
|
|
|
|
|
|
max_buckets => $self->max_buckets, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 create_key |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Create an access/secret key pair. Returns the keys as a list of hashrefs. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Dies on failure. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub create_key { |
82
|
1
|
|
|
1
|
1
|
245
|
my ($self) = @_; |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
7
|
return $self->_request( |
85
|
|
|
|
|
|
|
PUT => 'user', |
86
|
|
|
|
|
|
|
key => '', |
87
|
|
|
|
|
|
|
generate_key => 'True', |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 delete_key |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Delete a specific access/secret key pair. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Dies on failure. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub delete_key { |
100
|
1
|
|
|
1
|
1
|
4
|
my ($self, %args) = @_; |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
5
|
return $self->_request( |
103
|
|
|
|
|
|
|
DELETE => 'user', |
104
|
|
|
|
|
|
|
key => '', |
105
|
|
|
|
|
|
|
access_key => $args{'access_key'}, |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 get_usage |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Get usage information for the user. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Dies on failure. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub get_usage { |
118
|
1
|
|
|
1
|
1
|
232
|
my ($self, %args) = @_; |
119
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
6
|
my %usage = $self->_request(GET => 'usage', %args); |
121
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
11
|
return %usage; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 get_bucket_info |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Gets bucket information and statistics for the user. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Dies on failure. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub get_bucket_info { |
134
|
1
|
|
|
1
|
1
|
324
|
my ($self) = @_; |
135
|
|
|
|
|
|
|
|
136
|
1
|
|
|
|
|
7
|
my @info = $self->_request( |
137
|
|
|
|
|
|
|
GET => 'bucket', |
138
|
|
|
|
|
|
|
stats => 'True', |
139
|
|
|
|
|
|
|
); |
140
|
|
|
|
|
|
|
|
141
|
1
|
|
|
|
|
11
|
return @info; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub _request { |
145
|
19
|
|
|
19
|
|
60
|
my ($self, @args) = @_; |
146
|
|
|
|
|
|
|
|
147
|
19
|
|
|
|
|
911
|
return $self->_client->_request( |
148
|
|
|
|
|
|
|
@args, |
149
|
|
|
|
|
|
|
uid => $self->user_id, |
150
|
|
|
|
|
|
|
); |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub as_hashref { |
154
|
1
|
|
|
1
|
0
|
239
|
my ($self) = @_; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
return { |
157
|
1
|
|
|
|
|
4
|
map { $_ => $self->$_ } qw/user_id display_name suspended max_buckets keys caps/ |
|
6
|
|
|
|
|
267
|
|
158
|
|
|
|
|
|
|
}; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; |