assetapi

package
v1.96.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AssetTypeCommand = "asset-type"
View Source
const TaskInfosCommand = "task-infos"

Variables

This section is empty.

Functions

func NewAssetTypeCmd

func NewAssetTypeCmd(assetType AssetType) *cobra.Command

func NewTaskInfosCommand

func NewTaskInfosCommand(taskInfos TaskInfos) *cobra.Command

NewTaskInfosCommand returns a command that marshals the provided taskInfos as JSON and prints it to stdout.

func UpgradeConfigError

func UpgradeConfigError(err error, output []byte) error

Types

type Asset

type Asset struct {
	// AssetPath is the path to the asset.
	AssetPath string

	// AssetType is the type of asset.
	AssetType AssetType

	// TaskInfos is the information for asset-provided tasks. nil if the asset does not have any asset-provided tasks.
	TaskInfos *TaskInfos
}

Asset represents a distgo asset.

type AssetTaskInfo

type AssetTaskInfo struct {
	AssetPath string
	AssetType AssetType
	AssetName string
	TaskInfo  distgotaskprovider.TaskInfo
}

AssetTaskInfo represents a single TaskInfo provided by an asset. Packages together information from the Asset and AssetInfos structs for a particular TaskInfo.

func GetTaskProviderVerifyTasksFromAssets

func GetTaskProviderVerifyTasksFromAssets(assets Assets) []AssetTaskInfo

GetTaskProviderVerifyTasksFromAssets returns a slice that contains the VerifyTaskInfo for all the provided assets.

type AssetType

type AssetType string

AssetType is the name of the type of asset.

const (
	Dister        AssetType = "dister"
	Publisher     AssetType = "publisher"
	DockerBuilder AssetType = "docker-builder"
)

Asset types supported by distgo.

type Assets

type Assets struct {
	// contains filtered or unexported fields
}

Assets represents a collection of distgo assets.

func LoadAssets

func LoadAssets(assets []string) (Assets, error)

LoadAssets loads the assets at the specified path and returns a map from AssetType to the paths for the assets of that type. Returns an error if any of the provided assets do not respond to the command that queries for their type or if the returned type is not a recognized asset type.

func (*Assets) AssetsWithTaskInfos

func (a *Assets) AssetsWithTaskInfos() []Asset

AssetsWithTaskInfos returns all the Assets that have a non-nil TaskInfos field. The assets in the returned slice are ordered by the natural ordering of AssetType and, within a type, occur in the same order as they occur in the value slice of the assets map.

func (*Assets) GetAssetPathsForType

func (a *Assets) GetAssetPathsForType(assetType AssetType) []string

GetAssetPathsForType returns the paths to the asset of the provided type.

type TaskInfos

type TaskInfos struct {
	// AssetName is the name of the asset. Must be globally unique for an asset of a given type.
	// Should be human-readable and short (and use kebab-case if it has multiple components), as this value is used as
	// part of the fully qualified asset-provided task command.
	AssetName string `json:"asset-name"`

	// TaskInfos specifies the tasks provided by the asset.
	TaskInfos map[string]distgotaskprovider.TaskInfo `json:"task-infos"`
}

func GetTaskInfos

func GetTaskInfos(assetPath string) (*TaskInfos, error)

GetTaskInfos returns the TaskInfos returned by unmarshalling the JSON returned by invoking the TaskInfosCommand on the asset at the specified path. Returns nil if the asset does not provide any tasks (including returning an error when invoking the command on the asset at the provided path). Returns an error only in the case where invoking the TaskInfosCommand on the asset return with an exit code of 0 but produces output that cannot be unmarshalled as a *TaskInfos from JSON.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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