Documentation
¶
Index ¶
- Variables
- type CapabilityType
- type Extension
- func (e *Extension) Fail(err error)
- func (e *Extension) HasCapability(capability ...CapabilityType) bool
- func (e *Extension) Initialize()
- func (e *Extension) StdErr() *output.DynamicMultiWriter
- func (e *Extension) StdIn() io.Reader
- func (e *Extension) StdOut() *output.DynamicMultiWriter
- func (e *Extension) WaitUntilReady(ctx context.Context) error
- type ExtensionArtifact
- type ExtensionChecksum
- type ExtensionDependency
- type ExtensionExample
- type ExtensionMetadata
- type ExtensionVersion
- type FilterOptions
- type InvokeOptions
- type ListOptions
- type LookupOptions
- type Manager
- func (m *Manager) GetFromRegistry(ctx context.Context, extensionId string, options *FilterOptions) (*ExtensionMetadata, error)
- func (m *Manager) GetInstalled(options LookupOptions) (*Extension, error)
- func (m *Manager) Install(ctx context.Context, id string, options *FilterOptions) (*ExtensionVersion, error)
- func (m *Manager) ListFromRegistry(ctx context.Context, options *ListOptions) ([]*ExtensionMetadata, error)
- func (m *Manager) ListInstalled() (map[string]*Extension, error)
- func (m *Manager) Uninstall(id string) error
- func (m *Manager) Upgrade(ctx context.Context, extensionId string, options *FilterOptions) (*ExtensionVersion, error)
- type Registry
- type Runner
- type Source
- type SourceConfig
- type SourceKind
- type SourceManager
- func (sm *SourceManager) Add(ctx context.Context, name string, source *SourceConfig) error
- func (sm *SourceManager) CreateSource(ctx context.Context, config *SourceConfig) (Source, error)
- func (sm *SourceManager) Get(ctx context.Context, name string) (*SourceConfig, error)
- func (sm *SourceManager) List(ctx context.Context) ([]*SourceConfig, error)
- func (sm *SourceManager) Remove(ctx context.Context, name string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrExtensionNotFound = errors.New("extension not found") ErrInstalledExtensionNotFound = errors.New("extension not found") ErrRegistryExtensionNotFound = errors.New("extension not found in registry") ErrExtensionInstalled = errors.New("extension already installed") FeatureExtensions = alpha.MustFeatureKey("extensions") )
Functions ¶
This section is empty.
Types ¶
type CapabilityType ¶
type CapabilityType string
const ( // Custom commands expose new command groups & comments to AZD CustomCommandCapability CapabilityType = "custom-commands" // Lifecycle events enable extensions to subscribe to AZD project & service lifecycle events LifecycleEventsCapability CapabilityType = "lifecycle-events" )
type Extension ¶
type Extension struct { Id string `json:"id"` Namespace string `json:"namespace"` Capabilities []CapabilityType `json:"capabilities,omitempty"` DisplayName string `json:"displayName"` Description string `json:"description"` Version string `json:"version"` Usage string `json:"usage"` Path string `json:"path"` Source string `json:"source"` // contains filtered or unexported fields }
Extension represents an installed extension.
func (*Extension) HasCapability ¶
func (e *Extension) HasCapability(capability ...CapabilityType) bool
HasCapability checks if the extension has the specified capabilities.
func (*Extension) Initialize ¶
func (e *Extension) Initialize()
Initialize signals that the extension is ready.
func (*Extension) StdErr ¶
func (e *Extension) StdErr() *output.DynamicMultiWriter
StdErr returns the standard error writer for the extension.
func (*Extension) StdOut ¶
func (e *Extension) StdOut() *output.DynamicMultiWriter
StdOut returns the standard output writer for the extension.
type ExtensionArtifact ¶
type ExtensionArtifact struct { // URL is the location of the artifact URL string `json:"url"` // Checksum is the checksum of the artifact Checksum ExtensionChecksum `json:"checksum"` // AdditionalMetadata is a map of additional metadata for the artifact AdditionalMetadata map[string]any `json:"-"` }
ExtensionArtifact represents the artifact information of an extension An artifact can be a URL to a single binary file or a zip archive.
func (ExtensionArtifact) MarshalJSON ¶
func (c ExtensionArtifact) MarshalJSON() ([]byte, error)
func (*ExtensionArtifact) UnmarshalJSON ¶
func (c *ExtensionArtifact) UnmarshalJSON(data []byte) error
type ExtensionChecksum ¶
type ExtensionChecksum struct { // Algorithm is the algorithm used to calculate the checksum // Examples: sha256, sha512 Algorithm string `json:"algorithm"` // Value is the checksum value to match during the integrity check. Value string `json:"value"` }
ExtensionChecksum represents the checksum of an extension artifact used to validate the integrity of the artifact.
type ExtensionDependency ¶
type ExtensionDependency struct { // Id is the unique identifier of the dependent extension Id string `json:"id"` // Version is the version of the dependent extension and supports semantic versioning expressions. Version string `json:"version,omitempty"` }
ExtensionDependency represents a dependency of an extension
type ExtensionExample ¶
type ExtensionMetadata ¶
type ExtensionMetadata struct { // Id is a unique identifier for the extension Id string `json:"id"` // Namespace is used to expose extension commands within a named group Namespace string `json:"namespace,omitempty"` // DisplayName is the name of the extension DisplayName string `json:"displayName"` // Description is a brief description of the extension Description string `json:"description"` // Versions is a list of versions of the extension that are released over time. Versions []ExtensionVersion `json:"versions"` // Source is used to store the extension source from where the extension is fetched Source string `json:"source,omitempty"` // Tags is a list of tags that can be used to filter extensions Tags []string `json:"tags,omitempty"` // Platforms is a map of platform specific metadata required for extensions Platforms map[string]map[string]any `json:"platforms,omitempty"` }
Extension represents an extension in the registry
type ExtensionVersion ¶
type ExtensionVersion struct { // Capabilities is a list of capabilities that the extension provides Capabilities []CapabilityType `json:"capabilities,omitempty"` // Version is the version of the extension Version string `json:"version"` // Usage is show how to use the extension Usage string `json:"usage"` // Examples is a list of examples for the extension Examples []ExtensionExample `json:"examples"` // Artifacts is a map of artifacts for the extension key on platform (os & architecture) Artifacts map[string]ExtensionArtifact `json:"artifacts,omitempty"` // Dependencies is a list of dependencies for the extension // An extension with dependencies and no artifacts is considered an extension pack. // The dependencies are resolved and installed when the extension pack is installed. Dependencies []ExtensionDependency `json:"dependencies,omitempty"` // Entry point is the entry point for the extension // This will typically be the name of the executable or script to run EntryPoint string `json:"entryPoint,omitempty"` }
ExtensionVersion represents a version of an extension
type FilterOptions ¶
type FilterOptions struct { // Version is used to specify the version of the extension to install Version string // Source is used to specify the source of the extension to install Source string }
FilterOptions is used to filter extensions by version and source
type InvokeOptions ¶
type ListOptions ¶
type ListOptions struct { // Source is used to specify the source of the extension to install Source string // Tags is used to specify the tags of the extension to install Tags []string }
ListOptions is used to filter extensions by source and tags
type LookupOptions ¶
type LookupOptions struct { // Id is used to specify the id of the extension to install Id string // Namespace is used to specify the namespace of the extension to install Namespace string }
LookupOptions is used to lookup extensions by id or namespace
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is responsible for managing extensions
func NewManager ¶
func NewManager( configManager config.UserConfigManager, sourceManager *SourceManager, transport policy.Transporter, ) (*Manager, error)
NewManager creates a new extension manager
func (*Manager) GetFromRegistry ¶
func (m *Manager) GetFromRegistry( ctx context.Context, extensionId string, options *FilterOptions, ) (*ExtensionMetadata, error)
GetFromRegistry retrieves an extension from the registry by name
func (*Manager) GetInstalled ¶
func (m *Manager) GetInstalled(options LookupOptions) (*Extension, error)
GetInstalled retrieves an installed extension by name
func (*Manager) Install ¶
func (m *Manager) Install(ctx context.Context, id string, options *FilterOptions) (*ExtensionVersion, error)
Install an extension by name and optional version If no version is provided, the latest version is installed Latest version is determined by the last element in the Versions slice
func (*Manager) ListFromRegistry ¶
func (m *Manager) ListFromRegistry(ctx context.Context, options *ListOptions) ([]*ExtensionMetadata, error)
func (*Manager) ListInstalled ¶
ListInstalled retrieves a list of installed extensions
func (*Manager) Upgrade ¶
func (m *Manager) Upgrade(ctx context.Context, extensionId string, options *FilterOptions) (*ExtensionVersion, error)
Upgrade upgrades the extension to the specified version This is a convenience method that uninstalls the existing extension and installs the new version If the version is not specified, the latest version is installed
type Registry ¶
type Registry struct { // Extensions is a list of extensions in the registry Extensions []*ExtensionMetadata `json:"extensions"` }
Registry represents the registry.json structure
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(commandRunner exec.CommandRunner) *Runner
type Source ¶
type Source interface { // Name returns the name of the source. Name() string // ListExtensions returns a list of AZD compatible templates. ListExtensions(ctx context.Context) ([]*ExtensionMetadata, error) // GetExtension returns a template by path. GetExtension(ctx context.Context, extensionId string) (*ExtensionMetadata, error) }
type SourceConfig ¶
type SourceConfig struct { Name string `json:"name,omitempty"` Type SourceKind `json:"type,omitempty"` Location string `json:"location,omitempty"` }
SourceConfig represents the configuration for an extension source.
type SourceKind ¶
type SourceKind string
SourceKind represents the type of extension source.
const ( SourceKindFile SourceKind = "file" SourceKindUrl SourceKind = "url" )
type SourceManager ¶
type SourceManager struct {
// contains filtered or unexported fields
}
SourceManager manages extension sources.
func NewSourceManager ¶
func NewSourceManager( serviceLocator ioc.ServiceLocator, configManager config.UserConfigManager, transport policy.Transporter, ) *SourceManager
func (*SourceManager) Add ¶
func (sm *SourceManager) Add(ctx context.Context, name string, source *SourceConfig) error
Add adds a new extension source.
func (*SourceManager) CreateSource ¶
func (sm *SourceManager) CreateSource(ctx context.Context, config *SourceConfig) (Source, error)
Source returns a hydrated extension source for the current config.
func (*SourceManager) Get ¶
func (sm *SourceManager) Get(ctx context.Context, name string) (*SourceConfig, error)
Get returns an extension source by name.
func (*SourceManager) List ¶
func (sm *SourceManager) List(ctx context.Context) ([]*SourceConfig, error)
List returns a list of extension sources.