lib/Kubernetes/REST/CLI/Role/Connection.pm

filter: Statementstmt 85.0% 17 / 20 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 75.7% 25 / 33 CC 5 SCAR 11.3
CC
5
Cov
75%
__ANON__
4.1
_build_api
4.1
BEGIN
1.0
CRAP 3.1
« lib/Kubernetes/REST/CLI/Cmd/Create.pm ↑ Summary lib/Kubernetes/REST/AuthTokenFile.pm »
1 package Kubernetes::REST::CLI::Role::Connection;
2 1 our $VERSION = '1.110';
3 # ABSTRACT: Shared kubeconfig/auth options for CLI tools
4 5 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use MooX::Options;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use Kubernetes::REST::Kubeconfig;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 # Deliberately without a default: an option that always has a value is always
10 # passed on, and Kubernetes::REST::Kubeconfig never reaches its own default of
11 # $ENV{KUBECONFIG} // ~/.kube/config. Leaving it undef when the user did not ask
12 # for a path is what lets the environment variable through.
13 1 option kubeconfig => (
14 is => 'ro',
15 format => 's',
16 doc => 'Path to kubeconfig file (default: $KUBECONFIG, else ~/.kube/config)',
17 );
18  
19  
20 1 option context => (
21 is => 'ro',
22 format => 's',
23 short => 'c',
24 doc => 'Kubernetes context to use',
25 );
26  
27  
28 has api => (
29 is => 'lazy',
30 0 ▶ builder => sub {
Subroutine __ANON__: not called CC=3 SCAR=14.2
Subroutine _build_api: called CC=3 SCAR=14.2
31 0 my $self = shift;
32 # kubeconfig_path is only passed when --kubeconfig was given, so an
33 # unset option falls through to Kubeconfig's own $ENV{KUBECONFIG}
34 # default rather than being overridden by a home-directory guess.
35 0 ▶ my $kc = Kubernetes::REST::Kubeconfig->new(
Branch: 4 branches
BranchTrueFalseTotal
defined $self->kubeconfig ? : 0 0 0
$self->context ? : 0 0 0
defined $self->kubeconfig ? : 6 4 10
$self->context ? : 1 9 10
36 (defined $self->kubeconfig ? (kubeconfig_path => $self->kubeconfig) : ()),
37 ($self->context ? (context_name => $self->context) : ()),
38 );
39 0 return $kc->api;
40 },
41 1 );
42  
43  
44 1 1;
45  
46 __END__
« lib/Kubernetes/REST/CLI/Cmd/Create.pm ↑ Summary lib/Kubernetes/REST/AuthTokenFile.pm »