client

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BashExec added in v0.4.0

func BashExec(command string, opts ...cmd.Option) error

BashExec execute bash commands.

Types

type AWS added in v0.4.0

type AWS struct{}

AWS is a wrapper around aws commands.

func NewAWS added in v0.4.0

func NewAWS() *AWS

NewAWS returns a wrapper around AWS commands.

func (*AWS) CreateCodeCommitIAMUser added in v1.8.0

func (a *AWS) CreateCodeCommitIAMUser(userName string) (*IAMServiceCreds, error)

CreateCodeCommitIAMUser creates an IAM user that can push and pull from codecommit. Returns the credentials needed to interact with codecommit.

func (*AWS) CreateCodeCommitRepo added in v1.8.0

func (a *AWS) CreateCodeCommitRepo(name string) (cloneURL string, err error)

CreateCodeCommitRepo creates a repository with AWS CodeCommit and returns the HTTP git clone url.

func (*AWS) CreateECRRepo added in v0.4.0

func (a *AWS) CreateECRRepo(name string) (string, error)

CreateECRRepo runs: aws ecr create-repository --repository-name $name |

jq -r .repository.repositoryUri

func (*AWS) CreateStack added in v0.4.0

func (a *AWS) CreateStack(name, templatePath string) error

CreateStack runs: aws cloudformation create-stack

--stack-name $name
--template-body $templatePath

func (*AWS) DeleteAllDBClusterSnapshots added in v1.7.1

func (a *AWS) DeleteAllDBClusterSnapshots() error

DeleteAllDBClusterSnapshots removes all "manual" RDS cluster snapshots to avoid running into snapshot limits.

func (*AWS) DeleteCodeCommitIAMUser added in v1.8.0

func (a *AWS) DeleteCodeCommitIAMUser(userName, credentialID string) error

DeleteCodeCommitIAMUser deletes an IAM user that can access codecommit.

func (*AWS) DeleteCodeCommitRepo added in v1.8.0

func (a *AWS) DeleteCodeCommitRepo(name string) error

DeleteCodeCommitRepo delete a CodeCommit repository.

func (*AWS) DeleteECRRepo added in v0.4.0

func (a *AWS) DeleteECRRepo(name string) error

DeleteECRRepo runs: aws ecr delete-repository

--repository-name $name --force

func (*AWS) DeleteStack added in v0.4.0

func (a *AWS) DeleteStack(name string) error

DeleteStack runs: aws cloudformation delete-stack --stack-name $name

func (*AWS) ECRLoginPassword added in v0.4.0

func (a *AWS) ECRLoginPassword() (string, error)

ECRLoginPassword runs: aws ecr get-login-password

func (*AWS) GetFileSystemSize added in v1.7.0

func (a *AWS) GetFileSystemSize() (int, error)

GetFileSystemSize runs: aws efs describe-file-systems | jq -r '.FileSystems[0].SizeInBytes.Value', which returns the size in bytes of the first filesystem returned by the call.

func (*AWS) VPCStackOutput added in v0.4.0

func (a *AWS) VPCStackOutput(name string) ([]VPCStackOutput, error)

VPCStackOutput runs: aws cloudformation describe-stacks --stack-name $name |

jq -r .Stacks[0].Outputs

func (*AWS) WaitStackCreateComplete added in v0.4.0

func (a *AWS) WaitStackCreateComplete(name string) error

WaitStackCreateComplete runs: aws cloudformation wait stack-create-complete

--stack-name $name

func (*AWS) WaitStackDeleteComplete added in v0.4.0

func (a *AWS) WaitStackDeleteComplete(name string) error

WaitStackDeleteComplete runs: aws cloudformation wait stack-delete-complete

--stack-name $name

type AppInitRequest

type AppInitRequest struct {
	AppName string
	Domain  string
	Tags    map[string]string
}

AppInitRequest contains the parameters for calling copilot app init.

type AppShowOutput

type AppShowOutput struct {
	Name string `json:"name"`
	URI  string `json:"uri"`
}

AppShowOutput is the JSON output of app show.

type CLI

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

CLI is a wrapper around os.execs.

func NewCLI

func NewCLI() (*CLI, error)

NewCLI returns a wrapper around CLI.

