V1.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 52 CC 3 SCAR 12.8
CC
3
Cov
0%
BUILD
6.0
call_rpc
6.0
BEGIN
2.0
CRAP 3.6
1 # Copyright (C) 2026 Google LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14  
15 package Google::Cloud::Compute::V1;
16  
17 use strict;
18 use warnings;
19 use Moo;
20 use Google::gRPC::Client;
21 use Google::Auth;
22 use Carp qw(croak);
23  
24 our $VERSION = '0.03';
25  
26 has credentials => ( is => 'ro', required => 0 );
27 has transport => ( is => 'rw' );
28  
29 sub BUILD {
30 my ($self) = @_;
31  
32 my $auth = $self->credentials;
33 if (!$auth || !eval { $auth->can('get_token') }) {
34 $auth = Google::Auth->default();
35 }
36 my $token = $auth->get_token();
37  
38 my $client = Google::gRPC::Client->new(
39 target => 'compute.googleapis.com:443',
40 auth_token => $token,
41 );
42 $self->transport($client);
43 }
44  
45 sub call_rpc {
46 my ($self, $method, $request_msg, $response_class) = @_;
47 croak 'transport not initialized' unless $self->transport;
48 return $self->transport->call_unary($method, $request_msg, $response_class);
49 }
50  
51 1;
52  
53 __END__