| 1 | package WWW::Hetzner::Storage::Subaccount; | ||||||||||
| 2 | # ABSTRACT: Hetzner Storage Box Subaccount object | ||||||||||
| 3 | |||||||||||
| 4 | 11 | our $VERSION = '0.102'; | |||||||||
| 5 | |||||||||||
| 6 | 11 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 11 | with 'WWW::Hetzner::Role::HasAction'; | |||||||||
| 8 | 11 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 11 | ▶ | use WWW::Hetzner::Storage::API::Subaccounts; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 11 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 11 | has _client => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | weak_ref => 1, | ||||||||||
| 17 | init_arg => 'client', | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 11 | has _storage_box_id => ( | |||||||||
| 21 | is => 'ro', | ||||||||||
| 22 | required => 1, | ||||||||||
| 23 | init_arg => 'storage_box_id', | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 11 | has id => ( is => 'ro' ); | |||||||||
| 27 | 11 | has storage_box => ( is => 'ro' ); | |||||||||
| 28 | 11 | has name => ( is => 'rw' ); | |||||||||
| 29 | 11 | has home_directory => ( is => 'ro' ); | |||||||||
| 30 | 11 | has access_settings => ( is => 'ro' ); | |||||||||
| 31 | 11 | has description => ( is => 'rw' ); | |||||||||
| 32 | 11 | has labels => ( is => 'rw' ); | |||||||||
| 33 | 11 | has username => ( is => 'ro' ); | |||||||||
| 34 | 11 | has server => ( is => 'ro' ); | |||||||||
| 35 | 11 | has created => ( is => 'ro' ); | |||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | 2 | ▶ | sub _require_id { | ||||||||
|
Subroutine
_require_id: called CC=2 SCAR=7.2
| |||||||||||
| 48 | 2 | my ($self) = @_; | |||||||||
| 49 | 2 | ▶ | croak 'Cannot use subaccount without ID' unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 2 | ▶ | sub _controller { | ||||||||
|
Subroutine
_controller: called CC=1 SCAR=0.0
| |||||||||||
| 53 | 2 | my ($self) = @_; | |||||||||
| 54 | 2 | return WWW::Hetzner::Storage::API::Subaccounts->new( | |||||||||
| 55 | client => $self->_client, | ||||||||||
| 56 | storage_box_id => $self->_storage_box_id, | ||||||||||
| 57 | ); | ||||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | 1 | ▶ | sub update { | ||||||||
|
Subroutine
update: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 62 | 1 | my ($self) = @_; | |||||||||
| 63 | 1 | $self->_require_id; | |||||||||
| 64 | |||||||||||
| 65 | 1 | return $self->_controller->update( | |||||||||
| 66 | $self->id, | ||||||||||
| 67 | name => $self->name, | ||||||||||
| 68 | description => $self->description, | ||||||||||
| 69 | labels => $self->labels, | ||||||||||
| 70 | ); | ||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | 1 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 75 | 1 | my ($self) = @_; | |||||||||
| 76 | 1 | $self->_require_id; | |||||||||
| 77 | 1 | return $self->_controller->delete($self->id); | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | |||||||||||
| 81 | 0 | ▶ | sub change_home_directory { | ||||||||
|
Subroutine
change_home_directory: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 82 | 0 | my ($self, %params) = @_; | |||||||||
| 83 | 0 | $self->_require_id; | |||||||||
| 84 | 0 | return $self->_controller->change_home_directory($self->id, %params); | |||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | sub reset_subaccount_password { | ||||||||
|
Subroutine
reset_subaccount_password: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 89 | 0 | my ($self, %params) = @_; | |||||||||
| 90 | 0 | $self->_require_id; | |||||||||
| 91 | 0 | return $self->_controller->reset_subaccount_password($self->id, %params); | |||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | 0 | ▶ | sub update_access_settings { | ||||||||
|
Subroutine
update_access_settings: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 96 | 0 | my ($self, %params) = @_; | |||||||||
| 97 | 0 | $self->_require_id; | |||||||||
| 98 | 0 | return $self->_controller->update_access_settings($self->id, %params); | |||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | 3 | ▶ | sub data { | ||||||||
|
Subroutine
data: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 103 | 3 | my ($self) = @_; | |||||||||
| 104 | return { | ||||||||||
| 105 | 3 | id => $self->id, | |||||||||
| 106 | storage_box => $self->storage_box, | ||||||||||
| 107 | name => $self->name, | ||||||||||
| 108 | home_directory => $self->home_directory, | ||||||||||
| 109 | access_settings => $self->access_settings, | ||||||||||
| 110 | description => $self->description, | ||||||||||
| 111 | labels => $self->labels, | ||||||||||
| 112 | username => $self->username, | ||||||||||
| 113 | server => $self->server, | ||||||||||
| 114 | created => $self->created, | ||||||||||
| 115 | }; | ||||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | |||||||||||
| 119 | 11 | 1; | |||||||||
| 120 | |||||||||||
| 121 | __END__ | ||||||||||