cloudmigration

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalNotImplementedError = errutil.Internal("cloudmigrations.notImplemented").Errorf("Internal server error")
	ErrFeatureDisabledError        = errutil.Internal("cloudmigrations.disabled").Errorf("Cloud migrations are disabled on this instance")
	ErrMigrationNotFound           = errutil.NotFound("cloudmigrations.migrationNotFound").Errorf("Migration not found")
	ErrMigrationRunNotFound        = errutil.NotFound("cloudmigrations.migrationRunNotFound").Errorf("Migration run not found")
	ErrMigrationNotDeleted         = errutil.Internal("cloudmigrations.migrationNotDeleted").Errorf("Migration not deleted")
	ErrTokenNotFound               = errutil.NotFound("cloudmigrations.tokenNotFound").Errorf("Token not found")
)

Functions

This section is empty.

Types

type Base64EncodedTokenPayload

type Base64EncodedTokenPayload struct {
	Token    string
	Instance Base64HGInstance
}

func (Base64EncodedTokenPayload) ToMigration

func (p Base64EncodedTokenPayload) ToMigration() CloudMigration

type Base64HGInstance

type Base64HGInstance struct {
	StackID     int
	Slug        string
	RegionSlug  string
	ClusterSlug string
}

type CloudMigration

type CloudMigration struct {
	ID          int64     `json:"id" xorm:"pk autoincr 'id'"`
	UID         string    `json:"uid" xorm:"uid"`
	AuthToken   string    `json:"-"`
	Stack       string    `json:"stack"`
	StackID     int       `json:"stackID" xorm:"stack_id"`
	RegionSlug  string    `json:"regionSlug"`
	ClusterSlug string    `json:"clusterSlug"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
}

CloudMigration api dtos

type CloudMigrationListResponse

type CloudMigrationListResponse struct {
	Migrations []CloudMigrationResponse `json:"migrations"`
}

type CloudMigrationRequest

type CloudMigrationRequest struct {
	AuthToken string `json:"authToken"`
}

type CloudMigrationResponse

type CloudMigrationResponse struct {
	UID     string    `json:"uid"`
	Stack   string    `json:"stack"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

type CloudMigrationRun

type CloudMigrationRun struct {
	ID                int64     `json:"id" xorm:"pk autoincr 'id'"`
	UID               string    `json:"uid" xorm:"uid"`
	CloudMigrationUID string    `json:"migrationUid" xorm:"cloud_migration_uid"`
	Result            []byte    `json:"result"` //store raw cms response body
	Created           time.Time `json:"created"`
	Updated           time.Time `json:"updated"`
	Finished          time.Time `json:"finished"`
}

func (CloudMigrationRun) ToResponse

func (r CloudMigrationRun) ToResponse() (*MigrateDataResponseDTO, error)

type CloudMigrationRunList

type CloudMigrationRunList struct {
	Runs []MigrateDataResponseListDTO `json:"runs"`
}

type CreateAccessTokenResponse

type CreateAccessTokenResponse struct {
	Token string
}

type ItemStatus

type ItemStatus string

swagger:enum ItemStatus

const (
	ItemStatusOK    ItemStatus = "OK"
	ItemStatusError ItemStatus = "ERROR"
)

type MigrateDataRequestDTO

type MigrateDataRequestDTO struct {
	Items []MigrateDataRequestItemDTO `json:"items"`
}

type MigrateDataRequestItemDTO

type MigrateDataRequestItemDTO struct {
	Type  MigrateDataType `json:"type"`
	RefID string          `json:"refId"`
	Name  string          `json:"name"`
	Data  interface{}     `json:"data"`
}

type MigrateDataResponseDTO

type MigrateDataResponseDTO struct {
	RunUID string                       `json:"uid"`
	Items  []MigrateDataResponseItemDTO `json:"items"`
}

type MigrateDataResponseItemDTO

type MigrateDataResponseItemDTO struct {
	// required:true
	Type MigrateDataType `json:"type"`
	// required:true
	RefID string `json:"refId"`
	// required:true
	Status ItemStatus `json:"status"`
	Error  string     `json:"error,omitempty"`
}

type MigrateDataResponseListDTO

type MigrateDataResponseListDTO struct {
	RunUID string `json:"uid"`
}

type MigrateDataType

type MigrateDataType string

swagger:enum MigrateDataType

const (
	DashboardDataType  MigrateDataType = "DASHBOARD"
	DatasourceDataType MigrateDataType = "DATASOURCE"
	FolderDataType     MigrateDataType = "FOLDER"
)

type Service

type Service interface {
	// GetToken Returns the cloud migration token if it exists.
	GetToken(ctx context.Context) (gcom.TokenView, error)
	// CreateToken Creates a cloud migration token.
	CreateToken(ctx context.Context) (CreateAccessTokenResponse, error)
	// ValidateToken Sends a request to CMS to test the token.
	ValidateToken(ctx context.Context, mig CloudMigration) error
	DeleteToken(ctx context.Context, uid string) error

	CreateMigration(ctx context.Context, req CloudMigrationRequest) (*CloudMigrationResponse, error)
	GetMigration(ctx context.Context, migUID string) (*CloudMigration, error)
	DeleteMigration(ctx context.Context, migUID string) (*CloudMigration, error)
	UpdateMigration(ctx context.Context, migUID string, request CloudMigrationRequest) (*CloudMigrationResponse, error)
	GetMigrationList(context.Context) (*CloudMigrationListResponse, error)

	RunMigration(ctx context.Context, migUID string) (*MigrateDataResponseDTO, error)
	GetMigrationStatus(ctx context.Context, runUID string) (*CloudMigrationRun, error)
	GetMigrationRunList(ctx context.Context, migUID string) (*CloudMigrationRunList, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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