| 1 | package Kubernetes::REST::CLI::Cmd::Raw; | ||
| 2 | our $VERSION = '1.108'; | ||
| 3 | # ABSTRACT: The raw 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 ($group, $method, @rest) = @$args; | ||
| 13 | |||
| 14 | unless ($group && $method) { | ||
| 15 | print STDERR "Usage: kube_client raw <Group> <Method> [key=value ...]\n"; | ||
| 16 | print STDERR "Example: kube_client raw Core ListNamespace\n"; | ||
| 17 | return 1; | ||
| 18 | } | ||
| 19 | |||
| 20 | my %params; | ||
| 21 | for my $arg (@rest) { | ||
| 22 | if ($arg =~ /^([^=]+)=(.*)$/) { | ||
| 23 | $params{$1} = $2; | ||
| 24 | } else { | ||
| 25 | print STDERR "Invalid argument: $arg (expected key=value)\n"; | ||
| 26 | return 1; | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | my $result = $root->api->$group->$method(%params); | ||
| 31 | $root->format_output($result); | ||
| 32 | return 0; | ||
| 33 | } | ||
| 34 | |||
| 35 | |||
| 36 | 1; | ||
| 37 | |||
| 38 | __END__ | ||
| 39 | |||
| 40 | =pod | ||
| 41 | |||
| 42 | =encoding UTF-8 | ||
| 43 | |||
| 44 | =head1 NAME | ||
| 45 | |||
| 46 | Kubernetes::REST::CLI::Cmd::Raw - The raw command of kube_client | ||
| 47 | |||
| 48 | =head1 VERSION | ||
| 49 | |||
| 50 | version 1.108 | ||
| 51 | |||
| 52 | =head1 SYNOPSIS | ||
| 53 | |||
| 54 | kube_client raw <Group> <Method> [key=value ...] | ||
| 55 | kube_client raw Core ListNamespace | ||
| 56 | |||
| 57 | =head1 DESCRIPTION | ||
| 58 | |||
| 59 | Implements the C<raw> command of L<Kubernetes::REST::CLI>, which calls a method | ||
| 60 | on one of the L<Kubernetes::REST::V0Group> compatibility groups directly. | ||
| 61 | C<Group> is one of C<Core>, C<Apps>, C<Batch>, C<Networking>, C<Storage>, | ||
| 62 | C<Policy>, C<Autoscaling>, C<RbacAuthorization>, C<Certificates>, | ||
| 63 | C<Coordination>, C<Events>, C<Scheduling>, C<Authentication>, | ||
| 64 | C<Authorization>, C<Admissionregistration>, C<Apiextensions>, or | ||
| 65 | C<Apiregistration>; C<Method> is a v0-style method name such as | ||
| 66 | C<ListNamespacedPod> or C<ReadNamespacedPod>. Arguments after the method name | ||
| 67 | are passed as C<key=value> pairs. L<MooX::Cmd> finds and loads this class, you | ||
| 68 | do not use it directly. | ||
| 69 | |||
| 70 | =head2 execute | ||
| 71 | |||
| 72 | Runs the command. Called by L<MooX::Cmd> with the remaining arguments and the | ||
| 73 | command chain, whose first element is the L<Kubernetes::REST::CLI> root object. | ||
| 74 | |||
| 75 | =head1 SEE ALSO | ||
| 76 | |||
| 77 | =over | ||
| 78 | |||
| 79 | =item * L<Kubernetes::REST::CLI> - CLI base class | ||
| 80 | |||
| 81 | =item * L<Kubernetes::REST::V0Group> - The group objects this command calls into | ||
| 82 | |||
| 83 | =back | ||
| 84 | |||
| 85 | =head1 SUPPORT | ||
| 86 | |||
| 87 | =head2 Issues | ||
| 88 | |||
| 89 | Please report bugs and feature requests on GitHub at | ||
| 90 | L<https://github.com/pplu/kubernetes-rest/issues>. | ||
| 91 | |||
| 92 | =head2 IRC | ||
| 93 | |||
| 94 | Join C<#kubernetes> on C<irc.perl.org> or message Getty directly. | ||
| 95 | |||
| 96 | =head1 CONTRIBUTING | ||
| 97 | |||
| 98 | Contributions are welcome! Please fork the repository and submit a pull request. | ||
| 99 | |||
| 100 | =head1 AUTHORS | ||
| 101 | |||
| 102 | =over 4 | ||
| 103 | |||
| 104 | =item * | ||
| 105 | |||
| 106 | Torsten Raudssus <getty@cpan.org> | ||
| 107 | |||
| 108 | =item * | ||
| 109 | |||
| 110 | Jose Luis Martinez Torres <jlmartin@cpan.org> | ||
| 111 | |||
| 112 | =back | ||
| 113 | |||
| 114 | =head1 COPYRIGHT AND LICENSE | ||
| 115 | |||
| 116 | This software is Copyright (c) 2019-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>. | ||
| 117 | |||
| 118 | This is free software, licensed under: | ||
| 119 | |||
| 120 | The Apache License, Version 2.0, January 2004 | ||
| 121 | |||
| 122 | =cut |