Documentation ¶
Overview ¶
nolint: nakedret
nolint: goconst
nolint: lll
Index ¶
- Variables
- func APIVersionComment(gvk schema.GroupVersionKind) string
- func GVKFromRef(ref string) schema.GroupVersionKind
- func PulumiComment(kind string) string
- func PulumiSchema(swagger map[string]any, opts ...schemaGeneratorOption) pschema.PackageSpec
- func WithAllowHyphens(allow bool) schemaGeneratorOption
- func WithParameterization(parameterization *pschema.ParameterizationSpec) schemaGeneratorOption
- func WithPulumiKubernetesDependency(version string) schemaGeneratorOption
- func WithResourceOverlays(resourceOverlays map[string]pschema.ResourceSpec) schemaGeneratorOption
- func WithTypeOverlays(typeOverlays map[string]pschema.ComplexTypeSpec) schemaGeneratorOption
- type CaseMapping
- type GVK
- type GoTemplateResources
- type GroupConfig
- type GroupVersion
- type KindConfig
- func (kc KindConfig) Aliases() []string
- func (kc KindConfig) Comment() string
- func (kc KindConfig) DeprecationComment() string
- func (kc KindConfig) IsNested() bool
- func (kc KindConfig) Kind() string
- func (kc KindConfig) OptionalInputProperties() []Property
- func (kc KindConfig) Properties() []Property
- func (kc KindConfig) PulumiComment() string
- func (kc KindConfig) RequiredInputProperties() []Property
- type Property
- type TemplateProperty
- type TemplateResource
- type TemplateResources
- type VersionConfig
Constants ¶
This section is empty.
Variables ¶
var ( TypeOverlays = map[string]pschema.ComplexTypeSpec{} ResourceOverlays = map[string]pschema.ResourceSpec{} )
var PascalCaseMapping = CaseMapping{ // contains filtered or unexported fields }
PascalCaseMapping is a mapping of lower cased resources to their PascalCase equivalents.
Functions ¶
func APIVersionComment ¶
func APIVersionComment(gvk schema.GroupVersionKind) string
func GVKFromRef ¶
func GVKFromRef(ref string) schema.GroupVersionKind
func PulumiComment ¶
PulumiComment adds additional information to the docs generated automatically from the OpenAPI specs. This includes information about Pulumi's await behavior, deprecation information, etc.
func PulumiSchema ¶
func PulumiSchema(swagger map[string]any, opts ...schemaGeneratorOption) pschema.PackageSpec
PulumiSchema will generate a Pulumi schema for the given k8s schema.
func WithAllowHyphens ¶
func WithAllowHyphens(allow bool) schemaGeneratorOption
func WithParameterization ¶
func WithParameterization(parameterization *pschema.ParameterizationSpec) schemaGeneratorOption
func WithPulumiKubernetesDependency ¶
func WithPulumiKubernetesDependency(version string) schemaGeneratorOption
func WithResourceOverlays ¶
func WithResourceOverlays(resourceOverlays map[string]pschema.ResourceSpec) schemaGeneratorOption
func WithTypeOverlays ¶
func WithTypeOverlays(typeOverlays map[string]pschema.ComplexTypeSpec) schemaGeneratorOption
Types ¶
type CaseMapping ¶
type CaseMapping struct {
// contains filtered or unexported fields
}
CaseMapping is a mapping of names to their PascalCase equivalents. This is a a data structure that only allows adding new mappings, and will error if a mapping already exists.
func (*CaseMapping) Add ¶
func (c *CaseMapping) Add(name, pascal string) error
func (*CaseMapping) Get ¶
func (c *CaseMapping) Get(name string) string
type GVK ¶
type GVK struct { GroupVersions []GroupVersion Kinds []string PatchKinds []string ListKinds []string }
GVK holds sorted lists of GroupVersions and Kinds.
type GoTemplateResources ¶
type GoTemplateResources struct {
TemplateResources
}
GoTemplateResources are TemplateResources specific to the Go SDK.
func (GoTemplateResources) Imports ¶
func (tr GoTemplateResources) Imports() []string
Imports returns a sorted list of all resource imports. This is currently used for the YAML SDK overlay.
type GroupConfig ¶
type GroupConfig struct {
// contains filtered or unexported fields
}
GroupConfig represents a Kubernetes API group (e.g., core, apps, extensions, etc.)
func (GroupConfig) Group ¶
func (gc GroupConfig) Group() string
Group returns the name of the group (e.g., `core` for core, etc.)
func (GroupConfig) Versions ¶
func (gc GroupConfig) Versions() []VersionConfig
Versions returns the set of version for some Kubernetes API group. For example, the `apps` group has `v1beta1`, `v1beta2`, and `v1`.
type GroupVersion ¶
type GroupVersion string
GroupVersion is the GroupVersion for a k8s resource.
func (GroupVersion) GVConstName ¶
func (gv GroupVersion) GVConstName() string
GVConstName converts a GroupVersion to a name suitable for a const variable. This is used by codegen internal to the k8s provider. Example: apps/v1beta1 -> AppsV1B1
type KindConfig ¶
type KindConfig struct {
// contains filtered or unexported fields
}
KindConfig represents a Kubernetes API kind (e.g., the `Deployment` type in `apps/v1beta1/Deployment`).
func (KindConfig) Aliases ¶
func (kc KindConfig) Aliases() []string
Aliases returns the list of aliases for a Kubernetes API kind.
func (KindConfig) Comment ¶
func (kc KindConfig) Comment() string
Comment returns the comments associated with some Kubernetes API kind.
func (KindConfig) DeprecationComment ¶
func (kc KindConfig) DeprecationComment() string
DeprecationComment returns the deprecation comment for deprecated APIs, otherwise an empty string.
func (KindConfig) IsNested ¶
func (kc KindConfig) IsNested() bool
IsNested returns true if this is a nested kind.
func (KindConfig) Kind ¶
func (kc KindConfig) Kind() string
Kind returns the name of the Kubernetes API kind (e.g., `Deployment` for `apps/v1beta1/Deployment`).
func (KindConfig) OptionalInputProperties ¶
func (kc KindConfig) OptionalInputProperties() []Property
OptionalInputProperties returns the list of properties that are optional input properties on some Kubernetes API kind (i.e., things that we will want to provide, like `thing.metadata`, etc.).
func (KindConfig) Properties ¶
func (kc KindConfig) Properties() []Property
Properties returns the list of properties that exist on some Kubernetes API kind (i.e., things that we will want to `.` into, like `thing.apiVersion`, `thing.kind`, `thing.metadata`, etc.).
func (KindConfig) PulumiComment ¶
func (kc KindConfig) PulumiComment() string
PulumiComment returns the await logic documentation associated with some Kubernetes API kind.
func (KindConfig) RequiredInputProperties ¶
func (kc KindConfig) RequiredInputProperties() []Property
RequiredInputProperties returns the list of properties that are required input properties on some Kubernetes API kind (i.e., things that we will want to provide, like `thing.metadata`, etc.).
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
Property represents a property we want to expose on a Kubernetes API kind (i.e., things that we will want to `.` into, like `thing.apiVersion`, `thing.kind`, `thing.metadata`, etc.).
func (Property) ConstValue ¶
DefaultValue returns the constant value of the property.
func (Property) DefaultValue ¶
DefaultValue returns the default value of the property.
func (Property) SchemaType ¶
SchemaType returns the type of the property for the schema.
type TemplateProperty ¶
type TemplateProperty struct { ConstValue string // If set, the constant value of the property (e.g., "flowcontrol.apiserver.k8s.io/v1alpha1") Name string // The name of the property (e.g., "FlowSchemaSpec") Package string // The package path containing the property definition (e.g., "outputs.flowcontrol.v1alpha1") }
TemplateProperty holds information about a resource property that can be used to generate SDK overlays.
func (TemplateProperty) Type ¶
func (tp TemplateProperty) Type() string
Type returns the property type. This could be either a constant value or the type definition.
type TemplateResource ¶
type TemplateResource struct { Alias string // The optional alias to use for package imports (e.g., "flowcontrolv1alpha1") Name string // The name of the resource (e.g., "FlowSchema") Package string // The name of the package containing the resource definition (e.g., "flowcontrol.v1alpha1") Properties []TemplateProperty // Properties of the resource Token string // The schema token for the resource (e.g., "kubernetes:flowcontrol.apiserver.k8s.io/v1alpha1:FlowSchema") }
TemplateResource holds information about a resource that can be used to generate SDK overlays.
func (TemplateResource) GVK ¶
func (tr TemplateResource) GVK() string
GVK returns the GroupVersionKind string for the k8s resource in the form "group/version/kind". The "core" group is rewritten to "", so resources in that Group look like "v1/Pod" rather than "core/v1/Pod".
func (TemplateResource) IsListKind ¶
func (tr TemplateResource) IsListKind() bool
IsListKind returns true if the resource name has the suffix "List".
type TemplateResources ¶
type TemplateResources struct { Resources []TemplateResource Packages []string }
TemplateResources holds a list of TemplateResource structs than can be filtered for codegen purposes.
func (TemplateResources) ListKinds ¶
func (tr TemplateResources) ListKinds() []TemplateResource
ListKinds returns a sorted list of resources that are a List kind.
func (TemplateResources) NonListKinds ¶
func (tr TemplateResources) NonListKinds() []TemplateResource
ListKinds returns a sorted list of resources that are not a List kind.
type VersionConfig ¶
type VersionConfig struct {
// contains filtered or unexported fields
}
VersionConfig represents a version of a Kubernetes API group (e.g., the `apps` group has `v1beta1`, `v1beta2`, and `v1`.)
func (VersionConfig) APIVersion ¶
func (vc VersionConfig) APIVersion() string
APIVersion returns the fully-qualified apiVersion (e.g., `storage.k8s.io/v1` for storage, etc.)
func (VersionConfig) DefaultAPIVersion ¶
func (vc VersionConfig) DefaultAPIVersion() string
DefaultAPIVersion returns the default apiVersion (e.g., `v1` rather than `core/v1`).
func (VersionConfig) Kinds ¶
func (vc VersionConfig) Kinds() []KindConfig
Kinds returns the set of kinds in some Kubernetes API group/version combination (e.g., `apps/v1beta1` has the `Deployment` kind, etc.).
func (VersionConfig) Version ¶
func (vc VersionConfig) Version() string
Version returns the name of the version (e.g., `apps/v1beta1` would return `v1beta1`).