resource

package
v2.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDNS1123Subdomain

func IsDNS1123Subdomain(value string) []string

IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).

Types

type Options

type Options struct {
	// Group is the API Group. Does not contain the domain.
	Group string

	// Version is the API version.
	Version string

	// Kind is the API Kind.
	Kind string

	// Plural is the API Kind plural form.
	// Optional
	Plural string

	// Namespaced is true if the resource is namespaced.
	Namespaced bool

	// CreateExampleReconcileBody will create a Deployment in the Reconcile example.
	// v1 only
	CreateExampleReconcileBody bool
}

Options contains the information required to build a new Resource

func (*Options) GVK

func (opts *Options) GVK() config.GVK

GVK returns the group-version-kind information to check against tracked resources in the configuration file

func (*Options) NewResource

func (opts *Options) NewResource(c *config.Config, doResource bool) *Resource

NewResource creates a new resource from the options

func (*Options) NewV1Resource

func (opts *Options) NewV1Resource(c *config.Config, doResource bool) *Resource

NewV1Resource creates a new resource from the options specific to v1

func (*Options) Validate

func (opts *Options) Validate() error

Validate verifies that all the fields have valid values

type Resource

type Resource struct {
	// Group is the API Group. Does not contain the domain.
	Group string `json:"group,omitempty"`

	// GroupPackageName is the API Group cleaned to be used as the package name.
	GroupPackageName string `json:"-"`

	// Version is the API version.
	Version string `json:"version,omitempty"`

	// Kind is the API Kind.
	Kind string `json:"kind,omitempty"`

	// Plural is the API Kind plural form.
	Plural string `json:"plural,omitempty"`

	// ImportAlias is a cleaned concatenation of Group and Version.
	ImportAlias string `json:"-"`

	// Package is the go package of the Resource.
	Package string `json:"package,omitempty"`

	// Domain is the Group + "." + Domain of the Resource.
	Domain string `json:"domain,omitempty"`

	// Namespaced is true if the resource is namespaced.
	Namespaced bool `json:"namespaced,omitempty"`

	// CreateExampleReconcileBody will create a Deployment in the Reconcile example.
	// v1 only
	CreateExampleReconcileBody bool `json:"-"`
}

Resource contains the information required to scaffold files for a resource.

func (*Resource) GVK

func (r *Resource) GVK() config.GVK

GVK returns the group-version-kind information to check against tracked resources in the configuration file

func (Resource) Replacer

func (r Resource) Replacer() *strings.Replacer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL