cmd

package
v0.0.0-...-68db864 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package cmd module from cobra

cmd Corbra CLI

Package cmd from cobra

Package cmd module from cobra

Package cmd module from cobra

Package cmd module from cobra

Package cmd from gobra

types and methods for blueprint definitions file

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

cmd

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

Package cmd from cobra

cmd

cmd template functions

Package cmd from cobra

Index

Constants

View Source
const (
	// FileBlock a block generated from a file
	// containing a Go template
	FileBlock = "FileBlock"

	// CoreBlock a block that integrates core libraries
	CoreBlock = "CoreBlock"

	// CompositeBlock a block that integrates core libraries
	CompositeBlock = "CompositeBlock"

	// WebFileBlock a block generated from a file
	// containing a Go template using the HTML safe
	// typing processor
	HTMLFileBlock = "WebFileBlock"

	// DockerBlock generates a dockerfile
	DockerfileBlock = "DockerfileBlock"

	// DockerComposeBlock generates a docker-compose block
	DockerComposeBlock = "DockerComposeBlock"

	// EndpointsBlock generates HTTP endpoint routers and handlers
	EndpointsBlock = "EndpointsBlock"

	// FunctionBlock call a function that generates
	// non template based blocks
	FunctionBlock = "FunctionBlock"

	// KustomizeBlock creates a kustomize configuration
	// or fragments
	KustomizeBlock = "KustomizeBlock"

	// TemplateBlock creates a tpl fragments
	TemplateBlock = "TemplateBlock"

	// SkaffoldBlock creates a skaffold configuration
	// or fragments
	SkaffoldBlock = "SkaffoldBlock"
)
View Source
const (
	Mime_Type = iota
	Avro
	Protobuf
	YAML
	WASM
)

Types of data representations

View Source
const (
	TcBadBlueprintDirectory = "Unable to create blueprint directory, Got (%v)\n"
	TcNoCacheFile           = "Cache file not found (%v)\n"
	TcBadCacheFile          = "Bad cache file (%v)\n"
)

errmsg constants for bpCacheError

View Source
const (

	// PREFIX is the prefix to be replaced in front of the file name
	PREFIX = "template"
	// ORGANIZATION is the prefix to be replaced in front of the file name
	ORGANIZATION = "organization"

	// Name to add to sonarcloud projects to create unique namespace
	SONARPREFIX = "PavedRoad_"

	HOOK = "Hook"
)

BLUEPRINT needs documentation.

View Source
const (
	INVALIDCOLUMNTYPE = iota
	INVALIDCONTENT
	INVALIDTABLENAME
	NOPARENT
	NOMAPPEDNAME
	INVALIDTABLETYPE
	INVALIDCOLUMNNAME
	INVALIDCONSTRAINT
	INVALIDMODIFIER
	INVALIDARRAY
	INVALIDSERVICENAME
	UNKOWN
)

Define constants for error types iota starts at 0, next constant is iota + 1

View Source
const (
	ErrorGeneric int = iota
	ErrorNotFound
)

Constants for error numbers

View Source
const (
	DefaultFileMode      os.FileMode = 0660
	DefaultDirectoryMode os.FileMode = 0755
	DefaultExecutable    os.FileMode = 0750
)
View Source
const (
	TPLOutputFile = iota
	TPLOutputByteSlice
)
View Source
const (
	GoImports string = "goimports"
)
View Source
const (
	Snippets int = iota
)

Variables

View Source
var Build string

Build

View Source
var ErrList []tblDefError //Prior comment for exported format.

ErrList is a list of table definition error messages. Processing is done on all errors instead of exiting for every error.

View Source
var GitTag string

GitTag

