V1.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« V1/Volume/Types.pm ↑ Summary V1/NetAppClient.pm »
1 package Google::Cloud::Netapp::V1;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 0 ▶use Google::gRPC::Client;
Subroutine BEGIN: called CC=1 SCAR=2.6
7 use Google::Cloud::REST::Client;
8 use Google::Auth;
9 use Carp qw(croak);
10  
11 use Protobuf;
12 use Google::Api::Common;
13 use Google::Cloud::Netapp::V1::Common;
14 use Google::Cloud::Netapp::V1::Ontap;
15 use Google::Cloud::Netapp::V1::BackupPolicy;
16 use Google::Cloud::Netapp::V1::BackupVault;
17 use Google::Cloud::Netapp::V1::ActiveDirectory;
18 use Google::Cloud::Netapp::V1::Backup;
19 use Google::Cloud::Netapp::V1::Snapshot;
20 use Google::Cloud::Netapp::V1::QuotaRule;
21 use Google::Cloud::Netapp::V1::Kms;
22 use Google::Cloud::Netapp::V1::HostGroup;
23 use Google::Cloud::Netapp::V1::Volume;
24 use Google::Cloud::Netapp::V1::StoragePool;
25 use Google::Cloud::Netapp::V1::Replication;
26 use Google::Cloud::Netapp::V1::CloudNetappService;
27  
28 our $VERSION = '0.06';
29  
30 has credentials => ( is => 'ro', required => 0 );
31 has transport => ( is => 'rw' );
32  
33 sub BUILD {
34 my ($self) = @_;
35  
36 my $auth = $self->credentials;
37 if (!defined $auth) {
38 $auth = Google::Auth->default();
39 } elsif (!eval { $auth->can('get_token') }) {
40 croak 'Invalid credentials object: must implement get_token()';
41 }
42 my $token = $auth->get_token();
43  
44 my $target = 'netapp.googleapis.com:443';
45 my $t = $self->transport || 'grpc';
46  
47 if (ref($t) && eval { $t->can('call') }) {
48 # Already a transport object
49 } elsif (lc($t) eq 'rest') {
50 my $client = Google::Cloud::REST::Client->new(
51 target => $target,
52 auth_token => $token,
53 );
54 $self->transport($client);
55 } else {
56 my $client = Google::gRPC::Client->new(
57 target => $target,
58 auth_token => $token,
59 );
60 $self->transport($client);
61 }
62 }
63  
64 sub list_storage_pools {
65 my ($self, %params) = @_;
66  
67 my $request_class = 'Google::Cloud::Netapp::V1::StoragePool::ListStoragePoolsRequest';
68 my $request = eval { $request_class->new(\%params) };
69 my $new_err = $@;
70 if (!$request) {
71 $request = eval { $request_class->new(%params) };
72 $new_err ||= $@;
73 }
74 if (!$request) {
75 croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error');
76 }
77  
78 my $response_class = 'Google::Cloud::Netapp::V1::StoragePool::ListStoragePoolsResponse';
79 if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) {
80 return $self->transport->call({
81 http_method => 'POST',
82 path => '/google.cloud.netapp.v1.NetApp/ListStoragePools',
83 request => $request,
84 response_class => $response_class,
85 });
86 }
87  
88 my $response = $self->transport->call({
89 service => 'google.cloud.netapp.v1.NetApp',
90 method => 'ListStoragePools',
91 request => $request,
92 response_class => $response_class,
93 });
94  
95 return $response;
96 }
97 1; # End of Google::Cloud::Netapp::V1
98  
99 __END__
« V1/Volume/Types.pm ↑ Summary V1/NetAppClient.pm »