config

package
v0.0.0-...-7d3168a Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 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

func ErrGetLatestReleases(err error) error

ErrGetLatestReleases is the error for fetching consul releases

func ErrGetManifestNames

func ErrGetManifestNames(err error) error

ErrGetManifestNames is the error for fetching consul manifest names

func GetFileNames

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

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

func RootPath() string

RootPath returns the config root path for the adapter

Types

type Asset

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

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

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