spacefile

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFilename = ".spacefile.hcl"
View Source
const SpacefileTemplate = `` /* 2452-byte string literal not displayed */

Variables

This section is empty.

Functions

func Generate

func Generate(
	teamName string,
	spaceName string,
	spaceDNSLabel string,
	software *software.Software,
	paymentProfileID string,
	plan string,
	storage string,
	scaling int,
	backupInterval int,
	out io.Writer,
) error

Types

type CommandCronjobDef added in v1.1.0

type CommandCronjobDef struct {
	Command          string   `hcl:"command" hcle:"omitempty"`
	Arguments        []string `hcl:"arguments" hcle:"omitempty"`
	WorkingDirectory string   `hcl:"workingDirectory" hcle:"omitempty"`
}

type CronjobDef added in v1.1.0

type CronjobDef struct {
	Identifier    string             `hcl:",key"`
	Schedule      string             `hcl:"schedule"`
	AllowParallel bool               `hcl:"allowParallel"`
	Command       *CommandCronjobDef `hcl:"command" hcle:"omitempty"`
	Timezone      string             `hcl:"timezone" hcle:"omitempty"`
}

func CronjobFromDeclaration added in v1.8.0

func CronjobFromDeclaration(decl *spaces.Cronjob) CronjobDef

CronjobFromDeclaration returns a CronjobDef for the spacefile from a API Cronjob Declaration

func (CronjobDef) ToDeclaration added in v1.1.0

func (c CronjobDef) ToDeclaration() spaces.Cronjob

type CronjobDefList added in v1.1.0

type CronjobDefList []CronjobDef

type ErrSpacefileNotFound

type ErrSpacefileNotFound struct {
	Path string
}

func (ErrSpacefileNotFound) Error

func (n ErrSpacefileNotFound) Error() string

type OptionDef added in v1.12.0

type OptionDef struct {
	Option string      `hcl:",key"`
	Value  interface{} `hcl:"value"`
}

type PaymentDef added in v1.11.0

type PaymentDef struct {
	PaymentProfileID string `hcl:"paymentProfile"`
	PlanID           string `hcl:"plan"`
}

func (*PaymentDef) Validate added in v1.11.0

func (d *PaymentDef) Validate(offline bool) error

type ResourceDef added in v1.11.0

type ResourceDef struct {
	Resource string      `hcl:",key"`
	Quantity interface{} `hcl:"quantity"`
}

type SoftwareDef

type SoftwareDef struct {
	Identifier string      `hcl:",key"`
	Version    string      `hcl:"version"`
	UserData   interface{} `hcl:"userData" hcle:"omitempty"`
}

func (SoftwareDef) Validate added in v1.6.0

func (s SoftwareDef) Validate(offline bool) error

Validate performs (optional) online validation of software version and name

type SoftwareDefList added in v1.1.0

type SoftwareDefList []SoftwareDef

func (SoftwareDefList) Merge added in v1.1.0

type SpaceDef

type SpaceDef struct {
	DNSLabel  string        `hcl:",key"`
	Name      string        `hcl:"name"`
	TeamID    string        `hcl:"team"`
	Payment   PaymentDef    `hcl:"payment"`
	Resources []ResourceDef `hcl:"resource"`
	Options   []OptionDef   `hcl:"option"`
	Stages    []StageDef    `hcl:"stage"`
	// contains filtered or unexported fields
}

func FromSpace added in v1.8.0

func FromSpace(decl *spaces.Space, api client.SpacesClient) (*SpaceDef, error)

FromSpaceDeclaration converts a Space Declaration returned by the API to a SpaceDef object that can be returned as a spacefile it also makes additional api requests to gather information not contained in the SpaceDeclaration

func (*SpaceDef) CountOnDemandStages added in v1.11.0

func (d *SpaceDef) CountOnDemandStages() int

func (*SpaceDef) GetStageByName added in v1.7.0

func (d *SpaceDef) GetStageByName(stageName string) *StageDef

func (*SpaceDef) Option added in v1.12.0

func (d *SpaceDef) Option(r string) *OptionDef

func (*SpaceDef) Resource added in v1.11.0

func (d *SpaceDef) Resource(r string) *ResourceDef

func (*SpaceDef) StorageBytes added in v1.11.0

func (d *SpaceDef) StorageBytes() (uint64, error)

func (*SpaceDef) ToSpaceDeclaration

func (s *SpaceDef) ToSpaceDeclaration() (*spaces.SpaceDeclaration, error)

ToSpaceDeclaration converts the SpaceDef object used in the Spacefile to a SpaceDeclaration used for the Spaces API calls

func (*SpaceDef) Validate

func (d *SpaceDef) Validate(offline bool) error

type Spacefile

type Spacefile struct {
	Version string     `hcl:"version"`
	Spaces  []SpaceDef `hcl:"space"`
}

func ParseSpacefile

func ParseSpacefile(filename string, offline bool) (*Spacefile, error)

func (*Spacefile) Validate

func (f *Spacefile) Validate(offline bool) error

type StageDef

type StageDef struct {
	Name         string             `hcl:",key"`
	Inherit      string             `hcl:"inherit" hcle:"omitempty"`
	OnDemand     bool               `hcl:"onDemand"`
	Protection   string             `hcl:"protection" hcle:"omitempty"`
	Applications SoftwareDefList    `hcl:"application"`
	Databases    SoftwareDefList    `hcl:"database"`
	Cronjobs     CronjobDefList     `hcl:"cron"`
	VirtualHosts VirtualHostDefList `hcl:"virtualHost"`
	// contains filtered or unexported fields
}

func (*StageDef) Application added in v1.1.0

func (d *StageDef) Application() *SoftwareDef

Application returns a reference to the one application defined for this stage

func (*StageDef) Validate

func (d *StageDef) Validate(offline bool) error

type SyntaxError

type SyntaxError struct {
	File  string
	Inner error
}

func (SyntaxError) Error

func (s SyntaxError) Error() string

type TLSVirtualHostDef added in v1.7.0

type TLSVirtualHostDef struct {
	Type        string `hcl:"type"`
	Certificate string `hcl:"certificateID"`
}

type VirtualHostDef added in v1.7.0

type VirtualHostDef struct {
	Hostname string             `hcl:",key"`
	TLS      *TLSVirtualHostDef `hcl:"tls"`
}

func (VirtualHostDef) ToDeclaration added in v1.7.0

func (v VirtualHostDef) ToDeclaration() spaces.VirtualHost

type VirtualHostDefList added in v1.7.0

type VirtualHostDefList []VirtualHostDef

Jump to

Keyboard shortcuts

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