generator

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResourceOpsFiles

func AddResourceOpsFiles(jobName string, job jobtype, opsFiles map[string][]Ops)

func AddResourceVars

func AddResourceVars(jobName string, job jobtype, vars map[string]interface{})

func CollectionPropertyVars added in v0.0.14

func CollectionPropertyVars(propertyName string, subProperties []PropertyMetadata, vars map[string]interface{})

func CreateErrandConfig

func CreateErrandConfig(metadata *Metadata) map[string]Errand

func CreateErrandVars

func CreateErrandVars(metadata *Metadata) map[string]interface{}

func CreateNetworkOpsFiles

func CreateNetworkOpsFiles(metadata *Metadata) (map[string][]Ops, error)

func CreateOpsFileName added in v0.0.14

func CreateOpsFileName(propertyKey string) string

func CreateProductProperties

func CreateProductProperties(metadata *Metadata) (map[string]PropertyValue, error)

func CreateProductPropertiesFeaturesOpsFiles

func CreateProductPropertiesFeaturesOpsFiles(metadata *Metadata) (map[string][]Ops, error)

func CreateProductPropertiesOptionalOpsFiles

func CreateProductPropertiesOptionalOpsFiles(metadata *Metadata) (map[string][]Ops, error)

func CreateProductPropertiesVars

func CreateProductPropertiesVars(metadata *Metadata) (map[string]interface{}, error)

func CreateResourceConfig

func CreateResourceConfig(metadata *Metadata) map[string]Resource

func CreateResourceOpsFiles

func CreateResourceOpsFiles(metadata *Metadata) (map[string][]Ops, error)

func CreateResourceVars

func CreateResourceVars(metadata *Metadata) map[string]interface{}

func DefaultsArrayToCollectionArray added in v0.0.14

func DefaultsArrayToCollectionArray(propertyName string, defaultValue interface{}, subProperties []PropertyMetadata) ([]map[string]SimpleType, error)

func DefaultsToArray added in v0.0.14

func DefaultsToArray(propertyName string, subProperties []PropertyMetadata) map[string]SimpleType

func IsDefaultAnArray added in v0.0.14

func IsDefaultAnArray(defaultValue interface{}) bool

Types

type CertificateValue

type CertificateValue struct {
	CertPem        string `yaml:"cert_pem"`
	CertPrivateKey string `yaml:"private_key_pem"`
}

func NewCertificateValue added in v0.0.14

func NewCertificateValue(propertyName string) *CertificateValue

func (*CertificateValue) IsSelector

func (s *CertificateValue) IsSelector() bool

func (*CertificateValue) Parameters

func (s *CertificateValue) Parameters() []string

type CertificateValueHolder

type CertificateValueHolder struct {
	Value *CertificateValue `yaml:"value"`
}

func (*CertificateValueHolder) IsSelector

func (s *CertificateValueHolder) IsSelector() bool

func (*CertificateValueHolder) Parameters

func (s *CertificateValueHolder) Parameters() []string

type CollectionsPropertiesValueHolder

type CollectionsPropertiesValueHolder struct {
	Value []map[string]SimpleType `yaml:"value"`
}

func (*CollectionsPropertiesValueHolder) IsSelector

func (s *CollectionsPropertiesValueHolder) IsSelector() bool

func (*CollectionsPropertiesValueHolder) Parameters

func (s *CollectionsPropertiesValueHolder) Parameters() []string

type Displayer

type Displayer struct {
	// contains filtered or unexported fields
}

func NewDisplayer

func NewDisplayer(metadataBytes []byte, writer io.Writer) *Displayer

func (*Displayer) Display

func (d *Displayer) Display() error

type Errand

type Errand struct {
	PostDeployState string `yaml:"post-deploy-state,omitempty"`
	PreDeleteState  string `yaml:"pre-delete-state,omitempty"`
}

type ErrandMetadata

type ErrandMetadata struct {
	Name string `yaml:"name"`
}

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(metadataBytes []byte, baseDirectory string, doNotIncludeProductVersion, includeErrands bool) *Executor

func (*Executor) CreateTemplate

func (e *Executor) CreateTemplate(metadata *Metadata) (*Template, error)

func (*Executor) Generate

func (e *Executor) Generate() error

type FormType

