NAME
IO::K8s::AutoGen - Dynamically generate IO::K8s classes from OpenAPI schema
VERSION
version 1.000
SYNOPSIS
use IO::K8s::AutoGen;
# Generate a class from OpenAPI schema
my $class = IO::K8s::AutoGen::get_or_generate(
'helm.cattle.io.v1.HelmChart',
$schema_definition,
$all_definitions,
'IO::K8s::_AUTOGEN_abc123', # namespace
);
# The class is now available and works like any IO::K8s class
my $obj = $class->new(metadata => $meta, spec => $spec);
my $json = $obj->TO_JSON;
DESCRIPTION
This module dynamically generates Moo classes for Kubernetes custom resources that don't have pre-generated IO::K8s classes.
Generated classes use IO::K8s::Resource as their base, so they have:
The
k8sDSL for attribute definitionsTO_JSON/to_jsonserialization_k8s_attr_infofor inflate supportAll standard IO::K8s behavior
Generated classes are placed in a unique namespace per IO::K8s instance to avoid collisions:
IO::K8s::_AUTOGEN_abc123::helm::cattle::io::v1::HelmChart
NAME
IO::K8s::AutoGen - Dynamically generate IO::K8s classes from OpenAPI schema
FUNCTIONS
get_or_generate($def_name, $schema, $all_defs, $namespace)
Generate (or return cached) class for the given OpenAPI definition.
def_to_class($def_name, $namespace)
Convert OpenAPI definition name to Perl class name.
class_to_def($class)
Convert Perl class name back to OpenAPI definition name.
is_autogen($class)
Returns true if the class was auto-generated.
clear_cache()
Clear the generated class cache.
generated_classes()
List all generated class names.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/pplu/io-k8s-p5/issues.
IRC
Join #kubernetes on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHORS
Torsten Raudssus <torsten@raudssus.de>
Jose Luis Martinez <jlmartinez@capside.com> (original author, inactive)
COPYRIGHT AND LICENSE
This software is Copyright (c) 2018 by CAPSiDE.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004