Documentation ¶
Index ¶
- Variables
- type Extension
- type ExtensionArtifact
- type ExtensionChecksum
- type ExtensionDependency
- type ExtensionExample
- type ExtensionMetadata
- type ExtensionVersion
- type GetInstalledOptions
- type ListOptions
- type Manager
- func (m *Manager) GetFromRegistry(ctx context.Context, name string) (*ExtensionMetadata, error)
- func (m *Manager) GetInstalled(options GetInstalledOptions) (*Extension, error)
- func (m *Manager) Initialize() error
- func (m *Manager) Install(ctx context.Context, id string, version string) (*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, name string, version string) (*ExtensionVersion, error)
- type Registry
- 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 ¶
Functions ¶
This section is empty.
Types ¶
type Extension ¶
type Extension struct { Id string `json:"id"` Namespace string `json:"namespace"` DisplayName string `json:"displayName"` Description string `json:"description"` Version string `json:"version"` Usage string `json:"usage"` Path string `json:"path"` Source string `json:"source"` }
Extension represents an installed 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 { // 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 GetInstalledOptions ¶
type ListOptions ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager( configManager config.UserConfigManager, sourceManager *SourceManager, transport policy.Transporter, ) *Manager
NewManager creates a new extension manager
func (*Manager) GetFromRegistry ¶
GetFromRegistry retrieves an extension from the registry by name
func (*Manager) GetInstalled ¶
func (m *Manager) GetInstalled(options GetInstalledOptions) (*Extension, error)
GetInstalled retrieves an installed extension by name
func (*Manager) Install ¶
func (m *Manager) Install(ctx context.Context, id string, version string) (*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, name string, version string) (*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 Source ¶
type Source interface { // Name returns the name of the source. Name() string // ListTemplates returns a list of AZD compatible templates. ListExtensions(ctx context.Context) ([]*ExtensionMetadata, error) // GetTemplate returns a template by path. GetExtension(ctx context.Context, name 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.