project

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOTELCollectorVersion string

Functions

This section is empty.

Types

type BaseComputeConfig added in v1.16.0

type BaseComputeConfig struct {
	Type string `yaml:"type"`
}

Config shared by all compute types

type BaseConfig added in v1.16.0

type BaseConfig struct {
	Name     string `yaml:"name"`
	Dir      string `yaml:"-"`
	Handlers []any  `yaml:"handlers"`
}

type Bucket

type Bucket struct{}

type Collection

type Collection struct{}

type Compute

type Compute interface {
	ImageTagName(s *Project, provider string) string
	Unit() *ComputeUnit
	Workers() int
}

type ComputeUnit

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

	Type string `yaml:"-"`
}

type Config

type Config struct {
	BaseConfig       `yaml:",inline"`
	ConcreteHandlers []*HandlerConfig `yaml:"-"`
}

func ConfigFromProjectPath added in v1.4.0

func ConfigFromProjectPath(projPath string) (*Config, error)

ConfigFromProjectPath - loads the config nitric.yaml file from the project path, defaults to the current working directory

func (*Config) ToFile

func (p *Config) ToFile() error

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 *Project, 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) String added in v1.14.0

func (c *Container) String() string

func (*Container) Unit

func (c *Container) Unit() *ComputeUnit

func (*Container) Workers

func (c *Container) Workers() int

type Function

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

	ComputeUnit `yaml:",inline"`

	// The number of workers this function contains
	WorkerCount int
}

func FunctionFromHandler

func FunctionFromHandler(h string, t string) (Function, error)

func (*Function) ImageTagName

func (f *Function) ImageTagName(s *Project, 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 *Project) (string, error)

func (*Function) Unit

func (f *Function) Unit() *ComputeUnit

func (*Function) Workers

func (c *Function) Workers() int

type HandlerConfig added in v1.16.0

type HandlerConfig struct {
	BaseComputeConfig
	Match string
}

type Project

type Project 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:"-"`
	SecurityDefinitions map[string]map[string]*v1.ApiSecurityDefinition `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:"-"`
	Secrets  map[string]Secret    `yaml:"secrets,omitempty"`
}

func FromConfig

func FromConfig(c *Config) (*Project, error)

func FromFile

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

func New

func New(config BaseConfig) *Project

func (*Project) Computes

func (s *Project) Computes() []Compute

func (*Project) ToFile

func (s *Project) ToFile(file string) error

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 Secret

type Secret struct{}

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