config

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithConfig

func ContextWithConfig(ctx context.Context, config *Config) context.Context

func ContextWithProgress

func ContextWithProgress(ctx context.Context, p *mpb.Progress) context.Context

func ContextWithSummary

func ContextWithSummary(ctx context.Context, summary *report.Summary) context.Context

func NewFieldError

func NewFieldError(field string, err error) error

func NewFieldsError

func NewFieldsError(fields []string, err error) error

func ProgressFromContext

func ProgressFromContext(ctx context.Context) (*mpb.Progress, bool)

func SummaryFromContext

func SummaryFromContext(ctx context.Context) (*report.Summary, bool)

Types

type Authentication

type Authentication struct {
	Basic UserCredentials
	UAA   UAAAuthentication
}

func (Authentication) IsSet

func (a Authentication) IsSet() bool

func (Authentication) Validate

func (a Authentication) Validate(URLRequired bool) error

type Bosh

type Bosh struct {
	URL            string `yaml:"url" mapstructure:"url"`
	AllProxy       string `yaml:"all_proxy" mapstructure:"all_proxy"`
	TrustedCert    string `yaml:"root_ca_cert" mapstructure:"root_ca_cert"`
	Authentication Authentication
	Deployment     string
}

func (Bosh) IsSet

func (b Bosh) IsSet() bool

func (Bosh) Validate

func (b Bosh) Validate() error

type BoshProperties

type BoshProperties struct {
	URL, AllProxy, ClientID, ClientSecret string
	RootCA                                []httpclient.CA
	Deployment                            string
}

type BoshPropertiesBuilder

type BoshPropertiesBuilder interface {
	Build() *BoshProperties
}

type CCDBProperties

type CCDBProperties struct {
	Host, Username, Password, EncryptionKey string
	SSHHost, SSHUsername, SSHPrivateKey     string
}

type CCDBPropertiesBuilder

type CCDBPropertiesBuilder interface {
	Build() *CCDBProperties
}

type CFProperties

type CFProperties struct {
	URL, Username, Password string
}

type CFPropertiesBuilder

type CFPropertiesBuilder interface {
	Build() *CFProperties
}

type ClientCredentials

type ClientCredentials struct {
	ID     string `yaml:"client_id" mapstructure:"client_id"`
	Secret string `yaml:"client_secret" mapstructure:"client_secret"`
}

func (ClientCredentials) IsSet

func (cc ClientCredentials) IsSet() bool

func (ClientCredentials) Validate

func (cc ClientCredentials) Validate() error

type CloudController

type CloudController struct {
	URL          string `yaml:"url" mapstructure:"url"`
	Username     string `yaml:"username" mapstructure:"username"`
	Password     string `yaml:"password" mapstructure:"password"`
	ClientID     string `yaml:"client_id" mapstructure:"client_id"`
	ClientSecret string `yaml:"client_secret" mapstructure:"client_secret"`
}

func (CloudController) IsSet

func (c CloudController) IsSet() bool

func (CloudController) Validate

func (c CloudController) Validate() error

type Config

type Config struct {
	ConfigDir         string
	ConfigFile        string
	Debug             bool
	DryRun            bool `mapstructure:"dry_run"`
	DomainsToReplace  map[string]string
	ExportDir         string   `mapstructure:"export_dir"`
	ExcludedOrgs      []string `mapstructure:"exclude_orgs"`
	IncludedOrgs      []string `mapstructure:"include_orgs"`
	IgnoreServiceKeys bool     `mapstructure:"ignore_service_keys"`
	Foundations       struct {
		Source OpsManager `yaml:"source"`
		Target OpsManager `yaml:"target"`
	} `yaml:"foundations"`
	Migration  Migration
	Name       string
	Services   []string        `mapstructure:"services"`
	Instances  []string        `mapstructure:"instances"`
	SourceApi  CloudController `yaml:"source_api" mapstructure:"source_api"`
	SourceBosh Bosh            `yaml:"source_bosh" mapstructure:"source_bosh"`
	TargetApi  CloudController `yaml:"target_api" mapstructure:"target_api"`
	TargetBosh Bosh            `yaml:"target_bosh" mapstructure:"target_bosh"`
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) (*Config, bool)

func New

func New(configDir string, configFile string) *Config

func NewDefaultConfig

func NewDefaultConfig() *Config

func Parse

func Parse(configFilePath string) (Config, error)

func (Config) Validate

func (c Config) Validate() error

type EnvProperties

