azdcontext

package
v0.0.0-...-88ad9bc Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = "config.json"
View Source
const ConfigFileVersion = 1
View Source
const DotEnvFileName = ".env"
View Source
const EnvironmentDirectoryName = ".azure"
View Source
const ProjectFileName = "azure.yaml"

Variables

View Source
var (
	ErrNoProject = errors.New("no project exists; to create a new project, run `azd init`")
)

Functions

func ProjectName

func ProjectName(projectDirectory string) string

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.

Jump to

Keyboard shortcuts

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