type FormType struct {
	Description string     `yaml:"description"`
	Label       string     `yaml:"label"`
	Name        string     `yaml:"name"`
	Properties  []Property `yaml:"property_inputs"`
}

type InstanceDefinition

type InstanceDefinition struct {
	Configurable bool `yaml:"configurable"`
	Default      int  `yaml:"default"`
}

type InstanceType

type InstanceType struct {
	ID interface{} `yaml:"id"`
}

type JobType

type JobType struct {
	Name                string               `yaml:"name"`
	PropertyMetadata    []PropertyMetadata   `yaml:"property_blueprints"`
	ResourceDefinitions []ResourceDefinition `yaml:"resource_definitions"`
	InstanceDefinition  InstanceDefinition   `yaml:"instance_definition"`
}

func (*JobType) GetPropertyMetadata

func (j *JobType) GetPropertyMetadata(propertyName string) (*PropertyMetadata, error)

func (*JobType) HasPersistentDisk

func (j *JobType) HasPersistentDisk() bool

func (*JobType) InstanceDefinitionConfigurable

func (j *JobType) InstanceDefinitionConfigurable() bool

func (*JobType) IsIncluded

func (j *JobType) IsIncluded() bool

type Metadata

type Metadata struct {
	Name              string             `yaml:"name"`
	Version           string             `yaml:"product_version"`
	FormTypes         []FormType         `yaml:"form_types"`
	PropertyMetadata  []PropertyMetadata `yaml:"property_blueprints"`
	JobTypes          []JobType          `yaml:"job_types"`
	ProvidesVersions  []ProvidesVersion  `yaml:"provides_product_versions"`
	PostDeployErrands []ErrandMetadata   `yaml:"post_deploy_errands"`
	PreDeleteErrands  []ErrandMetadata   `yaml:"pre_delete_errands"`
}

func NewMetadata

func NewMetadata(fileBytes []byte) (*Metadata, error)

func (*Metadata) Errands

func (m *Metadata) Errands() []ErrandMetadata

func (*Metadata) GetJob

func (m *Metadata) GetJob(jobName string) (*JobType, error)

func (*Metadata) GetPropertyMetadata

func (m *Metadata) GetPropertyMetadata(propertyName string) (*PropertyMetadata, error)

func (*Metadata) ProductName added in v0.0.5

func (m *Metadata) ProductName() string

func (*Metadata) ProductVersion added in v0.0.5

func (m *Metadata) ProductVersion() string

func (*Metadata) Properties

func (m *Metadata) Properties() []Property

func (*Metadata) UsesServiceNetwork

func (m *Metadata) UsesServiceNetwork() bool

type MultiSelectorValue added in v0.0.11

type MultiSelectorValue struct {
	Value []string `yaml:"value"`
}

func (*MultiSelectorValue) IsSelector added in v0.0.11

func (s *MultiSelectorValue) IsSelector() bool

func (*MultiSelectorValue) Parameters added in v0.0.11

func (s *MultiSelectorValue) Parameters() []string

type Name

type Name struct {
	Name string `yaml:"name"`
}

type NetworkProperties

type NetworkProperties struct {
	Network                   *Name  `yaml:"network,omitempty"`
	ServiceNetwork            *Name  `yaml:"service_network,omitempty"`
	OtherAvailabilityZones    []Name `yaml:"other_availability_zones"`
	SingletonAvailabilityZone *Name  `yaml:"singleton_availability_zone"`
}

func CreateNetworkProperties

func CreateNetworkProperties(metadata metadata) *NetworkProperties

type Ops

type Ops struct {
	Type  string       `yaml:"type"`
	Path  string       `yaml:"path"`
	Value OpsValueType `yaml:"value,omitempty"`
}

type OpsNameValue

type OpsNameValue struct {
	Value string `yaml:"name"`
}

func (*OpsNameValue) Parameters

func (n *OpsNameValue) Parameters() []string

type OpsValue

type OpsValue struct {
	Value string `yaml:"value"`
}

func (*OpsValue) Parameters

func (n *OpsValue) Parameters() []string

type OpsValueType

type OpsValueType interface {
	Parameters() []string
}

func CollectionOpsFile added in v0.0.14

func CollectionOpsFile(numOfElements int, propertyName string, subProperties []PropertyMetadata) OpsValueType

type Option

type Option struct {
	Label string      `json:"label"`
	Name  interface{} `json:"name"`
}

