commands

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFileSize = 1073741824 // 1GB

MaxFileSize is the tarball file size allowed to be uploaded in bytes.

Variables

This section is empty.

Functions

func BuildFilelist

func BuildFilelist(dir string, ignores []string) (files []string, err error)

BuildFilelist builds a list of files to be tarballed, with optional ignores.

func CreateTarball

func CreateTarball(w io.Writer, filePaths []string) error

CreateTarball creates a tarball containing all the files in filePaths and writes it to w.

func IsValidNodeApp added in v0.0.6

func IsValidNodeApp(dir string) (errs []error)

IsValidNodeApp detects if a Node.js app is present in a given directory

func NewSpinner added in v1.3.1

func NewSpinner(txt string) (s *spinner.Spinner)

NewSpinner returns a nicely formatted spinner for display while users are waiting.

func NewTable

func NewTable(out io.Writer) (t *tablewriter.Table)

NewTable returns a table with sectionctl standard formatting

func PrettyBool added in v1.3.0

func PrettyBool(b bool) (s string)

PrettyBool pretty prints a bool value

func Split added in v1.8.0

func Split(r rune) bool

Split helps differentiate between different directory delimiters. / or \

Types

type AccountsCmd

type AccountsCmd struct {
	List AccountsListCmd `cmd help:"List accounts on Section." default:"1"`
}

AccountsCmd manages accounts on Section

type AccountsCreateCmd

type AccountsCreateCmd struct{}

AccountsCreateCmd handles creating apps on Section

type AccountsListCmd

type AccountsListCmd struct{}

AccountsListCmd handles listing accounts on Section

func (*AccountsListCmd) Run

func (c *AccountsListCmd) Run() (err error)

Run executes the command

type AppsCmd

type AppsCmd struct {
	List   AppsListCmd   `cmd help:"List apps on Section." default:"1"`
	Info   AppsInfoCmd   `cmd help:"Show detailed app information on Section."`
	Create AppsCreateCmd `cmd help:"Create new app on Section."`
	Delete AppsDeleteCmd `cmd help:"Delete an existing app on Section."`
	Init   AppsInitCmd   `cmd help:"Initialize your project for deployment."`
	Stacks AppsStacksCmd `cmd help:"See the available stacks to create new apps with."`
}

AppsCmd manages apps on Section

type AppsCreateCmd

type AppsCreateCmd struct {
	AccountID int    `required short:"a" help:"ID of account to create the app under"`
	Hostname  string `required short:"d" help:"FQDN the app can be accessed at"`
	Origin    string `required short:"o" help:"URL to fetch the origin"`
	StackName string `required short:"s" help:"Name of stack to deploy"`
}

AppsCreateCmd handles creating apps on Section

func (*AppsCreateCmd) Run added in v1.5.0

func (c *AppsCreateCmd) Run() (err error)

Run executes the command

type AppsDeleteCmd added in v1.5.0

type AppsDeleteCmd struct {
	AccountID int `required short:"a" help:"ID of account the app belongs to"`
	AppID     int `required short:"i" help:"ID of the app to delete"`
}

AppsDeleteCmd handles deleting apps on Section

func (*AppsDeleteCmd) Run added in v1.5.0

func (c *AppsDeleteCmd) Run() (err error)

Run executes the command

type AppsInfoCmd

type AppsInfoCmd struct {
	AccountID int `required short:"a"`
	AppID     int `required short:"i"`
}

AppsInfoCmd shows detailed information on an app running on Section

func (*AppsInfoCmd) Run

func (c *AppsInfoCmd) Run() (err error)

Run executes the command

type AppsInitCmd added in v1.7.0

type AppsInitCmd struct {
	StackName string `optional default:"nodejs-basic" short:"s" help:"Name of stack to deploy. Default is nodejs-basic"`
	Force     bool   `optional short:"f" help:"Resets deployment specific files to their default configuration"`
}

AppsInitCmd creates and validates server.conf and package.json to prepare an app for deployment

func (*AppsInitCmd) CreatePkgJSON added in v1.9.0

func (c *AppsInitCmd) CreatePkgJSON(stdout, stderr bytes.Buffer) (err error)

Create package.json

func (*AppsInitCmd) InitializeNodeBasicApp added in v1.7.0

func (c *AppsInitCmd) InitializeNodeBasicApp(stdout, stderr bytes.Buffer) (err error)

InitializeNodeBasicApp initializes a basic node app.

func (*AppsInitCmd) Run added in v1.7.0

func (c *AppsInitCmd) Run() (err error)

Run executes the command

type AppsListCmd

type AppsListCmd struct {
	AccountID int `short:"a" help:"Account ID to find apps under"`
}

AppsListCmd handles listing apps running on Section

func (*AppsListCmd) Run

func (c *AppsListCmd) Run() (err error)

Run executes the command

type AppsStacksCmd added in v1.9.0

type AppsStacksCmd struct{}

AppsStacksCmd lists available stacks to create new apps with

func (*AppsStacksCmd) Run added in v1.9.0

func (c *AppsStacksCmd) Run() (err error)

Run executes the command

type CertsCmd added in v1.1.0

type CertsCmd struct {
	Renew CertsRenewCmd `cmd help:"Renew a certificate for a domain."`
}

CertsCmd manages certificates on Section

type CertsRenewCmd added in v1.1.0

type CertsRenewCmd struct {
	Hostname string `arg help:"The domain name to renew the cert for"`
}

CertsRenewCmd handles renewing a certificate

func (*CertsRenewCmd) Run added in v1.1.0

func (c *CertsRenewCmd) Run() (err error)

