stack

package
v1.0.0-develop.17 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMembraneVersion string

Functions

func AddOptions

func AddOptions(cmd *cobra.Command)

Types

type Bucket

type Bucket struct{}

type Collection

type Collection struct{}

type Compute

type Compute interface {
	ImageTagName(s *Stack, provider string) string
	SetContextDirectory(stackDir string)
	Unit() *ComputeUnit
}

type ComputeUnit

type ComputeUnit struct {
	Name string `yaml:"-"`

	// This is the stack.Dir + Context
	ContextDirectory string `yaml:"-"`

	// Context is the directory containing the code for the function
	Context string `yaml:"context,omitempty"`

	// Triggers used to invoke this compute unit, e.g. Topic Subscriptions
	Triggers Triggers `yaml:"triggers,omitempty"`

	// The memory of the compute instance in MB
	Memory int `yaml:"memory,omitempty"`

	// The minimum number of instances to keep alive
	MinScale int `yaml:"minScale,omitempty"`

	// The maximum number of instances to scale to
	MaxScale int `yaml:"maxScale,omitempty"`

	// Allow the user to specify a custom unique tag for the function
	Tag string `yaml:"tag,omitempty"`
}

type Container

type Container struct {
	Dockerfile string   `yaml:"dockerfile"`
	Args       []string `yaml:"args,omitempty"`

	ComputeUnit `yaml:",inline"`
}

func (*Container) ImageTagName

func (c *Container) ImageTagName(s *Stack, provider string) string

ImageTagName returns the default image tag for a source image built from this function provider the provider name (e.g. aws), used to uniquely identify builds for specific providers

func (*Container) SetContextDirectory

func (c *Container) SetContextDirectory(stackDir string)

func (*Container) Unit

func (c *Container) Unit() *ComputeUnit

type Function

type Function struct {
	// The location of the function handler
	// relative to context
	Handler string `yaml:"handler"`

	// The build pack version of the membrane used for the function build
	Version string `yaml:"version,omitempty"`

	// Scripts that will be executed by the nitric
	// build process before beginning the docker build
	BuildScripts []string `yaml:"buildScripts,omitempty"`

	// files to exclude from final build
	Excludes []string `yaml:"excludes,omitempty"`

	// The most requests a single function instance should handle
	MaxRequests int `yaml:"maxRequests,omitempty"`

	// Simple configuration to determine if the function should be directly
	// invokable without authentication
	// would use public, but its reserved by typescript
	External bool `yaml:"external"`

	ComputeUnit `yaml:",inline"`
}

func FunctionFromHandler

func FunctionFromHandler(h, stackDir string) Function

func (*Function) ImageTagName

func (f *Function) ImageTagName(s *Stack, provider string) string

ImageTagName returns the default image tag for a source image built from this function provider the provider name (e.g. aws), used to uniquely identify builds for specific providers

func (*Function) RelativeHandlerPath

func (f *Function) RelativeHandlerPath(s *Stack) (string, error)

func (*Function) SetContextDirectory

func (f *Function) SetContextDirectory(stackDir string)

func (*Function) Unit

func (f *Function) Unit() *ComputeUnit

func (*Function) VersionString

func (f *Function) VersionString(s *Stack) string

type Queue

type Queue struct{}

type Schedule

type Schedule struct {
	Expression string `yaml:"expression"`

	// The Topic to be targeted for schedule
	Target ScheduleTarget `yaml:"target"`
	Event  ScheduleEvent  `yaml:"event"`
}

type ScheduleEvent

type ScheduleEvent struct {
	PayloadType string                 `yaml:"payloadType"`
	Payload     map[string]interface{} `yaml:"payload,omitempty"`
}

A subset of a NitricEvent excluding it's requestId This will be generated based on the scedule

type ScheduleTarget

type ScheduleTarget struct {
	Type string `yaml:"type"` // TODO(Angus) check type: 'topic'; // ; | "queue"
	Name string `yaml:"name"`
}

type Stack

type Stack struct {
	Dir         string                 `yaml:"-"`
	Name        string                 `yaml:"name"`
	Functions   map[string]Function    `yaml:"functions,omitempty"`
	Collections map[string]Collection  `yaml:"collections,omitempty"`
	Containers  map[string]Container   `yaml:"containers,omitempty"`
	Buckets     map[string]Bucket      `yaml:"buckets,omitempty"`
	Topics      map[string]Topic       `yaml:"topics,omitempty"`
	Queues      map[string]Queue       `yaml:"queues,omitempty"`
	Schedules   map[string]Schedule    `yaml:"schedules,omitempty"`
	ApiDocs     map[string]*openapi3.T `yaml:"-"`
	Apis        map[string]string      `yaml:"apis,omitempty"`
	// TODO: Not currently supported by nitric.yaml configuration (but is technically definable using the proto model)
	// We may want to decouple the definition from contracts at a later stage
	// but re-using the contract here provides us a serializable entity with no
	// repetition/redefinition
	// NOTE: if we want to use the proto definition here we would need support for yaml parsing to use customisable tags
	Policies []*v1.PolicyResource `yaml:"-"`
}

func FromFile

func FromFile(name string) (*Stack, error)

func FromGlobArgs

func FromGlobArgs(glob []string) (*Stack, error)

func FromOptions

func FromOptions() (*Stack, error)

func FromOptionsMinimal

func FromOptionsMinimal() (*Stack, error)

func New

func New(name, dir string) *Stack

func (*Stack) ToFile

func (s *Stack) ToFile(name string) error

type Topic

type Topic struct{}

type Triggers

type Triggers struct {
	Topics []string `yaml:"topics,omitempty"`
}

Jump to

Keyboard shortcuts

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