migrate

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: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateService

func CreateService(orgName, spaceName string, instance *cf.ServiceInstance, h ClientHolder, isExport bool) flow.StepFunc

func CreateUserProvidedService

func CreateUserProvidedService(orgName, spaceName string, instance *cf.ServiceInstance, holder ClientHolder, isExport bool) flow.StepFunc

func NewManagedServiceFlow

func NewManagedServiceFlow(org, space string, h ClientHolder, instance *cf.ServiceInstance, isExport bool) flow.Flow

func NewUserProvidedServiceFlow

func NewUserProvidedServiceFlow(org, space string, h ClientHolder, instance *cf.ServiceInstance, isExport bool) flow.Flow

func ReplaceDomain

func ReplaceDomain(val string, domainsToReplace map[string]string) string

Types

type ClientFactory

type ClientFactory struct {
	ConfigLoader  config.Loader
	BoshFactory   bosh.ClientFactory
	OpsmanFactory om.ClientFactory
	OpsmanConfig  config.OpsManager
	// contains filtered or unexported fields
}

func NewClientFactory

func NewClientFactory(
	configLoader config.Loader,
	boshFactory bosh.ClientFactory,
	opsmanFactory om.ClientFactory,
	opsManConfig config.OpsManager,
) *ClientFactory

func (*ClientFactory) CFClient

func (f *ClientFactory) CFClient(toSource bool) cf.Client

func (*ClientFactory) SourceBoshClient

func (f *ClientFactory) SourceBoshClient() bosh.Client

func (*ClientFactory) SourceCFClient

func (f *ClientFactory) SourceCFClient() cf.Client

func (*ClientFactory) SourceOpsManClient

func (f *ClientFactory) SourceOpsManClient() om.Client

func (*ClientFactory) TargetBoshClient

func (f *ClientFactory) TargetBoshClient() bosh.Client

func (*ClientFactory) TargetCFClient

func (f *ClientFactory) TargetCFClient() cf.Client

func (*ClientFactory) TargetOpsManClient

func (f *ClientFactory) TargetOpsManClient() om.Client

type ClientHolder

type ClientHolder interface {
	SourceBoshClient() bosh.Client
	TargetBoshClient() bosh.Client
	SourceOpsManClient() om.Client
	TargetOpsManClient() om.Client
	SourceCFClient() cf.Client
	TargetCFClient() cf.Client
	CFClient(toSource bool) cf.Client
}

type ConfigLoader

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

func (ConfigLoader) BoshConfig

func (l ConfigLoader) BoshConfig(toSource bool) *config.Bosh

func (ConfigLoader) BuildSourceConfig

func (l ConfigLoader) BuildSourceConfig()

func (ConfigLoader) BuildTargetConfig

func (l ConfigLoader) BuildTargetConfig()

func (ConfigLoader) CCDBConfig

func (l ConfigLoader) CCDBConfig(m string, toSource bool) interface{}

func (ConfigLoader) CFConfig

func (l ConfigLoader) CFConfig(toSource bool) *config.CloudController

func (ConfigLoader) SourceApiConfig

func (l ConfigLoader) SourceApiConfig() *config.CloudController

func (ConfigLoader) SourceBoshConfig

func (l ConfigLoader) SourceBoshConfig() *config.Bosh

func (ConfigLoader) SourceCCDBConfig

func (l ConfigLoader) SourceCCDBConfig(m string) interface{}

func (ConfigLoader) TargetApiConfig

func (l ConfigLoader) TargetApiConfig() *config.CloudController

func (ConfigLoader) TargetBoshConfig

func (l ConfigLoader) TargetBoshConfig() *config.Bosh

func (ConfigLoader) TargetCCDBConfig

func (l ConfigLoader) TargetCCDBConfig(m string) interface{}

type DefaultMigratorRegistry

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

func NewMigratorRegistry

func NewMigratorRegistry(
	factory Factory,
	helper *MigratorHelper,
	cfg *config.Config,
	cfgLoader config.Loader,
	clientHolder ClientHolder,
) *DefaultMigratorRegistry

func (*DefaultMigratorRegistry) Lookup

type DefaultServiceInstanceExporter

type DefaultServiceInstanceExporter struct {
	ClientHolder ClientHolder
	Registry     MigratorRegistry
	Parser       ServiceInstanceParser
	// contains filtered or unexported fields
}

func (*DefaultServiceInstanceExporter) ExportManagedServices

func (e *DefaultServiceInstanceExporter) ExportManagedServices(ctx context.Context, org cfclient.Org, space cfclient.Space, om config.OpsManager, dir string) error

func (*DefaultServiceInstanceExporter) ExportUserProvidedServices

func (e *DefaultServiceInstanceExporter) ExportUserProvidedServices(ctx context.Context, org cfclient.Org, space cfclient.Space, dir string) error

type Factory

type Factory interface {
	New(org, space string, si *cf.ServiceInstance, om config.OpsManager, l config.Loader, h ClientHolder, dir string, isExport bool) (ServiceInstanceMigrator, error)
}

type ManagedServiceInstanceImporter

type ManagedServiceInstanceImporter struct {
	Registry MigratorRegistry
}

func NewServiceInstanceImporter

func NewServiceInstanceImporter(registry MigratorRegistry) ManagedServiceInstanceImporter

func (ManagedServiceInstanceImporter) ImportManagedService

func (i ManagedServiceInstanceImporter) ImportManagedService(ctx context.Context, org, space string, si *cf.ServiceInstance, om config.OpsManager, dir string) error

type ManagedServiceMigrator

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

func NewManagedServiceMigrator

func NewManagedServiceMigrator(flow flow.Flow) ManagedServiceMigrator

func (ManagedServiceMigrator) Migrate

