modelmigration

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterExport

func RegisterExport(coordinator Coordinator)

RegisterExport registers the export operations with the given coordinator.

func RegisterImport

func RegisterImport(coordinator Coordinator, logger logger.Logger)

RegisterImport register's a new model authorized keys importer into the supplied coordinator.

Types

type Coordinator

type Coordinator interface {
	// Add adds the given operation to the migration.
	Add(modelmigration.Operation)
}

Coordinator is the interface that is used to add operations to a migration.

type ExportService

type ExportService interface {
	// GetAllUserPublicKeys returns all of the public keys in the model for each
	// user grouped by [user.UUID].
	GetAllUsersPublicKeys(context.Context) (map[user.Name][]string, error)
}

ExportService represents the service methods needed for exporting the authorized keys of a model during migration.

type ImportService

type ImportService interface {
	// AddPublicKeysForUser is responsible for adding public keys for a user to a
	// model. The following errors can be expected:
	// - [errors.NotValid] when the user id is not valid
	// - [github.com/juju/juju/domain/access/errors.UserNotFound] when the user does
	// not exist.
	// - [keyserrors.InvalidPublicKey] when a public key fails validation.
	// - [keyserrors.ReservedCommentViolation] when a key being added contains a
	// comment string that is reserved.
	// - [keyserrors.PublicKeyAlreadyExists] when a public key being added
	// for a user already exists.
	AddPublicKeysForUser(context.Context, user.UUID, ...string) error
}

ImportService represents the service methods needed for importing the authorized keys of a model during migration.

type UserService

type UserService interface {
	// GetUserByName will find and return the user associated with name. If
	// there is no user for the user name then an error that satisfies
	// [github.com/juju/juju/domain/access/errors].NotFound will be returned.
	// If supplied with an invalid user name then an error that satisfies
	// [github.com/juju/juju/domain/access/errors].UserNameNotValid will be
	// returned.
	GetUserByName(context.Context, user.Name) (user.User, error)
}

UserService represents the service methods needed for finding users when importing ssh public keys for a model.

Jump to

Keyboard shortcuts

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