| 1 | package Kubernetes::REST::CLI::Cmd::Get; | ||
| 2 | our $VERSION = '1.108'; | ||
| 3 | # ABSTRACT: The get command of kube_client | ||
| 4 | use Moo; | ||
| 5 | use MooX::Cmd; | ||
| 6 | |||
| 7 | |||
| 8 | sub execute { | ||
| 9 | my ($self, $args, $chain) = @_; | ||
| 10 | my $root = $chain->[0]; | ||
| 11 | |||
| 12 | my ($kind, $name) = @$args; | ||
| 13 | |||
| 14 | unless ($kind) { | ||
| 15 | print STDERR "Usage: kube_client get <Kind> [name]\n"; | ||
| 16 | return 1; | ||
| 17 | } | ||
| 18 | |||
| 19 | my $result; | ||
| 20 | if ($name) { | ||
| 21 | $result = $root->api->get($kind, $name, namespace => $root->namespace); | ||
| 22 | } else { | ||
| 23 | $result = $root->api->list($kind, namespace => $root->namespace); | ||
| 24 | } | ||
| 25 | |||
| 26 | $root->format_output($result); | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | |||
| 31 | 1; | ||
| 32 | |||
| 33 | __END__ | ||
| 34 | |||
| 35 | =pod | ||
| 36 | |||
| 37 | =encoding UTF-8 | ||
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Kubernetes::REST::CLI::Cmd::Get - The get command of kube_client | ||
| 42 | |||
| 43 | =head1 VERSION | ||
| 44 | |||
| 45 | version 1.108 | ||
| 46 | |||
| 47 | =head1 SYNOPSIS | ||
| 48 | |||
| 49 | kube_client get <Kind> [name] [options] | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | Implements the C<get> command of L<Kubernetes::REST::CLI>. Without a name it | ||
| 54 | lists the resources of that kind in the namespace, with a name it fetches that | ||
| 55 | one resource. L<MooX::Cmd> finds and loads this class, you do not use it | ||
| 56 | directly. | ||
| 57 | |||
| 58 | =head2 execute | ||
| 59 | |||
| 60 | Runs the command. Called by L<MooX::Cmd> with the remaining arguments and the | ||
| 61 | command chain, whose first element is the L<Kubernetes::REST::CLI> root object. | ||
| 62 | |||
| 63 | =head1 SEE ALSO | ||
| 64 | |||
| 65 | =over | ||
| 66 | |||
| 67 | =item * L<Kubernetes::REST::CLI> - CLI base class | ||
| 68 | |||
| 69 | =back | ||
| 70 | |||
| 71 | =head1 SUPPORT | ||
| 72 | |||
| 73 | =head2 Issues | ||
| 74 | |||
| 75 | Please report bugs and feature requests on GitHub at | ||
| 76 | L<https://github.com/pplu/kubernetes-rest/issues>. | ||
| 77 | |||
| 78 | =head2 IRC | ||
| 79 | |||
| 80 | Join C<#kubernetes> on C<irc.perl.org> or message Getty directly. | ||
| 81 | |||
| 82 | =head1 CONTRIBUTING | ||
| 83 | |||
| 84 | Contributions are welcome! Please fork the repository and submit a pull request. | ||
| 85 | |||
| 86 | =head1 AUTHORS | ||
| 87 | |||
| 88 | =over 4 | ||
| 89 | |||
| 90 | =item * | ||
| 91 | |||
| 92 | Torsten Raudssus <getty@cpan.org> | ||
| 93 | |||
| 94 | =item * | ||
| 95 | |||
| 96 | Jose Luis Martinez Torres <jlmartin@cpan.org> | ||
| 97 | |||
| 98 | =back | ||
| 99 | |||
| 100 | =head1 COPYRIGHT AND LICENSE | ||
| 101 | |||
| 102 | This software is Copyright (c) 2019-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>. | ||
| 103 | |||
| 104 | This is free software, licensed under: | ||
| 105 | |||
| 106 | The Apache License, Version 2.0, January 2004 | ||
| 107 | |||
| 108 | =cut |