Run executes the command

type DeployCmd

type DeployCmd struct {
	AccountID      int           `required short:"a" help:"AccountID to deploy application to."`
	AppID          int           `required short:"i" help:"AppID to deploy application to."`
	Environment    string        `short:"e" default:"production" help:"Environment to deploy application to."`
	Debug          bool          `help:"Display extra debugging information about what is happening inside sectionctl."`
	Directory      string        `short:"C" default:"." help:"Directory which contains the application to deploy."`
	ServerURL      *url.URL      `default:"https://aperture.section.io/new/code_upload/v1/upload" help:"URL to upload application to"`
	Timeout        time.Duration `default:"600s" help:"Timeout of individual HTTP requests."`
	SkipDelete     bool          `help:"Skip delete of temporary tarball created to upload app."`
	SkipValidation bool          `help:"Skip validation of the workload before pushing into Section. Use with caution."`
	AppPath        string        `default:"nodejs" help:"Path of NodeJS application in environment repository."`
}

DeployCmd handles deploying an app to Section.

func (*DeployCmd) Run

func (c *DeployCmd) Run() (err error)

Run deploys an app to Section's edge

type DomainsCmd added in v1.7.0

type DomainsCmd struct {
	List DomainsListCmd `cmd help:"List domains on Section." default:"1"`
}

DomainsCmd manages domains on Section

type DomainsListCmd added in v1.7.0

type DomainsListCmd struct {
	AccountID int `short:"a" help:"ID of account to list domains under"`
}

DomainsListCmd handles listing domains on Section

func (*DomainsListCmd) Run added in v1.7.0

func (c *DomainsListCmd) Run() (err error)

Run executes the command

type GS added in v1.10.0

type GS struct{}

GS ...

func (*GS) UpdateGitViaGit added in v1.10.0

func (g *GS) UpdateGitViaGit(c *DeployCmd, response UploadResponse) error

UpdateGitViaGit clones the application repository to a temporary directory then updates it with the latest payload id and pushes a new commit

type GitService added in v1.10.0

type GitService interface {
	UpdateGitViaGit(c *DeployCmd, response UploadResponse) error
}

GitService interface provides a way to interact with Git

type LoginCmd

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

LoginCmd handles authenticating the CLI against Section's API

func (*LoginCmd) In added in v1.3.0

func (c *LoginCmd) In() io.Reader

In returns the input to read from

func (*LoginCmd) Out added in v1.3.0

func (c *LoginCmd) Out() io.Writer

Out returns the output to write to

func (*LoginCmd) Run

func (c *LoginCmd) Run() (err error)

Run executes the command

type LogoutCmd added in v1.4.0

type LogoutCmd struct{}

LogoutCmd handles revoking previously set up authentication

func (*LogoutCmd) Run added in v1.4.0

func (c *LogoutCmd) Run() (err error)

Run executes the command

type LogsCmd added in v1.5.0

type LogsCmd struct {
	AccountID    int    `required short:"a" help:"ID of account to query"`
	AppID        int    `required short:"i" help:"ID of app to query"`
	AppPath      string `default:"nodejs" help:"Path of NodeJS application in environment repository."`
	InstanceName string `default:"" help:"Specific instance of NodeJS application running on Section platform."`
	Number       int    `short:"n" default:100 help:"Number of log lines to fetch."`
	Follow       bool   `help:"Displays recent logs and leaves the session open for logs to stream in. --instance-name required."`
}

LogsCmd returns logs from an application on Section's delivery platform

func (*LogsCmd) Run added in v1.5.0

func (c *LogsCmd) Run() (err error)

Run executes the command

type PayloadValue added in v0.0.5

type PayloadValue struct {
	ID string `json:"section_payload_id"`
}

PayloadValue represents the value of a trigger update payload.

type PsCmd added in v1.3.0

type PsCmd struct {
	AccountID int           `short:"a" help:"ID of account to query"`
	AppID     int           `short:"i" help:"ID of app to query"`
	AppPath   string        `default:"nodejs" help:"Path of NodeJS application in environment repository."`
	Watch     bool          `short:"w" help:"Run repeatedly, output status"`
	Interval  time.Duration `short:"t" default:"10s" help:"Interval to poll if watching"`
}

PsCmd checks an application's status on Section's delivery platform

func (*PsCmd) Run added in v1.3.0

func (c *PsCmd) Run() (err error)

Run executes the command

type UploadResponse added in v0.0.5

type UploadResponse struct {
	PayloadID string `json:"payloadID"`
}

UploadResponse represents the response from a request to the upload service.

type VersionCmd

type VersionCmd struct {
	LatestReleaseURL *url.URL      `hidden default:"https://api.github.com/repos/section/sectionctl/releases/latest"`
	Timeout          time.Duration `hidden default:"5s"`
	// contains filtered or unexported fields
}

VersionCmd handles authenticating the CLI against Section's API

func (*VersionCmd) In added in v1.7.0

func (c *VersionCmd) In() io.Reader

In returns the input to read from

func (*VersionCmd) Out added in v1.7.0

func (c *VersionCmd) Out() io.Writer

Out returns the output to write to

func (*VersionCmd) Run

func (c *VersionCmd) Run() (err error)

Run executes the `login` command

func (VersionCmd) String added in v1.9.0

func (c VersionCmd) String() string

type WhoAmICmd added in v1.3.0

type WhoAmICmd struct{}

WhoAmICmd returns information about the currently authenticated user

func (*WhoAmICmd) Run added in v1.3.0

func (c *WhoAmICmd) Run() (err error)

Run executes the command

Jump to

Keyboard shortcuts

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