func (ManagedServiceMigrator) Validate

func (m ManagedServiceMigrator) Validate(si *cf.ServiceInstance, export bool) error

type Migrator

type Migrator int64
const (
	ECS Migrator = iota
	MySQL
	SQLServer
	CredHub
)

func (Migrator) HasCCDBConfig

func (m Migrator) HasCCDBConfig() bool

func (Migrator) String

func (m Migrator) String() string

type MigratorFactory

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

func (*MigratorFactory) New

type MigratorHelper

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

func NewMigratorHelper

func NewMigratorHelper(mr config.MigrationReader) *MigratorHelper

func (*MigratorHelper) GetMigratorConfig

func (h *MigratorHelper) GetMigratorConfig(data interface{}, si *cf.ServiceInstance) (interface{}, error)

func (*MigratorHelper) GetMigratorType

func (h *MigratorHelper) GetMigratorType(service string) (Migrator, bool)

func (*MigratorHelper) GetReader

func (h *MigratorHelper) GetReader() config.MigrationReader

func (*MigratorHelper) IsCCDBMigrator

func (h *MigratorHelper) IsCCDBMigrator(service string) bool

type MigratorRegistry

type MigratorRegistry interface {
	Lookup(org, space string, si *cf.ServiceInstance, om config.OpsManager, dir string, isExport bool) (ServiceInstanceMigrator, bool, error)
}

type OrgExporter

type OrgExporter struct {
	ClientHolder            ClientHolder
	ExcludedOrgs            []string
	IncludedOrgs            []string
	ServiceInstanceExporter ServiceInstanceExporter
}

func NewOrgExporter

func NewOrgExporter(e ServiceInstanceExporter, h ClientHolder, includedOrgs []string, excludedOrgs []string) *OrgExporter

func (OrgExporter) ExcludeOrg

func (e OrgExporter) ExcludeOrg(orgName string) bool

func (OrgExporter) Export

func (e OrgExporter) Export(ctx context.Context, om config.OpsManager, dir string, orgs ...string) error

func (OrgExporter) ExportAll

func (e OrgExporter) ExportAll(ctx context.Context, om config.OpsManager, dir string) error

func (OrgExporter) IncludeOrg

func (e OrgExporter) IncludeOrg(orgName string) bool

type OrgImporter

type OrgImporter struct {
	IncludedOrgs []string
	ExcludedOrgs []string
	*SpaceImporter
}

func NewOrgImporter

func NewOrgImporter(spaceImporter *SpaceImporter, includedOrgs []string, excludedOrgs []string) *OrgImporter

func (OrgImporter) ExcludeOrg

func (i OrgImporter) ExcludeOrg(orgName string) bool

func (OrgImporter) Import

func (i OrgImporter) Import(ctx context.Context, om config.OpsManager, dir string, orgs ...string) error

func (OrgImporter) ImportAll

func (i OrgImporter) ImportAll(ctx context.Context, om config.OpsManager, dir string) error

func (OrgImporter) IncludeOrg

func (i OrgImporter) IncludeOrg(orgName string) bool

type Service

type Service string
const (
	ECSBucketService       Service = "ecs-bucket"
	MySQLService           Service = "p.mysql"
	SQLServerService       Service = "SQLServer"
	CustomSQLServerService Service = "MSSQL-Broker"
	CredHubService         Service = "credhub"
)

func (Service) String

func (s Service) String() string

type ServiceInstanceExporter

type ServiceInstanceExporter interface {
	ExportManagedServices(ctx context.Context, org cfclient.Org, space cfclient.Space, om config.OpsManager, dir string) error
	ExportUserProvidedServices(ctx context.Context, org cfclient.Org, space cfclient.Space, dir string) error
}

type ServiceInstanceImporter

type ServiceInstanceImporter interface {
	ImportManagedService(ctx context.Context, org string, space string, instance *cf.ServiceInstance, om config.OpsManager, dir string) error
}

type ServiceInstanceMigrator

type ServiceInstanceMigrator interface {
	Migrate(ctx context.Context) (*cf.ServiceInstance, error)
	Validator
}

type ServiceInstanceParser

type ServiceInstanceParser interface {
	Unmarshal(out interface{}, fd io.FileDescriptor) error
	Marshal(in interface{}, fd io.FileDescriptor) error
}

type ServiceType

type ServiceType string
const (
	ManagedService      ServiceType = "managed_service_instance"
	UserProvidedService ServiceType = "user_provided_service_instance"
)

func (ServiceType) String

func (t ServiceType) String() string

type SpaceExporter

type SpaceExporter struct {
	ClientHolder ClientHolder
	ServiceInstanceExporter
}

func (SpaceExporter) Export

func (e SpaceExporter) Export(ctx context.Context, om config.OpsManager, dir string, orgName, spaceName string) error

type SpaceImporter

type SpaceImporter struct {
	ServiceInstanceImporter
}

func NewSpaceImporter

func NewSpaceImporter(serviceInstanceImporter ServiceInstanceImporter) *SpaceImporter

func (SpaceImporter) Import

func (i SpaceImporter) Import(ctx context.Context, om config.OpsManager, dir string, orgName, spaceName string) error

type UserProvidedServiceMigrator

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

func NewUserProvidedServiceMigrator

func NewUserProvidedServiceMigrator(flow flow.Flow) UserProvidedServiceMigrator

func (UserProvidedServiceMigrator) Migrate

func (UserProvidedServiceMigrator) Validate

func (m UserProvidedServiceMigrator) Validate(si *cf.ServiceInstance, export bool) error

type Validator

type Validator interface {
	Validate(*cf.ServiceInstance, bool) error
}

Directories

Path Synopsis
cc
db
db/fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
s3
s3/fakes
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