config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OAM Metadata constants
	OAMAdapterNameMetadataKey       = "adapter.meshery.io/name"
	OAMComponentCategoryMetadataKey = "ui.meshery.io/category"
)
View Source
const (

	// ErrGetLatestReleasesCode represents the error which occurs during the process of getting
	// latest releases
	ErrGetLatestReleasesCode = "1008"
	// ErrGetManifestNamesCode represents the error which occurs during the process of getting
	// manifest names
	ErrGetManifestNamesCode = "1009"
	// ErrEmptyConfigCode represents the error when the configuration is either empty
	// or is invalid
	ErrEmptyConfigCode = "1010"
)
View Source
const (
	CustomOperation        = "custom"
	Consul182DemoOperation = "consul_182_demo"
	Consul191DemoOperation = "consul_191_demo"
	BookInfoOperation      = "bookinfo"
	HTTPBinOperation       = "httpbin"
	ImageHubOperation      = "imagehub"

	// Keys in AdditionalProperties of Operation
	HelmChartRepositoryKey = "helm_chart_repository"
	HelmChartChartKey      = "helm_chart_chart"
	HelmChartVersionKey    = "helm_chart_version"
	HelmChartValuesFileKey = "helm_chart_values_file"
)

Variables

View Source
var (
	ServerDefaults = map[string]string{
		"name":     smp.ServiceMesh_CONSUL.Enum().String(),
		"type":     "adapter",
		"port":     "10002",
		"traceurl": "none",
	}

	MeshSpecDefaults = map[string]string{
		"name":    smp.ServiceMesh_CONSUL.Enum().String(),
		"status":  status.NotInstalled,
		"version": "1.8.2",
	}

	ViperDefaults = map[string]string{
		"filepath": ConfigRootPath,
		"filename": "consul",
		"filetype": "yaml",
	}

	KubeConfigDefaults = map[string]string{
		configprovider.FilePath: ConfigRootPath,
		configprovider.FileType: "yaml",
		configprovider.FileName: "kubeconfig",
	}
	// Operations represents the set of valid operations that are available
	// to the adapter
	Operations = getOperations(common.Operations)
)
View Source
var (
	ConfigRootPath = path.Join(utils.GetHome(), ".meshery")
)
View Source
var (
	ConsulOperation = strings.ToLower(smp.ServiceMesh_CONSUL.Enum().String())
)
View Source
var (
	// ErrEmptyConfig error is the error when config is invalid
	ErrEmptyConfig = errors.New(ErrEmptyConfigCode, errors.Alert, []string{"Config is empty"}, []string{}, []string{}, []string{})
)

Functions

func ErrGetLatestReleases added in v0.5.8

func ErrGetLatestReleases(err error) error

ErrGetLatestReleases is the error for fetching consul releases

func ErrGetManifestNames added in v0.5.8

func ErrGetManifestNames(err error) error

ErrGetManifestNames is the error for fetching consul manifest names

func GetFileNames added in v0.5.8

func GetFileNames(owner string, repo string, path string) ([]string, error)

GetFileNames takes the url of a github repo and the path to a directory. Then returns all the filenames from that directory

func New

func New(provider string) (h config.Handler, err error)

New creates a new config instance

func NewKubeconfigBuilder added in v0.5.9

func NewKubeconfigBuilder(provider string) (config.Handler, error)

NewKubeconfigBuilder returns a config handler based on the provider

Valid providers are "viper" and "in-mem"

func RootPath added in v0.5.9

func RootPath() string

RootPath returns the config root path for the adapter

Types

type Asset added in v0.5.8

type Asset struct {
	Name        string `json:"name,omitempty"`
	State       string `json:"state,omitempty"`
	DownloadURL string `json:"browser_download_url,omitempty"`
}

Asset describes the github release asset object

type Release added in v0.5.8

type Release struct {
	ID      int             `json:"id,omitempty"`
	TagName string          `json:"tag_name,omitempty"`
	Name    adapter.Version `json:"name,omitempty"`
	Draft   bool            `json:"draft,omitempty"`
	Assets  []*Asset        `json:"assets,omitempty"`
}

Release is used to save the release informations

func GetLatestReleases added in v0.5.8

func GetLatestReleases(releases uint) ([]*Release, error)

GetLatestReleases fetches the latest releases from the Consul mesh repository

Jump to

Keyboard shortcuts

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