type EnvProperties struct {
	*BoshProperties
	*CFProperties
	*CCDBProperties
}

type FieldError

type FieldError struct {
	Field string
	Msg   string
}

func (FieldError) Error

func (f FieldError) Error() string

type Loader

type Loader interface {
	BoshConfig(toSource bool) *Bosh
	SourceBoshConfig() *Bosh
	TargetBoshConfig() *Bosh
	CFConfig(toSource bool) *CloudController
	SourceApiConfig() *CloudController
	TargetApiConfig() *CloudController
	CCDBConfig(m string, toSource bool) interface{}
	SourceCCDBConfig(m string) interface{}
	TargetCCDBConfig(m string) interface{}
}

type MapDecoder

type MapDecoder struct {
	Config  *interface{}
	Decoder *mapstructure.Decoder
}

func NewMapDecoder

func NewMapDecoder(cfg interface{}) MapDecoder

func (MapDecoder) Decode

func (d MapDecoder) Decode(migration Migration, key string) interface{}

type Migration

type Migration struct {
	UseDefaultMigrator bool       `mapstructure:"use_default_migrator"`
	Migrators          []Migrator `yaml:"migrators"`
}

type MigrationDecoder

type MigrationDecoder interface {
	Decode(migration Migration, key string) interface{}
}

type MigrationReader

type MigrationReader interface {
	GetMigration() (*Migration, error)
}

type Migrator

type Migrator struct {
	Name  string                 `yaml:"name" mapstructure:"name"`
	Value map[string]interface{} `yaml:"migrator" mapstructure:"migrator"`
}

func LookupMigrator

func LookupMigrator(migration Migration, key string) *Migrator

type OpsManager

type OpsManager struct {
	URL          string `yaml:"url"`
	Username     string `yaml:"username"`
	Password     string `yaml:"password"`
	ClientID     string `yaml:"client_id" mapstructure:"client_id"`
	ClientSecret string `yaml:"client_secret" mapstructure:"client_secret"`
	Hostname     string `yaml:"hostname,omitempty" mapstructure:"hostname,omitempty"`
	IP           string `yaml:"ip,omitempty" mapstructure:"ip,omitempty"`
	PrivateKey   string `yaml:"private_key,omitempty" mapstructure:"private_key,omitempty"`
	SshUser      string `yaml:"ssh_user,omitempty" mapstructure:"ssh_user,omitempty"`
}

func (OpsManager) Validate

func (c OpsManager) Validate() error

func (OpsManager) ValidateSSH

func (c OpsManager) ValidateSSH() error

type PropertiesProvider

type PropertiesProvider interface {
	Environment(BoshPropertiesBuilder, CFPropertiesBuilder, CCDBPropertiesBuilder) EnvProperties
	SourceBoshPropertiesBuilder() BoshPropertiesBuilder
	TargetBoshPropertiesBuilder() BoshPropertiesBuilder
	SourceCFPropertiesBuilder() CFPropertiesBuilder
	TargetCFPropertiesBuilder() CFPropertiesBuilder
	SourceCCDBPropertiesBuilder(b BoshPropertiesBuilder) CCDBPropertiesBuilder
	TargetCCDBPropertiesBuilder(b BoshPropertiesBuilder) CCDBPropertiesBuilder
}

type UAAAuthentication

type UAAAuthentication struct {
	URL               string
	ClientCredentials ClientCredentials `yaml:"client_credentials" mapstructure:"client_credentials"`
	UserCredentials   UserCredentials   `yaml:"user_credentials" mapstructure:"user_credentials"`
}

func (UAAAuthentication) IsSet

func (a UAAAuthentication) IsSet() bool

func (UAAAuthentication) Validate

func (a UAAAuthentication) Validate(URLRequired bool) error

type UserCredentials

type UserCredentials struct {
	Username string
	Password string
}

func (UserCredentials) IsSet

func (c UserCredentials) IsSet() bool

func (UserCredentials) Validate

func (c UserCredentials) Validate() error

type YAMLMigrationReader

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

func NewMigrationReader

func NewMigrationReader(cfg *Config) (*YAMLMigrationReader, error)

func ReadFrom

func ReadFrom(r io.Reader) (*YAMLMigrationReader, error)

func ReadFromDir

func ReadFromDir(path string) (*YAMLMigrationReader, error)

func (*YAMLMigrationReader) GetMigration

func (r *YAMLMigrationReader) GetMigration() (*Migration, error)

func (*YAMLMigrationReader) GetString

func (r *YAMLMigrationReader) GetString() (string, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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