ganeti

Safe HaskellNone

Ganeti.Types

Contents

Description

Some common Ganeti types.

This holds types common to both core work, and to htools. Types that are very core specific (e.g. configuration objects) should go in Objects, while types that are specific to htools in-memory representation should go into Types.

Synopsis

Generic types

newtype NonNegative a Source

Type that holds a non-negative value.

Constructors

NonNegative 

Fields

fromNonNegative :: a
 

Instances

Eq a => Eq (NonNegative a) 
Ord a => Ord (NonNegative a) 
Show a => Show (NonNegative a) 
(Arbitrary a, Ord a, Num a, Show a) => Arbitrary (NonNegative a) 
(JSON a, Num a, Ord a, Show a) => JSON (NonNegative a) 
PyValue a => PyValue (NonNegative a) 

mkNonNegative :: (Monad m, Num a, Ord a, Show a) => a -> m (NonNegative a)Source

Smart constructor for NonNegative.

newtype Positive a Source

Type that holds a positive value.

Constructors

Positive 

Fields

fromPositive :: a
 

Instances

Eq a => Eq (Positive a) 
Ord a => Ord (Positive a) 
Show a => Show (Positive a) 
(Arbitrary a, Ord a, Num a, Show a) => Arbitrary (Positive a) 
(JSON a, Num a, Ord a, Show a) => JSON (Positive a) 

mkPositive :: (Monad m, Num a, Ord a, Show a) => a -> m (Positive a)Source

Smart constructor for Positive.

newtype Negative a Source

Type that holds a negative value.

Constructors

Negative 

Fields

fromNegative :: a
 

Instances

Eq a => Eq (Negative a) 
Ord a => Ord (Negative a) 
Show a => Show (Negative a) 
(Arbitrary a, Ord a, Num a, Show a) => Arbitrary (Negative a) 
(JSON a, Num a, Ord a, Show a) => JSON (Negative a) 

mkNegative :: (Monad m, Num a, Ord a, Show a) => a -> m (Negative a)Source

Smart constructor for Negative.

newtype NonEmpty a Source

Type that holds a non-null list.

Constructors

NonEmpty 

Fields

fromNonEmpty :: [a]
 

Instances

Eq a => Eq (NonEmpty a) 
Ord a => Ord (NonEmpty a) 
Show a => Show (NonEmpty a) 
Arbitrary a => Arbitrary (NonEmpty a) 
JSON a => JSON (NonEmpty a) 
PyValue a => PyValue (NonEmpty a) 

mkNonEmpty :: Monad m => [a] -> m (NonEmpty a)Source

Smart constructor for NonEmpty.

type NonEmptyString = NonEmpty CharSource

A simple type alias for non-empty strings.

newtype IPv4Address Source

Constructors

IPv4Address 

Fields

fromIPv4Address :: String
 

Instances

mkIPv4Address :: Monad m => String -> m IPv4AddressSource

newtype IPv4Network Source

Constructors

IPv4Network 

Fields

fromIPv4Network :: String
 

Instances

mkIPv4Network :: Monad m => String -> m IPv4NetworkSource

newtype IPv6Address Source

Constructors

IPv6Address 

Fields

fromIPv6Address :: String
 

Instances

mkIPv6Address :: Monad m => String -> m IPv6AddressSource

newtype IPv6Network Source

Constructors

IPv6Network 

Fields

fromIPv6Network :: String
 

Instances

mkIPv6Network :: Monad m => String -> m IPv6NetworkSource

Ganeti types

data DiskTemplate Source

Instance disk template type. The disk template is a name for the constructor of the disk configuration DiskLogicalId used for serialization, configuration values, etc.

Instances

Bounded DiskTemplate 
Enum DiskTemplate 
Eq DiskTemplate 
Ord DiskTemplate 
Show DiskTemplate 
Arbitrary DiskTemplate

Custom Arbitrary instance for DiskTemplate, which needs to handle the case of file storage being disabled at configure time.

JSON DiskTemplate 
HasStringRepr DiskTemplate 
PyValue DiskTemplate 

diskTemplateFromRaw :: forall m. Monad m => String -> m DiskTemplateSource

diskTemplateMovable :: DiskTemplate -> BoolSource

Predicate on disk templates indicating if instances based on this disk template can freely be moved (to any node in the node group).

data TagKind Source

Data type representing what items the tag operations apply to.

Instances

Bounded TagKind 
Enum TagKind 
Eq TagKind 
Ord TagKind 
Show TagKind 
Arbitrary TagKind 
JSON TagKind 

tagKindFromRaw :: forall m. Monad m => String -> m TagKindSource

data AllocPolicy Source

The Group allocation policy type.

Note that the order of constructors is important as the automatic Ord instance will order them in the order they are defined, so when changing this data type be careful about the interaction with the desired sorting order.

