V1beta/BackupDrProtectionSummaryClient.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
« V1beta/BackupDRClient.pm ↑ Summary
1 package Google::Cloud::Backupdr::V1beta::BackupDrProtectionSummaryClient;
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::Backupdr::V1beta::RestoreVerificationPlanAssociation;
14 use Google::Cloud::Backupdr::V1beta::Backupplan;
15 use Google::Cloud::Backupdr::V1beta::BackupvaultAlloydb;
16 use Google::Cloud::Backupdr::V1beta::BackupvaultGce;
17 use Google::Cloud::Backupdr::V1beta::Bindingmatchingresource;
18 use Google::Cloud::Backupdr::V1beta::ProtectionSummary;
19 use Google::Cloud::Backupdr::V1beta::BackupvaultCloudsql;
20 use Google::Cloud::Backupdr::V1beta::BackupvaultBa;
21 use Google::Cloud::Backupdr::V1beta::Autoprotectionpolicybinding;
22 use Google::Cloud::Backupdr::V1beta::RestoreTemplateCommon;
23 use Google::Cloud::Backupdr::V1beta::Autoprotectionpolicy;
24 use Google::Cloud::Backupdr::V1beta::RestoreVerificationPlan;
25 use Google::Cloud::Backupdr::V1beta::BackupvaultDisk;
26 use Google::Cloud::Backupdr::V1beta::Backupplanassociation;
27 use Google::Cloud::Backupdr::V1beta::Appliedautoprotectionpolicy;
28 use Google::Cloud::Backupdr::V1beta::RestoreTemplateExecution;
29 use Google::Cloud::Backupdr::V1beta::Backupvault;
30 use Google::Cloud::Backupdr::V1beta::RestoreTemplate;
31 use Google::Cloud::Backupdr::V1beta::Datasourcereference;
32 use Google::Cloud::Backupdr::V1beta::Backupdr;
33  
34 our $VERSION = '0.06';
35  
36 has credentials => ( is => 'ro', required => 0 );
37 has transport => ( is => 'rw' );
38  
39 sub BUILD {
40 my ($self) = @_;
41  
42 my $auth = $self->credentials;
43 if (!defined $auth) {
44 $auth = Google::Auth->default();
45 } elsif (!eval { $auth->can('get_token') }) {
46 croak 'Invalid credentials object: must implement get_token()';
47 }
48 my $token = $auth->get_token();
49  
50 my $target = 'backupdr.googleapis.com:443';
51 my $t = $self->transport || 'grpc';
52  
53 if (ref($t) && eval { $t->can('call') }) {
54 # Already a transport object
55 } elsif (lc($t) eq 'rest') {
56 my $client = Google::Cloud::REST::Client->new(
57 target => $target,
58 auth_token => $token,
59 );
60 $self->transport($client);
61 } else {
62 my $client = Google::gRPC::Client->new(
63 target => $target,
64 auth_token => $token,
65 );
66 $self->transport($client);
67 }
68 }
69  
70 sub list_resource_backup_configs {
71 my ($self, %params) = @_;
72  
73 my $request_class = 'Google::Cloud::Backupdr::V1beta::ProtectionSummary::ListResourceBackupConfigsRequest';
74 my $request = eval { $request_class->new(\%params) };
75 my $new_err = $@;
76 if (!$request) {
77 $request = eval { $request_class->new(%params) };
78 $new_err ||= $@;
79 }
80 if (!$request) {
81 croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error');
82 }
83  
84 my $response_class = 'Google::Cloud::Backupdr::V1beta::ProtectionSummary::ListResourceBackupConfigsResponse';
85 if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) {
86 return $self->transport->call({
87 http_method => 'POST',
88 path => '/google.cloud.backupdr.v1beta.BackupDrProtectionSummary/ListResourceBackupConfigs',
89 request => $request,
90 response_class => $response_class,
91 });
92 }
93  
94 my $response = $self->transport->call({
95 service => 'google.cloud.backupdr.v1beta.BackupDrProtectionSummary',
96 method => 'ListResourceBackupConfigs',
97 request => $request,
98 response_class => $response_class,
99 });
100  
101 return $response;
102 }
103 1; # End of Google::Cloud::Backupdr::V1beta::BackupDrProtectionSummaryClient
104  
105 __END__
« V1beta/BackupDRClient.pm ↑ Summary