func NewCLIWithDir added in v1.8.0

func NewCLIWithDir(workingDir string) (*CLI, error)

NewCLIWithDir returns the Copilot CLI such that the commands are run in the specified working directory.

func (*CLI) AppDelete

func (cli *CLI) AppDelete() (string, error)

AppDelete runs: copilot app delete --yes

func (*CLI) AppInit

func (cli *CLI) AppInit(opts *AppInitRequest) (string, error)

AppInit runs: copilot app init $a

--domain $d (optionally)
--resource-tags $k1=$v1,$k2=$k2 (optionally)

func (*CLI) AppList

func (cli *CLI) AppList() (string, error)

AppList runs: copilot app ls

func (*CLI) AppShow

func (cli *CLI) AppShow(appName string) (*AppShowOutput, error)

AppShow runs: copilot app show

--name $n
--json

func (*CLI) EnvDelete

func (cli *CLI) EnvDelete(envName string) (string, error)

EnvDelete runs: copilot env delete

--name $n
--yes

func (*CLI) EnvInit

func (cli *CLI) EnvInit(opts *EnvInitRequest) (string, error)

EnvInit runs: copilot env init

--name $n
--app $a
--profile $pr
--prod (optional)
--default-config (optional)
--import-private-subnets (optional)
--import-public-subnets (optional)
--import-vpc-id (optional)
--override-private-cidrs (optional)
--override-public-cidrs (optional)
--override-vpc-cidr (optional)

func (*CLI) EnvList

func (cli *CLI) EnvList(appName string) (*EnvListOutput, error)

EnvList runs: copilot env ls

--app $a
--json

func (*CLI) EnvShow

func (cli *CLI) EnvShow(opts *EnvShowRequest) (*EnvShowOutput, error)

EnvShow runs: copilot env show

--app $a
--name $n
--json

func (*CLI) Help

func (cli *CLI) Help() (string, error)

Help runs copilot --help

func (*CLI) Init

func (cli *CLI) Init(opts *InitRequest) (string, error)

Init runs: copilot init

--app $p
--svc $s
--svc-type $type
--tag $t
--dockerfile $d
--deploy (optionally)
--schedule $schedule (optionally)
--port $port (optionally)

func (*CLI) JobDelete added in v0.7.0

func (cli *CLI) JobDelete(jobName string) (string, error)

JobDelete runs: copilot job delete

--name $n
--yes

func (*CLI) JobDeploy added in v0.7.0

func (cli *CLI) JobDeploy(opts *JobDeployInput) (string, error)

JobDeploy runs: copilot job deploy

--name $n
--env $e
--tag $t

func (*CLI) JobInit added in v0.7.0

func (cli *CLI) JobInit(opts *JobInitInput) (string, error)

JobInit runs: copilot job init

--name $n
--dockerfile $d
--schedule $sched
--retries $r
--timeout $o

func (*CLI) JobList added in v0.7.0

func (cli *CLI) JobList(appName string) (*JobListOutput, error)

JobList runs: copilot job ls

--json?
--local?

func (*CLI) JobPackage added in v0.7.0

func (cli *CLI) JobPackage(opts *PackageInput) (string, error)

JobPackage runs: copilot job package

--output-dir $dir
--name $name
--env $env
--app $appname
--tag $tag

func (*CLI) PipelineDeploy added in v1.14.0

func (cli *CLI) PipelineDeploy(opts PipelineDeployInput) (string, error)

PipelineDeploy runs:

copilot pipeline deploy
--name $n
--yes

func (*CLI) PipelineInit added in v1.8.0

func (cli *CLI) PipelineInit(opts PipelineInitInput) (string, error)

PipelineInit runs:

copilot pipeline init
--name $n
--url $t
--git-branch $b
--environments $e[0],$e[1],...

func (*CLI) PipelineShow added in v1.8.0

func (cli *CLI) PipelineShow(opts PipelineShowInput) (PipelineShowOutput, error)

PipelineShow runs:

copilot pipeline show
--name $n
--json

func (*CLI) PipelineStatus added in v1.8.0

func (cli *CLI) PipelineStatus(opts PipelineStatusInput) (PipelineStatusOutput, error)

PipelineStatus runs:

