config

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config implements CRUD operations for application, environment, service and pipeline configuration. This configuration contains the Copilot applications a customer has, and the environments and pipelines associated with each application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjustVPC added in v0.5.0

type AdjustVPC struct {
	CIDR               string   `json:"cidr"` // CIDR range for the VPC.
	PublicSubnetCIDRs  []string `json:"publicSubnetCIDRs"`
	PrivateSubnetCIDRs []string `json:"privateSubnetCIDRs"`
}

AdjustVPC holds the fields to adjust default VPC resources.

type Application

type Application struct {
	Name               string            `json:"name"`               // Name of an Application. Must be unique amongst other apps in the same account.
	AccountID          string            `json:"account"`            // AccountID this app is mastered in.
	Domain             string            `json:"domain"`             // Existing domain name in Route53. An empty domain name means the user does not have one.
	DomainHostedZoneID string            `json:"domainHostedZoneID"` // Existing domain hosted zone in Route53. An empty domain name means the user does not have one.
	Version            string            `json:"version"`            // The version of the app layout in the underlying datastore (e.g. SSM).
	Tags               map[string]string `json:"tags,omitempty"`     // Labels to apply to resources created within the app.
}

Application is a named collection of environments and services.

func (*Application) RequiresDNSDelegation

func (a *Application) RequiresDNSDelegation() bool

RequiresDNSDelegation returns true if we have to set up DNS Delegation resources

type CustomizeEnv added in v0.5.0

type CustomizeEnv struct {
	ImportVPC *ImportVPC `json:"importVPC,omitempty"`
	VPCConfig *AdjustVPC `json:"adjustVPC,omitempty"`
}

CustomizeEnv represents the custom environment config.

func NewCustomizeEnv added in v0.5.0

func NewCustomizeEnv(importVPC *ImportVPC, adjustVPC *AdjustVPC) *CustomizeEnv

NewCustomizeEnv returns a new CustomizeEnv struct.

type Environment

type Environment struct {
	App              string        `json:"app"`                    // Name of the app this environment belongs to.
	Name             string        `json:"name"`                   // Name of the environment, must be unique within a App.
	Region           string        `json:"region"`                 // Name of the region this environment is stored in.
	AccountID        string        `json:"accountID"`              // Account ID of the account this environment is stored in.
	Prod             bool          `json:"prod"`                   // Whether or not this environment is a production environment.
	RegistryURL      string        `json:"registryURL"`            // URL For ECR Registry for this environment.
	ExecutionRoleARN string        `json:"executionRoleARN"`       // ARN used by CloudFormation to make modification to the environment stack.
	ManagerRoleARN   string        `json:"managerRoleARN"`         // ARN for the manager role assumed to manipulate the environment and its services.
	CustomConfig     *CustomizeEnv `json:"customConfig,omitempty"` // Custom environment configuration by users.
}

Environment represents a deployment environment in an application.

type ErrNoSuchApplication

type ErrNoSuchApplication struct {
	ApplicationName string
	AccountID       string
	Region          string
}

ErrNoSuchApplication means an application couldn't be found within a specific account and region.

func (*ErrNoSuchApplication) Error

func (e *ErrNoSuchApplication) Error() string

func (*ErrNoSuchApplication) Is

func (e *ErrNoSuchApplication) Is(target error) bool

Is returns whether the provided error equals this error.

type ErrNoSuchEnvironment

type ErrNoSuchEnvironment struct {
	ApplicationName string
	EnvironmentName string
}

ErrNoSuchEnvironment means a specific environment couldn't be found in a specific project.

func (*ErrNoSuchEnvironment) Error

func (e *ErrNoSuchEnvironment) Error() string

func (*ErrNoSuchEnvironment) Is

func (e *ErrNoSuchEnvironment) Is(target error) bool

Is returns whether the provided error equals this error.

type ErrNoSuchJob added in v0.5.0

type ErrNoSuchJob struct {
	App  string
	Name string
}

ErrNoSuchJob means a specific job couldn't be found in a specific application.

func (*ErrNoSuchJob) Error added in v0.5.0

func (e *ErrNoSuchJob) Error() string

func (*ErrNoSuchJob) Is added in v0.5.0

func (e *ErrNoSuchJob) Is(target error) bool

Is returns whether the provided error equals this error.

type ErrNoSuchService

type ErrNoSuchService struct {
	App  string
	Name string
}

ErrNoSuchService means a specific service couldn't be found in a specific application.

func (*ErrNoSuchService) Error

func (e *ErrNoSuchService) Error() string

func (*ErrNoSuchService) Is

func (e *ErrNoSuchService) Is(target error) bool

Is returns whether the provided error equals this error.

type ErrNoSuchWorkload added in v0.6.0

type ErrNoSuchWorkload struct {
	App  string
	Name string
}

