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



This section is empty.


This section is empty.


This section is empty.


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) *Client

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

func (*Client) Abort

func (c *Client) Abort(modelUUID string) error

Abort removes all data relating to a previously imported model.

func (*Client) Activate

func (c *Client) Activate(modelUUID string) error

Activate marks a migrated model as being ready to use.

func (*Client) AdoptResources

func (c *Client) AdoptResources(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) CACert

func (c *Client) CACert() (string, error)

CACert returns the CA certificate associated with the connection.

func (*Client) CheckMachines

func (c *Client) CheckMachines(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(bytes []byte) error

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

func (*Client) LatestLogTime

func (c *Client) LatestLogTime(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(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(model coremigration.ModelInfo) error

func (*Client) SetPlaceholderResource

func (c *Client) SetPlaceholderResource(modelUUID string, res resource.Resource) error

SetPlaceholderResource sets the metadata for a placeholder resource.

func (*Client) SetUnitResource

func (c *Client) SetUnitResource(modelUUID, unit string, res resource.Resource) error

SetUnitResource sets the metadata for a particular unit resource.

func (*Client) UploadCharm

func (c *Client) UploadCharm(modelUUID string, curl *charm.URL, content io.ReadSeeker) (*charm.URL, 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(modelUUID string, res resource.Resource, r io.ReadSeeker) error

UploadResource uploads a resource to the migration endpoint.

func (*Client) UploadTools

func (c *Client) UploadTools(modelUUID string, r io.ReadSeeker, vers version.Binary) (tools.List, error)

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

Source Files