2019-03-23 16:42:23 +08:00
|
|
|
=begin comment
|
|
|
|
|
|
|
|
|
|
Kubernetes
|
|
|
|
|
|
|
|
|
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
|
|
|
|
2019-05-16 20:24:00 +08:00
|
|
|
The version of the OpenAPI document: v1.13.7
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
Generated by: https://openapi-generator.tech
|
|
|
|
|
|
|
|
|
|
=end comment
|
|
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
|
|
|
# Do not edit the class manually.
|
|
|
|
|
# Ref: https://openapi-generator.tech
|
|
|
|
|
#
|
|
|
|
|
package Kubernetes::Role::AutoDoc;
|
|
|
|
|
use List::MoreUtils qw(uniq);
|
|
|
|
|
|
|
|
|
|
use Moose::Role;
|
|
|
|
|
|
|
|
|
|
sub autodoc {
|
2019-05-16 20:24:00 +08:00
|
|
|
my ($self, $how) = @_;
|
|
|
|
|
|
|
|
|
|
die "Unknown format '$how'" unless $how =~ /^(pod|wide|narrow)$/;
|
|
|
|
|
|
|
|
|
|
$self->_printisa($how);
|
|
|
|
|
$self->_printmethods($how);
|
|
|
|
|
$self->_printattrs($how);
|
|
|
|
|
print "\n";
|
2019-03-23 16:42:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub _printisa {
|
2019-05-16 20:24:00 +08:00
|
|
|
my ($self, $how) = @_;
|
|
|
|
|
my $meta = $self->meta;
|
|
|
|
|
|
|
|
|
|
my $myclass = ref $self;
|
|
|
|
|
|
|
|
|
|
my $super = join ', ', $meta->superclasses;
|
|
|
|
|
my @roles = $meta->calculate_all_roles;
|
|
|
|
|
#shift(@roles) if @roles > 1; # if > 1, the first is a composite, the rest are the roles
|
|
|
|
|
|
|
|
|
|
my $isa = join ', ', grep {$_ ne $myclass} $meta->linearized_isa;
|
|
|
|
|
my $sub = join ', ', $meta->subclasses;
|
|
|
|
|
my $dsub = join ', ', $meta->direct_subclasses;
|
|
|
|
|
|
2019-03-23 16:42:23 +08:00
|
|
|
my $app_name = $self->version_info->{app_name};
|
|
|
|
|
my $app_version = $self->version_info->{app_version};
|
|
|
|
|
my $generated_date = $self->version_info->{generated_date};
|
|
|
|
|
my $generator_class = $self->version_info->{generator_class};
|
|
|
|
|
|
|
|
|
|
$~ = $how eq 'pod' ? 'INHERIT_POD' : 'INHERIT';
|
|
|
|
|
write;
|
2019-05-16 20:24:00 +08:00
|
|
|
|
|
|
|
|
my ($rolepkg, $role_reqs);
|
|
|
|
|
|
|
|
|
|
foreach my $role (@roles) {
|
|
|
|
|
$rolepkg = $role->{package} || next; # some are anonymous, or something
|
|
|
|
|
next if $rolepkg eq 'Kubernetes::Role::AutoDoc';
|
|
|
|
|
$role_reqs = join ', ', keys %{$role->{required_methods}};
|
|
|
|
|
$role_reqs ||= '';
|
|
|
|
|
$~ = $how eq 'pod' ? 'ROLES_POD' : 'ROLES';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($how eq 'pod') {
|
|
|
|
|
$~ = 'ROLES_POD_CLOSE';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-23 16:42:23 +08:00
|
|
|
# ----- format specs -----
|
2019-05-16 20:24:00 +08:00
|
|
|
format INHERIT =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
@* -
|
|
|
|
|
$myclass
|
|
|
|
|
ISA: @*
|
|
|
|
|
$isa
|
|
|
|
|
Direct subclasses: @*
|
|
|
|
|
$dsub
|
|
|
|
|
All subclasses: @*
|
|
|
|
|
$sub
|
|
|
|
|
|
|
|
|
|
Target API: @* @*
|
|
|
|
|
$app_name, $app_version
|
|
|
|
|
Generated on: @*
|
|
|
|
|
$generated_date
|
|
|
|
|
Generator class: @*
|
|
|
|
|
$generator_class
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format ROLES =
|
2019-03-23 16:42:23 +08:00
|
|
|
Composes: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~
|
|
|
|
|
$rolepkg
|
|
|
|
|
requires: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~
|
|
|
|
|
$role_reqs
|
|
|
|
|
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
|
|
|
|
|
$role_reqs
|
|
|
|
|
.
|
|
|
|
|
|
2019-05-16 20:24:00 +08:00
|
|
|
format INHERIT_POD =
|
2019-03-23 16:42:23 +08:00
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
@*
|
|
|
|
|
$myclass
|
|
|
|
|
|
|
|
|
|
=head1 VERSION
|
|
|
|
|
|
|
|
|
|
=head2 @* version: @*
|
|
|
|
|
$app_name, $app_version
|
|
|
|
|
|
|
|
|
|
Automatically generated by the Perl Generator in the OpenAPI Generator project:
|
|
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
|
|
=item Build date: @*
|
|
|
|
|
$generated_date
|
|
|
|
|
|
|
|
|
|
=item Build package: @*
|
|
|
|
|
$generator_class
|
|
|
|
|
|
|
|
|
|
=item Codegen version:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
|
|
=head1 INHERITANCE
|
|
|
|
|
|
|
|
|
|
=head2 Base class(es)
|
|
|
|
|
|
|
|
|
|
@*
|
|
|
|
|
$isa
|
|
|
|
|
|
|
|
|
|
=head2 Direct subclasses
|
|
|
|
|
|
|
|
|
|
@*
|
|
|
|
|
$dsub
|
|
|
|
|
|
|
|
|
|
=head2 All subclasses
|
|
|
|
|
|
|
|
|
|
@*
|
|
|
|
|
$sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=head1 COMPOSITION
|
|
|
|
|
|
|
|
|
|
@* composes the following roles:
|
|
|
|
|
$myclass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format ROLES_POD =
|
2019-03-23 16:42:23 +08:00
|
|
|
=head2 C<@*>
|
|
|
|
|
$rolepkg
|
|
|
|
|
|
|
|
|
|
Requires:
|
|
|
|
|
|
|
|
|
|
@*
|
|
|
|
|
$role_reqs
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format ROLES_POD_CLOSE =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
.
|
|
|
|
|
# ----- / format specs -----
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub _printmethods {
|
2019-05-16 20:24:00 +08:00
|
|
|
my ($self, $how) = @_;
|
|
|
|
|
|
|
|
|
|
if ($how eq 'narrow') {
|
|
|
|
|
print <<HEAD;
|
2019-03-23 16:42:23 +08:00
|
|
|
METHODS
|
|
|
|
|
-------
|
|
|
|
|
HEAD
|
2019-05-16 20:24:00 +08:00
|
|
|
}
|
|
|
|
|
elsif ($how eq 'wide') {
|
|
|
|
|
$~ = 'METHODHEAD';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
elsif ($how eq 'pod') {
|
|
|
|
|
$~ = 'METHODHEAD_POD';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
die "Don't know how to print '$how'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$self->_printmethod($_, $how) for uniq sort $self->meta->get_all_method_names; #$self->meta->get_method_list,
|
|
|
|
|
|
|
|
|
|
if ($how eq 'pod') {
|
|
|
|
|
$~ = 'METHOD_POD_CLOSE';
|
|
|
|
|
write;
|
|
|
|
|
}
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub _printmethod {
|
2019-05-16 20:24:00 +08:00
|
|
|
my ($self, $methodname, $how) = @_;
|
|
|
|
|
return if $methodname =~ /^_/;
|
|
|
|
|
return if $self->meta->has_attribute($methodname);
|
|
|
|
|
my %internal = map {$_ => 1} qw(BUILD BUILDARGS meta can new DEMOLISHALL DESTROY
|
|
|
|
|
DOES isa BUILDALL does VERSION dump
|
|
|
|
|
);
|
|
|
|
|
return if $internal{$methodname};
|
|
|
|
|
my $method = $self->meta->get_method($methodname) or return; # symbols imported into namespaces i.e. not known by Moose
|
|
|
|
|
|
|
|
|
|
return if $method->original_package_name eq __PACKAGE__;
|
|
|
|
|
|
|
|
|
|
my $delegate_to = '';
|
|
|
|
|
my $via = '';
|
|
|
|
|
my $on = '';
|
|
|
|
|
my $doc = '';
|
|
|
|
|
my $original_pkg = $method->original_package_name;
|
|
|
|
|
if ($method->can('associated_attribute')) {
|
|
|
|
|
$delegate_to = $method->delegate_to_method;
|
|
|
|
|
my $aa = $method->associated_attribute;
|
|
|
|
|
$on = $aa->{isa};
|
|
|
|
|
$via = $aa->{name};
|
|
|
|
|
$original_pkg = $on;
|
|
|
|
|
$doc = $original_pkg->method_documentation->{$delegate_to}->{summary};
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$doc = $method->documentation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($how eq 'narrow') {
|
|
|
|
|
$~ = 'METHOD_NARROW';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
elsif ($how eq 'pod' and $delegate_to) {
|
|
|
|
|
$~ = 'METHOD_POD_DELEGATED';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
elsif ($how eq 'pod') {
|
|
|
|
|
$~ = 'METHOD_POD';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$~ = 'METHOD';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-23 16:42:23 +08:00
|
|
|
# ----- format specs -----
|
2019-05-16 20:24:00 +08:00
|
|
|
format METHODHEAD =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
METHODS
|
|
|
|
|
-------
|
|
|
|
|
Name delegates to on via
|
|
|
|
|
===========================================================================================================================================================================
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format METHOD =
|
2019-03-23 16:42:23 +08:00
|
|
|
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... @<<<<<<<<<<<<<<<<...
|
|
|
|
|
$methodname, $delegate_to, $on, $via
|
|
|
|
|
.
|
|
|
|
|
|
2019-05-16 20:24:00 +08:00
|
|
|
format METHOD_NARROW =
|
2019-03-23 16:42:23 +08:00
|
|
|
@*
|
|
|
|
|
$methodname
|
|
|
|
|
original pkg: @*
|
|
|
|
|
$original_pkg
|
|
|
|
|
delegates to: @*
|
|
|
|
|
$delegate_to
|
|
|
|
|
on: @*
|
|
|
|
|
$on
|
|
|
|
|
via: @*
|
|
|
|
|
$via
|
|
|
|
|
|
|
|
|
|
.
|
|
|
|
|
|
2019-05-16 20:24:00 +08:00
|
|
|
format METHODHEAD_POD =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
=head1 METHODS
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
|
|
|
|
|
format METHOD_POD =
|
|
|
|
|
|
2019-03-23 16:42:23 +08:00
|
|
|
=head2 C<@*()>
|
|
|
|
|
$methodname
|
|
|
|
|
|
|
|
|
|
Defined in: @*
|
|
|
|
|
$original_pkg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format METHOD_POD_DELEGATED =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
=head2 C<@*()>
|
|
|
|
|
$methodname
|
|
|
|
|
|
|
|
|
|
Defined in: @*
|
2019-05-16 20:24:00 +08:00
|
|
|
$original_pkg
|
2019-03-23 16:42:23 +08:00
|
|
|
Delegates to: @*()
|
|
|
|
|
$delegate_to
|
|
|
|
|
On: @*
|
|
|
|
|
$on
|
|
|
|
|
Via: @*()
|
|
|
|
|
$via
|
|
|
|
|
Doc: @*
|
|
|
|
|
$doc
|
|
|
|
|
Same as: $self->@*->@*()
|
|
|
|
|
$via, $delegate_to
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format METHOD_POD_CLOSE =
|
|
|
|
|
|
2019-03-23 16:42:23 +08:00
|
|
|
.
|
|
|
|
|
# ----- / format specs -----
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub _printattrs {
|
2019-05-16 20:24:00 +08:00
|
|
|
my ($self, $how) = @_;
|
|
|
|
|
|
|
|
|
|
if ($how eq 'narrow') {
|
|
|
|
|
print <<HEAD;
|
2019-03-23 16:42:23 +08:00
|
|
|
ATTRIBUTES
|
|
|
|
|
----------
|
|
|
|
|
HEAD
|
2019-05-16 20:24:00 +08:00
|
|
|
}
|
|
|
|
|
elsif ($how eq 'wide') {
|
|
|
|
|
$~ = 'ATTRHEAD';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
elsif ($how eq 'pod') {
|
|
|
|
|
$~ = 'ATTRHEAD_POD';
|
|
|
|
|
write;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
die "Don't know how to print attributes '$how'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$self->_printattr($_, $how) for sort $self->meta->get_attribute_list;
|
|
|
|
|
|
|
|
|
|
if ($how eq 'pod') {
|
|
|
|
|
$~ = 'ATTR_POD_CLOSE';
|
|
|
|
|
write;
|
|
|
|
|
}
|
2019-03-23 16:42:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub _printattr {
|
2019-05-16 20:24:00 +08:00
|
|
|
my ($self, $attrname, $how) = @_;
|
|
|
|
|
return if $attrname =~ /^_/;
|
|
|
|
|
my $attr = $self->meta->get_attribute($attrname) or die "No attr for $attrname";
|
|
|
|
|
|
|
|
|
|
my $is;
|
|
|
|
|
$is = 'rw' if $attr->get_read_method && $attr->get_write_method;
|
|
|
|
|
$is = 'ro' if $attr->get_read_method && ! $attr->get_write_method;
|
|
|
|
|
$is = 'wo' if $attr->get_write_method && ! $attr->get_read_method;
|
|
|
|
|
$is = '--' if ! $attr->get_write_method && ! $attr->get_read_method;
|
|
|
|
|
$is or die "No \$is for $attrname";
|
|
|
|
|
|
|
|
|
|
my $tc = $attr->type_constraint || '';
|
|
|
|
|
my $from = $attr->associated_class->name || '';
|
|
|
|
|
my $reqd = $attr->is_required ? 'yes' : 'no';
|
|
|
|
|
my $lazy = $attr->is_lazy ? 'yes' : 'no';
|
|
|
|
|
my $has_doc = $attr->has_documentation ? 'yes' : 'no'; # *_api attributes will never have doc, but other attributes might have
|
|
|
|
|
my $doc = $attr->documentation || '';
|
|
|
|
|
my $handles = join ', ', sort @{$attr->handles || []};
|
|
|
|
|
$handles ||= '';
|
|
|
|
|
|
|
|
|
|
if ($how eq 'narrow') {
|
|
|
|
|
$~ = 'ATTR_NARROW';
|
|
|
|
|
}
|
|
|
|
|
elsif ($how eq 'pod') {
|
|
|
|
|
$~ = 'ATTR_POD';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$~ = 'ATTR';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
write;
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
# ----- format specs -----
|
2019-05-16 20:24:00 +08:00
|
|
|
format ATTRHEAD =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
ATTRIBUTES
|
|
|
|
|
----------
|
|
|
|
|
Name is isa reqd lazy doc handles
|
|
|
|
|
==============================================================================================================
|
2019-05-16 20:24:00 +08:00
|
|
|
.
|
|
|
|
|
format ATTR =
|
2019-03-23 16:42:23 +08:00
|
|
|
@<<<<<<<<<<<<<<<<< @< @<<<<<<<<<<<<<<<<<<<<<<<< @<<< @<<< @<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
|
|
$attrname, $is, $tc, $reqd, $lazy, $has_doc, $handles
|
|
|
|
|
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
|
|
|
|
|
$handles
|
|
|
|
|
.
|
|
|
|
|
|
2019-05-16 20:24:00 +08:00
|
|
|
format ATTR_NARROW =
|
2019-03-23 16:42:23 +08:00
|
|
|
@*
|
|
|
|
|
$attrname
|
|
|
|
|
is: @*
|
|
|
|
|
$is
|
|
|
|
|
isa: @*
|
|
|
|
|
$tc
|
|
|
|
|
reqd: @*
|
|
|
|
|
$reqd
|
|
|
|
|
lazy: @*
|
|
|
|
|
$lazy
|
|
|
|
|
doc: @*
|
|
|
|
|
$doc
|
|
|
|
|
handles: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
|
|
$handles
|
|
|
|
|
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
|
|
|
|
|
$handles
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format ATTRHEAD_POD =
|
2019-03-23 16:42:23 +08:00
|
|
|
=head1 ATTRIBUTES
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format ATTR_POD =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
=head2 C<@*>
|
|
|
|
|
$attrname
|
|
|
|
|
|
|
|
|
|
is: @*
|
|
|
|
|
$is
|
|
|
|
|
isa: @*
|
|
|
|
|
$tc
|
|
|
|
|
reqd: @*
|
|
|
|
|
$reqd
|
|
|
|
|
lazy: @*
|
|
|
|
|
$lazy
|
|
|
|
|
doc: @*
|
|
|
|
|
$doc
|
|
|
|
|
handles: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
|
|
$handles
|
|
|
|
|
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
|
|
|
|
|
$handles
|
|
|
|
|
|
|
|
|
|
.
|
2019-05-16 20:24:00 +08:00
|
|
|
format ATTR_POD_CLOSE =
|
2019-03-23 16:42:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
.
|
|
|
|
|
# ----- / format specs -----
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1;
|