Documentation ¶
Overview ¶
Package workspace contains functionality to manage a user's local workspace. This includes creating a project directory, reading and writing a summary file to that directory and managing (reading, writing, and listing) infrastructure-as-code files. The typical workspace will be structured like:
. ├── ecs-project (project directory) │ ├── .ecs-workspace (workspace summary) │ └── my-app │ │ └── manifest.yml (application manifest) │ ├── buildspec.yml (buildspec for the pipeline's build stage) │ └── pipeline.yml (pipeline manifest) └── my-app (customer application)
Index ¶
- Constants
- type ErrNoProjectAssociated
- type ErrWorkspaceHasExistingProject
- type ErrWorkspaceNotFound
- type Summary
- type Workspace
- func (ws *Workspace) AppNames() ([]string, error)
- func (ws *Workspace) Create(projectName string) error
- func (ws *Workspace) DeleteAll() error
- func (ws *Workspace) DeleteApp(name string) error
- func (ws *Workspace) DeletePipelineManifest() error
- func (ws *Workspace) ReadAddonsDir(appName string) ([]string, error)
- func (ws *Workspace) ReadAddonsFile(appName, fileName string) ([]byte, error)
- func (ws *Workspace) ReadAppManifest(appName string) ([]byte, error)
- func (ws *Workspace) ReadPipelineManifest() ([]byte, error)
- func (ws *Workspace) Summary() (*Summary, error)
- func (ws *Workspace) WriteAppManifest(marshaler encoding.BinaryMarshaler, appName string) (string, error)
- func (ws *Workspace) WritePipelineBuildspec(marshaler encoding.BinaryMarshaler) (string, error)
- func (ws *Workspace) WritePipelineManifest(marshaler encoding.BinaryMarshaler) (string, error)
Constants ¶
const (
// ProjectDirectoryName is the name of the directory where generated infrastructure code will be stored.
ProjectDirectoryName = "ecs-project"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrNoProjectAssociated ¶
type ErrNoProjectAssociated struct{}
ErrNoProjectAssociated means we couldn't locate a workspace summary file.
func (*ErrNoProjectAssociated) Error ¶
func (e *ErrNoProjectAssociated) Error() string
type ErrWorkspaceHasExistingProject ¶
type ErrWorkspaceHasExistingProject struct {
ExistingProjectName string
}
ErrWorkspaceHasExistingProject means we tried to create a workspace for a project but it already belongs to another project.
func (*ErrWorkspaceHasExistingProject) Error ¶
func (e *ErrWorkspaceHasExistingProject) Error() string
type ErrWorkspaceNotFound ¶
type ErrWorkspaceNotFound struct { CurrentDirectory string ManifestDirectoryName string NumberOfLevelsChecked int }
ErrWorkspaceNotFound means we couldn't locate a workspace root.
func (*ErrWorkspaceNotFound) Error ¶
func (e *ErrWorkspaceNotFound) Error() string
type Summary ¶ added in v0.0.6
type Summary struct {
ProjectName string `yaml:"project"`
}
Summary is a description of what's associated with this workspace.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace manages a local workspace, including creating and managing manifest files.
func (*Workspace) AppNames ¶ added in v0.0.6
AppNames returns the application names in the workspace.
func (*Workspace) Create ¶
Create creates the manifest directory (if it doesn't already exist) in the current working directory, and saves a summary in the manifest directory with the project name.
func (*Workspace) DeleteApp ¶ added in v0.0.6
DeleteApp removes the application directory from the project directory.
func (*Workspace) DeletePipelineManifest ¶ added in v0.0.6
DeletePipelineManifest removes the from the project directory.
func (*Workspace) ReadAddonsDir ¶ added in v0.0.7
ReadAddonsDir returns a list of file names under an application's "addons/" directory.
func (*Workspace) ReadAddonsFile ¶ added in v0.0.7
ReadAddonsFile returns the contents of a file under the application's "addons/" directory.
func (*Workspace) ReadAppManifest ¶ added in v0.0.6
ReadAppManifest returns the contents of the application manifest under ecs-project/{appName}/manifest.yml.
func (*Workspace) ReadPipelineManifest ¶ added in v0.0.6
ReadPipelineManifest returns the contents of the pipeline manifest under ecs-project/pipeline.yml.
func (*Workspace) Summary ¶
Summary returns a summary of the workspace - including the project name.
func (*Workspace) WriteAppManifest ¶ added in v0.0.6
func (ws *Workspace) WriteAppManifest(marshaler encoding.BinaryMarshaler, appName string) (string, error)
WriteAppManifest writes the application manifest under the project directory. If successful returns the full path of the file, otherwise returns an empty string and the 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 project 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 project directory. If successful returns the full path of the file, otherwise returns an empty string and the error.