migrationtarget

package
v0.0.0-...-0a271de Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 18 Imported by: 1

Documentation

Overview

Package migrationtarget defines the client side API facade for use by the migration master worker when communicating with the target controller.

Index

Constants

This section is empty.

Variables

View Source
var WithTracer = base.WithTracer

WithTracer returns an Option that configures the Client to use the supplied tracer.

Functions

This section is empty.

Types

type Client

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

Client is the client-side API for the MigrationTarget facade. It is used by the migrationmaster worker when talking to the target controller during a migration.

func NewClient

func NewClient(caller base.APICaller, options ...Option) *Client

NewClient returns a new Client based on an existing API connection.

func (*Client) Abort

func (c *Client) Abort(ctx context.Context, modelUUID string) error

Abort removes all data relating to a previously imported model.

func (*Client) Activate

func (c *Client) Activate(ctx context.Context, modelUUID string, sourceInfo coremigration.SourceControllerInfo, relatedModels []string) error

Activate marks a migrated model as being ready to use.

func (*Client) AdoptResources

func (c *Client) AdoptResources(ctx context.Context, modelUUID string) error

AdoptResources asks the cloud provider to update the controller tags for a model's resources. This prevents the resources from being destroyed if the source controller is destroyed after the model is migrated away.

func (*Client) BestFacadeVersion

func (c *Client) BestFacadeVersion() int

BestFacadeVersion returns the best supported facade version on the target controller.

func (*Client) CACert

func (c *Client) CACert(ctx context.Context) (string, error)

CACert returns the CA certificate associated with the connection.

func (*Client) CheckMachines

func (c *Client) CheckMachines(ctx context.Context, modelUUID string) ([]error, error)

CheckMachines compares the machines in state with the ones reported by the provider and reports any discrepancies.

func (*Client) Import

func (c *Client) Import(ctx context.Context, bytes []byte) error

Import takes a serialized model and imports it into the target controller.

func (*Client) LatestLogTime

func (c *Client) LatestLogTime(ctx context.Context, modelUUID string) (time.Time, error)

LatestLogTime asks the target controller for the time of the latest log record it has seen. This can be used to make the log transfer restartable.

func (*Client) OpenLogTransferStream

func (c *Client) OpenLogTransferStream(ctx context.Context, modelUUID string) (base.Stream, error)

OpenLogTransferStream connects to the migration logtransfer endpoint on the target controller and returns a stream that JSON logs records can be fed into. The objects written should be params.LogRecords.

func (*Client) Prechecks

func (c *Client) Prechecks(ctx context.Context, model coremigration.ModelInfo) error

Prechecks checks that the target controller is able to accept the model being migrated.

func (*Client) UploadCharm

func (c *Client) UploadCharm(ctx context.Context, modelUUID string, curl string, charmRef string, content io.Reader) (string, error)

UploadCharm sends the content to the API server using an HTTP post in order to add the charm binary to the model specified.

func (*Client) UploadResource

func (c *Client) UploadResource(ctx context.Context, modelUUID string, res resource.Resource, r io.Reader) error

UploadResource uploads a resource to the migration endpoint.

func (*Client) UploadTools

func (c *Client) UploadTools(ctx context.Context, modelUUID string, r io.Reader, vers version.Binary) (tools.List, error)

UploadTools uploads tools at the specified location to the API server over HTTPS for the specified model.

type Option

type Option = base.Option

Option is a function that can be used to configure a Client.

Jump to

Keyboard shortcuts

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