constraints

package
v0.0.0-...-fab76b5 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: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeConstraints

func EncodeConstraints(cons Constraints) constraints.Value

EncodeConstraints is responsible for converting a Constraints value to a constraints.Value.

Types

type Constraints

type Constraints struct {
	// Arch, if not nil or empty, indicates that a machine must run the named
	// architecture.
	Arch *string

	// Container, if not nil, indicates that a machine must be the specified container type.
	Container *instance.ContainerType

	// CpuCores, if not nil, indicates that a machine must have at least that
	// number of effective cores available.
	CpuCores *uint64

	// CpuPower, if not nil, indicates that a machine must have at least that
	// amount of CPU power available, where 100 CpuPower is considered to be
	// equivalent to 1 Amazon ECU (or, roughly, a single 2007-era Xeon).
	CpuPower *uint64

	// Mem, if not nil, indicates that a machine must have at least that many
	// megabytes of RAM.
	Mem *uint64

	// RootDisk, if not nil, indicates that a machine must have at least
	// that many megabytes of disk space available in the root disk. In
	// providers where the root disk is configurable at instance startup
	// time, an instance with the specified amount of disk space in the OS
	// disk might be requested.
	RootDisk *uint64

	// RootDiskSource, if specified, determines what storage the root
	// disk should be allocated from. This will be provider specific -
	// in the case of vSphere it identifies the datastore the root
	// disk file should be created in.
	RootDiskSource *string

	// Tags, if not nil, indicates tags that the machine must have applied to it.
	// An empty list is treated the same as a nil (unspecified) list, except an
	// empty list will override any default tags, where a nil list will not.
	Tags *[]string

	// InstanceRole, if not nil, indicates that the specified role/profile for
	// the given cloud should be used. Only valid for clouds which support
	// instance roles. Currently only for AWS with instance-profiles
	InstanceRole *string

	// InstanceType, if not nil, indicates that the specified cloud instance type
	// be used. Only valid for clouds which support instance types.
	InstanceType *string

	// Spaces, if not nil, holds a list of juju network spaces that
	// should be available (or not) on the machine.
	Spaces *[]SpaceConstraint

	// VirtType, if not nil or empty, indicates that a machine must run the named
	// virtual type. Only valid for clouds with multi-hypervisor support.
	VirtType *string

	// Zones, if not nil, holds a list of availability zones limiting where
	// the machine can be located.
	Zones *[]string

	// AllocatePublicIP, if nil or true, signals that machines should be
	// created with a public IP address instead of a cloud local one.
	// The default behaviour if the value is not specified is to allocate
	// a public IP so that public cloud behaviour works out of the box.
	AllocatePublicIP *bool

	// ImageID, if not nil, indicates that a machine must use the specified
	// image. This is provider specific, and for the moment is only
	// implemented on MAAS clouds.
	ImageID *string
}

Constraints represents the application constraints. All fields of this struct are taken from core/constraints except for the spaces, which are modeled with SpaceConstraint to take into account the negative constraint (excluded field in the db).

func DecodeConstraints

func DecodeConstraints(coreCons constraints.Value) Constraints

DecodeConstraints is responsible for converting a constraints.Value to a Constraints object.

type SpaceConstraint

type SpaceConstraint struct {
	// Excluded indicates that this space should not be available to the
	// machine.
	Exclude bool

	// SpaceName is the name of the space.
	SpaceName string
}

SpaceConstraint represents a single space constraint for an application.

Jump to

Keyboard shortcuts

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