type OptionTemplate

type OptionTemplate struct {
	Name             string             `yaml:"name"`
	SelectValue      string             `yaml:"select_value"`
	PropertyMetadata []PropertyMetadata `yaml:"property_blueprints"`
}

type PersistentDisk

type PersistentDisk struct {
	Size interface{} `yaml:"size_mb"`
}

type Property

type Property struct {
	Description string             `yaml:"description"`
	Label       string             `yaml:"label"`
	Placeholder string             `yaml:"placeholder"`
	Reference   string             `yaml:"reference"`
	Selectors   []SelectorProperty `yaml:"selector_property_inputs"`
}

type PropertyMetadata

type PropertyMetadata struct {
	Configurable     string             `yaml:"configurable"`
	Default          interface{}        `yaml:"default"`
	Optional         bool               `yaml:"optional"`
	Name             string             `yaml:"name"`
	Type             string             `yaml:"type"`
	Options          []Option           `yaml:"options"`
	OptionTemplates  []OptionTemplate   `yaml:"option_templates"`
	PropertyMetadata []PropertyMetadata `yaml:"property_blueprints"`
}

func SelectorMetadata added in v0.0.14

func SelectorMetadata(optionTemplates []OptionTemplate, selector string) ([]PropertyMetadata, error)

func SelectorMetadataBySelectValue added in v0.0.14

func SelectorMetadataBySelectValue(optionTemplates []OptionTemplate, selector string) ([]PropertyMetadata, error)

SelectorMetadataBySelectValue - uses the option template SelectValue properties of each OptionTemplate to perform the property medata selection

func (*PropertyMetadata) DataType

func (p *PropertyMetadata) DataType() string

func (*PropertyMetadata) DefaultSelector

func (p *PropertyMetadata) DefaultSelector() string

func (*PropertyMetadata) DefaultSelectorPath

func (p *PropertyMetadata) DefaultSelectorPath(property string) string

func (*PropertyMetadata) GetPropertyMetadata added in v0.0.15

func (p *PropertyMetadata) GetPropertyMetadata(propertyName string) *PropertyMetadata

func (*PropertyMetadata) IsAZList

func (p *PropertyMetadata) IsAZList() bool

func (*PropertyMetadata) IsBool

func (p *PropertyMetadata) IsBool() bool

func (*PropertyMetadata) IsCertificate

func (p *PropertyMetadata) IsCertificate() bool

func (*PropertyMetadata) IsCollection

func (p *PropertyMetadata) IsCollection() bool

func (*PropertyMetadata) IsConfigurable added in v0.0.13

func (p *PropertyMetadata) IsConfigurable() bool

func (*PropertyMetadata) IsDropdown

func (p *PropertyMetadata) IsDropdown() bool

func (*PropertyMetadata) IsExplicityConfigurable added in v0.0.13

func (p *PropertyMetadata) IsExplicityConfigurable() bool

func (*PropertyMetadata) IsInt

func (p *PropertyMetadata) IsInt() bool

func (*PropertyMetadata) IsMultiSelect

func (p *PropertyMetadata) IsMultiSelect() bool

func (*PropertyMetadata) IsRequired

func (p *PropertyMetadata) IsRequired() bool

func (*PropertyMetadata) IsRequiredCollection

func (p *PropertyMetadata) IsRequiredCollection() bool

func (*PropertyMetadata) IsSecret

func (p *PropertyMetadata) IsSecret() bool

func (*PropertyMetadata) IsSelector

func (p *PropertyMetadata) IsSelector() bool

func (*PropertyMetadata) IsSimpleCredentials

func (p *PropertyMetadata) IsSimpleCredentials() bool

func (*PropertyMetadata) IsString

func (p *PropertyMetadata) IsString() bool

func (*PropertyMetadata) IsUUID added in v0.0.15

func (p *PropertyMetadata) IsUUID() bool

func (*PropertyMetadata) OptionTemplate

func (p *PropertyMetadata) OptionTemplate(selectorReference string) (*OptionTemplate, error)

func (*PropertyMetadata) PropertyType

func (p *PropertyMetadata) PropertyType(propertyName string) PropertyValue

type PropertyValue

type PropertyValue interface {
	Parameters() []string
	IsSelector() bool
}

func CollectionPropertyType added in v0.0.14

