| 1 | package Kubernetes::REST::HTTPRequest; | ||||||||||
| 2 | 91 | our $VERSION = '1.110'; | |||||||||
| 3 | # ABSTRACT: HTTP request object | ||||||||||
| 4 | 91 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 91 | ▶ | use Types::Standard qw/Str HashRef/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 91 | has server => (is => 'ro'); | |||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 91 | has credentials => (is => 'ro'); | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | sub authenticate { | ||||||||
|
Subroutine
authenticate: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 15 | 2 | my $self = shift; | |||||||||
| 16 | 2 | my $auth = $self->credentials; | |||||||||
| 17 | 2 | ▶ | if (defined $auth) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | $self->headers->{ Authorization } = 'Bearer ' . $auth->token; | |||||||||
| 19 | } | ||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | 91 | has uri => (is => 'rw', isa => Str); | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 91 | has method => (is => 'rw', isa => Str); | |||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | 1 | ▶ | has url => (is => 'rw', isa => Str, lazy => 1, default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=8.1
| |||||||||||
| 30 | 1 | my $self = shift; | |||||||||
| 31 | 1 | ▶ | return $self->server->endpoint . $self->uri if $self->server; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | return ''; | |||||||||
| 33 | 91 | }); | |||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | has headers => (is => 'rw', isa => HashRef, default => sub { {} }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | 91 | has parameters => (is => 'rw', isa => HashRef); | |||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | 91 | has content => (is => 'rw', isa => Str); | |||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 91 | 1; | |||||||||
| 46 | |||||||||||
| 47 | __END__ | ||||||||||