copilot pipeline show
--name $n
--json

func (*CLI) StorageInit added in v1.5.0

func (cli *CLI) StorageInit(opts *StorageInitRequest) (string, error)

StorageInit runs: copilot storage init

	--name $n
	--storage-type $t
	--workload $w
	--engine $e
  --initial-db $d

func (*CLI) SvcDelete

func (cli *CLI) SvcDelete(serviceName string) (string, error)

SvcDelete runs: copilot svc delete

--name $n
--yes

func (*CLI) SvcDeploy

func (cli *CLI) SvcDeploy(opts *SvcDeployInput) (string, error)

SvcDeploy runs: copilot svc deploy

--name $n
--env $e
--tag $t

func (*CLI) SvcExec added in v1.4.0

func (cli *CLI) SvcExec(opts *SvcExecRequest) (string, error)

SvcExec runs: copilot svc exec

--app $p
--env $e
--name $n
--command $cmd
--container $ctnr
--task-id $td
--yes=false

func (*CLI) SvcInit

func (cli *CLI) SvcInit(opts *SvcInitRequest) (string, error)

SvcInit runs: copilot svc init

--name $n
--svc-type $t
--port $port

func (*CLI) SvcList

func (cli *CLI) SvcList(appName string) (*SvcListOutput, error)

SvcList runs: copilot svc ls

--app $p
--json

func (*CLI) SvcLogs

func (cli *CLI) SvcLogs(opts *SvcLogsRequest) ([]SvcLogsOutput, error)

SvcLogs runs: copilot svc logs

--app $p
--name $n
--since $s
--env $e
--json

func (*CLI) SvcPackage added in v0.7.0

func (cli *CLI) SvcPackage(opts *PackageInput) (string, error)

SvcPackage runs: copilot svc package

--output-dir $dir
--name $name
--env $env
--app $appname

func (*CLI) SvcPause added in v1.7.0

func (cli *CLI) SvcPause(opts *SvcPauseRequest) (string, error)

SvcPause runs: copilot svc pause

--app $p
--name $n
--env $e

func (*CLI) SvcResume added in v1.7.0

func (cli *CLI) SvcResume(opts *SvcResumeRequest) (string, error)

SvcResume runs: copilot svc pause

--app $p
--name $n
--env $e

func (*CLI) SvcShow

func (cli *CLI) SvcShow(opts *SvcShowRequest) (*SvcShowOutput, error)

SvcShow runs: copilot svc show

--app $p
--name $n
--json

func (*CLI) SvcStatus added in v0.4.0

func (cli *CLI) SvcStatus(opts *SvcStatusRequest) (*SvcStatusOutput, error)

SvcStatus runs: copilot svc status

--app $p
--env $e
--name $n
--json

func (*CLI) TaskDelete added in v1.2.0

func (cli *CLI) TaskDelete(opts *TaskDeleteInput) (string, error)

TaskDelete runs: copilot task delete

--name $n
--yes
--default (optionally)
--app $a (optionally)
--env $e (optionally)

func (*CLI) TaskExec added in v1.4.0

func (cli *CLI) TaskExec(opts *TaskExecRequest) (string, error)

TaskExec runs: copilot task exec

--app $p
--env $e
--name $n
--command $cmd
--yes=false

func (*CLI) TaskRun added in v0.3.0

func (cli *CLI) TaskRun(input *TaskRunInput) (string, error)

TaskRun runs: copilot task run

-n $t
--dockerfile $d
--app $a (optionally)
--env $e (optionally)
--command $c (optionally)
--env-vars $e1=$v1,$e2=$v2 (optionally)
--default (optionally)
--follow (optionally)

func (*CLI) Version

func (cli *CLI) Version() (string, error)

Version runs: copilot --version

type Docker added in v0.4.0

type Docker struct{}

Docker is a wrapper around Docker commands.

func NewDocker added in v0.4.0

func NewDocker() *Docker

NewDocker returns a wrapper around Docker commands.

func (*Docker) Build added in v0.4.0

func (d *Docker) Build(uri, path string) error

Build runs: docker build -t $uri $path

func (*Docker) Login added in v0.4.0

func (d *Docker) Login(uri, password string) error

Login runs: docker login -u AWS --password-stdin $uri

