Documentation
¶
Index ¶
- Constants
- Variables
- func ProjectName(projectDirectory string) string
- type AzdContext
- func (c *AzdContext) ClearCopilotSession() error
- func (c *AzdContext) EnvironmentDirectory() string
- func (c *AzdContext) EnvironmentRoot(name string) string
- func (c *AzdContext) GetCopilotSession() *CopilotSession
- 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) SetCopilotSession(session *CopilotSession) error
- func (c *AzdContext) SetProjectDirectory(dir string)
- func (c *AzdContext) SetProjectState(state ProjectState) error
- type CopilotSession
- 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`")
)
var ProjectFileNames = []string{"azure.yaml", "azure.yml"}
ProjectFileNames lists all valid project file names, in order of preference
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) ClearCopilotSession ¶
func (c *AzdContext) ClearCopilotSession() error
ClearCopilotSession removes the saved Copilot session.
func (*AzdContext) EnvironmentDirectory ¶
func (c *AzdContext) EnvironmentDirectory() string
func (*AzdContext) EnvironmentRoot ¶
func (c *AzdContext) EnvironmentRoot(name string) string
func (*AzdContext) GetCopilotSession ¶
func (c *AzdContext) GetCopilotSession() *CopilotSession
GetCopilotSession returns the in-progress Copilot session, if any.
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
ProjectPath returns the path to the project file. If the context was created by searching for a project file, returns the actual file that was found. Otherwise, returns the default project file name joined with the project directory (useful when creating new projects).
func (*AzdContext) SetCopilotSession ¶
func (c *AzdContext) SetCopilotSession(session *CopilotSession) error
SetCopilotSession saves a Copilot session ID for resume support.
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 CopilotSession ¶
type CopilotSession struct {
SessionID string `json:"sessionId"`
Command string `json:"command"`
StartedAt string `json:"startedAt"`
}
CopilotSession tracks an in-progress Copilot agent session for resume support.
type ProjectState ¶
type ProjectState struct {
DefaultEnvironment string
}
ProjectState represents the state of the project.