workspace

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

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

View Source
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

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 New

func New() (*Workspace, error)

New returns a workspace, used for reading and writing to user's local workspace.

func (*Workspace) AppNames added in v0.0.6

func (ws *Workspace) AppNames() ([]string, error)

AppNames returns the application names in the workspace.

func (*Workspace) Create

func (ws *Workspace) Create(projectName string) error

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) DeleteAll added in v0.0.6

func (ws *Workspace) DeleteAll() error

DeleteAll removes the local project directory.

func (*Workspace) DeleteApp added in v0.0.6

func (ws *Workspace) DeleteApp(name string) error

DeleteApp removes the application directory from the project directory.

func (*Workspace) DeletePipelineManifest added in v0.0.6

func (ws *Workspace) DeletePipelineManifest() error

DeletePipelineManifest removes the from the project directory.

func (*Workspace) ReadAddonsDir added in v0.0.7

func (ws *Workspace) ReadAddonsDir(appName string) ([]string, error)

ReadAddonsDir returns a list of file names under an application's "addons/" directory.

func (*Workspace) ReadAddonsFile added in v0.0.7

func (ws *Workspace) ReadAddonsFile(appName, fileName string) ([]byte, error)

ReadAddonsFile returns the contents of a file under the application's "addons/" directory.

func (*Workspace) ReadAppManifest added in v0.0.6

func (ws *Workspace) ReadAppManifest(appName string) ([]byte, error)

ReadAppManifest returns the contents of the application manifest under ecs-project/{appName}/manifest.yml.

func (*Workspace) ReadPipelineManifest added in v0.0.6

func (ws *Workspace) ReadPipelineManifest() ([]byte, error)

ReadPipelineManifest returns the contents of the pipeline manifest under ecs-project/pipeline.yml.

func (*Workspace) Summary

func (ws *Workspace) Summary() (*Summary, error)

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.

Jump to

Keyboard shortcuts

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