model

package
v0.0.0-...-6248505 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 9 Imported by: 12

Documentation

Overview

Package model contains the controller model service. The controller stores information about all the models it manages. This service exposes methods to perform management operations such as creating, destroying and gathering information about models the controller manages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteModelOption

type DeleteModelOption func(*DeleteModelOptions)

DeleteModelOption is a functional option that can be used to modify the behavior of the DeleteModel function.

func WithDeleteDB

func WithDeleteDB() DeleteModelOption

WithDeleteDB is a functional option that can be used to modify the behavior of the DeleteModel function to delete the model from the database.

type DeleteModelOptions

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

DeleteModelOptions is a struct that is used to modify the behavior of the DeleteModel function.

func DefaultDeleteModelOptions

func DefaultDeleteModelOptions() *DeleteModelOptions

DefaultDeleteModelOptions returns a pointer to a DeleteModelOptions struct with the default values set.

func (DeleteModelOptions) DeleteDB

func (o DeleteModelOptions) DeleteDB() bool

DeleteDB returns a boolean value that indicates if the model should be deleted from the database.

type GlobalModelCreationArgs

type GlobalModelCreationArgs struct {
	// Cloud is the name of the cloud to associate with the model.
	// Must not be empty for a valid struct.
	Cloud string

	// CloudRegion is the region that the model will use in the cloud.
	CloudRegion string

	// Credential is the id attributes for the credential to be associated with
	// model. Credential must be for the same cloud as that of the model.
	// Credential can be the zero value of the struct to not have a credential
	// associated with the model.
	Credential credential.Key

	// Name is the name of the model.
	// Must not be empty for a valid struct.
	Name string

	// Owner is the uuid of the user that owns this model in the Juju controller.
	Owner user.UUID

	// SecretBackend dictates the secret backend to be used for the newly
	// created model. SecretBackend can be left empty and a default will be
	// chosen at creation time.
	SecretBackend string
}

GlobalModelCreationArgs supplies the information required for recording details of a new model in the controller database.

func (GlobalModelCreationArgs) Validate

func (m GlobalModelCreationArgs) Validate() error

Validate is responsible for checking all of the fields of GlobalModelCreationArgs are in a set state that is valid for use. If a validation failure happens an error satisfying errors.NotValid is returned.

type ModelDetailArgs

type ModelDetailArgs struct {
	// UUID represents the unique id for the model when being created. This
	// value is optional and if omitted will be generated for the caller. Use
	// this value when you are trying to import a model during model migration.
	UUID coremodel.UUID

	// ControllerUUID represents the unique id for the controller that the model
	// is associated with.
	ControllerUUID uuid.UUID

	// Name is the name of the model.
	// Must not be empty for a valid struct.
	Name string

	// Type is the type of the model.
	// Type must satisfy IsValid() for a valid struct.
	Type coremodel.ModelType

	// Cloud is the name of the cloud to associate with the model.
	// Must not be empty for a valid struct.
	Cloud string

	// CloudType is the type of the underlying cloud (e.g. lxd, azure, ...)
	CloudType string

	// CloudRegion is the region that the model will use in the cloud.
	// Optional and can be empty.
	CloudRegion string

	// CredentialOwner is the name of the credential owner for this model in
	// the Juju controller.
	// Optional and can be empty.
	CredentialOwner user.Name

	// CredentialName is the name of the credential to be associated with the
	// model.
	// Optional and can be empty.
	CredentialName string

	// IsControllerModel is a boolean value that indicates if the model is the
	// controller model.
	IsControllerModel bool

	// AgentVersion is the target version for agents running in this model.
	AgentVersion version.Number
}

ModelDetailArgs supplies the information required for recording details of a new model in the model database.

type ModelImportArgs

type ModelImportArgs struct {
	// GlobalModelCreationArgs supplies the information needed for
	// importing the new model into Juju.
	GlobalModelCreationArgs

	// ID represents the unique id of the model to import.
	ID coremodel.UUID

	// AgentVersion is the target version for agents running in this model.
	AgentVersion version.Number
}

ModelImportArgs supplies the information needed for importing a model into a Juju controller.

func (ModelImportArgs) Validate

func (m ModelImportArgs) Validate() error

Validate is responsible for checking all of the fields of ModelImportArgs are in a set state valid for use. If a validation failure happens an error satisfying errors.NotValid is returned.

type ModelState

type ModelState struct {
	// Destroying is a boolean value that indicates if the model is being destroyed.
	Destroying bool
	// Migrating is a boolean value that indicates if the model is being migrated.
	Migrating bool
	// HasInvalidCloudCredential is a boolean value that indicates if the model's cloud credential is invalid.
	HasInvalidCloudCredential bool
	// InvalidCloudCredentialReason is a string that describes the reason for the model's cloud credential being invalid.
	InvalidCloudCredentialReason string
}

ModelState describes the state of a model.

type StatusInfo

type StatusInfo struct {
	// Status is the current status of the model.
	Status corestatus.Status
	// Message is a human-readable message that describes the current status of the model.
	Message string
	// Reason is a human-readable message that describes the reason for the current status of the model.
	Reason string
	// Since is the time when the model entered the current status.
	Since time.Time
}

StatusInfo represents the current status of a model.

Directories

Path Synopsis
Package service contains the services required for interacting with the underlying models within a Juju controller.
Package service contains the services required for interacting with the underlying models within a Juju controller.

Jump to

Keyboard shortcuts

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