func CollectionPropertyType(propertyName string, defaultValue interface{}, subProperties []PropertyMetadata) (PropertyValue, error)

type ProvidesVersion

type ProvidesVersion struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

type Resource

type Resource struct {
	InstanceType   InstanceType    `yaml:"instance_type,omitempty"`
	Instances      interface{}     `yaml:"instances,omitempty"`
	PersistentDisk *PersistentDisk `yaml:"persistent_disk,omitempty"`
}

func CreateResource

func CreateResource(jobName string, job jobtype) Resource

type ResourceDefinition

type ResourceDefinition struct {
	Configurable bool        `yaml:"configurable"`
	Default      interface{} `yaml:"default"`
	Name         string      `yaml:"name"`
	Type         string      `yaml:"type"`
}

type SecretValue

type SecretValue struct {
	Value string `yaml:"secret"`
}

func (*SecretValue) IsSelector

func (s *SecretValue) IsSelector() bool

func (*SecretValue) Parameters

func (s *SecretValue) Parameters() []string

type SecretValueHolder

type SecretValueHolder struct {
	Value *SecretValue `yaml:"value"`
}

func (*SecretValueHolder) IsSelector

func (s *SecretValueHolder) IsSelector() bool

func (*SecretValueHolder) Parameters

func (s *SecretValueHolder) Parameters() []string

type SelectorProperty

type SelectorProperty struct {
	Label      string     `yaml:"label"`
	Reference  string     `yaml:"reference"`
	Properties []Property `yaml:"property_inputs"`
}

type SelectorValue

type SelectorValue struct {
	Value string `yaml:"value"`
}

func (*SelectorValue) IsSelector

func (s *SelectorValue) IsSelector() bool

func (*SelectorValue) Parameters

func (s *SelectorValue) Parameters() []string

type SimpleBoolean added in v0.0.9

type SimpleBoolean bool

func (SimpleBoolean) IsSelector added in v0.0.9

func (s SimpleBoolean) IsSelector() bool

func (SimpleBoolean) Parameters added in v0.0.9

func (s SimpleBoolean) Parameters() []string

type SimpleCredentialValue

type SimpleCredentialValue struct {
	Identity string `yaml:"identity"`
	Password string `yaml:"password"`
}

type SimpleCredentialValueHolder

type SimpleCredentialValueHolder struct {
	Value *SimpleCredentialValue `yaml:"value"`
}

func (*SimpleCredentialValueHolder) IsSelector

func (s *SimpleCredentialValueHolder) IsSelector() bool

func (*SimpleCredentialValueHolder) Parameters

func (s *SimpleCredentialValueHolder) Parameters() []string

type SimpleFloat added in v0.0.16

type SimpleFloat float64

func (SimpleFloat) IsSelector added in v0.0.16

func (s SimpleFloat) IsSelector() bool

func (SimpleFloat) Parameters added in v0.0.16

func (s SimpleFloat) Parameters() []string

type SimpleInteger added in v0.0.9

type SimpleInteger int

func (SimpleInteger) IsSelector added in v0.0.9

func (s SimpleInteger) IsSelector() bool

func (SimpleInteger) Parameters added in v0.0.9

func (s SimpleInteger) Parameters() []string

type SimpleString

type SimpleString string

func (SimpleString) IsSelector

func (s SimpleString) IsSelector() bool

func (SimpleString) Parameters

func (s SimpleString) Parameters() []string

type SimpleType

type SimpleType interface {
	Parameters() []string
	IsSelector() bool
}

type SimpleValue

type SimpleValue struct {
	Value string `yaml:"value"`
}

func (*SimpleValue) IsSelector

func (s *SimpleValue) IsSelector() bool

func (*SimpleValue) Parameters

func (s *SimpleValue) Parameters() []string

type StringOpsValue

type StringOpsValue string

func (StringOpsValue) Parameters

func (n StringOpsValue) Parameters() []string

type Template

type Template struct {
	ProductName       string                   `yaml:"product-name"`
	NetworkProperties *NetworkProperties       `yaml:"network-properties"`
	ProductProperties map[string]PropertyValue `yaml:"product-properties"`
	ResourceConfig    map[string]Resource      `yaml:"resource-config,omitempty"`
	ErrandConfig      map[string]Errand        `yaml:"errand-config,omitempty"`
}

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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