func (*Docker) Push added in v0.4.0

func (d *Docker) Push(uri string) error

Push runs: docker push $uri

type EnvDescription

type EnvDescription struct {
	Name          string `json:"name"`
	App           string `json:"app"`
	Region        string `json:"region"`
	Account       string `json:"accountID"`
	Prod          bool   `json:"prod"`
	RegistryURL   string `json:"registryURL"`
	ExecutionRole string `json:"executionRoleARN"`
	ManagerRole   string `json:"managerRoleARN"`
}

EnvDescription contains descriptive info about an environment.

type EnvInitRequest

type EnvInitRequest struct {
	AppName       string
	EnvName       string
	Profile       string
	Prod          bool
	CustomizedEnv bool
	VPCImport     EnvInitRequestVPCImport
	VPCConfig     EnvInitRequestVPCConfig
}

EnvInitRequest contains the parameters for calling copilot env init.

type EnvInitRequestVPCConfig added in v0.4.0

type EnvInitRequestVPCConfig struct {
	CIDR               string
	AZs                string
	PublicSubnetCIDRs  string
	PrivateSubnetCIDRs string
}

EnvInitRequestVPCConfig contains the parameters for configuring VPC config when calling copilot env init.

type EnvInitRequestVPCImport added in v0.4.0

type EnvInitRequestVPCImport struct {
	ID               string
	PublicSubnetIDs  string
	PrivateSubnetIDs string
}

EnvInitRequestVPCImport contains the parameters for configuring VPC import when calling copilot env init.

func (EnvInitRequestVPCImport) IsSet added in v0.4.0

func (e EnvInitRequestVPCImport) IsSet() bool

IsSet returns true if all fields are set.

type EnvListOutput

type EnvListOutput struct {
	Envs []EnvDescription `json:"environments"`
}

EnvListOutput is the JSON output of env list.

type EnvShowOutput

type EnvShowOutput struct {
	Environment EnvDescription      `json:"environment"`
	Services    []EnvShowServices   `json:"services"`
	Tags        map[string]string   `json:"tags"`
	Resources   []map[string]string `json:"resources"`
}

EnvShowOutput is the JSON output of env show.

type EnvShowRequest

type EnvShowRequest struct {
	AppName string
	EnvName string
}

EnvShowRequest contains the parameters for calling copilot env show.

type EnvShowServices

type EnvShowServices struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

EnvShowServices contains brief info about a service.

type IAMServiceCreds added in v1.8.0

type IAMServiceCreds struct {
	UserName     string `json:"ServiceUserName"`             // Git username.
	Password     string `json:"ServicePassword"`             // Git password.
	CredentialID string `json:"ServiceSpecificCredentialId"` // ID for the creds in order to delete them.
}

IAMServiceCreds represents service-specific IAM credentials.

type Image added in v0.4.0

type Image struct {
	ID     string
	Digest string
}

Image contains very basic info of a container image.

type InitRequest

type InitRequest struct {
	AppName      string
	WorkloadName string
	Deploy       bool
	ImageTag     string
	Dockerfile   string
	WorkloadType string
	SvcPort      string
	Schedule     string
}

InitRequest contains the parameters for calling copilot init.

type JobDeployInput added in v0.7.0

type JobDeployInput struct {
	Name     string
	EnvName  string
	ImageTag string
}

JobDeployInput contains the parameters for calling copilot job deploy.

type JobInitInput added in v0.7.0

type JobInitInput struct {
	Name       string
	Dockerfile string
	Schedule   string
	Retries    string
	Timeout    string
}

JobInitInput contains the parameters for calling copilot job init.

type JobListOutput added in v0.7.0

type JobListOutput struct {
	Jobs []WkldDescription `json:"jobs"`
}

JobListOutput is the JSON output for job list.

type PackageInput added in v0.7.0

type PackageInput struct {
	AppName string
	Name    string
	Env     string
	Dir     string
	Tag     string
}

PackageInput contains the parameters for calling copilot job package.

type PipelineDeployInput added in v1.16.0

type PipelineDeployInput struct {
	Name string
}

PipelineDeployInput contains the parameters for calling copilot pipeline deploy.

type PipelineInitInput added in v1.16.0

