| 1 | package Net::Kubernetes::Resource::Role::State; | ||||||||||
| 2 | # ABSTRACT: Resource role for types that have a status | ||||||||||
| 3 | 4 | $Net::Kubernetes::Resource::Role::State::VERSION = '0.19'; | |||||||||
| 4 | 4 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | has status => ( | |||||||||
| 7 | is => 'rw', | ||||||||||
| 8 | isa => 'HashRef', | ||||||||||
| 9 | required => 1 | ||||||||||
| 10 | ); | ||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | sub refresh { | ||||||||||
| 14 | 4 | ▶ | my($self) = @_; | ||||||||
|
Subroutine
refresh: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 15 | 4 | my($res) = $self->ua->request($self->create_request(GET => $self->path)); | |||||||||
| 16 | 4 | ▶ | if ($res->is_success) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 4 | my($data) = $self->json->decode($res->content); | |||||||||
| 18 | 4 | $self->status($data->{status}); | |||||||||
| 19 | 4 | return 1; | |||||||||
| 20 | } | ||||||||||
| 21 | 0 | return 0; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 4 | return 42; | |||||||||
| 25 | |||||||||||
| 26 | __END__ | ||||||||||
| 27 | |||||||||||
| 28 | =pod | ||||||||||
| 29 | |||||||||||
| 30 | =encoding UTF-8 | ||||||||||
| 31 | |||||||||||
| 32 | =head1 NAME | ||||||||||
| 33 | |||||||||||
| 34 | Net::Kubernetes::Resource::Role::State - Resource role for types that have a status | ||||||||||
| 35 | |||||||||||
| 36 | =head1 VERSION | ||||||||||
| 37 | |||||||||||
| 38 | version 0.19 | ||||||||||
| 39 | |||||||||||
| 40 | =head1 METHODS | ||||||||||
| 41 | |||||||||||
| 42 | =head2 refresh | ||||||||||
| 43 | |||||||||||
| 44 | Retrieve current state information from kubernetes. | ||||||||||
| 45 | |||||||||||
| 46 | =head1 AUTHOR | ||||||||||
| 47 | |||||||||||
| 48 | Dave Mueller <dave@perljedi.com> | ||||||||||
| 49 | |||||||||||
| 50 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 51 | |||||||||||
| 52 | This software is Copyright (c) 2015 by Dave Mueller. | ||||||||||
| 53 | |||||||||||
| 54 | This is free software, licensed under: | ||||||||||
| 55 | |||||||||||
| 56 | The MIT (X11) License | ||||||||||
| 57 | |||||||||||
| 58 | =head1 SEE ALSO | ||||||||||
| 59 | |||||||||||
| 60 | Please see those modules/websites for more information related to this module. | ||||||||||
| 61 | |||||||||||
| 62 | =over 4 | ||||||||||
| 63 | |||||||||||
| 64 | =item * | ||||||||||
| 65 | |||||||||||
| 66 | L<Net::Kubernetes|Net::Kubernetes> | ||||||||||
| 67 | |||||||||||
| 68 | =back | ||||||||||
| 69 | |||||||||||
| 70 | =cut | ||||||||||