Instances

Bounded AllocPolicy 
Enum AllocPolicy 
Eq AllocPolicy 
Ord AllocPolicy 
Show AllocPolicy 
Arbitrary AllocPolicy 
JSON AllocPolicy 

allocPolicyFromRaw :: forall m. Monad m => String -> m AllocPolicySource

instanceStatusFromRaw :: forall m. Monad m => String -> m InstanceStatusSource

data MigrationMode Source

Migration mode.

Instances

migrationModeFromRaw :: forall m. Monad m => String -> m MigrationModeSource

verifyOptionalChecksFromRaw :: forall m. Monad m => String -> m VerifyOptionalChecksSource

cVErrorCodeFromRaw :: forall m. Monad m => String -> m CVErrorCodeSource

data DdmSimple Source

Dynamic device modification, just add/remove version.

Instances

Bounded DdmSimple 
Enum DdmSimple 
Eq DdmSimple 
Ord DdmSimple 
Show DdmSimple 
Arbitrary DdmSimple 
JSON DdmSimple 

ddmSimpleFromRaw :: forall m. Monad m => String -> m DdmSimpleSource

data DdmFull Source

Dynamic device modification, all operations version.

TODO: DDM_SWAP, DDM_MOVE?

Instances

Bounded DdmFull 
Enum DdmFull 
Eq DdmFull 
Ord DdmFull 
Show DdmFull 
Arbitrary DdmFull 
JSON DdmFull 

ddmFullFromRaw :: forall m. Monad m => String -> m DdmFullSource

data Hypervisor Source

Hypervisor type definitions.

Constructors

Kvm 
XenPvm 
Chroot 
XenHvm 
Lxc 
Fake 

Instances

Bounded Hypervisor 
Enum Hypervisor 
Eq Hypervisor 
Ord Hypervisor 
Show Hypervisor 
Arbitrary Hypervisor 
Arbitrary OsHvParams

No real arbitrary instance for OsHvParams yet.

Arbitrary ClusterHvParams

No real arbitrary instance for ClusterHvParams yet.

JSON Hypervisor 
HasStringRepr Hypervisor 
PyValue Hypervisor 

hypervisorFromRaw :: forall m. Monad m => String -> m HypervisorSource

data OobCommand Source

Oob command type.

Instances

Bounded OobCommand 
Enum OobCommand 
Eq OobCommand 
Ord OobCommand 
Show OobCommand 
Arbitrary OobCommand 
JSON OobCommand 

oobCommandFromRaw :: forall m. Monad m => String -> m OobCommandSource

data OobStatus Source

Oob command status

Instances

Bounded OobStatus 
Enum OobStatus 
Eq OobStatus 
Ord OobStatus 
Show OobStatus 
JSON OobStatus 

oobStatusFromRaw :: forall m. Monad m => String -> m OobStatusSource

data StorageType Source

Storage type.

Instances

Bounded StorageType 
Enum StorageType 
Eq StorageType 
Ord StorageType 
Show StorageType 
Arbitrary StorageType

Custom Arbitrary instance for StorageType, which needs to handle the case of file storage being disabled at configure time.

JSON StorageType 

storageTypeFromRaw :: forall m. Monad m => String -> m StorageTypeSource

type StorageKey = StringSource

Storage keys are identifiers for storage units. Their content varies depending on the storage type, for example a storage key for LVM storage is the volume group name.

data StorageUnitRaw Source

Storage units without storage-type-specific parameters

diskTemplateToStorageType :: DiskTemplate -> StorageTypeSource

Mapping from disk templates to storage types.

addParamsToStorageUnit :: SPExclusiveStorage -> StorageUnitRaw -> StorageUnitSource

Equips a raw storage unit with its parameters

data EvacMode Source

Node evac modes.

This is part of the IAllocator interface and it is used, for example, in RqType. However, it must reside in this module, and not in Types, because it is also used by Constants.

Instances

Bounded EvacMode 
Enum EvacMode 
Eq EvacMode 
Ord EvacMode 
Show EvacMode 
Arbitrary EvacMode 
JSON EvacMode 

evacModeFromRaw :: forall m. Monad m => String -> m EvacModeSource

data FileDriver Source

The file driver type.

Instances

Bounded FileDriver 
Enum FileDriver 
Eq FileDriver 
Ord FileDriver 
Show FileDriver 
Arbitrary FileDriver 
JSON FileDriver 

fileDriverFromRaw :: forall m. Monad m => String -> m FileDriverSource

data InstCreateMode Source

The instance create mode.

instCreateModeFromRaw :: forall m. Monad m => String -> m InstCreateModeSource

data RebootType Source

Reboot type.

Instances

