{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.TPU.Types.Sum where
import Network.Google.Prelude hiding (Bytes)
data NodeState
= StateUnspecified
| Creating
| Ready
| Restarting
| Reimaging
| Deleting
| Repairing
| Stopped
| Stopping
| Starting
| Preempted
| Terminated
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable NodeState
instance FromHttpApiData NodeState where
parseQueryParam = \case
"STATE_UNSPECIFIED" -> Right StateUnspecified
"CREATING" -> Right Creating
"READY" -> Right Ready
"RESTARTING" -> Right Restarting
"REIMAGING" -> Right Reimaging
"DELETING" -> Right Deleting
"REPAIRING" -> Right Repairing
"STOPPED" -> Right Stopped
"STOPPING" -> Right Stopping
"STARTING" -> Right Starting
"PREEMPTED" -> Right Preempted
"TERMINATED" -> Right Terminated
x -> Left ("Unable to parse NodeState from: " <> x)
instance ToHttpApiData NodeState where
toQueryParam = \case
StateUnspecified -> "STATE_UNSPECIFIED"
Creating -> "CREATING"
Ready -> "READY"
Restarting -> "RESTARTING"
Reimaging -> "REIMAGING"
Deleting -> "DELETING"
Repairing -> "REPAIRING"
Stopped -> "STOPPED"
Stopping -> "STOPPING"
Starting -> "STARTING"
Preempted -> "PREEMPTED"
Terminated -> "TERMINATED"
instance FromJSON NodeState where
parseJSON = parseJSONText "NodeState"
instance ToJSON NodeState where
toJSON = toJSONText
data NodeHealth
= HealthUnspecified
| Healthy
| Unhealthy
| Timeout
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable NodeHealth
instance FromHttpApiData NodeHealth where
parseQueryParam = \case
"HEALTH_UNSPECIFIED" -> Right HealthUnspecified
"HEALTHY" -> Right Healthy
"UNHEALTHY" -> Right Unhealthy
"TIMEOUT" -> Right Timeout
x -> Left ("Unable to parse NodeHealth from: " <> x)
instance ToHttpApiData NodeHealth where
toQueryParam = \case
HealthUnspecified -> "HEALTH_UNSPECIFIED"
Healthy -> "HEALTHY"
Unhealthy -> "UNHEALTHY"
Timeout -> "TIMEOUT"
instance FromJSON NodeHealth where
parseJSON = parseJSONText "NodeHealth"
instance ToJSON NodeHealth 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