modelconfig

package
v0.0.0-...-f88c608 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: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogTracingValidator

func LogTracingValidator(isAdmin bool) config.ValidatorFunc

LogTracingValidator is a logging config validator that checks if a logging change is being requested, specifically that of trace and to see if the requesting user has the required permission for the change.

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type Backend

type Backend interface {
	ControllerTag() names.ControllerTag
	Sequences() (map[string]int, error)
}

Backend contains the state.State methods used in this package, allowing stubs to be created for testing.

func NewStateBackend

func NewStateBackend(m *state.Model) Backend

NewStateBackend creates a backend for the facade to use.

type BlockCommandService

type BlockCommandService interface {
	// GetBlockSwitchedOn returns the optional block message if it is switched
	// on for the given type.
	GetBlockSwitchedOn(ctx context.Context, t blockcommand.BlockType) (string, error)

	// GetBlocks returns all the blocks that are currently in place.
	GetBlocks(ctx context.Context) ([]blockcommand.Block, error)
}

BlockCommandService defines methods for interacting with block commands.

type ModelConfigAPI

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

ModelConfigAPI provides the base implementation of the methods.

func NewModelConfigAPI

func NewModelConfigAPI(
	modelUUID coremodel.UUID,
	backend Backend,
	modelSecretBackendService ModelSecretBackendService,
	configService ModelConfigService,
	modelSericve ModelService,
	authorizer facade.Authorizer,
	blockCommandService common.BlockCommandService,
) (*ModelConfigAPI, error)

NewModelConfigAPI creates a new instance of the ModelConfig Facade.

func (*ModelConfigAPI) GetModelConstraints

func (c *ModelConfigAPI) GetModelConstraints(ctx context.Context) (params.GetConstraintsResults, error)

GetModelConstraints returns the constraints for the model.

func (*ModelConfigAPI) GetModelSecretBackend

func (s *ModelConfigAPI) GetModelSecretBackend(ctx context.Context) (params.StringResult, error)

GetModelSecretBackend returns the secret backend for the model, returning an error satisfying authentication.ErrorEntityMissingPermission if the user does not have read access to the model, returning params.CodeModelNotFound if the model does not exist.

func (*ModelConfigAPI) ModelGet

ModelGet implements the server-side part of the model-config CLI command.

func (*ModelConfigAPI) ModelSet

func (c *ModelConfigAPI) ModelSet(ctx context.Context, args params.ModelSet) error

ModelSet implements the server-side part of the set-model-config CLI command.

func (*ModelConfigAPI) ModelUnset

func (c *ModelConfigAPI) ModelUnset(ctx context.Context, args params.ModelUnset) error

ModelUnset implements the server-side part of the set-model-config CLI command.

func (*ModelConfigAPI) Sequences

Sequences returns the model's sequence names and next values.

func (*ModelConfigAPI) SetModelConstraints

func (c *ModelConfigAPI) SetModelConstraints(ctx context.Context, args params.SetConstraints) error

SetModelConstraints sets the constraints for the model.

func (*ModelConfigAPI) SetModelSecretBackend

func (s *ModelConfigAPI) SetModelSecretBackend(ctx context.Context, arg params.SetModelSecretBackendArg) (params.ErrorResult, error)

SetModelSecretBackend sets the secret backend for the model, returning an error satisfying authentication.ErrorEntityMissingPermission if the user does not have write access to the model, returning params.CodeModelNotFound if the model does not exist, returning params.CodeSecretBackendNotFound if the secret backend does not exist, returning params.CodeSecretBackendNotValid if the secret backend name is not valid.

type ModelConfigAPIV3

type ModelConfigAPIV3 struct {
	*ModelConfigAPI
}

ModelConfigAPIV3 is currently the latest.

func (*ModelConfigAPIV3) GetModelSecretBackend

func (s *ModelConfigAPIV3) GetModelSecretBackend(struct{})

GetModelSecretBackend isn't implemented in the ModelConfigAPIV3 facade.

func (*ModelConfigAPIV3) SetModelSecretBackend

func (s *ModelConfigAPIV3) SetModelSecretBackend(_, _ struct{})

SetModelSecretBackend isn't implemented in the ModelConfigAPIV3 facade.

type ModelConfigService

type ModelConfigService interface {
	// ModelConfigValues returns the current model configuration values.
	ModelConfigValues(context.Context) (config.ConfigValues, error)
	// UpdateModelConfig updates the model configuration values.
	UpdateModelConfig(context.Context, map[string]any, []string, ...config.Validator) error
}

ModelConfigService is an interface for interacting with a model's underlying model configuration values.

type ModelSecretBackendService

type ModelSecretBackendService interface {
	// GetModelSecretBackend returns the name of the secret backend configured for the model.
	GetModelSecretBackend(ctx context.Context) (string, error)

	// SetModelSecretBackend sets the secret backend for the model.
	SetModelSecretBackend(ctx context.Context, backendName string) error
}

ModelSecretBackendService is an interface for interacting with model secret backend service.

type ModelService

type ModelService interface {
	// GetModelConstraints returns the current model constraints.
	// It returns an error satisfying [modelerrors.NotFound] if the model does not
	// exist.
	// It returns an empty Value if the model does not have any constraints
	// configured.
	GetModelConstraints(ctx context.Context) (constraints.Value, error)

	// SetModelConstraints sets the model constraints to the new values removing
	// any previously set constraints.
	//
	// The following error types can be expected:
	// - [modelerrors.NotFound]: when the model does not exist
	// - [github.com/juju/juju/domain/network/errors.SpaceNotFound]: when the space
	// being set in the model constraint doesn't exist.
	// - [github.com/juju/juju/domain/machine/errors.InvalidContainerType]: when
	// the container type being set in the model constraint isn't valid.
	SetModelConstraints(ctx context.Context, cons constraints.Value) error
}

ModelService is a subset of the model domain service methods.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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