View Source
var SQLToJSONBlock = Block{
	APIVersion: "v1beta",
	Kind:       "FunctionBlock",
	ID:         "http://io.pavedroad/test/sql/jsonGenerator",
	Family:     "pavedroad/test/data/generation",
	Metadata: Metadata{
		Labels: []string{
			"pavedroad",
			"test",
			"sql",
			"table",
			"generator",
			"outputJSON",
		},
		Tags: []string{
			"pavedroad",
			"test",
			"sql",
			"table",
			"generator",
			"outputJSON",
		},
		Information: BlockInformation{
			Description: "Generate test data based on an SQL table structure",
			Title:       "Generate test data based on an SQL table structure",
			Contact: Contact{
				Author:       "John Scharber",
				Organization: "PavedRoad",
				Email:        "support@pavedroad.io",
				Website:      "www.pavedroad.io",
				Support:      "pavedroad-io.slack.com",
			},
		},
	},
	UsageRights: UsageRights{
		TermsOfService: "As is",
		Licenses:       "Apache 2",
		AccessToken:    "",
	},
	Language:      "go",
	HomeDirectory: "dev",
	Environment:   "dev",
	FunctionMappings: []FunctionItem{
		{
			Function:           createPostData,
			OutputFileName:     "post.json",
			OutputType:         "OutputFile",
			ExecutePermissions: false,
			Description:        "JSON content for a new POST",
		},
		{
			Function:           createPutData,
			OutputFileName:     "put.json",
			OutputType:         "OutputFile",
			ExecutePermissions: false,
			Description:        "JSON content for a PUT updated",
		},
	},
}

SQLToJSONBlock produce test data for a SQL table

View Source
var StaticDefinitionFileVersion = "v0.9.0"
View Source
var Version string

Version

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewBlueprintCache

func NewBlueprintCache() (*bpCache, bpCacheError)

NewBlueprintCache read the blueprint directory and it's meta-data

func RandomBool

func RandomBool() bool

RandomBool return random boolen

func RandomFloat

func RandomFloat() float64

RandomFloat returns a random float

func RandomInteger

func RandomInteger(min, max int) int

RandomInteger return random int no larger than max

func RandomString

func RandomString(length int) string

RandomString returns a human readable string of length X TODO: Move these to a core lib

func RandomUUID

func RandomUUID() uuid.UUID

RandomUUID generate a new UUID

Types

type Badge

type Badge struct {
	Enable bool   `yaml:"enable"`
	Link   string `yaml:"link"`
	Name   string `yaml:"name"`
}

Badge are links with graphics to be included in doc/service.html file. These go to CI test results

type Block

type Block struct {

	// APIVersion version of this block
	// Added to the path for URL and file system
	// access to blocks
	// i.e. templatedir/v1/block
	// TODO: implement this
	APIVersion string `yaml:"apiVersion"`

	// Kind a type that determines how this block
	// is processed
	// - template
	// - function
	// - fileTemplate a template that also creates thefile
	Kind string `yaml:"kind"` // i.e. template, function

	// Metadata for this block
	Metadata Metadata `yaml:"metadata"`

	// Inverted namespace ID unique to these templates
	// For example, io.pavedroad.core.loggers.http_access
	ID string `yaml:"id"`

	// Family friendly name for this grouping of templates
	// or functions, for example, gorilla/mux
	Family string `yaml:"family"`

	// UsageRights for using the block
	UsageRights UsageRights `yaml:"usageRights"`

	// Imports required modules for these templates
	// Required package imports
	Imports []string `yaml:"imports"`

	// ImportedBlocks additional blocks imported by this block
	ImportedBlocks []Block `yaml:"importedBlocks"`

	// Language the computer programming language
	Language string `yaml:"language"`

	// BaseDirectory in blueprints repository
	BaseDirectory string `yaml:"baseDirectory"`

	// HomeDirectory to place a fileTemplate in
	HomeDirectory string `yaml:"homeDirectory"`

	// HomeFileName to create
	HomeFilename string `yaml:"homeFilename"`

	// Environment this template applies to
	Environment string `yaml:"environment"`

	// TemplateMap a simple map
	TemplateMap []TemplateItem `yaml:"templateMap"`

	// HTTPMappings templates mapped by HTTP methods
	HTTPMappings []HTTPMethodTemplateMap `yaml:"httpMappings"`

	// EventMappings templates mapped by events
	EventMappings []EventMethodTemplateMap `yaml:"eventMappings"`

	// FunctionMap functions that generate code, data, etc
	FunctionMappings []FunctionItem `yaml:"functionMappings"`

	// TemplateExports variables for templates and the
	// data source that provides them
	TemplateExports []ExportedItem `yaml:"templateExports"`
}

Block defines a family of templates and the directory location Then a list HTTP methods or Kafka events that trigger generating the code using the specified templates

