| 1 | package Net::SecurityCenter::API::Credential; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use parent 'Net::SecurityCenter::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use Net::SecurityCenter::Utils qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 2 | our $VERSION = '0.310'; | |||||||||
| 13 | |||||||||||
| 14 | 2 | my $common_template = { | |||||||||
| 15 | |||||||||||
| 16 | id => { | ||||||||||
| 17 | required => 1, | ||||||||||
| 18 | allow => qr/^\d+$/, | ||||||||||
| 19 | messages => { | ||||||||||
| 20 | required => 'Credential ID is required', | ||||||||||
| 21 | allow => 'Invalid Credential ID', | ||||||||||
| 22 | }, | ||||||||||
| 23 | }, | ||||||||||
| 24 | |||||||||||
| 25 | filter => { | ||||||||||
| 26 | allow => [ 'usable', 'manageable' ], | ||||||||||
| 27 | }, | ||||||||||
| 28 | |||||||||||
| 29 | fields => { | ||||||||||
| 30 | filter => \&sc_filter_array_to_string, | ||||||||||
| 31 | }, | ||||||||||
| 32 | |||||||||||
| 33 | }; | ||||||||||
| 34 | |||||||||||
| 35 | #------------------------------------------------------------------------------- | ||||||||||
| 36 | # METHODS | ||||||||||
| 37 | #------------------------------------------------------------------------------- | ||||||||||
| 38 | |||||||||||
| 39 | sub list { | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
list: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 42 | |||||||||||
| 43 | my $tmpl = { | ||||||||||
| 44 | filter => $common_template->{'filter'}, | ||||||||||
| 45 | 0 | fields => $common_template->{'fields'}, | |||||||||
| 46 | raw => {} | ||||||||||
| 47 | }; | ||||||||||
| 48 | |||||||||||
| 49 | 0 | my $params = sc_check_params( $tmpl, \%args ); | |||||||||
| 50 | 0 | my $credentials = $self->client->get( '/credential', $params ); | |||||||||
| 51 | 0 | my $raw = delete( $params->{'raw'} ); | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | return if ( !$credentials ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | ▶ | return $credentials if ($raw); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | return sc_merge($credentials); | |||||||||
| 56 | |||||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | #------------------------------------------------------------------------------- | ||||||||||
| 60 | |||||||||||
| 61 | sub get { | ||||||||||
| 62 | |||||||||||
| 63 | 0 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 64 | |||||||||||
| 65 | my $tmpl = { | ||||||||||
| 66 | fields => $common_template->{'fields'}, | ||||||||||
| 67 | 0 | id => $common_template->{'id'}, | |||||||||
| 68 | }; | ||||||||||
| 69 | |||||||||||
| 70 | 0 | my $params = sc_check_params( $tmpl, \%args ); | |||||||||
| 71 | 0 | my $credential_id = delete( $params->{'id'} ); | |||||||||
| 72 | 0 | my $credential = $self->client->get( "/credential/$credential_id", $params ); | |||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | return if ( !$credential ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | 0 | return $credential; | |||||||||
| 76 | |||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | #------------------------------------------------------------------------------- | ||||||||||
| 80 | |||||||||||
| 81 | 2 | 1; | |||||||||
| 82 | |||||||||||
| 83 | __END__ | ||||||||||