ganeti

Safe HaskellNone

Ganeti.Query.Language

Contents

Description

Implementation of the Ganeti Query2 language.

Synopsis

THH declarations, that require ordering.

data ResultStatus Source #

Status of a query field.

Instances
Bounded ResultStatus # 
Instance details

Defined in Ganeti.Query.Language

Enum ResultStatus # 
Instance details

Defined in Ganeti.Query.Language

Eq ResultStatus # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: ResultStatus -> ResultStatus -> Bool

(/=) :: ResultStatus -> ResultStatus -> Bool

Ord ResultStatus # 
Instance details

Defined in Ganeti.Query.Language

Show ResultStatus # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> ResultStatus -> ShowS

show :: ResultStatus -> String

showList :: [ResultStatus] -> ShowS

JSON ResultStatus # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result ResultStatus

showJSON :: ResultStatus -> JSValue

readJSONs :: JSValue -> Result [ResultStatus]

showJSONs :: [ResultStatus] -> JSValue

NFData ResultStatus #

No-op NFData instance for ResultStatus, since it's a single constructor data-type.

Instance details

Defined in Ganeti.Query.Language

Methods

rnf :: ResultStatus -> ()

Arbitrary ResultStatus 
Instance details

Defined in Test.Ganeti.Query.Language

checkRS :: MonadFail m => ResultStatus -> a -> m a Source #

Check that ResultStatus is success or fail with descriptive message.

data FieldType Source #

Type of a query field.

Instances
Bounded FieldType # 
Instance details

Defined in Ganeti.Query.Language

Enum FieldType # 
Instance details

Defined in Ganeti.Query.Language

Eq FieldType # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: FieldType -> FieldType -> Bool

(/=) :: FieldType -> FieldType -> Bool

Ord FieldType # 
Instance details

Defined in Ganeti.Query.Language

Methods

compare :: FieldType -> FieldType -> Ordering

(<) :: FieldType -> FieldType -> Bool

(<=) :: FieldType -> FieldType -> Bool

(>) :: FieldType -> FieldType -> Bool

(>=) :: FieldType -> FieldType -> Bool

max :: FieldType -> FieldType -> FieldType

min :: FieldType -> FieldType -> FieldType

Show FieldType # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> FieldType -> ShowS

show :: FieldType -> String

showList :: [FieldType] -> ShowS

JSON FieldType # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result FieldType

showJSON :: FieldType -> JSValue

readJSONs :: JSValue -> Result [FieldType]

showJSONs :: [FieldType] -> JSValue

Arbitrary FieldType 
Instance details

Defined in Test.Ganeti.Query.Language

data QueryTypeOp Source #

Supported items on which Qlang works.

Instances
Bounded QueryTypeOp # 
Instance details

Defined in Ganeti.Query.Language

Enum QueryTypeOp # 
Instance details

Defined in Ganeti.Query.Language

Eq QueryTypeOp # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: QueryTypeOp -> QueryTypeOp -> Bool

(/=) :: QueryTypeOp -> QueryTypeOp -> Bool

Ord QueryTypeOp # 
Instance details

Defined in Ganeti.Query.Language

Show QueryTypeOp # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> QueryTypeOp -> ShowS

show :: QueryTypeOp -> String

showList :: [QueryTypeOp] -> ShowS

JSON QueryTypeOp # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result QueryTypeOp

showJSON :: QueryTypeOp -> JSValue

readJSONs :: JSValue -> Result [QueryTypeOp]

showJSONs :: [QueryTypeOp] -> JSValue

Arbitrary QueryTypeOp 
Instance details

Defined in Test.Ganeti.Query.Language

data QueryTypeLuxi Source #

Supported items on which Qlang works.

Constructors

QRLock 
QRJob 
QRFilter 
Instances
Bounded QueryTypeLuxi # 
Instance details

Defined in Ganeti.Query.Language

Enum QueryTypeLuxi # 
Instance details

Defined in Ganeti.Query.Language

Eq QueryTypeLuxi # 
Instance details

Defined in Ganeti.Query.Language

Ord QueryTypeLuxi # 
Instance details

Defined in Ganeti.Query.Language

Show QueryTypeLuxi # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> QueryTypeLuxi -> ShowS

show :: QueryTypeLuxi -> String

showList :: [QueryTypeLuxi] -> ShowS

JSON QueryTypeLuxi # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result QueryTypeLuxi

showJSON :: QueryTypeLuxi -> JSValue

readJSONs :: JSValue -> Result [QueryTypeLuxi]

showJSONs :: [QueryTypeLuxi] -> JSValue

Arbitrary QueryTypeLuxi 
Instance details

Defined in Test.Ganeti.Query.Language

data ItemType Source #

Overall query type.

Instances
Eq ItemType # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: ItemType -> ItemType -> Bool

(/=) :: ItemType -> ItemType -> Bool

Show ItemType # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> ItemType -> ShowS

show :: ItemType -> String

showList :: [ItemType] -> ShowS

JSON ItemType #

Custom JSON instance for ItemType since its encoding is not consistent with the data type itself.

Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result ItemType

showJSON :: ItemType -> JSValue

readJSONs :: JSValue -> Result [ItemType]

showJSONs :: [ItemType] -> JSValue

Arbitrary ItemType 
Instance details

Defined in Test.Ganeti.Query.Language

Sub data types for query2 queries and responses.

type Fields = [String] Source #

List of requested fields.

data Filter a Source #

Query2 filter expression. It's a parameteric type since we can filter different "things"; e.g. field names, or actual field getters, etc.

Constructors

EmptyFilter

No filter at all

AndFilter [Filter a]

& [expression, ...]

OrFilter [Filter a]

| [expression, ...]

NotFilter (Filter a)

! expression

TrueFilter a

? field

EQFilter a FilterValue

(=|!=) field value

LTFilter a FilterValue

< field value

GTFilter a FilterValue

> field value

LEFilter a FilterValue

<= field value

GEFilter a FilterValue

>= field value

RegexpFilter a FilterRegex

=~ field regexp

ContainsFilter a FilterValue

=[] list-field value

Instances
Functor Filter # 
Instance details

Defined in Ganeti.Query.Language

Methods

fmap :: (a -> b) -> Filter a -> Filter b

(<$) :: a -> Filter b -> Filter a

Foldable Filter # 
Instance details

Defined in Ganeti.Query.Language

Methods

fold :: Monoid m => Filter m -> m

foldMap :: Monoid m => (a -> m) -> Filter a -> m

foldr :: (a -> b -> b) -> b -> Filter a -> b

foldr' :: (a -> b -> b) -> b -> Filter a -> b

foldl :: (b -> a -> b) -> b -> Filter a -> b

foldl' :: (b -> a -> b) -> b -> Filter a -> b

foldr1 :: (a -> a -> a) -> Filter a -> a

foldl1 :: (a -> a -> a) -> Filter a -> a

toList :: Filter a -> [a]

null :: Filter a -> Bool

length :: Filter a -> Int

elem :: Eq a => a -> Filter a -> Bool

maximum :: Ord a => Filter a -> a

minimum :: Ord a => Filter a -> a

sum :: Num a => Filter a -> a

product :: Num a => Filter a -> a

Traversable Filter # 
Instance details

Defined in Ganeti.Query.Language

Methods

traverse :: Applicative f => (a -> f b) -> Filter a -> f (Filter b)

sequenceA :: Applicative f => Filter (f a) -> f (Filter a)

mapM :: Monad m => (a -> m b) -> Filter a -> m (Filter b)

sequence :: Monad m => Filter (m a) -> m (Filter a)

Eq a => Eq (Filter a) # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: Filter a -> Filter a -> Bool

(/=) :: Filter a -> Filter a -> Bool

Ord a => Ord (Filter a) # 
Instance details

Defined in Ganeti.Query.Language

Methods

compare :: Filter a -> Filter a -> Ordering

(<) :: Filter a -> Filter a -> Bool

(<=) :: Filter a -> Filter a -> Bool

(>) :: Filter a -> Filter a -> Bool

(>=) :: Filter a -> Filter a -> Bool

max :: Filter a -> Filter a -> Filter a

min :: Filter a -> Filter a -> Filter a

Show a => Show (Filter a) # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> Filter a -> ShowS

show :: Filter a -> String

showList :: [Filter a] -> ShowS

JSON a => JSON (Filter a) # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result (Filter a)

showJSON :: Filter a -> JSValue

readJSONs :: JSValue -> Result [Filter a]

showJSONs :: [Filter a] -> JSValue

Arbitrary (Filter FilterField) 
Instance details

Defined in Test.Ganeti.Query.Language

filterArguments :: Filter a -> [a] Source #

Get the "things" a filter talks about. This is useful, e.g., to decide which additional fields to fetch in a query depending on live data.

type FilterField = String Source #

Field name to filter on.

data FilterValue Source #

Value to compare the field value to, for filtering purposes.

Constructors

QuotedString String 
NumericValue Integer 
Instances
Eq FilterValue # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: FilterValue -> FilterValue -> Bool

(/=) :: FilterValue -> FilterValue -> Bool

Ord FilterValue # 
Instance details

Defined in Ganeti.Query.Language

Show FilterValue # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> FilterValue -> ShowS

show :: FilterValue -> String

showList :: [FilterValue] -> ShowS

JSON FilterValue # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result FilterValue

showJSON :: FilterValue -> JSValue

readJSONs :: JSValue -> Result [FilterValue]

showJSONs :: [FilterValue] -> JSValue

showFilterValue :: FilterValue -> JSValue Source #

Serialiser for FilterValue. The Python code just sends this to JSON as-is, so we'll do the same.

data FilterRegex Source #

Regexp to apply to the filter value, for filtering purposes. It holds both the string format, and the "compiled" format, so that we don't re-compile the regex at each match attempt.

Instances
Eq FilterRegex #

Eq instance: we only compare the string versions of the regexes.

Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: FilterRegex -> FilterRegex -> Bool

(/=) :: FilterRegex -> FilterRegex -> Bool

Ord FilterRegex #

Ord instance: we only compare the string versions of the regexes.

Instance details

Defined in Ganeti.Query.Language

Show FilterRegex #

Show instance: we show the constructor plus the string version of the regex.

Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> FilterRegex -> ShowS

show :: FilterRegex -> String

showList :: [FilterRegex] -> ShowS

JSON FilterRegex #

JSON instance: like for show and read instances, we work only with the string component.

Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result FilterRegex

showJSON :: FilterRegex -> JSValue

readJSONs :: JSValue -> Result [FilterRegex]

showJSONs :: [FilterRegex] -> JSValue

Arbitrary FilterRegex 
Instance details

Defined in Test.Ganeti.Query.Language

mkRegex :: MonadFail m => String -> m FilterRegex Source #

Builder for FilterRegex. We always attempt to compile the regular expression on the initialisation of the data structure; this might fail, if the RE is not well-formed.

type FieldName = String Source #

Name of a field.

type FieldTitle = String Source #

Title of a field, when represented in tabular format.

type FieldDoc = String Source #

Human redable description of a field.

data FieldDefinition Source #

Definition of a field.

Instances
Eq FieldDefinition # 
Instance details

Defined in Ganeti.Query.Language

Show FieldDefinition # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> FieldDefinition -> ShowS

show :: FieldDefinition -> String

showList :: [FieldDefinition] -> ShowS

JSON FieldDefinition # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result FieldDefinition

showJSON :: FieldDefinition -> JSValue

readJSONs :: JSValue -> Result [FieldDefinition]

showJSONs :: [FieldDefinition] -> JSValue

ArrayObject FieldDefinition # 
Instance details

Defined in Ganeti.Query.Language

Methods

toJSArray :: FieldDefinition -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result FieldDefinition Source #

DictObject FieldDefinition # 
Instance details

Defined in Ganeti.Query.Language

Methods

toDict :: FieldDefinition -> [(String, JSValue)] Source #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result FieldDefinition Source #

fromDict :: [(String, JSValue)] -> Result FieldDefinition Source #

Arbitrary FieldDefinition 
Instance details

Defined in Test.Ganeti.Query.Language

data ResultEntry Source #

Constructors

ResultEntry 

Fields

Instances
Eq ResultEntry # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: ResultEntry -> ResultEntry -> Bool

(/=) :: ResultEntry -> ResultEntry -> Bool

Show ResultEntry # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> ResultEntry -> ShowS

show :: ResultEntry -> String

showList :: [ResultEntry] -> ShowS

JSON ResultEntry # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result ResultEntry

showJSON :: ResultEntry -> JSValue

readJSONs :: JSValue -> Result [ResultEntry]

showJSONs :: [ResultEntry] -> JSValue

NFData ResultEntry # 
Instance details

Defined in Ganeti.Query.Language

Methods

rnf :: ResultEntry -> ()

type ResultValue = JSValue Source #

Value of a field, in json encoding. (its type will be depending on ResultStatus and FieldType)

Main Qlang queries and responses.

data Query Source #

Query2 query.

data QueryResult Source #

Query2 result.

Constructors

QueryResult 

Fields

Instances
Eq QueryResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

(==) :: QueryResult -> QueryResult -> Bool

(/=) :: QueryResult -> QueryResult -> Bool

Show QueryResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> QueryResult -> ShowS

show :: QueryResult -> String

showList :: [QueryResult] -> ShowS

JSON QueryResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result QueryResult

showJSON :: QueryResult -> JSValue

readJSONs :: JSValue -> Result [QueryResult]

showJSONs :: [QueryResult] -> JSValue

ArrayObject QueryResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

toJSArray :: QueryResult -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result QueryResult Source #

DictObject QueryResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

toDict :: QueryResult -> [(String, JSValue)] Source #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result QueryResult Source #

fromDict :: [(String, JSValue)] -> Result QueryResult Source #

data QueryFields Source #

Query2 Fields query. (to get supported fields names, descriptions, and types)

data QueryFieldsResult Source #

Query2 Fields result.

Instances
Eq QueryFieldsResult # 
Instance details

Defined in Ganeti.Query.Language

Show QueryFieldsResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

showsPrec :: Int -> QueryFieldsResult -> ShowS

show :: QueryFieldsResult -> String

showList :: [QueryFieldsResult] -> ShowS

JSON QueryFieldsResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

readJSON :: JSValue -> Result QueryFieldsResult

showJSON :: QueryFieldsResult -> JSValue

readJSONs :: JSValue -> Result [QueryFieldsResult]

showJSONs :: [QueryFieldsResult] -> JSValue

ArrayObject QueryFieldsResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

toJSArray :: QueryFieldsResult -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result QueryFieldsResult Source #

DictObject QueryFieldsResult # 
Instance details

Defined in Ganeti.Query.Language

Methods

toDict :: QueryFieldsResult -> [(String, JSValue)] Source #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result QueryFieldsResult Source #

fromDict :: [(String, JSValue)] -> Result QueryFieldsResult Source #

Arbitrary QueryFieldsResult 
Instance details

Defined in Test.Ganeti.Query.Language