var GorillaMethodBlocks Block = Block{
	APIVersion: "v1beta",
	Kind:       "EndpointsBlocks",
	ID:         "io.pavedroad.http.methods.gorilla",
	Family:     "gorilla/mux",
	Metadata: Metadata{
		Labels: []string{"gorilla", "methods", "http"},
		Tags:   []string{"http", "methods"},
		Information: BlockInformation{
			Description: "Gorilla method generator",
			Title:       "Gorilla method generator",
			Contact: Contact{
				Author:       "John Scharber",
				Organization: "PavedRoad",
				Email:        "support@pavedroad.io",
				Website:      "www.pavedroad.io",
				Support:      "pavedroad-io.slack.com",
			},
		},
	},
	Language: "go",
	Imports: []string{
		`"github.com/gorilla/mux"`,
		`"github.com/gorilla/handlers"`,
		`_ "github.com/lib/pq"`},
	UsageRights: UsageRights{
		TermsOfService: "As is",
		Licenses:       "Apache 2",
		AccessToken:    "",
	},
	BaseDirectory: "/blocks/go/gorilla/",
	HTTPMappings: []HTTPMethodTemplateMap{
		{
			HTTPMethods: []string{"GET", "HEAD", "DELETE", "PATCH", "PUT"},
			Template: TemplateItem{
				FileName:         "keyed_method.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		}, {
			HTTPMethods: []string{"LIST"},
			Template: TemplateItem{
				FileName:         "list_method.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		}, {
			HTTPMethods: []string{"OPTIONS", "TRACE"},
			Template: TemplateItem{
				FileName:         "keyed_method.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		}, {
			HTTPMethods: []string{"POST"},
			Template: TemplateItem{
				FileName:         "post_method.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		},
	},
	TemplateExports: []ExportedItem{
		{
			TemplateVar:         "{{.Method}}",
			SourceInDefinitions: "defs.Project.Endpoints.Methods",
		},
		{
			TemplateVar:         "{{.EndPointName}}",
			SourceInDefinitions: "defs.Project.Endpoitns.Name",
		},
		{
			TemplateVar:         "{{.Namespace}}",
			SourceInDefinitions: "defs.Project.Kubernetes.Namespace",
		},
		{
			TemplateVar:         "{{.APIVersion}}",
			SourceInDefinitions: "defs.Project.APIVersion",
		},
		{
			TemplateVar:         "{{.ToCamel}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToLower}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToUpper}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToSnake}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
	},
}

GorillaMethodBlocks

var GorillaMethodHookBlocks Block = Block{
	APIVersion: "v1beta",
	Kind:       "EndpointsBlocks",
	ID:         "io.pavedroad.http.methods.gorilla",
	Family:     "gorilla/mux",
	Metadata: Metadata{
		Labels: []string{"gorilla", "methods", "hooks", "http"},
		Tags:   []string{"http", "methods", "hooks"},
		Information: BlockInformation{
			Description: "Gorilla method pre-post processing hooks generator",
			Title:       "Gorilla method pre-post processing hooks generator",
			Contact: Contact{
				Author:       "John Scharber",
				Organization: "PavedRoad",
				Email:        "support@pavedroad.io",
				Website:      "www.pavedroad.io",
				Support:      "pavedroad-io.slack.com",
			},
		},
	},
	Language: "go",
	Imports:  []string{},
	UsageRights: UsageRights{
		TermsOfService: "As is",
		Licenses:       "Apache 2",
		AccessToken:    "",
	},
	BaseDirectory: "/blocks/go/gorilla/",
	HTTPMappings: []HTTPMethodTemplateMap{
		{
			HTTPMethods: []string{"GET", "HEAD", "DELETE", "PUT", "PATCH", "OPTIONS"},
			Template: TemplateItem{
				FileName:         "method-keyed-hooks.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		},
		{
			HTTPMethods: []string{"POST", "TRACE", "CONNECT"},
			Template: TemplateItem{
				FileName:         "method-hooks.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		},
		{
			HTTPMethods: []string{"LIST"},
			Template: TemplateItem{
				FileName:         "method-list-hooks.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		},
	},
	TemplateExports: []ExportedItem{
		{
			TemplateVar:         "{{.Method}}",
			SourceInDefinitions: "defs.Project.Endpoints.Methods",
		},
		{
			TemplateVar:         "{{.EndPointName}}",
			SourceInDefinitions: "defs.Project.Endpoitns.Name",
		},
		{
			TemplateVar:         "{{.Namespace}}",
			SourceInDefinitions: "defs.Project.Kubernetes.Namespace",
		},
		{
			TemplateVar:         "{{.NameExported}}",
			SourceInDefinitions: "defs.Info.Name",
		},
		{
			TemplateVar:         "{{.APIVersion}}",
			SourceInDefinitions: "defs.Project.APIVersion",
		},
		{
			TemplateVar:         "{{.ToCamel}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToLower}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToUpper}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToSnake}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
	},
}

GorillaMethodHookBlocks

var GorillaRouteBlocks Block = Block{
	APIVersion: "v1beta",
	Kind:       "EndpointsBlock",
	ID:         "io.pavedroad.http.routers.gorilla",
	Family:     "gorilla/mux",
	Metadata: Metadata{
		Labels: []string{"gorilla", "router", "http"},
		Tags:   []string{"http", "request router"},
		Information: BlockInformation{
			Description: "Gorilla route generator",
			Title:       "Gorilla route generator",
			Contact: Contact{
				Author:       "John Scharber",
				Organization: "PavedRoad",
				Email:        "support@pavedroad.io",
				Website:      "www.pavedroad.io",
				Support:      "pavedroad-io.slack.com",
			},
		},
	},
	UsageRights: UsageRights{
		TermsOfService: "As is",
		Licenses:       "Apache 2",
		AccessToken:    "",
	},
	Language: "go",
	Imports: []string{
		`"github.com/gorilla/mux"`,
		`"github.com/gorilla/handlers"`,
		`_ "github.com/lib/pq"`},
	BaseDirectory: "/blocks/go/gorilla/",
	HTTPMappings: []HTTPMethodTemplateMap{
		{
			HTTPMethods: []string{"GET", "HEAD", "DELETE", "PATCH", "PUT"},
			Template: TemplateItem{
				FileName:         "keyed_route.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		}, {
			HTTPMethods: []string{"LIST"},
			Template: TemplateItem{
				FileName:         "list_route.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		}, {
			HTTPMethods: []string{"POST", "TRACE"},
			Template: TemplateItem{
				FileName:         "non_keyed_route.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		}, {
			HTTPMethods: []string{"OPTIONS"},
			Template: TemplateItem{
				FileName:         "options_route.tpl",
				TemplateFunction: stringFunctionMap(),
				TemplatePtr:      nil},
		},
	},
	TemplateExports: []ExportedItem{
		{
			TemplateVar:         "{{.Method}}",
			SourceInDefinitions: "defs.Project.Endpoints.Methods",
		},
		{
			TemplateVar:         "{{.EndPointName}}",
			SourceInDefinitions: "defs.Project.Endpoitns.Name",
		},
		{
			TemplateVar:         "{{.Namespace}}",
			SourceInDefinitions: "defs.Project.Kubernetes.Namespace",
		},
		{
			TemplateVar:         "{{.APIVersion}}",
			SourceInDefinitions: "defs.Project.APIVersion",
		},
		{
			TemplateVar:         "{{.ToCamel}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToLower}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToUpper}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
		{
			TemplateVar:         "{{.ToSnake}}",
			SourceInDefinitions: "stringFunctionMap()",
		},
	},
}

GorillaRouteBlocks

var PRApplicationLogger Block = Block{
	APIVersion: "v1beta",
	Kind:       "CompositeBlock",
	ID:         "io.pavedroad.core.loggers.application",
	Family:     "pavedroad/core/logger",
	Metadata: Metadata{
		Labels: []string{
			"pavedroad",
			"logger",
			"http access",
			"W3C"},
		Tags: []string{
			"W3C",
			"protobuf",
			"text",
			"JSON",
			"HTTP access logger"},
		Information: BlockInformation{
			Description: "Application debug log",
			Title:       "Application debug log",
			Contact: Contact{
				Author:       "John Scharber",
				Organization: "PavedRoad",
				Email:        "support@pavedroad.io",
				Website:      "www.pavedroad.io",
				Support:      "pavedroad-io.slack.com",
			},
		},
	},
	UsageRights: UsageRights{
		TermsOfService: "As is",
		Licenses:       "Apache 2",
		AccessToken:    "",
	},
	Language: "go",
	Imports:  []string{`log "github.com/pavedroad-io/go-core/logger"`},
	ImportedBlocks: []Block{
		{
			ID: "io.pavedroad.core.manifests.kubernetes.kustomize",
			Metadata: Metadata{
				Labels: []string{
					"kubernetes",
					"kafka",
					"zookepper",
					"kustomize",
					"envconfiguration",
					"dev",
				},
			},
		},
		{
			ID: "io.pavedroad.core.manifests.docker.docker-compoase",
			Metadata: Metadata{
				Labels: []string{
					"docker",
					"docker-compose",
					"kafka",
					"zookepper",
					"envconfiguration",
					"dev",
				},
			},
		},
	},
}

PRApplicationLogger

func (*Block) GenerateBlock

func (b *Block) GenerateBlock(def bpDef) (output string, err error)

GenerateBlock

type BlockInformation

type BlockInformation struct {
	// Description a paragraph or  two about this block
	Description string `yaml:"description"`

	// Title a single line description
	Title string `yaml:"title"`

	// Contact information for suport
	Contact Contact `yaml:"contact"`
}

type BlockKind

type BlockKind struct {
	BlockType  string
	APIVersion string
}

type BlockResource

type BlockResource struct {
	// APIVersion for this object
	ApiVersion string

	// Kind/data representation
	Kind string

	// UUID unique ID for an object
	UUID uuid.UUID

	// LifeCycleEvents
	LifeCycleEvents []Event

	// Policies RBAC / ABAC including authentication
	Policies []string

	// Schema JSON or other object specific representation
	//   if the object is not self defining
	Schema string

	// SignatureType SHA, MD5, etc
	SignatureType string

	// Signature for anti-tampering
	Signature string

	// Mutable
	Mutable bool

	// Payload return payload for a resource
	Payload PayloadLoader

	// Events manage an event queue
	Events EventInteface
}

BlockResource

type Community

type Community struct {
	CommunityFiles []struct {
		Name string `yaml:"name"`
		Path string `yaml:"path"`
		Src  string `yaml:"src"`
		Md5  string `yaml:"md5,omitempty"`
	} `yaml:"community-files"`
	Description string `yaml:"description"`
}

Community files to be included

For example, CONTRIBUTING.md

type Config

type Config struct {
	HTTPHost string `yaml:"http-host"`
	HTTPPort string `yaml:"http-port"`
}

type ConfigurationFile

type ConfigurationFile struct {
	ArtifactsDir string `yaml:"artifacts-dir"`
	Name         string `yaml:"name"`
	Path         string `yaml:"path"`
	Src          string `yaml:"src"`
}

ConfigurationFile where the configuration can be found

type Contact

type Contact struct {
	// Author of block
	Author string `yaml:"author"`

	// Organization who built this block
	Organization string `yaml:"organization"`

	// Email address for support
	Email string `yaml:"email"`

	// Website for more information
	Website string `yaml:"website"`

	// Support channel like slack URL
	Support string `yaml:"support"`
}

Contact information for this block

type Core

type Core struct {
	Loggers []Logger `yaml:"loggers"`
}

Core capabilities to enable / configure

type DORA

type DORA struct {
	// DF deployment Frequency
	DF float64 `yaml:"df"`

	// MLT mean Lead Time for changes
	MLT float64 `yaml:"mlt"`

	// MTTR Mean Time To Recover
	MTTR float64 `yaml:"mttr"`

	// CFR Change Failure Rate
	CFR float64 `yaml:"cfr"`
}

DORA metrics are a result of six years worth of surveys conducted by the DevOps Research and Assessments (DORA) team These metrics guide determine how successful a company is at DevOps - ranging from elite performer

type Dependencies

type Dependencies []struct {
	Command          string      `yaml:"command"`
	Comments         string      `yaml:"comments"`
	DockerCockroahdb interface{} `yaml:"docker-cockroahdb,omitempty"`
	Image            string      `yaml:"image"`
	Name             string      `yaml:"name"`
	Ports            []struct {
		External string `yaml:"external"`
		Internal string `yaml:"internal"`
	} `yaml:"ports"`
	Volumes     []interface{} `yaml:"volumes"`
	DockerKafka interface{}   `yaml:"docker-kafka,omitempty"`
	Topics      []Topic       `yaml:"topics,omitempty"`
}

Dependencies that this service requires

type Event

type Event struct {
	Topic string
}

type EventDetail

type EventDetail struct {
	// Time of event
	Time time.Time

	Type string

	//Source of event
	From string

	// SubObjectPath where in this object the event occurred
	SubObjectPath string

	Reason string

	Massage string
}

type EventInteface

type EventInteface struct {
	EventBusType string
	Brokers      []string
	ReadEvents   []Event
	WriteEvents  []Event
}

type EventMethodTemplateMap

type EventMethodTemplateMap struct {
	// Events using this template
	Events []string `yaml:"events"`

	// Template a TemplateItem
	Template TemplateItem `yaml:"template"`
}

EventMethodTemplateMap

type EventOutput

type EventOutput struct {
	// Enable or disable
	Enable bool `json:"enable"`

	// OutputTopics a list of topics to publish
	// to
	OutputTopics []Topic `json:"outputTopics"`

	// KafkaBrokers "kafka:9092", ....
	KafkaBrokers string `json:"kafkaBrokers"`

	// EnableCloudEvents use cloud event formatting
	EnableCloudEvents bool `json:"enableCloudEvents"`
}

EventOutput configuration

type EventSummary

type EventSummary struct {
	// FirstSeen time this event was first seen, aka 1 minute ago
	FirstSeen int

	// LastSeen time this event was last seen
	LastSeen int

	// Count number of times this event has occurred
	Count int

	//Source of event
	From string

	// SubObjectPath where in this object the event occurred
	SubObjectPath string

	// Type event error level, normal, warning, etc
	Type string

	// Reason what triggered this event, created, schedule, etc
	Reason string

	// Message help humans
	Message string
}

type ExportedItem

type ExportedItem struct {

	// TemplateVar the names or functions available for inclusion in this templates
	TemplateVar string `yaml:"templateVar"`

	// SourceInDefinitions where in the definitions file this value is populated from
	SourceInDefinitions string `yaml:"sourceInDefinitions"`

	// Description of this blocks capabilities
	Description string `yaml:"description"`

	// Required is this item required in a blueprint using this block
	Required bool `yaml:"required"`
}

ExportedItem Template variables exported by this template

type FileOutput

type FileOutput struct {
	// Enable or disable
	Enable bool `json:"enable"`

	// FileFormant text, JSON, etc
	FileFormant string `json:"fileFormant"`

	// Directory to place log in
	Directory string `json:"directory"`

	// FileName of log
	FileName string `json:"fileName"`
}

FileOutput configuration

type FunctionItem

type FunctionItem struct {
	// Function to generate desired output
	Function func(options ...interface{}) (results []byte, err error)

	// OutputFileName if writing the results to a file
	OutputFileName string `yaml:"outputFileName"`

	// OutputType controls execution of block processing
	//   - TPLOutputFile writes this template to the file name
	//     specified by OutputFileName
	//   - TPLOutputByteSlice aggregates one or more templates
	//     for use in a TPLOutputFile
	OutputType string `yaml:"outputType"`

	// FilePermissions to set when creating a file
	ExecutePermissions bool `yaml:"executePermissions"`

	// Description user friendly description
	Description string `yaml:"description"`
}

FunctionItem produces code or data generated by a function

type GitStatistics

type GitStatistics struct {
	Stars     int `yaml:"stars"`
	Forks     int `yaml:"forks"`
	Clones    int `yaml:"clones"`
	Watchers  int `yaml:"watchers"`
	Downloads int `yaml:"downloads"`
}

GitStatistics tracked from GitHub repositories holding blocks

type Go

type Go struct {
	DependencyManager string `yaml:"dependency-manager"`
}

type HTTPHeader

type HTTPHeader struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

HTTPHeader header name and value

type HTTPMethodTemplateMap

type HTTPMethodTemplateMap struct {
	// HTTP methods using this template
	HTTPMethods []string `yaml:"httpMethods"`

	// Template a TemplateItem
	Template TemplateItem `yaml:"template"`
}

HTTPMethodTemplateMap a list of methods, the assoicated tpl file, and a ptr to a compiled instance of it

type Info

type Info struct {
	APIVersion    string `yaml:"api-version"`
	ID            string `yaml:"id"`
	Name          string `yaml:"name"`
	Organization  string `yaml:"organization"`
	GitHubOrg     string `yaml:"githuborg"`
	SonarCloudOrg string `yaml:"sonarcloudorg"`
	ReleaseStatus string `yaml:"release-status"`
	Version       string `yaml:"version"`
}

Info defines information about the services and organization

type Integrations

type Integrations struct {
	Badges  []string `yaml:"shields,omitempty"`
	Name    string   `yaml:"name"`
	Enabled bool     `yaml:"enable"`
	// TODO: Needs to be more generic
	//
	SonarCloudConfig struct {
		// A sonarcloud access token
		Login string `yaml:"login"`
		// Project key should be same as the name
		Key     string `yaml:"key"`
		Options struct {
			Badges   []string `yaml:"shields"`
			Coverage struct {
				Enable bool   `yaml:"enable"`
				Report string `yaml:"report"`
			} `yaml:"coverage"`
			GoSec struct {
				Enable bool   `yaml:"enable"`
				Report string `yaml:"report"`
			} `yaml:"go-sec"`
			Lint struct {
				Enable bool   `yaml:"enable"`
				Report string `yaml:"report"`
			} `yaml:"lint"`
		} `yaml:"options"`
	} `yaml:"sonar-cloud-config,omitempty"`
	ConfigurationFile ConfigurationFile `yaml:"configuration-file,omitempty"`
}

Integrations CI/CD tools

type KubeConfig

type KubeConfig struct {
	// Namespace to use when constructing URLs
	Namespace string `yaml:"namespace"`

	// Liveness endpoint name for k8s checks
	Liveness string `yaml:"liveness"`

	// Readiness endpoint name for k8s checks
	Readiness string `yaml:"readiness"`

	// Metrics endpoint name for k8s checks
	Metrics string `yaml:"metrics"`

	// Management endpoint
	Management string `yaml:"management"`

	// Explain endpoint
	Explain string `yaml:"explain"`
}

KubeConfig

type LevelType

type LevelType string

LevelType provided to select log level

const (
	NormalType LevelType = "noraml"
	DebugType  LevelType = "debug"
	InfoType   LevelType = "info" // default
	WarnType   LevelType = "warn"
	ErrorType  LevelType = "error"
	FatalType  LevelType = "fatal"
	PanicType  LevelType = "panic"
)

type LogOutput

type LogOutput struct {
	// Console logging
	Console bool `json:"console"`

	// Disk logging
	Disk FileOutput `json:"disk"`

	// EventStream logging
	EventStream EventOutput `json:"eventStream"`
}

LogOutput configuration

type Logger

type Logger struct {
	// ID BlockID
	ID string `json:"id"`

	// APIVersion API version
	APIVersion string `json:"apiVersion"`

	// Name of the logger
	Name string `json:"name"`

	Metadata Metadata `json:"metadata"`

	// AutoInit true or false
	AutoInit bool `json:"autoInit"`

	// ConfigType env
	ConfigType string `json:"configType"`

	// EnableDocker support
	EnableDocker bool `json:"enableDocker"`

	// EnableKubernetes support
	EnableKubernetes bool `json:"enableKubernetes"`

	// Outputs to enable
	Outputs LogOutput `json:"outputs"`
}

Data to be read from definitions and passed to the templates or functions A list of loggers is allowed in the definitions file

type Maintainer

type Maintainer struct {
	Email string `yaml:"email"`
	Name  string `yaml:"name"`
	Slack string `yaml:"slack"`
	Web   string `yaml:"web"`
}

Maintainer contact information

type Metadata

type Metadata struct {
	// Label's allow blueprints to be associated
	Labels []string `yaml:"labels"`

	// Tags catagorize blocks for search
	Tags []string `yaml:"tags"`

	// Information about block author and support
	Information BlockInformation `yaml:"information"`
}

TODO: break into its own go file for use in other types

type Metrics

type Metrics struct {

	// DORA metrics
	DORAStatistics DORA `yaml:"doraStatistics"`

	// GitHub metrics
	GitHub GitStatistics `yaml:"gitHub"`

	// Operations metrics developed by PavedRoad
	Operations OperationalStatictics `yaml:"operations"`
}

Metrics that support data driven development and operations

type OperationalStatictics

type OperationalStatictics struct {
	// NumberOfTimesDeployed
	NumberOfTimesDeployed int `yaml:"numberOfTimesDeployed"`

	// ActiveDeployments
	ActiveDeployments int `yaml:"activeDeployments"`

	// Failures int
	Failures int `yaml:"failures"`

	// Response times per HTTP method or pub/sub event
	Performance map[string]int `yaml:"performance"`
}

OperationalStatictics created automatically when deploying on the PR SaaS service

type PayloadLoader

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

PayloadLoader

Loads from either a external ULR or a pointer to the
data

func (*PayloadLoader) Payload

func (dl *PayloadLoader) Payload() ([]byte, error)

Payload returns the contents of a resource

type Project

type Project struct {
	TLD           string         `yaml:"top_level_domain"`
	Description   string         `yaml:"description"`
	Dependencies  Dependencies   `yaml:"dependencies"`
	License       string         `yaml:"license"`
	SchedulerName string         `yaml:"scheduler_name"`
	Maintainer    Maintainer     `yaml:"maintainer"`
	ProjectFiles  []ProjectFiles `yaml:"project-files"`
	Integrations  []Integrations `yaml:"integrations"`
	Kubernetes    KubeConfig     `yaml:"kubernetes"`
	Endpoints     []endPoint     `yaml:"endpoints"`
	Loggers       []Logger       `yaml:"loggers"`
	Blocks        []Block        `yaml:"blocks"`
	Config        Config         `yaml:"configuration"`
}

Project information

type ProjectFiles

type ProjectFiles struct {
	Description string `yaml:"description"`
	Name        string `yaml:"name"`
	Path        string `yaml:"path"`
	Src         string `yaml:"src"`
}

ProjectFiles blueprint files to be included

type ReasonType

type ReasonType string
const (
	RTCreating          ReasonType = "creating"
	RTCreated           ReasonType = "created"
	RTUpdating          ReasonType = "updating" // default
	RTUpdated           ReasonType = "updated"
	RTDeleting          ReasonType = "deleting"
	RTDeleted           ReasonType = "deleted"
	RTPolicyCheck       ReasonType = "policy-check"
	RTPolicyCheckSucced ReasonType = "policy-success"
	RTPolicyCheckFailed ReasonType = "policy-failure"
)

type Response

type Response interface {
	RespondWithJSON() string
	RespondWithYAML() string
	RespondWithText() string
}

Response must include all three

type Tables

type Tables struct {
	// TableName is the name of the table to create.
	//   This is really just a sub-object
	//   It could be meta-data, user, blah...
	//
	TableName string `yaml:"table-name"`

	// TableType
	//   JSONB    Supported today
	//   SQLTable Future
	//
	//   If TableRole is Secondary, TableType is ignored
	//   if present and the table will be added as a sub
	//   structure
	//
	TableType string `yaml:"table-type"`

	// ParentTable
	//   Nest this table under the named parent
	ParentTable string `yaml:"parent-tables"`

	// A list of table columns or object attributes
	Columns []struct {
		// Name of the column
		Name string `yaml:"name"`

		// Modifiers to apply when marshalling
		// omitempty or string
		//
		Modifiers string `yaml:"modifiers"`

		// MappedName to use when marshalling
		// If empty, map to lowercase of name
		//
		MappedName string `yaml:"mapped-name"`

		// Constraints such as required
		// Valid swagger 2.0 validation
		//
		Constraints string `yaml:"constraints"`

		Type string `yaml:"type"`
	} `yaml:"columns"`
}

Tables structure for user defined tables that need to be generated

type TemplateItem

type TemplateItem struct {

	// FileName the file name of this template in
	// the directory and in the template define
	FileName string `yaml:"fileName"`

	// OutputFileName for templates that create files
	OutputFileName string `yaml:"outputFileName"`

	// OutputType controls execution of block processing
	//   - TPLOutputFile writes this template to the file name
	//     specified by OutputFileName
	//   - TPLOutputByteSlice aggregates one or more templates
	//     for use in a TPLOutputFile
	OutputType string `yaml:"outputType"`

	// FilePermissions to set when creating a file
	ExecutePermissions bool `yaml:"executePermissions"`

	// TemplateFunction the name of the function map
	// required for this template
	TemplateFunction interface{} `yaml:"templateFunction"`

	// TemplatePtr a pointer if the template if already
	// initialized or nil
	TemplatePtr *template.Template `yaml:"templatePtr"`

	// Description user friendly description
	Description string `yaml:"description"`
}

TemplateItem information about a Go tpl and its associated requirements. If the template has been parsed it also contains a pointer too the template for execution

type Topic

type Topic struct {
	// Value is the topic name
	Value string `json:"value"`
	// Partitions is the number of partions
	Partitions int `json:"partitions"`
	// ReleaseStatus is the replication factor for this topic
	Replication int `json:"replication"`
}

Topic defines a Kafka topic and its partition and replication counts

type UsageRights

type UsageRights struct {
	// TermsOfService for example, as is
	TermsOfService string `yaml:"termsOfService"`

	// Licenses cost for example,  annual, per use, perpetual
	Licenses string `yaml:"licenses"`

	// ContributeLink for donation to the developer
	ContributeLink string `yaml:"contributeLink"`

	// AccessToken for downloading this block
	AccessToken string `yaml:"accessToken"`
}

UsageRights terms of service, licensing, and access tokens

Jump to

Keyboard shortcuts

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