cloudenv

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: JSON Imports: 16 Imported by: 4

Documentation

Overview

It manages the detection of the environment but also the detections of services asked by a Loader.

Index

Constants

View Source
const (
	LOCAL_ENV_KEY        = "CLOUD_FILE"
	LOCAL_CONFIG_ENV_KEY = "CONFIG_FILE"
	DEFAULT_CONFIG_PATH  = "config.yml"
	SERVICES_CONFIG_KEY  = "services"
)
View Source
const ENV_KEY_APP_NAME string = "GAUTOCLOUD_APP_NAME"

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInfo

type AppInfo struct {
	Id         string
	Name       string
	Port       int
	Properties map[string]interface{}
}

type CfCloudEnv

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

func (CfCloudEnv) GetAppInfo

func (c CfCloudEnv) GetAppInfo() AppInfo

func (CfCloudEnv) GetServicesFromName

func (c CfCloudEnv) GetServicesFromName(name string) []Service

func (CfCloudEnv) GetServicesFromTags

func (c CfCloudEnv) GetServicesFromTags(tags []string) []Service

func (CfCloudEnv) IsInCloudEnv

func (c CfCloudEnv) IsInCloudEnv() bool

func (*CfCloudEnv) Load

func (c *CfCloudEnv) Load() error

func (CfCloudEnv) Name

func (c CfCloudEnv) Name() string

type CloudEnv

type CloudEnv interface {
	// name of your cloud environment (e.g.: cloud foundry, heroku, local ...)
	Name() string
	// The loader will call this function and pass a list of tags
	// You will need to give services which match with those tags
	// NOTE: tag can be an regex, better to take this in consideration
	GetServicesFromTags(tags []string) []Service
	// the loader will call this function and pass a service name as a regex
	// You will need to give services which match with this name
	GetServicesFromName(name string) []Service
	// The loader will call this function to see if this cloud envionment can be use
	// This function should detect the targeted environment
	IsInCloudEnv() bool
	// The loader will call this method to load the environment
	Load() error
	// This need to return information about application instance information
	GetAppInfo() AppInfo
}

You must implement this interface if you want to add another cloud environment See the cf_cloudenv or heroku_cloudenv or local_cloudenv to have an example of implementation

func NewCfCloudEnv

func NewCfCloudEnv() CloudEnv

func NewCfCloudEnvWithAppEnv

func NewCfCloudEnvWithAppEnv(appEnv *cfenv.App) CloudEnv

func NewHerokuCloudEnv

func NewHerokuCloudEnv() CloudEnv

func NewHerokuCloudEnvEnvironment

func NewHerokuCloudEnvEnvironment(environ []string) CloudEnv

func NewKubernetesCloudEnv

func NewKubernetesCloudEnv() CloudEnv

func NewKubernetesCloudEnvEnvironment

func NewKubernetesCloudEnvEnvironment(environ []string) CloudEnv

func NewLocalCloudEnv

func NewLocalCloudEnv() CloudEnv

func NewLocalCloudEnvFromReader

func NewLocalCloudEnvFromReader(r io.Reader, configType string) CloudEnv

type EnvVar

type EnvVar struct {
	Key   string
	Value string
}

type EnvVarCloudEnv

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

func NewEnvVarCloudEnv

func NewEnvVarCloudEnv() EnvVarCloudEnv

func NewEnvVarCloudEnvEnvironment

func NewEnvVarCloudEnvEnvironment(environ []string) EnvVarCloudEnv

func (EnvVarCloudEnv) EnvVars

func (c EnvVarCloudEnv) EnvVars() []EnvVar

func (EnvVarCloudEnv) GetEnvValueName

func (c EnvVarCloudEnv) GetEnvValueName(key string) string

func (EnvVarCloudEnv) GetServicesFromName

func (c EnvVarCloudEnv) GetServicesFromName(name string) []Service

func (EnvVarCloudEnv) GetServicesFromTags

func (c EnvVarCloudEnv) GetServicesFromTags(tags []string) []Service

func (*EnvVarCloudEnv) InitEnv

func (c *EnvVarCloudEnv) InitEnv(environ []string)

func (*EnvVarCloudEnv) Load

func (c *EnvVarCloudEnv) Load() error

type HerokuCloudEnv

type HerokuCloudEnv struct {
	EnvVarCloudEnv
}

func (HerokuCloudEnv) GetAppInfo

func (c HerokuCloudEnv) GetAppInfo() AppInfo

func (HerokuCloudEnv) IsInCloudEnv

func (c HerokuCloudEnv) IsInCloudEnv() bool

func (HerokuCloudEnv) Name

func (c HerokuCloudEnv) Name() string

type KubernetesCloudEnv

type KubernetesCloudEnv struct {
	EnvVarCloudEnv
}

func (KubernetesCloudEnv) GetAppInfo

func (c KubernetesCloudEnv) GetAppInfo() AppInfo

func (KubernetesCloudEnv) IsInCloudEnv

func (c KubernetesCloudEnv) IsInCloudEnv() bool

func (*KubernetesCloudEnv) Load

func (c *KubernetesCloudEnv) Load() error

func (KubernetesCloudEnv) Name

func (c KubernetesCloudEnv) Name() string

func (KubernetesCloudEnv) SanitizeEnvVars

func (c KubernetesCloudEnv) SanitizeEnvVars(envVars []string) []string

type LocalCloudEnv

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

func (*LocalCloudEnv) GetAppInfo

func (c *LocalCloudEnv) GetAppInfo() AppInfo

func (LocalCloudEnv) GetServicesFromName

func (c LocalCloudEnv) GetServicesFromName(name string) []Service

func (LocalCloudEnv) GetServicesFromTags

func (c LocalCloudEnv) GetServicesFromTags(tags []string) []Service

func (LocalCloudEnv) IsInCloudEnv

func (c LocalCloudEnv) IsInCloudEnv() bool

func (*LocalCloudEnv) Load

func (c *LocalCloudEnv) Load() error

func (LocalCloudEnv) Name

func (c LocalCloudEnv) Name() string

type Service

type Service struct {
	Credentials map[string]interface{}
}

type ServiceLocal

type ServiceLocal struct {
	Name        string
	Tags        []string
	Credentials map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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