codegen

package
v0.0.1-alpha1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type AdditionalResources

type AdditionalResources struct {
	Services   []Service   `yaml:"services",json:"services"`
	ConfigMaps []ConfigMap `yaml:"configMaps",json:"configMaps"`
	Secrets    []Secret    `yaml:"secrets",json:"secrets"`
}

AdditionalResources defines what is created after the fact

func (AdditionalResources) ConfigMapCount

func (a AdditionalResources) ConfigMapCount() int

ConfigMapCount is the amount of configmaps

func (AdditionalResources) SecretCount

func (a AdditionalResources) SecretCount() int

SecretCount is the amount of secrets

func (AdditionalResources) ServiceCount

func (a AdditionalResources) ServiceCount() int

ServiceCount is the amount of services

type Codegen

type Codegen struct {
	ModelPath string
	RootPath  string
}

Codegen hold the base contructs

func New

func New(modelPath string, rootPath string) *Codegen

New will create a new Codegen pointer with a config

func (*Codegen) Run

func (c *Codegen) Run() error

Run will run the loop over the model files

type ConfigMap

type ConfigMap struct {
	Name string          `yaml:"name",json:"name"`
	Data []ConfigMapData `yaml:"data",json:"data"`
}

ConfigMap defines what you can mutate in a configmap object

type ConfigMapData

type ConfigMapData struct {
	Key   string `yaml:"key",json:"key"`
	Value string `yaml:"value",json:"value"`
}

ConfigMapData defines what the data is in a CM.

type Customizations

type Customizations struct {
	Package string `yaml:"package",json:"package"`
	Add     string `yaml:"add",json:"add"`
	Update  string `yaml:"update",json:"update"`
	Delete  string `yaml:"delete",json:"delete"`
}

Customizations returns the able customizations

type ModelFile

type ModelFile struct {
	APIVersion string        `yaml:"apiVersion",json:"apiVersion"`
	Kind       string        `yaml:"kind",json:"kind"`
	Metadata   ModelMetadata `yaml:"metadata",json:"metadata"`
	Spec       ModelSpec     `yaml:"spec",json:"spec"`
}

ModelFile parses the model files for each service

type ModelFiles

type ModelFiles struct {
	APIVersion string      `yaml:"apiVersion",json:"apiVersion"`
	Kind       string      `yaml:"kind",json:"kind"`
	Items      []ModelFile `yaml:"items",json:"items"`
}

ModelFiles returns all model files in a list format

type ModelMetadata

type ModelMetadata struct {
	Name string `yaml:"name",json:"name"`
}

ModelMetadata stores any specific metadata about the model

type ModelSpec

type ModelSpec struct {
	Kind                string              `yaml:"kind",json:"kind"`
	Type                string              `yaml:"type",json:"type"`
	Queue               bool                `yaml:"queue",json:"queue"`
	UseCloudFormation   bool                `yaml:"useCloudFormation",json:"useCloudFormation"`
	Resource            SpecResource        `yaml:"resource",json:"resource"`
	Body                ResourceBody        `yaml:"body",json:"body"`
	Output              ResourceOutput      `yaml:"output",json:"output"`
	AdditionalResources AdditionalResources `yaml:"additionalResources",json:"additionalResources"`
	Customizations      Customizations      `yaml:"customizations",json:"customizations"`
	IsCustomized        bool
}

ModelSpec defines the core of how the resource is structured

func (ModelSpec) PluralName

func (s ModelSpec) PluralName() string

PluralName returns the plural version of the name

func (ModelSpec) TypeJSON

func (s ModelSpec) TypeJSON() string

TypeJSON returns the full JSON response

type Port

type Port struct {
	Port     string `yaml:"port",json:"port"`
	Protocol string `yaml:"protocol",json:"protcol"`
}

Port defines the ServicePorts

type ResourceBody

type ResourceBody struct {
	Schema SpecSchema `yaml:"schema",json:"schema"`
}

ResourceBody defines the body of the object

type ResourceOutput

type ResourceOutput struct {
	Schema SpecSchema `yaml:"schema",json:"schema"`
}

ResourceOutput defines the body of the object

type SchemaProperty

type SchemaProperty struct {
	Key         string           `yaml:"key",json:"key"`
	Type        string           `yaml:"type",json:"type"`
	Description string           `yaml:"description",json:"description"`
	StructKey   string           `yaml:"structKey",json:"structKey"`
	TemplateKey string           `yaml:"templateKey",json:"templateKey"`
	Templatized bool             `yaml:"templatized",json:"templatized"`
	Template    string           `yaml:"template",json:"template"`
	Properties  []SchemaProperty `yaml:"properties",json:"properties"`
}

SchemaProperty is the definition for the full properties

func (SchemaProperty) TypeOfObject

func (s SchemaProperty) TypeOfObject(kind string) string

TypeOfObject returns the Type of Object it is

type Secret

type Secret struct {
}

Secret defines what you can mutate in a secret object

type Service

type Service struct {
	Name         string `yaml:"name",json:"name"`
	Type         string `yaml:"type",json:"type"`
	ExternalName string `yaml:"externalName",json:"externalName"`
	Ports        []Port `yaml:"ports",json:"ports"`
}

Service defines what you can mutate in a service object

func (Service) NameToLowerCamel

func (s Service) NameToLowerCamel() string

NameToLowerCamel will lowercase the name for variables in golang

type Shortname

type Shortname struct {
	Name string `yaml:"name",json"name"`
}

Shortname defines the shortnames the crd will listen to

type SpecResource

type SpecResource struct {
	Name       string      `yaml:"name",json:"name"`
	Plural     string      `yaml:"plural",json:"plural"`
	Shortnames []Shortname `yaml:"shortNames",json:"shortNames"`
}

SpecResource defines how the CRD is populated

type SpecSchema

type SpecSchema struct {
	Type       string           `yaml:"type",json:"type"`
	Properties []SchemaProperty `yaml:"properties",json:"properties"`
	KeyMapping map[string][]SchemaProperty
}

SpecSchema defines how the object is defined in types.go and the CFT

Jump to

Keyboard shortcuts

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