| 1 | package Net::Kubernetes::Resource::Pod; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Object representatioon of a Kubernetes Pod | ||||||||||||||||||||||||||||
| 3 | 4 | $Net::Kubernetes::Resource::Pod::VERSION = '0.19'; | |||||||||||||||||||||||||||
| 4 | 4 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 4 | extends 'Net::Kubernetes::Resource'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | with 'Net::Kubernetes::Resource::Role::State'; | |||||||||||||||||||||||||||
| 9 | 4 | with 'Net::Kubernetes::Resource::Role::Spec'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub logs { | ||||||||||||||||||||||||||||
| 13 | 3 | ▶ | my($self, %options) = @_; | ||||||||||||||||||||||||||
|
Subroutine
logs: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 3 | ▶ | if (scalar(@{ $self->spec->{containers} }) > 1 && ! exists($options{container})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
scalar @{$self->spec->{"containers"};} > 1 and not exists $options{"container"}
MC/DC50%1/2
scalar @{$self->spec->{"containers"};} > 1 and not exists $options{"container"}
scalar @{$self->spec->{"containers"};} > 1
not exists $options{"container"}
Truth table66%2/3
A and not(B)
A= scalar @{$self->spec->{"containers"};} > 1B= not exists $options{"container"}
| |||||||||||||||||||||||||||||
| 15 | 1 | Net::Kunbernetes::Exception::ClientException->throw(code=>499, message=>'Must provide container to get logs from a multi-container pod'); | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | my $uri = URI->new($self->path.'/log'); | |||||||||||||||||||||||||||
| 19 | 2 | $uri->query_form(\%options); | |||||||||||||||||||||||||||
| 20 | 2 | my $res = $self->ua->request($self->create_request(GET => $uri)); | |||||||||||||||||||||||||||
| 21 | 2 | ▶ | if ($res->is_success) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 2 | return $res->content; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 4 | return 42; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | __END__ | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =pod | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 NAME | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | Net::Kubernetes::Resource::Pod - Object representatioon of a Kubernetes Pod | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 VERSION | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | version 0.19 | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 METHODS | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head2 logs([container=>'foo']) | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | This method will return the logs from STDERR on for containers in a pod. If the pod has more than one container, | ||||||||||||||||||||||||||||
| 47 | the container argument become manditory, however for single container pods it may be ommited. | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | Dave Mueller <dave@perljedi.com> | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | This software is Copyright (c) 2015 by Dave Mueller. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | The MIT (X11) License | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | Please see those modules/websites for more information related to this module. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =over 4 | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =item * | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | L<Net::Kubernetes|Net::Kubernetes> | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =back | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head1 CONSUMES | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =over 4 | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =item * L<Net::Kubernetes::Resource::Role::Spec> | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =item * L<Net::Kubernetes::Resource::Role::State> | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =back | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =cut | ||||||||||||||||||||||||||||