{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.Spanner.Types.Sum where
import Network.Google.Prelude hiding (Bytes)
data TypeCode
= TypeCodeUnspecified
| Bool
| INT64
| FLOAT64
| Timestamp
| Date
| String
| Bytes
| Array
| Struct
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable TypeCode
instance FromHttpApiData TypeCode where
parseQueryParam = \case
"TYPE_CODE_UNSPECIFIED" -> Right TypeCodeUnspecified
"BOOL" -> Right Bool
"INT64" -> Right INT64
"FLOAT64" -> Right FLOAT64
"TIMESTAMP" -> Right Timestamp
"DATE" -> Right Date
"STRING" -> Right String
"BYTES" -> Right Bytes
"ARRAY" -> Right Array
"STRUCT" -> Right Struct
x -> Left ("Unable to parse TypeCode from: " <> x)
instance ToHttpApiData TypeCode where
toQueryParam = \case
TypeCodeUnspecified -> "TYPE_CODE_UNSPECIFIED"
Bool -> "BOOL"
INT64 -> "INT64"
FLOAT64 -> "FLOAT64"
Timestamp -> "TIMESTAMP"
Date -> "DATE"
String -> "STRING"
Bytes -> "BYTES"
Array -> "ARRAY"
Struct -> "STRUCT"
instance FromJSON TypeCode where
parseJSON = parseJSONText "TypeCode"
instance ToJSON TypeCode where
toJSON = toJSONText
data PlanNodeKind
= KindUnspecified
| Relational
| Scalar
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable PlanNodeKind
instance FromHttpApiData PlanNodeKind where
parseQueryParam = \case
"KIND_UNSPECIFIED" -> Right KindUnspecified
"RELATIONAL" -> Right Relational
"SCALAR" -> Right Scalar
x -> Left ("Unable to parse PlanNodeKind from: " <> x)
instance ToHttpApiData PlanNodeKind where
toQueryParam = \case
KindUnspecified -> "KIND_UNSPECIFIED"
Relational -> "RELATIONAL"
Scalar -> "SCALAR"
instance FromJSON PlanNodeKind where
parseJSON = parseJSONText "PlanNodeKind"
instance ToJSON PlanNodeKind where
toJSON = toJSONText
data ExecuteSQLRequestQueryMode
= Normal
| Plan
| ProFile
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable ExecuteSQLRequestQueryMode
instance FromHttpApiData ExecuteSQLRequestQueryMode where
parseQueryParam = \case
"NORMAL" -> Right Normal
"PLAN" -> Right Plan
"PROFILE" -> Right ProFile
x -> Left ("Unable to parse ExecuteSQLRequestQueryMode from: " <> x)
instance ToHttpApiData ExecuteSQLRequestQueryMode where
toQueryParam = \case
Normal -> "NORMAL"
Plan -> "PLAN"
ProFile -> "PROFILE"
instance FromJSON ExecuteSQLRequestQueryMode where
parseJSON = parseJSONText "ExecuteSQLRequestQueryMode"
instance ToJSON ExecuteSQLRequestQueryMode where
toJSON = toJSONText
data DatabaseState
= StateUnspecified
| Creating
| Ready
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable DatabaseState
instance FromHttpApiData DatabaseState where
parseQueryParam = \case
"STATE_UNSPECIFIED" -> Right StateUnspecified
"CREATING" -> Right Creating
"READY" -> Right Ready
x -> Left ("Unable to parse DatabaseState from: " <> x)
instance ToHttpApiData DatabaseState where
toQueryParam = \case
StateUnspecified -> "STATE_UNSPECIFIED"
Creating -> "CREATING"
Ready -> "READY"
instance FromJSON DatabaseState where
parseJSON = parseJSONText "DatabaseState"
instance ToJSON DatabaseState where
toJSON = toJSONText
data Xgafv
= X1
| X2
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable Xgafv
instance FromHttpApiData Xgafv where
parseQueryParam = \case
"1" -> Right X1
"2" -> Right X2
x -> Left ("Unable to parse Xgafv from: " <> x)
instance ToHttpApiData Xgafv where
toQueryParam = \case
X1 -> "1"
X2 -> "2"
instance FromJSON Xgafv where
parseJSON = parseJSONText "Xgafv"
instance ToJSON Xgafv where
toJSON = toJSONText
data InstanceState
= ISStateUnspecified
| ISCreating
| ISReady
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable InstanceState
instance FromHttpApiData InstanceState where
parseQueryParam = \case
"STATE_UNSPECIFIED" -> Right ISStateUnspecified
"CREATING" -> Right ISCreating
"READY" -> Right ISReady
x -> Left ("Unable to parse InstanceState from: " <> x)
instance ToHttpApiData InstanceState where
toQueryParam = \case
ISStateUnspecified -> "STATE_UNSPECIFIED"
ISCreating -> "CREATING"
ISReady -> "READY"
instance FromJSON InstanceState where
parseJSON = parseJSONText "InstanceState"
instance ToJSON InstanceState where
toJSON = toJSONText