ErrNoSuchWorkload means a workload couldn't be found in a specific application.

func (*ErrNoSuchWorkload) Error added in v0.6.0

func (e *ErrNoSuchWorkload) Error() string

func (*ErrNoSuchWorkload) Is added in v0.6.0

func (e *ErrNoSuchWorkload) Is(target error) bool

Is returns whether the provided error equals this error

type ImportVPC added in v0.5.0

type ImportVPC struct {
	ID               string   `json:"id"` // ID for the VPC.
	PublicSubnetIDs  []string `json:"publicSubnetIDs"`
	PrivateSubnetIDs []string `json:"privateSubnetIDs"`
}

ImportVPC holds the fields to import VPC resources.

type Store

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

Store is in charge of fetching and creating applications, environment, services and other workloads, and pipeline configuration in SSM.

func NewStore

func NewStore() (*Store, error)

NewStore returns a new store, allowing you to query or create Applications, Environments, Services, and other workloads.

func (*Store) CreateApplication

func (s *Store) CreateApplication(application *Application) error

CreateApplication instantiates a new application, validates its uniqueness and stores it in SSM.

func (*Store) CreateEnvironment

func (s *Store) CreateEnvironment(environment *Environment) error

CreateEnvironment instantiates a new environment within an existing App. Skip if the environment already exists in the App.

func (*Store) CreateJob added in v0.5.0

func (s *Store) CreateJob(job *Workload) error

CreateJob instantiates a new job within an existing application. Skip if the job already exists in the application.

func (*Store) CreateService

func (s *Store) CreateService(svc *Workload) error

CreateService instantiates a new service within an existing application. Skip if the service already exists in the application.

func (*Store) DeleteApplication

func (s *Store) DeleteApplication(name string) error

DeleteApplication deletes the SSM parameter related to the application.

func (*Store) DeleteEnvironment

func (s *Store) DeleteEnvironment(appName, environmentName string) error

DeleteEnvironment removes an environment from SSM. If the environment does not exist in the store or is successfully deleted then returns nil. Otherwise, returns an error.

func (*Store) DeleteJob added in v0.5.0

func (s *Store) DeleteJob(appName, jobName string) error

DeleteJob removes a job from SSM. If the job does not exist in the store or is successfully deleted then returns nil. Otherwise, returns an error.

func (*Store) DeleteService

func (s *Store) DeleteService(appName, svcName string) error

DeleteService removes a service from SSM. If the service does not exist in the store or is successfully deleted then returns nil. Otherwise, returns an error.

func (*Store) GetApplication

func (s *Store) GetApplication(applicationName string) (*Application, error)

GetApplication fetches an application by name. If it can't be found, return a ErrNoSuchApplication

func (*Store) GetEnvironment

func (s *Store) GetEnvironment(appName string, environmentName string) (*Environment, error)

GetEnvironment gets an environment belonging to a particular application by name. If no environment is found it returns ErrNoSuchEnvironment.

func (*Store) GetJob added in v0.5.0

func (s *Store) GetJob(appName, jobName string) (*Workload, error)

GetJob gets a job belonging to a particular application by name. If no job by that name is found, it returns ErrNoSuchJob.

func (*Store) GetService

func (s *Store) GetService(appName, svcName string) (*Workload, error)

GetService gets a service belonging to a particular application by name. If no job or svc is found it returns ErrNoSuchService.

func (*Store) GetWorkload added in v0.6.0

func (s *Store) GetWorkload(appName, name string) (*Workload, error)

GetWorkload gets a workload belonging to an application by name.

func (*Store) ListApplications

func (s *Store) ListApplications() ([]*Application, error)

ListApplications returns the list of existing applications in the customer's account and region.

func (*Store) ListEnvironments

func (s *Store) ListEnvironments(appName string) ([]*Environment, error)

ListEnvironments returns all environments belonging to a particular application.

func (*Store) ListJobs added in v0.5.0

func (s *Store) ListJobs(appName string) ([]*Workload, error)

ListJobs returns all jobs belonging to a particular application.

func (*Store) ListServices

func (s *Store) ListServices(appName string) ([]*Workload, error)

ListServices returns all services belonging to a particular application.

func (*Store) ListWorkloads added in v0.6.0

func (s *Store) ListWorkloads(appName string) ([]*Workload, error)

ListWorkloads returns all workloads belonging to a particular application.

func (*Store) UpdateApplication added in v1.7.0

func (s *Store) UpdateApplication(application *Application) error

type Workload added in v0.5.0

type Workload struct {
	App  string `json:"app"`  // Name of the app this workload belongs to.
	Name string `json:"name"` // Name of the workload, which must be unique within a app.
	Type string `json:"type"` // Type of the workload (ex: Load Balanced Web Service, etc)
}

Workload represents a deployable long running service or task.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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