Documentation
¶
Overview ¶
Package workspace contains functionality to manage a user's local workspace. This includes creating an application directory, reading and writing a summary file to associate the workspace with the application, and managing infrastructure-as-code files. The typical workspace will be structured like:
. ├── copilot (application directory) │ ├── .workspace (workspace summary) │ └── my-service │ │ └── manifest.yml (service manifest) │ ├── buildspec.yml (buildspec for the pipeline's build stage) │ └── pipeline.yml (pipeline manifest) └── my-service-src (customer service code)
Index ¶
- Constants
- Variables
- type ErrFileExists
- type Summary
- type Workspace
- func (ws *Workspace) Create(appName string) error
- func (ws *Workspace) DeleteWorkspaceFile() error
- func (ws *Workspace) ReadAddon(svc, fname string) ([]byte, error)
- func (ws *Workspace) ReadAddonsDir(svcName string) ([]string, error)
- func (ws *Workspace) ReadPipelineManifest() ([]byte, error)
- func (ws *Workspace) ReadServiceManifest(name string) ([]byte, error)
- func (ws *Workspace) ServiceNames() ([]string, error)
- func (ws *Workspace) Summary() (*Summary, error)
- func (ws *Workspace) WriteAddon(content encoding.BinaryMarshaler, svc, name string) (string, error)
- func (ws *Workspace) WritePipelineBuildspec(marshaler encoding.BinaryMarshaler) (string, error)
- func (ws *Workspace) WritePipelineManifest(marshaler encoding.BinaryMarshaler) (string, error)
- func (ws *Workspace) WriteServiceManifest(marshaler encoding.BinaryMarshaler, name string) (string, error)
Constants ¶
const ( // CopilotDirName is the name of the directory where generated infrastructure code for an application will be stored. CopilotDirName = "copilot" // SummaryFileName is the name of the file that is associated with the application. SummaryFileName = ".workspace" )
Variables ¶
var ErrNoPipelineInWorkspace = errors.New("no pipeline manifest found in the workspace")
ErrNoPipelineInWorkspace means there was no pipeline manifest in the workspace dir.
Functions ¶
This section is empty.
Types ¶
type ErrFileExists ¶ added in v0.0.8
type ErrFileExists struct {
FileName string
}
ErrFileExists means we tried to create an existing file.
func (*ErrFileExists) Error ¶ added in v0.0.8
func (e *ErrFileExists) Error() string
type Summary ¶ added in v0.0.6
type Summary struct {
Application string `yaml:"application"` // Name of the application.
}
Summary is a description of what's associated with this workspace.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace typically represents a Git repository where the user has its infrastructure-as-code files as well as source files.
func (*Workspace) Create ¶
Create creates the copilot directory (if it doesn't already exist) in the current working directory, and saves a summary with the application name.
func (*Workspace) DeleteWorkspaceFile ¶ added in v0.1.0
DeleteWorkspaceFile removes the .workspace file under copilot/ directory. This will be called during app delete, we do not want to delete any other generated files
func (*Workspace) ReadAddon ¶ added in v0.1.0
ReadAddon returns the contents of a file under the service's "addons/" directory.
func (*Workspace) ReadAddonsDir ¶ added in v0.0.7
ReadAddonsDir returns a list of file names under a service's "addons/" directory.
func (*Workspace) ReadPipelineManifest ¶ added in v0.0.6
ReadPipelineManifest returns the contents of the pipeline manifest under copilot/pipeline.yml.
func (*Workspace) ReadServiceManifest ¶ added in v0.1.0
ReadServiceManifest returns the contents of the service manifest under copilot/{name}/manifest.yml.
func (*Workspace) ServiceNames ¶ added in v0.1.0
ServiceNames returns the names of the services in the workspace.
func (*Workspace) Summary ¶
Summary returns a summary of the workspace - including the application name.
func (*Workspace) WriteAddon ¶ added in v0.1.0
WriteAddon writes the content of an addon file under "{svc}/addons/{name}.yml". If successful returns the full path of the file, otherwise an empty string and an error.
func (*Workspace) WritePipelineBuildspec ¶ added in v0.0.6
func (ws *Workspace) WritePipelineBuildspec(marshaler encoding.BinaryMarshaler) (string, error)
WritePipelineBuildspec writes the pipeline buildspec under the copilot/ directory. If successful returns the full path of the file, otherwise returns an empty string and the error.
func (*Workspace) WritePipelineManifest ¶ added in v0.0.6
func (ws *Workspace) WritePipelineManifest(marshaler encoding.BinaryMarshaler) (string, error)
WritePipelineManifest writes the pipeline manifest under the copilot directory. If successful returns the full path of the file, otherwise returns an empty string and the error.
func (*Workspace) WriteServiceManifest ¶ added in v0.1.0
func (ws *Workspace) WriteServiceManifest(marshaler encoding.BinaryMarshaler, name string) (string, error)
WriteServiceManifest writes the service's manifest under the copilot/{name}/ directory.