Documentation ¶
Index ¶
- Constants
- Variables
- func ProjectName(projectDirectory string) string
- type AzdContext
- func (c *AzdContext) EnvironmentDirectory() string
- func (c *AzdContext) EnvironmentRoot(name string) string
- func (c *AzdContext) GetDefaultEnvironmentName() (string, error)
- func (c *AzdContext) GetEnvironmentWorkDirectory(name string) string
- func (c *AzdContext) ProjectDirectory() string
- func (c *AzdContext) ProjectPath() string
- func (c *AzdContext) SetProjectDirectory(dir string)
- func (c *AzdContext) SetProjectState(state ProjectState) error
- type ProjectState
Constants ¶
const ConfigFileName = "config.json"
const ConfigFileVersion = 1
const DotEnvFileName = ".env"
const EnvironmentDirectoryName = ".azure"
const ProjectFileName = "azure.yaml"
Variables ¶
var (
ErrNoProject = errors.New("no project exists; to create a new project, run `azd init`")
)
Functions ¶
func ProjectName ¶
ProjectName returns a suitable project name from the given project directory.
Types ¶
type AzdContext ¶
type AzdContext struct {
// contains filtered or unexported fields
}
func NewAzdContext ¶
func NewAzdContext() (*AzdContext, error)
Creates context with project directory set to the nearest project file found by calling NewAzdContextFromWd on the current working directory.
func NewAzdContextFromWd ¶
func NewAzdContextFromWd(wd string) (*AzdContext, error)
Creates context with project directory set to the nearest project file found.
The project file is first searched for in the working directory, if not found, the parent directory is searched recursively up to root. If no project file is found, errNoProject is returned.
func NewAzdContextWithDirectory ¶
func NewAzdContextWithDirectory(projectDirectory string) *AzdContext
Creates context with project directory set to the desired directory.
func (*AzdContext) EnvironmentDirectory ¶
func (c *AzdContext) EnvironmentDirectory() string
func (*AzdContext) EnvironmentRoot ¶
func (c *AzdContext) EnvironmentRoot(name string) string
func (*AzdContext) GetDefaultEnvironmentName ¶
func (c *AzdContext) GetDefaultEnvironmentName() (string, error)
GetDefaultEnvironmentName returns the name of the default environment. Returns an empty string if a default environment has not been set.
func (*AzdContext) GetEnvironmentWorkDirectory ¶
func (c *AzdContext) GetEnvironmentWorkDirectory(name string) string
func (*AzdContext) ProjectDirectory ¶
func (c *AzdContext) ProjectDirectory() string
func (*AzdContext) ProjectPath ¶
func (c *AzdContext) ProjectPath() string
func (*AzdContext) SetProjectDirectory ¶
func (c *AzdContext) SetProjectDirectory(dir string)
func (*AzdContext) SetProjectState ¶
func (c *AzdContext) SetProjectState(state ProjectState) error
SetProjectState persists the state of the project to the file system, like the default environment.
type ProjectState ¶
type ProjectState struct {
DefaultEnvironment string
}
ProjectState represents the state of the project.