config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: Apache-2.0 Imports: 9 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

View Source
const (
	// ServiceCfnTemplateNameFormat is the base output file name when `service package`
	// is called. This is also used to render the pipeline CFN template.
	ServiceCfnTemplateNameFormat = "%s.stack.yml"
	// ServiceCfnTemplateConfigurationNameFormat is the base output configuration
	// file name when `service package` is called. It's also used to render the
	// pipeline CFN template.
	ServiceCfnTemplateConfigurationNameFormat = "%s-%s.params.json"
	// AddonsCfnTemplateNameFormat is the addons output file name when `service package`
	// is called.
	AddonsCfnTemplateNameFormat = "%s.addons.stack.yml"
)
View Source
const EnvNameNone = "None"

Variables

This section is empty.

Functions

This section is empty.

Types

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.
	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 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.
}

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 ErrNoSuchService

type ErrNoSuchService struct {
	ApplicationName string
	ServiceName     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 Service

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

Service represents a deployable long running service or task.

type Store

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

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

func NewStore

func NewStore() (*Store, error)

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

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) CreateService

func (s *Store) CreateService(svc *Service) 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) 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) GetService

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

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

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) ListServices

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

ListServices returns all services belonging to a particular application.

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