Bounded RebootType 
Enum RebootType 
Eq RebootType 
Ord RebootType 
Show RebootType 
Arbitrary RebootType 
JSON RebootType 

rebootTypeFromRaw :: forall m. Monad m => String -> m RebootTypeSource

data ExportMode Source

Export modes.

Instances

exportModeFromRaw :: forall m. Monad m => String -> m ExportModeSource

data IAllocatorTestDir Source

IAllocator run types (OpTestIAllocator).

iAllocatorTestDirFromRaw :: forall m. Monad m => String -> m IAllocatorTestDirSource

iAllocatorModeFromRaw :: forall m. Monad m => String -> m IAllocatorModeSource

data NICMode Source

Network mode.

Constructors

NMBridged 
NMRouted 
NMOvs 
NMPool 

Instances

Bounded NICMode 
Enum NICMode 
Eq NICMode 
Ord NICMode 
Show NICMode 
Arbitrary NICMode 
JSON NICMode 

nICModeFromRaw :: forall m. Monad m => String -> m NICModeSource

data JobStatus Source

The JobStatus data type. Note that this is ordered especially such that greater/lesser comparison on values of this type makes sense.

Instances

Bounded JobStatus 
Enum JobStatus 
Eq JobStatus 
Ord JobStatus 
Show JobStatus 
Arbitrary JobStatus 
JSON JobStatus 

jobStatusFromRaw :: forall m. Monad m => String -> m JobStatusSource

finalizedJobStatusFromRaw :: forall m. Monad m => String -> m FinalizedJobStatusSource

newtype JobId Source

The Ganeti job type.

Constructors

JobId 

Fields

fromJobId :: Int
 

Instances

Eq JobId 
Ord JobId 
Show JobId 
Arbitrary JobId 
JSON JobId 

makeJobId :: Monad m => Int -> m JobIdSource

Builds a job ID.

makeJobIdS :: Monad m => String -> m JobIdSource

Builds a job ID from a string.

parseJobId :: Monad m => JSValue -> m JobIdSource

type RelativeJobId = Negative IntSource

Relative job ID type alias.

data JobIdDep Source

Job ID dependency.

Instances

Eq JobIdDep 
Ord JobIdDep 
Show JobIdDep 
Arbitrary JobIdDep 
JSON JobIdDep 

data JobDependency Source

Job Dependency type.

Instances

absoluteJobDependency :: Monad m => JobDependency -> JobId -> m JobDependencySource

From job dependency and job id compute an absolute job dependency.

getJobIdFromDependency :: JobDependency -> [JobId]Source

From a job dependency get the absolute job id it depends on, if given absolutely.

data OpSubmitPriority Source

Valid opcode priorities for submit.

opSubmitPriorityFromRaw :: forall m. Monad m => Int -> m OpSubmitPrioritySource

parseSubmitPriority :: Monad m => String -> m OpSubmitPrioritySource

Parse submit priorities from a string.

fmtSubmitPriority :: OpSubmitPriority -> StringSource

Format a submit priority as string.

data OpStatus Source

Our ADT for the OpCode status at runtime (while in a job).

Instances

Bounded OpStatus 
Enum OpStatus 
Eq OpStatus 
Ord OpStatus 
Show OpStatus 
Arbitrary OpStatus 
JSON OpStatus 

opStatusFromRaw :: forall m. Monad m => String -> m OpStatusSource

data ELogType Source

Type for the job message type.

Instances

Bounded ELogType 
Enum ELogType 
Eq ELogType 
Ord ELogType 
Show ELogType 
Arbitrary ELogType 
JSON ELogType 

eLogTypeFromRaw :: forall m. Monad m => String -> m ELogTypeSource

type ReasonElem = (String, String, Integer)Source

Type of one element of a reason trail, of form (source, reason, timestamp).

type ReasonTrail = [ReasonElem]Source

Type representing a reason trail.

data VType Source

The VTYPES, a mini-type system in Python.

Instances

Bounded VType 
Enum VType 
Eq VType 
Ord VType 
Show VType 
JSON VType 
PyValue VType 

vTypeFromRaw :: forall m. Monad m => String -> m VTypeSource

vTypeToRaw :: VType -> StringSource

Node role type

data NodeRole Source

Instances

Bounded NodeRole 
Enum NodeRole 
Eq NodeRole 
Ord NodeRole 
Show NodeRole 
JSON NodeRole 

nodeRoleFromRaw :: forall m. Monad m => String -> m NodeRoleSource

roleDescription :: NodeRole -> StringSource

The description of the node role.

Disk types

data DiskMode Source

Constructors

DiskRdOnly 
DiskRdWr 

Instances

Bounded DiskMode 
Enum DiskMode 
Eq DiskMode 
Ord DiskMode 
Show DiskMode 
Arbitrary DiskMode 
JSON DiskMode 

