spaces

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeHour  = "hour"
	ScopeToday = "today"
	ScopeWeek  = "week"
	ScopeMonth = "month"
	ScopeYear  = "year"
)
View Source
const (
	UnitBytes = 1
	UnitKB    = 1024
	UnitMB    = 1024 * 1024
	UnitGB    = 1024 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationUpdate added in v1.2.0

type ApplicationUpdate struct {
	ID                string                        `json:"id"`
	StartedAt         time.Time                     `json:"startedAt"`
	CompletedAt       time.Time                     `json:"completedAt"`
	Status            string                        `json:"status"`
	VersionConstraint string                        `json:"versionConstraint"`
	ExactVersion      ApplicationUpdateExactVersion `json:"exactVersion"`
	Progress          ApplicationUpdateProgress     `json:"progress"`
	SourceStage       StageRef                      `json:"sourceStage"`
	TargetStage       StageRef                      `json:"targetStage"`
}

type ApplicationUpdateExactVersion added in v1.2.0

type ApplicationUpdateExactVersion struct {
	Number string `json:"number"`
}

type ApplicationUpdateInput added in v1.2.0

type ApplicationUpdateInput struct {
	VersionConstraint string    `json:"versionConstraint"`
	TargetStage       *StageRef `json:"targetStage,omitempty"`
}

type ApplicationUpdateProgress added in v1.2.0

type ApplicationUpdateProgress struct {
	CurrentStep int    `json:"currentStep"`
	TotalSteps  int    `json:"totalSteps"`
	Status      string `json:"status"`
}

type CaughtEmail added in v1.5.0

type CaughtEmail struct {
	ID       string    `json:"id"`
	Envelope Envelope  `json:"envelope"`
	Date     time.Time `json:"date"`
	Mail     Mail      `json:"mail"`
}

func (*CaughtEmail) Header added in v1.5.0

func (c *CaughtEmail) Header(name string) string

func (*CaughtEmail) Headers added in v1.5.0

func (c *CaughtEmail) Headers(name string) []string

type CaughtEmailList added in v1.5.0

type CaughtEmailList []CaughtEmail

func (CaughtEmailList) ByID added in v1.5.0

func (l CaughtEmailList) ByID(id string) *CaughtEmail

type CommandCronjobExecution added in v1.1.0

type CommandCronjobExecution struct {
	Date     time.Time `json:"date"`
	ExitCode int       `json:"exitCode,omitempty"`
}

type ComputeMetricPoint added in v1.6.0

type ComputeMetricPoint struct {
	Date   MetricDateRange `json:"date"`
	Stage  string          `json:"stage"`
	CPU    MetricUsage     `json:"cpu"`
	Memory MetricUsage     `json:"memory"`
}

type ComputeMetricPointList added in v1.6.0

type ComputeMetricPointList []ComputeMetricPoint

func (ComputeMetricPointList) CPUUsage added in v1.6.0

func (l ComputeMetricPointList) CPUUsage() []float64

func (ComputeMetricPointList) DateStrings added in v1.6.0

func (l ComputeMetricPointList) DateStrings(layout string) []string

func (ComputeMetricPointList) Dates added in v1.6.0

func (l ComputeMetricPointList) Dates() []time.Time

func (ComputeMetricPointList) MemoryUsage added in v1.6.0

func (l ComputeMetricPointList) MemoryUsage(unit int) []float64

type ConnectOption added in v1.11.2

type ConnectOption func(in *SpacePaymentLinkInput) error

func WithBackupIntervalMinutes added in v1.12.0

func WithBackupIntervalMinutes(interval uint64) ConnectOption

func WithPods added in v1.11.2

func WithPods(pods uint64) ConnectOption

func WithStages added in v1.11.2

func WithStages(stages uint64) ConnectOption

func WithStorage added in v1.11.2

func WithStorage(storageBytes uint64) ConnectOption

func WithStorageStr added in v1.11.2

func WithStorageStr(storage string) ConnectOption

func WithoutTestingPeriod added in v1.12.0

func WithoutTestingPeriod() ConnectOption

type Cronjob added in v1.1.0

type Cronjob struct {
	ID            string     `json:"id,omitempty"`
	Schedule      string     `json:"schedule"`
	AllowParallel bool       `json:"allowParallel"`
	Job           CronjobJob `json:"job"`
	Timezone      string     `json:"timezone"`
}

type CronjobJob added in v1.1.0

type CronjobJob struct {
	Type             string                   `json:"type"`
	Command          string                   `json:"command,omitempty"`
	Arguments        []string                 `json:"arguments,omitempty"`
	WorkingDirectory string                   `json:"workingDirectory,omitempty"`
	NextExecution    *CommandCronjobExecution `json:"nextExecution,omitempty"`
	LastExecution    *CommandCronjobExecution `json:"lastExecution,omitempty"`
}

type DatabaseUser added in v1.10.0

type DatabaseUser struct {
	User       string    `json:"user"`
	CreatedAt  time.Time `json:"createdAt"`
	ModifiedAt time.Time `json:"modifiedAt"`
	Status     string    `json:"status"`
	Type       string    `json:"type"`
	Stage      StageRef  `json:"stage"`
}

type DatabaseUserInput added in v1.10.0

type DatabaseUserInput struct {
	UserSuffix string `json:"userSuffix"`
	Password   string `json:"password"`
	External   string `json:"external"`
	Type       string `json:"type"`
}

type DatabaseUserList added in v1.10.0

type DatabaseUserList []DatabaseUser

type Empty

type Empty struct{}

type Envelope added in v1.5.0

type Envelope struct {
	MailFrom string   `json:"mailFrom"`
	RcptTo   []string `json:"rcptTo"`
}
type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type InitStep added in v1.5.0

type InitStep struct {
	CurrentStep string   `json:"currentStep"`
	TotalSteps  []string `json:"totalSteps"`
}

type InitializationProgress added in v1.5.0

type InitializationProgress struct {
	Status string   `json:"status"`
	Step   InitStep `json:"step"`
}

type Mail added in v1.5.0

type Mail struct {
	Subject string   `json:"subject"`
	Headers []Header `json:"headers"`
	Text    string   `json:"text"`
	HTML    string   `json:"html"`
	To      string   `json:"to"`
	From    string   `json:"from"`
	CC      string   `json:"cc"`
	BCC     string   `json:"bcc"`
}

type MetricDateRange added in v1.6.0

type MetricDateRange struct {
	From time.Time `json:"from"`
	To   time.Time `json:"to"`
}

type MetricUsage added in v1.6.0

type MetricUsage struct {
	Usage   float64 `json:"usage"`
	Limit   float64 `json:"limit"`
	Request float64 `json:"request"`
}

type SoftwareRef

type SoftwareRef struct {
	ID   string `json:"id"`
	HREF string `json:"href,omitempty"`
}

type SoftwareVersionRef added in v1.3.0

type SoftwareVersionRef struct {
	Software          SoftwareRef `json:"software"`
	VersionConstraint string      `json:"versionConstraint"`
	UserData          interface{} `json:"userData,omitempty"`
}

type Space

type Space struct {
	ID        string            `json:"id"`
	Links     lowlevel.LinkList `json:"_links"`
	Name      SpaceName         `json:"name"`
	CreatedAt time.Time         `json:"createdAt"`
	Status    string            `json:"status"`
	DNSNames  []string          `json:"dnsNames"`
	Stages    []Stage           `json:"stages"`
	Team      TeamRef           `json:"team"`
	Running   bool              `json:"running"`
}

func (Space) StagesCount

func (s Space) StagesCount() int

func (Space) StagesNames

func (s Space) StagesNames() []string

type SpaceDeclaration

type SpaceDeclaration struct {
	Name        SpaceName             `json:"name"`
	PaymentLink SpacePaymentLinkInput `json:""`
	Stages      []StageDeclaration    `json:"stages"`
}

type SpaceName

type SpaceName struct {
	DNSName           string `json:"dnsName"`
	HumanReadableName string `json:"humanReadableName"`
}
type SpacePaymentLink struct {
	Plan           payment.Plan           `json:"plan"`
	PaymentProfile payment.PaymentProfile `json:"paymentProfile"`
}

type SpacePaymentLinkInput added in v1.4.0

type SpacePaymentLinkInput struct {
	Plan              payment.PlanReferenceInput                 `json:"plan"`
	PaymentProfile    payment.PaymentProfileReferenceInput       `json:"paymentProfile"`
	Preprovisionings  *payment.SpaceResourcePreprovisioningInput `json:"preprovisionings,omitempty"`
	Options           *payment.SpaceOptionInput                  `json:"options,omitempty"`
	SkipTestingPeriod bool                                       `json:"skipTestingPeriod"`
}

type SpacesClient

type SpacesClient interface {
	List() ([]Space, error)
	ListByTeam(teamID string) ([]Space, error)
	Declare(teamID string, declaration *SpaceDeclaration) (*Space, error)
	GetByID(spaceID string) (*Space, error)
	GetByTeamAndName(teamIDOrName string, spaceIDOrName string) (*Space, error)
	Delete(spaceID string) error
	UpdateApplication(spaceID, stage, targetStage, version string) (*ApplicationUpdate, error)
	ListApplicationUpdatesByStage(spaceID, stage string) ([]ApplicationUpdate, error)
	ListApplicationUpdatesBySpace(spaceID string) ([]ApplicationUpdate, error)
	GetPaymentLink(spaceID string) (*SpacePaymentLink, error)
	ConnectWithPaymentProfile(spaceID string, paymentProfileID string, planID string, opts ...ConnectOption) (*SpacePaymentLink, error)
	ListCaughtEmails(spaceID string) (CaughtEmailList, error)
	GetComputeMetrics(spaceID string, scope string) (ComputeMetricPointList, error)
	ListVirtualHostsByStage(spaceID, stage string) (VirtualHostList, error)
	UpdateVirtualHost(spaceID, stage string, vhost VirtualHost) (*VirtualHost, error)
	DeleteVirtualHost(spaceID, stage, hostname string) error
	GetStageProtection(spaceID, stage string) (*StageProtection, error)
	CreateStageProtection(spaceID, stage string, inputProtection StageProtection) (*StageProtection, error)
	DeleteStageProtection(spaceID, stage string) error
	ListDatabaseUsersByStage(spaceID, stage string) (DatabaseUserList, error)
	GetDatabaseUser(spaceID, stage, username string) (*DatabaseUser, error)
	CreateDatabaseUser(spaceID, stage string, dbUser DatabaseUserInput) (*DatabaseUser, error)
	DeleteDatabaseUser(spaceID, stage, name, dbType string) error
}

func NewSpacesClient

func NewSpacesClient(client *lowlevel.SpacesLowlevelClient, logger *log.Logger) SpacesClient

type Stage

type Stage struct {
	Links   lowlevel.LinkList `json:"_links"`
	Actions lowlevel.LinkList `json:"_actions"`

	Name              string                 `json:"name"`
	Application       SoftwareVersionRef     `json:"application"`
	Databases         []SoftwareVersionRef   `json:"databases"`
	Cronjobs          []Cronjob              `json:"cronjobs"`
	Version           VersionRef             `json:"version"`
	VersionConstraint string                 `json:"versionConstraint"`
	UserData          interface{}            `json:"userData"`
	DNSNames          []string               `json:"dnsNames"`
	Status            string                 `json:"status"`
	Running           bool                   `json:"running"`
	Initialization    InitializationProgress `json:"initializationProgress"`
}

type StageDeclaration

type StageDeclaration struct {
	Name              string               `json:"name"`
	Application       SoftwareRef          `json:"application"`
	Databases         []SoftwareVersionRef `json:"databases"`
	Cronjobs          []Cronjob            `json:"cronjobs"`
	VersionConstraint string               `json:"versionConstraint"`
	UserData          interface{}          `json:"userData"`
}

type StageProtection added in v1.8.0

type StageProtection struct {
	ProtectionType string `json:"type"`
}

type StageRef added in v1.2.0

type StageRef struct {
	Name string `json:"name"`
	HREF string `json:"href,omitempty"`
}

type StorageMetricPoint added in v1.6.0

type StorageMetricPoint struct {
	Date     MetricDateRange `json:"date"`
	Stage    string          `json:"stage"`
	Files    StorageUsage    `json:"files"`
	Database StorageUsage    `json:"database"`
}

type StorageUsage added in v1.6.0

type StorageUsage struct {
	Mean         float64 `json:"mean"`
	Percentile90 float64 `json:"p90"`
}

type TeamRef

type TeamRef struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	DNSLabel string `json:"dnsLabel"`
}

type VersionRef

type VersionRef struct {
	Number string `json:"number"`
}

type VirtualHost added in v1.7.0

type VirtualHost struct {
	Hostname string         `json:"hostname"`
	TLS      VirtualHostTLS `json:"tls"`
}

type VirtualHostCertificate added in v1.7.0

type VirtualHostCertificate struct {
	ID string `json:"id"`
}

type VirtualHostList added in v1.7.0

type VirtualHostList []VirtualHost

func (VirtualHostList) Exists added in v1.7.0

func (l VirtualHostList) Exists(hostname string) bool

type VirtualHostTLS added in v1.7.0

type VirtualHostTLS struct {
	Type        string                 `json:"type"`
	Certificate VirtualHostCertificate `json:"certificate"`
}

Jump to

Keyboard shortcuts

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