asset

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package asset provides utilities for managing and manipulating assets. It includes functionalities for JSON schema compilation, caching, and manipulation of JSON objects. It also provides utilities for handling concurrent operations on these assets.

The package uses the "github.com/santhosh-tekuri/jsonschema/v5" library for JSON schema compilation and validation. It uses the "github.com/zhchang/goquiver/safe" library for safe concurrent operations.

The package initializes a JSON schema compiler in the Draft4 mode and provides a function to remove empty required fields from a JSON object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

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

Asset represents an asset in the system. It contains information about the asset's ID, type, release, local path, URL, and associated JSON schema.

Fields: id: A unique identifier for the asset. typ: The type of the asset. release: The release version of the asset. localPath: The local file path where the asset is stored. url: The URL where the asset can be accessed. schema: The JSON schema associated with the asset, used for validation.

func New

func New(rc global.AssetContext, typ, release string) (*Asset, error)

New creates a new Asset instance with the specified asset context, type, and release. It returns a pointer to the created Asset and an error, if any. The asset context (rc) must not be nil. The type (typ) and release must be non-empty strings. The function initializes the local path, URL, and ID of the asset. It also sets up a loader for the asset and performs necessary operations to populate the asset's local directory. Finally, it compiles the asset's schema using the specified schema file.

func (*Asset) ChartPath

func (a *Asset) ChartPath() string

ChartPath returns the path to the chart.tgz file for the asset.

func (*Asset) Validate

func (a *Asset) Validate(values map[string]any) error

Validate validates the given values against the asset's schema. It returns an error if the schema is not initialized or if the validation fails.

Jump to

Keyboard shortcuts

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