diskModeFromRaw :: forall m. Monad m => String -> m DiskModeSource

data BlockDriver Source

The persistent block driver type. Currently only one type is allowed.

Constructors

BlockDrvManual 

Instances

Bounded BlockDriver 
Enum BlockDriver 
Eq BlockDriver 
Ord BlockDriver 
Show BlockDriver 
Arbitrary BlockDriver 
JSON BlockDriver 

blockDriverFromRaw :: forall m. Monad m => String -> m BlockDriverSource

Instance types

data AdminState Source

Instances

Bounded AdminState 
Enum AdminState 
Eq AdminState 
Ord AdminState 
Show AdminState 
Arbitrary AdminState 
JSON AdminState 

adminStateFromRaw :: forall m. Monad m => String -> m AdminStateSource

adminStateSourceFromRaw :: forall m. Monad m => String -> m AdminStateSourceSource

Storage field type

storageFieldFromRaw :: forall m. Monad m => String -> m StorageFieldSource

Disk access protocol

diskAccessModeFromRaw :: forall m. Monad m => String -> m DiskAccessModeSource

data LocalDiskStatus Source

Local disk status

Python code depends on: DiskStatusOk < DiskStatusUnknown < DiskStatusFaulty

localDiskStatusFromRaw :: forall m. Monad m => Int -> m LocalDiskStatusSource

replaceDisksModeFromRaw :: forall m. Monad m => String -> m ReplaceDisksModeSource

data RpcTimeout Source

Basic timeouts for RPC calls.

Constructors

Urgent 
Fast 
Normal 
Slow 
FourHours 
OneDay 

Instances

Bounded RpcTimeout 
Enum RpcTimeout 
Eq RpcTimeout 
Ord RpcTimeout 
Show RpcTimeout 

rpcTimeoutFromRaw :: forall m. Monad m => Int -> m RpcTimeoutSource

data HotplugAction Source

Hotplug action.

Constructors

HAAdd 
HARemove 
HAMod 

hotplugActionFromRaw :: forall m. Monad m => String -> m HotplugActionSource

data HotplugTarget Source

Hotplug Device Target.

Constructors

HTDisk 
HTNic 

hotplugTargetFromRaw :: forall m. Monad m => String -> m HotplugTargetSource

data SshKeyType Source

SSH key type.

Constructors

RSA 
DSA 
ECDSA 

Instances

Bounded SshKeyType 
Enum SshKeyType 
Eq SshKeyType 
Ord SshKeyType 
Show SshKeyType 
Arbitrary SshKeyType 
JSON SshKeyType 

sshKeyTypeFromRaw :: forall m. Monad m => String -> m SshKeyTypeSource

Private type and instances

redacted :: StringSource

newtype Private a Source

A container for values that should be happy to be manipulated yet refuses to be shown unless explicitly requested.

Constructors

Private 

Fields

getPrivate :: a
 

Instances

Monad Private 
Functor Private 
Applicative Private 
Arbitrary ClusterOsParamsPrivate 
Eq a => Eq (Private a) 
Ord a => Ord (Private a) 
Show a => Show (Private a)

Show the value of the field.

It would be better not to implement this at all. Alas, Show OpCode requires Show Private.

Arbitrary a => Arbitrary (Private a) 
(Show a, JSON a) => JSON (Private a) 
PyValue a => PyValue (Private a) 

showPrivateJSObject :: JSON a => [(String, a)] -> JSObject (Private JSValue)Source

Secret type and instances

newtype Secret a Source

A container for values that behaves like Private, but doesn't leak the value through showJSON

Constructors

Secret 

Fields

getSecret :: a
 

Instances

Monad Secret 
Functor Secret 
Applicative Secret 
Eq a => Eq (Secret a) 
Ord a => Ord (Secret a) 
Show a => Show (Secret a) 
(Show a, JSON a) => JSON (Secret a) 
PyValue a => PyValue (Secret a) 

showSecretJSObject :: JSON a => [(String, a)] -> JSObject (Secret JSValue)Source

We return <redacted> here to satisfy the idempotence of serialization and deserialization, although this will impact the meaningfulness of secret parameters within configuration tests.

revealValInJSObject :: JSObject (Secret JSValue) -> JSObject (Private JSValue)Source

type HvParams = Container JSValueSource

The hypervisor parameter type. This is currently a simple map, without type checking on key/value pairs.

type OsParams = Container StringSource

The OS parameters type. This is, and will remain, a string container, since the keys are dynamically declared by the OSes, and the values are always strings.

class ForthcomingObject a whereSource

Class of objects that can be forthcoming.

Methods

isForthcoming :: a -> BoolSource

class TagsObject a whereSource

Class of objects that have tags.

Methods

tagsOf :: a -> Set StringSource