type PipelineInitInput struct {
	Name         string
	URL          string
	GitBranch    string
	Environments []string
}

PipelineInitInput contains the parameters for calling copilot pipeline init.

type PipelineShowInput added in v1.16.0

type PipelineShowInput struct {
	Name string
}

PipelineShowInput contains the parameters for calling copilot pipeline show.

type PipelineShowOutput added in v1.8.0

type PipelineShowOutput struct {
	Name   string `json:"name"`
	Stages []struct {
		Name     string `json:"name"`
		Category string `json:"category"`
	} `json:"stages"`
}

PipelineShowOutput represents the JSON output of the "pipeline show" command.

type PipelineStatusInput added in v1.16.0

type PipelineStatusInput struct {
	Name string
}

PipelineStatusInput contains the parameters for calling copilot pipeline status.

type PipelineStatusOutput added in v1.8.0

type PipelineStatusOutput struct {
	States []struct {
		Name    string `json:"stageName"`
		Actions []struct {
			Name   string `json:"name"`
			Status string `json:"status"`
		} `json:"actions"`
	} `json:"stageStates"`
}

PipelineStatusOutput represents the JSON output of the "pipeline status" command.

type StorageInitRequest added in v1.5.0

type StorageInitRequest struct {
	StorageName  string
	StorageType  string
	WorkloadName string

	RDSEngine     string
	InitialDBName string
}

StorageInitRequest contains the parameters for calling copilot storage init.

type SvcDeployInput

type SvcDeployInput struct {
	Name     string
	EnvName  string
	ImageTag string
	Force    bool
}

SvcDeployInput contains the parameters for calling copilot svc deploy.

type SvcExecRequest added in v1.4.0

type SvcExecRequest struct {
	Name      string
	AppName   string
	Command   string
	TaskID    string
	Container string
	EnvName   string
}

SvcExecRequest contains the parameters for calling copilot svc exec.

type SvcInitRequest

type SvcInitRequest struct {
	Name               string
	SvcType            string
	Dockerfile         string
	Image              string
	SvcPort            string
	TopicSubscriptions []string
}

SvcInitRequest contains the parameters for calling copilot svc init.

type SvcListOutput

type SvcListOutput struct {
	Services []WkldDescription `json:"services"`
}

SvcListOutput is the JSON output for svc list.

type SvcLogsOutput

type SvcLogsOutput struct {
	LogStreamName string `json:"logStreamName"`
	IngestionTime int64  `json:"ingestionTime"`
	Timestamp     int64  `json:"timestamp"`
	Message       string `json:"message"`
}

SvcLogsOutput is the JSON output of svc logs.

type SvcLogsRequest

type SvcLogsRequest struct {
	AppName string
	EnvName string
	Name    string
	Since   string
}

SvcLogsRequest contains the parameters for calling copilot svc logs.

type SvcPauseRequest added in v1.7.0

type SvcPauseRequest struct {
	AppName string
	EnvName string
	Name    string
}

SvcPauseRequest contains the parameters for calling copilot svc logs.

type SvcResumeRequest added in v1.7.0

type SvcResumeRequest struct {
	AppName string
	EnvName string
	Name    string
}

SvcResumeRequest contains the parameters for calling copilot svc logs.

type SvcShowConfigurations

type SvcShowConfigurations struct {
	Environment string `json:"environment"`
	Port        string `json:"port"`
	Tasks       string `json:"tasks"`
	CPU         string `json:"cpu"`
	Memory      string `json:"memory"`
}

SvcShowConfigurations contains serialized configuration parameters for a service.

type SvcShowOutput

type SvcShowOutput struct {
	SvcName            string                            `json:"service"`
	Type               string                            `json:"type"`
	AppName            string                            `json:"application"`
	Configs            []SvcShowConfigurations           `json:"configurations"`
	ServiceDiscoveries []SvcShowServiceDiscoveries       `json:"serviceDiscovery"`
	Routes             []SvcShowRoutes                   `json:"routes"`
	Variables          []SvcShowVariables                `json:"variables"`
	Resources          map[string][]*SvcShowResourceInfo `json:"resources"`
}

SvcShowOutput is the JSON output of the svc show.

type SvcShowRequest

