config

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 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.
	AZs                []string `json:"availabilityZoneNames"`
	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.
	PermissionsBoundary string            `json:"permissionsBoundary,omitempty"` // Existing IAM permissions boundary.
	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.

type CustomizeEnv added in v0.5.0

type CustomizeEnv struct {
	ImportVPC                   *ImportVPC `json:"importVPC,omitempty"`
	VPCConfig                   *AdjustVPC `json:"adjustVPC,omitempty"`
	ImportCertARNs              []string   `json:"importCertARNs,omitempty"`
	InternalALBSubnets          []string   `json:"internalALBSubnets,omitempty"`
	EnableInternalALBVPCIngress bool       `json:"enableInternalALBVPCIngress,omitempty"`
}

CustomizeEnv represents the custom environment config.

func (*CustomizeEnv) IsEmpty added in v1.18.0

func (c *CustomizeEnv) IsEmpty() bool

IsEmpty returns true if CustomizeEnv is an empty 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.
	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.

	// Fields that store user configuration is no longer updated, but kept for retrofitting purpose.
	CustomConfig *CustomizeEnv `json:"customConfig,omitempty"` // Deprecated. Custom environment configuration by users. This configuration is now available in the env manifest.
	Telemetry    *Telemetry    `json:"telemetry,omitempty"`    // Deprecated. Optional environment telemetry features. This configuration is now available in the env manifest.
}

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 IAMIdentityGetter added in v1.16.0

type IAMIdentityGetter interface {
	Get() (identity.Caller, error)
}

IAMIdentityGetter is the interface to get information about the IAM user or role whose credentials are used to make AWS requests.

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 SSM added in v1.16.0

type SSM interface {
	PutParameter(in *ssm.PutParameterInput) (*ssm.PutParameterOutput, error)
	GetParametersByPath(in *ssm.GetParametersByPathInput) (*ssm.GetParametersByPathOutput, error)
	GetParameter(in *ssm.GetParameterInput) (*ssm.GetParameterOutput, error)
	DeleteParameter(in *ssm.DeleteParameterInput) (*ssm.DeleteParameterOutput, error)
}

SSM is the interface for the AWS SSM client.

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 NewSSMStore added in v1.16.0

func NewSSMStore(sts IAMIdentityGetter, ssm SSM, appRegion string) *Store

NewSSMStore 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

UpdateApplication updates the data in SSM about an application.

type Telemetry added in v1.14.0

type Telemetry struct {
	EnableContainerInsights bool `json:"containerInsights"`
}

Telemetry represents optional observability and monitoring configuration.

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 an app.
	Type string `json:"type"` // Type of the workload (ex: Load Balanced Web Service, etc)
}

Workload represents a deployable long-running service or task.

Jump to

Keyboard shortcuts

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