type SvcShowRequest struct {
	Name      string
	AppName   string
	Resources bool
}

SvcShowRequest contains the parameters for calling copilot svc show.

type SvcShowResourceInfo added in v1.7.0

type SvcShowResourceInfo struct {
	Type       string `json:"type"`
	PhysicalID string `json:"physicalID"`
}

SvcShowResourceInfo contains serialized resource info for a service.

type SvcShowRoutes

type SvcShowRoutes struct {
	Environment string `json:"environment"`
	URL         string `json:"url"`
}

SvcShowRoutes contains serialized route parameters for a web service.

type SvcShowServiceDiscoveries

type SvcShowServiceDiscoveries struct {
	Environment []string `json:"environment"`
	Namespace   string   `json:"namespace"`
}

SvcShowServiceDiscoveries contains serialized service discovery info for an service.

type SvcShowVariables

type SvcShowVariables struct {
	Environment string `json:"environment"`
	Name        string `json:"name"`
	Value       string `json:"value"`
}

SvcShowVariables contains serialized environment variables for a service.

type SvcStatusAlarmInfo added in v0.4.0

type SvcStatusAlarmInfo struct {
	Arn          string    `json:"arn"`
	Name         string    `json:"name"`
	Reason       string    `json:"reason"`
	Status       string    `json:"status"`
	Type         string    `json:"type"`
	UpdatedTimes time.Time `json:"updatedTimes"`
}

SvcStatusAlarmInfo contains CloudWatch alarm status info.

type SvcStatusOutput added in v0.4.0

type SvcStatusOutput struct {
	Status    string `json:"status"`
	Service   SvcStatusServiceInfo
	Tasks     []SvcStatusTaskInfo  `json:"tasks"`
	Alarms    []SvcStatusAlarmInfo `json:"alarms"`
	LogEvents []*SvcLogsOutput     `json:"logEvents"`
}

SvcStatusOutput is the JSON output of the svc status.

type SvcStatusRequest added in v0.4.0

type SvcStatusRequest struct {
	Name    string
	AppName string
	EnvName string
}

SvcStatusRequest contains the parameters for calling copilot svc status.

type SvcStatusServiceInfo added in v0.4.0

type SvcStatusServiceInfo struct {
	DesiredCount     int64     `json:"desiredCount"`
	RunningCount     int64     `json:"runningCount"`
	Status           string    `json:"status"`
	LastDeploymentAt time.Time `json:"lastDeploymentAt"`
	TaskDefinition   string    `json:"taskDefinition"`
}

SvcStatusServiceInfo contains the status info of a service.

type SvcStatusTaskInfo added in v0.4.0

type SvcStatusTaskInfo struct {
	Health        string    `json:"health"`
	ID            string    `json:"id"`
	Images        []Image   `json:"images"`
	LastStatus    string    `json:"lastStatus"`
	StartedAt     time.Time `json:"startedAt"`
	StoppedAt     time.Time `json:"stoppedAt"`
	StoppedReason string    `json:"stoppedReason"`
}

SvcStatusTaskInfo contains the status info of a task.

type TaskDeleteInput added in v1.2.0

type TaskDeleteInput struct {
	App     string
	Env     string
	Name    string
	Default bool
}

TaskDeleteInput contains the parameters for calling copilot task delete.

type TaskExecRequest added in v1.4.0

type TaskExecRequest struct {
	Name    string
	AppName string
	Command string
	EnvName string
}

TaskExecRequest contains the parameters for calling copilot task exec.

type TaskRunInput added in v0.3.0

type TaskRunInput struct {
	AppName string

	GroupName string

	Image      string
	Dockerfile string

	Subnets        []string
	SecurityGroups []string
	Env            string

	Command string
	EnvVars string

	Default bool
	Follow  bool
}

TaskRunInput contains the parameters for calling copilot task run.

type VPCStackOutput added in v0.4.0

type VPCStackOutput struct {
	OutputKey   string
	OutputValue string
	ExportName  string
}

VPCStackOutput is the output for VPC stack.

type WkldDescription added in v0.7.0

type WkldDescription struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	AppName string `json:"app"`
}

WkldDescription contains the brief description of the workload.

Jump to

Keyboard shortcuts

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