module Network.AWS.EMR.Types
(
EMR
, JSONError
, MarketType (..)
, InstanceGroupConfig
, instanceGroupConfig
, igcBidPrice
, igcInstanceCount
, igcInstanceRole
, igcInstanceType
, igcMarket
, igcName
, InstanceStateChangeReason
, instanceStateChangeReason
, iscrCode
, iscrMessage
, JobFlowDetail
, jobFlowDetail
, jfdAmiVersion
, jfdBootstrapActions
, jfdExecutionStatusDetail
, jfdInstances
, jfdJobFlowId
, jfdJobFlowRole
, jfdLogUri
, jfdName
, jfdServiceRole
, jfdSteps
, jfdSupportedProducts
, jfdVisibleToAllUsers
, KeyValue
, keyValue
, kvKey
, kvValue
, SupportedProductConfig
, supportedProductConfig
, spcArgs
, spcName
, Command
, command
, cArgs
, cName
, cScriptPath
, StepExecutionState (..)
, ActionOnFailure (..)
, ClusterStateChangeReason
, clusterStateChangeReason
, cscrCode
, cscrMessage
, Tag
, tag
, tagKey
, tagValue
, Application
, application
, aAdditionalInfo
, aArgs
, aName
, aVersion
, JobFlowExecutionStatusDetail
, jobFlowExecutionStatusDetail
, jfesdCreationDateTime
, jfesdEndDateTime
, jfesdLastStateChangeReason
, jfesdReadyDateTime
, jfesdStartDateTime
, jfesdState
, InstanceGroupStatus
, instanceGroupStatus
, igsState
, igsStateChangeReason
, igsTimeline
, Cluster
, cluster
, c1Applications
, c1AutoTerminate
, c1Ec2InstanceAttributes
, c1Id
, c1LogUri
, c1MasterPublicDnsName
, c1Name
, c1NormalizedInstanceHours
, c1RequestedAmiVersion
, c1RunningAmiVersion
, c1ServiceRole
, c1Status
, c1Tags
, c1TerminationProtected
, c1VisibleToAllUsers
, InstanceTimeline
, instanceTimeline
, itCreationDateTime
, itEndDateTime
, itReadyDateTime
, Ec2InstanceAttributes
, ec2InstanceAttributes
, eiaEc2AvailabilityZone
, eiaEc2KeyName
, eiaEc2SubnetId
, eiaIamInstanceProfile
, StepStateChangeReasonCode (..)
, ClusterState (..)
, HadoopStepConfig
, hadoopStepConfig
, hscArgs
, hscJar
, hscMainClass
, hscProperties
, JobFlowExecutionState (..)
, StepDetail
, stepDetail
, sdExecutionStatusDetail
, sdStepConfig
, InstanceGroupStateChangeReason
, instanceGroupStateChangeReason
, igscrCode
, igscrMessage
, InstanceGroupType (..)
, InstanceGroupStateChangeReasonCode (..)
, StepStatus
, stepStatus
, ssState
, ssStateChangeReason
, ssTimeline
, StepSummary
, stepSummary
, ssActionOnFailure
, ssConfig
, ssId
, ssName
, ssStatus
, InstanceGroupState (..)
, StepTimeline
, stepTimeline
, stCreationDateTime
, stEndDateTime
, stStartDateTime
, PlacementType
, placementType
, ptAvailabilityZone
, HadoopJarStepConfig
, hadoopJarStepConfig
, hjscArgs
, hjscJar
, hjscMainClass
, hjscProperties
, InstanceGroupModifyConfig
, instanceGroupModifyConfig
, igmcEC2InstanceIdsToTerminate
, igmcInstanceCount
, igmcInstanceGroupId
, InstanceGroupDetail
, instanceGroupDetail
, igdBidPrice
, igdCreationDateTime
, igdEndDateTime
, igdInstanceGroupId
, igdInstanceRequestCount
, igdInstanceRole
, igdInstanceRunningCount
, igdInstanceType
, igdLastStateChangeReason
, igdMarket
, igdName
, igdReadyDateTime
, igdStartDateTime
, igdState
, StepStateChangeReason
, stepStateChangeReason
, sscrCode
, sscrMessage
, ClusterStateChangeReasonCode (..)
, Step
, step
, sActionOnFailure
, sConfig
, sId
, sName
, sStatus
, StepState (..)
, InstanceGroupTimeline
, instanceGroupTimeline
, igtCreationDateTime
, igtEndDateTime
, igtReadyDateTime
, BootstrapActionDetail
, bootstrapActionDetail
, badBootstrapActionConfig
, StepExecutionStatusDetail
, stepExecutionStatusDetail
, sesdCreationDateTime
, sesdEndDateTime
, sesdLastStateChangeReason
, sesdStartDateTime
, sesdState
, InstanceStatus
, instanceStatus
, isState
, isStateChangeReason
, isTimeline
, InstanceRoleType (..)
, JobFlowInstancesConfig
, jobFlowInstancesConfig
, jficEc2KeyName
, jficEc2SubnetId
, jficHadoopVersion
, jficInstanceCount
, jficInstanceGroups
, jficKeepJobFlowAliveWhenNoSteps
, jficMasterInstanceType
, jficPlacement
, jficSlaveInstanceType
, jficTerminationProtected
, StepConfig
, stepConfig
, scActionOnFailure
, scHadoopJarStep
, scName
, InstanceGroup
, instanceGroup
, igBidPrice
, igId
, igInstanceGroupType
, igInstanceType
, igMarket
, igName
, igRequestedInstanceCount
, igRunningInstanceCount
, igStatus
, BootstrapActionConfig
, bootstrapActionConfig
, bacName
, bacScriptBootstrapAction
, ClusterSummary
, clusterSummary
, csId
, csName
, csNormalizedInstanceHours
, csStatus
, JobFlowInstancesDetail
, jobFlowInstancesDetail
, jfidEc2KeyName
, jfidEc2SubnetId
, jfidHadoopVersion
, jfidInstanceCount
, jfidInstanceGroups
, jfidKeepJobFlowAliveWhenNoSteps
, jfidMasterInstanceId
, jfidMasterInstanceType
, jfidMasterPublicDnsName
, jfidNormalizedInstanceHours
, jfidPlacement
, jfidSlaveInstanceType
, jfidTerminationProtected
, ClusterStatus
, clusterStatus
, csState
, csStateChangeReason
, csTimeline
, InstanceState (..)
, ClusterTimeline
, clusterTimeline
, ctCreationDateTime
, ctEndDateTime
, ctReadyDateTime
, InstanceStateChangeReasonCode (..)
, Instance
, instance'
, iEc2InstanceId
, iId
, iPrivateDnsName
, iPrivateIpAddress
, iPublicDnsName
, iPublicIpAddress
, iStatus
, ScriptBootstrapActionConfig
, scriptBootstrapActionConfig
, sbacArgs
, sbacPath
) where
import Network.AWS.Prelude
import Network.AWS.Signing
import qualified GHC.Exts
data EMR
instance AWSService EMR where
type Sg EMR = V4
type Er EMR = JSONError
service = service'
where
service' :: Service EMR
service' = Service
{ _svcAbbrev = "EMR"
, _svcPrefix = "elasticmapreduce"
, _svcVersion = "2009-03-31"
, _svcTargetPrefix = Just "ElasticMapReduce"
, _svcJSONVersion = Just "1.1"
, _svcHandle = handle
, _svcRetry = retry
}
handle :: Status
-> Maybe (LazyByteString -> ServiceError JSONError)
handle = jsonError statusSuccess service'
retry :: Retry EMR
retry = Exponential
{ _retryBase = 0.05
, _retryGrowth = 2
, _retryAttempts = 5
, _retryCheck = check
}
check :: Status
-> JSONError
-> Bool
check (statusCode -> s) (awsErrorCode -> e)
| s == 400 && "ThrottlingException" == e = True
| s == 500 = True
| s == 509 = True
| s == 503 = True
| otherwise = False
data MarketType
= OnDemand
| Spot
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable MarketType
instance FromText MarketType where
parser = takeText >>= \case
"ON_DEMAND" -> pure OnDemand
"SPOT" -> pure Spot
e -> fail $
"Failure parsing MarketType from " ++ show e
instance ToText MarketType where
toText = \case
OnDemand -> "ON_DEMAND"
Spot -> "SPOT"
instance ToByteString MarketType
instance ToHeader MarketType
instance ToQuery MarketType
instance FromJSON MarketType where
parseJSON = parseJSONText "MarketType"
instance ToJSON MarketType where
toJSON = toJSONText
data InstanceGroupConfig = InstanceGroupConfig
{ _igcBidPrice :: Maybe Text
, _igcInstanceCount :: Int
, _igcInstanceRole :: InstanceRoleType
, _igcInstanceType :: Text
, _igcMarket :: Maybe MarketType
, _igcName :: Maybe Text
} deriving (Eq, Show)
instanceGroupConfig :: InstanceRoleType
-> Text
-> Int
-> InstanceGroupConfig
instanceGroupConfig p1 p2 p3 = InstanceGroupConfig
{ _igcInstanceRole = p1
, _igcInstanceType = p2
, _igcInstanceCount = p3
, _igcName = Nothing
, _igcMarket = Nothing
, _igcBidPrice = Nothing
}
igcBidPrice :: Lens' InstanceGroupConfig (Maybe Text)
igcBidPrice = lens _igcBidPrice (\s a -> s { _igcBidPrice = a })
igcInstanceCount :: Lens' InstanceGroupConfig Int
igcInstanceCount = lens _igcInstanceCount (\s a -> s { _igcInstanceCount = a })
igcInstanceRole :: Lens' InstanceGroupConfig InstanceRoleType
igcInstanceRole = lens _igcInstanceRole (\s a -> s { _igcInstanceRole = a })
igcInstanceType :: Lens' InstanceGroupConfig Text
igcInstanceType = lens _igcInstanceType (\s a -> s { _igcInstanceType = a })
igcMarket :: Lens' InstanceGroupConfig (Maybe MarketType)
igcMarket = lens _igcMarket (\s a -> s { _igcMarket = a })
igcName :: Lens' InstanceGroupConfig (Maybe Text)
igcName = lens _igcName (\s a -> s { _igcName = a })
instance FromJSON InstanceGroupConfig where
parseJSON = withObject "InstanceGroupConfig" $ \o -> InstanceGroupConfig
<$> o .:? "BidPrice"
<*> o .: "InstanceCount"
<*> o .: "InstanceRole"
<*> o .: "InstanceType"
<*> o .:? "Market"
<*> o .:? "Name"
instance ToJSON InstanceGroupConfig where
toJSON InstanceGroupConfig{..} = object
[ "Name" .= _igcName
, "Market" .= _igcMarket
, "InstanceRole" .= _igcInstanceRole
, "BidPrice" .= _igcBidPrice
, "InstanceType" .= _igcInstanceType
, "InstanceCount" .= _igcInstanceCount
]
data InstanceStateChangeReason = InstanceStateChangeReason
{ _iscrCode :: Maybe InstanceStateChangeReasonCode
, _iscrMessage :: Maybe Text
} deriving (Eq, Show)
instanceStateChangeReason :: InstanceStateChangeReason
instanceStateChangeReason = InstanceStateChangeReason
{ _iscrCode = Nothing
, _iscrMessage = Nothing
}
iscrCode :: Lens' InstanceStateChangeReason (Maybe InstanceStateChangeReasonCode)
iscrCode = lens _iscrCode (\s a -> s { _iscrCode = a })
iscrMessage :: Lens' InstanceStateChangeReason (Maybe Text)
iscrMessage = lens _iscrMessage (\s a -> s { _iscrMessage = a })
instance FromJSON InstanceStateChangeReason where
parseJSON = withObject "InstanceStateChangeReason" $ \o -> InstanceStateChangeReason
<$> o .:? "Code"
<*> o .:? "Message"
instance ToJSON InstanceStateChangeReason where
toJSON InstanceStateChangeReason{..} = object
[ "Code" .= _iscrCode
, "Message" .= _iscrMessage
]
data JobFlowDetail = JobFlowDetail
{ _jfdAmiVersion :: Maybe Text
, _jfdBootstrapActions :: List "BootstrapActions" BootstrapActionDetail
, _jfdExecutionStatusDetail :: JobFlowExecutionStatusDetail
, _jfdInstances :: JobFlowInstancesDetail
, _jfdJobFlowId :: Text
, _jfdJobFlowRole :: Maybe Text
, _jfdLogUri :: Maybe Text
, _jfdName :: Text
, _jfdServiceRole :: Maybe Text
, _jfdSteps :: List "Steps" StepDetail
, _jfdSupportedProducts :: List "SupportedProducts" Text
, _jfdVisibleToAllUsers :: Maybe Bool
} deriving (Eq, Show)
jobFlowDetail :: Text
-> Text
-> JobFlowExecutionStatusDetail
-> JobFlowInstancesDetail
-> JobFlowDetail
jobFlowDetail p1 p2 p3 p4 = JobFlowDetail
{ _jfdJobFlowId = p1
, _jfdName = p2
, _jfdExecutionStatusDetail = p3
, _jfdInstances = p4
, _jfdLogUri = Nothing
, _jfdAmiVersion = Nothing
, _jfdSteps = mempty
, _jfdBootstrapActions = mempty
, _jfdSupportedProducts = mempty
, _jfdVisibleToAllUsers = Nothing
, _jfdJobFlowRole = Nothing
, _jfdServiceRole = Nothing
}
jfdAmiVersion :: Lens' JobFlowDetail (Maybe Text)
jfdAmiVersion = lens _jfdAmiVersion (\s a -> s { _jfdAmiVersion = a })
jfdBootstrapActions :: Lens' JobFlowDetail [BootstrapActionDetail]
jfdBootstrapActions =
lens _jfdBootstrapActions (\s a -> s { _jfdBootstrapActions = a })
. _List
jfdExecutionStatusDetail :: Lens' JobFlowDetail JobFlowExecutionStatusDetail
jfdExecutionStatusDetail =
lens _jfdExecutionStatusDetail
(\s a -> s { _jfdExecutionStatusDetail = a })
jfdInstances :: Lens' JobFlowDetail JobFlowInstancesDetail
jfdInstances = lens _jfdInstances (\s a -> s { _jfdInstances = a })
jfdJobFlowId :: Lens' JobFlowDetail Text
jfdJobFlowId = lens _jfdJobFlowId (\s a -> s { _jfdJobFlowId = a })
jfdJobFlowRole :: Lens' JobFlowDetail (Maybe Text)
jfdJobFlowRole = lens _jfdJobFlowRole (\s a -> s { _jfdJobFlowRole = a })
jfdLogUri :: Lens' JobFlowDetail (Maybe Text)
jfdLogUri = lens _jfdLogUri (\s a -> s { _jfdLogUri = a })
jfdName :: Lens' JobFlowDetail Text
jfdName = lens _jfdName (\s a -> s { _jfdName = a })
jfdServiceRole :: Lens' JobFlowDetail (Maybe Text)
jfdServiceRole = lens _jfdServiceRole (\s a -> s { _jfdServiceRole = a })
jfdSteps :: Lens' JobFlowDetail [StepDetail]
jfdSteps = lens _jfdSteps (\s a -> s { _jfdSteps = a }) . _List
jfdSupportedProducts :: Lens' JobFlowDetail [Text]
jfdSupportedProducts =
lens _jfdSupportedProducts (\s a -> s { _jfdSupportedProducts = a })
. _List
jfdVisibleToAllUsers :: Lens' JobFlowDetail (Maybe Bool)
jfdVisibleToAllUsers =
lens _jfdVisibleToAllUsers (\s a -> s { _jfdVisibleToAllUsers = a })
instance FromJSON JobFlowDetail where
parseJSON = withObject "JobFlowDetail" $ \o -> JobFlowDetail
<$> o .:? "AmiVersion"
<*> o .:? "BootstrapActions" .!= mempty
<*> o .: "ExecutionStatusDetail"
<*> o .: "Instances"
<*> o .: "JobFlowId"
<*> o .:? "JobFlowRole"
<*> o .:? "LogUri"
<*> o .: "Name"
<*> o .:? "ServiceRole"
<*> o .:? "Steps" .!= mempty
<*> o .:? "SupportedProducts" .!= mempty
<*> o .:? "VisibleToAllUsers"
instance ToJSON JobFlowDetail where
toJSON JobFlowDetail{..} = object
[ "JobFlowId" .= _jfdJobFlowId
, "Name" .= _jfdName
, "LogUri" .= _jfdLogUri
, "AmiVersion" .= _jfdAmiVersion
, "ExecutionStatusDetail" .= _jfdExecutionStatusDetail
, "Instances" .= _jfdInstances
, "Steps" .= _jfdSteps
, "BootstrapActions" .= _jfdBootstrapActions
, "SupportedProducts" .= _jfdSupportedProducts
, "VisibleToAllUsers" .= _jfdVisibleToAllUsers
, "JobFlowRole" .= _jfdJobFlowRole
, "ServiceRole" .= _jfdServiceRole
]
data KeyValue = KeyValue
{ _kvKey :: Maybe Text
, _kvValue :: Maybe Text
} deriving (Eq, Ord, Show)
keyValue :: KeyValue
keyValue = KeyValue
{ _kvKey = Nothing
, _kvValue = Nothing
}
kvKey :: Lens' KeyValue (Maybe Text)
kvKey = lens _kvKey (\s a -> s { _kvKey = a })
kvValue :: Lens' KeyValue (Maybe Text)
kvValue = lens _kvValue (\s a -> s { _kvValue = a })
instance FromJSON KeyValue where
parseJSON = withObject "KeyValue" $ \o -> KeyValue
<$> o .:? "Key"
<*> o .:? "Value"
instance ToJSON KeyValue where
toJSON KeyValue{..} = object
[ "Key" .= _kvKey
, "Value" .= _kvValue
]
data SupportedProductConfig = SupportedProductConfig
{ _spcArgs :: List "Args" Text
, _spcName :: Maybe Text
} deriving (Eq, Ord, Show)
supportedProductConfig :: SupportedProductConfig
supportedProductConfig = SupportedProductConfig
{ _spcName = Nothing
, _spcArgs = mempty
}
spcArgs :: Lens' SupportedProductConfig [Text]
spcArgs = lens _spcArgs (\s a -> s { _spcArgs = a }) . _List
spcName :: Lens' SupportedProductConfig (Maybe Text)
spcName = lens _spcName (\s a -> s { _spcName = a })
instance FromJSON SupportedProductConfig where
parseJSON = withObject "SupportedProductConfig" $ \o -> SupportedProductConfig
<$> o .:? "Args" .!= mempty
<*> o .:? "Name"
instance ToJSON SupportedProductConfig where
toJSON SupportedProductConfig{..} = object
[ "Name" .= _spcName
, "Args" .= _spcArgs
]
data Command = Command
{ _cArgs :: List "Args" Text
, _cName :: Maybe Text
, _cScriptPath :: Maybe Text
} deriving (Eq, Ord, Show)
command :: Command
command = Command
{ _cName = Nothing
, _cScriptPath = Nothing
, _cArgs = mempty
}
cArgs :: Lens' Command [Text]
cArgs = lens _cArgs (\s a -> s { _cArgs = a }) . _List
cName :: Lens' Command (Maybe Text)
cName = lens _cName (\s a -> s { _cName = a })
cScriptPath :: Lens' Command (Maybe Text)
cScriptPath = lens _cScriptPath (\s a -> s { _cScriptPath = a })
instance FromJSON Command where
parseJSON = withObject "Command" $ \o -> Command
<$> o .:? "Args" .!= mempty
<*> o .:? "Name"
<*> o .:? "ScriptPath"
instance ToJSON Command where
toJSON Command{..} = object
[ "Name" .= _cName
, "ScriptPath" .= _cScriptPath
, "Args" .= _cArgs
]
data StepExecutionState
= Cancelled
| Completed
| Continue
| Failed
| Interrupted
| Pending
| Running
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable StepExecutionState
instance FromText StepExecutionState where
parser = takeText >>= \case
"CANCELLED" -> pure Cancelled
"COMPLETED" -> pure Completed
"CONTINUE" -> pure Continue
"FAILED" -> pure Failed
"INTERRUPTED" -> pure Interrupted
"PENDING" -> pure Pending
"RUNNING" -> pure Running
e -> fail $
"Failure parsing StepExecutionState from " ++ show e
instance ToText StepExecutionState where
toText = \case
Cancelled -> "CANCELLED"
Completed -> "COMPLETED"
Continue -> "CONTINUE"
Failed -> "FAILED"
Interrupted -> "INTERRUPTED"
Pending -> "PENDING"
Running -> "RUNNING"
instance ToByteString StepExecutionState
instance ToHeader StepExecutionState
instance ToQuery StepExecutionState
instance FromJSON StepExecutionState where
parseJSON = parseJSONText "StepExecutionState"
instance ToJSON StepExecutionState where
toJSON = toJSONText
data ActionOnFailure
= AOFCancelAndWait
| AOFContinue
| AOFTerminateCluster
| AOFTerminateJobFlow
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable ActionOnFailure
instance FromText ActionOnFailure where
parser = takeText >>= \case
"CANCEL_AND_WAIT" -> pure AOFCancelAndWait
"CONTINUE" -> pure AOFContinue
"TERMINATE_CLUSTER" -> pure AOFTerminateCluster
"TERMINATE_JOB_FLOW" -> pure AOFTerminateJobFlow
e -> fail $
"Failure parsing ActionOnFailure from " ++ show e
instance ToText ActionOnFailure where
toText = \case
AOFCancelAndWait -> "CANCEL_AND_WAIT"
AOFContinue -> "CONTINUE"
AOFTerminateCluster -> "TERMINATE_CLUSTER"
AOFTerminateJobFlow -> "TERMINATE_JOB_FLOW"
instance ToByteString ActionOnFailure
instance ToHeader ActionOnFailure
instance ToQuery ActionOnFailure
instance FromJSON ActionOnFailure where
parseJSON = parseJSONText "ActionOnFailure"
instance ToJSON ActionOnFailure where
toJSON = toJSONText
data ClusterStateChangeReason = ClusterStateChangeReason
{ _cscrCode :: Maybe ClusterStateChangeReasonCode
, _cscrMessage :: Maybe Text
} deriving (Eq, Show)
clusterStateChangeReason :: ClusterStateChangeReason
clusterStateChangeReason = ClusterStateChangeReason
{ _cscrCode = Nothing
, _cscrMessage = Nothing
}
cscrCode :: Lens' ClusterStateChangeReason (Maybe ClusterStateChangeReasonCode)
cscrCode = lens _cscrCode (\s a -> s { _cscrCode = a })
cscrMessage :: Lens' ClusterStateChangeReason (Maybe Text)
cscrMessage = lens _cscrMessage (\s a -> s { _cscrMessage = a })
instance FromJSON ClusterStateChangeReason where
parseJSON = withObject "ClusterStateChangeReason" $ \o -> ClusterStateChangeReason
<$> o .:? "Code"
<*> o .:? "Message"
instance ToJSON ClusterStateChangeReason where
toJSON ClusterStateChangeReason{..} = object
[ "Code" .= _cscrCode
, "Message" .= _cscrMessage
]
data Tag = Tag
{ _tagKey :: Maybe Text
, _tagValue :: Maybe Text
} deriving (Eq, Ord, Show)
tag :: Tag
tag = Tag
{ _tagKey = Nothing
, _tagValue = Nothing
}
tagKey :: Lens' Tag (Maybe Text)
tagKey = lens _tagKey (\s a -> s { _tagKey = a })
tagValue :: Lens' Tag (Maybe Text)
tagValue = lens _tagValue (\s a -> s { _tagValue = a })
instance FromJSON Tag where
parseJSON = withObject "Tag" $ \o -> Tag
<$> o .:? "Key"
<*> o .:? "Value"
instance ToJSON Tag where
toJSON Tag{..} = object
[ "Key" .= _tagKey
, "Value" .= _tagValue
]
data Application = Application
{ _aAdditionalInfo :: Map Text Text
, _aArgs :: List "Args" Text
, _aName :: Maybe Text
, _aVersion :: Maybe Text
} deriving (Eq, Show)
application :: Application
application = Application
{ _aName = Nothing
, _aVersion = Nothing
, _aArgs = mempty
, _aAdditionalInfo = mempty
}
aAdditionalInfo :: Lens' Application (HashMap Text Text)
aAdditionalInfo = lens _aAdditionalInfo (\s a -> s { _aAdditionalInfo = a }) . _Map
aArgs :: Lens' Application [Text]
aArgs = lens _aArgs (\s a -> s { _aArgs = a }) . _List
aName :: Lens' Application (Maybe Text)
aName = lens _aName (\s a -> s { _aName = a })
aVersion :: Lens' Application (Maybe Text)
aVersion = lens _aVersion (\s a -> s { _aVersion = a })
instance FromJSON Application where
parseJSON = withObject "Application" $ \o -> Application
<$> o .:? "AdditionalInfo" .!= mempty
<*> o .:? "Args" .!= mempty
<*> o .:? "Name"
<*> o .:? "Version"
instance ToJSON Application where
toJSON Application{..} = object
[ "Name" .= _aName
, "Version" .= _aVersion
, "Args" .= _aArgs
, "AdditionalInfo" .= _aAdditionalInfo
]
data JobFlowExecutionStatusDetail = JobFlowExecutionStatusDetail
{ _jfesdCreationDateTime :: POSIX
, _jfesdEndDateTime :: Maybe POSIX
, _jfesdLastStateChangeReason :: Maybe Text
, _jfesdReadyDateTime :: Maybe POSIX
, _jfesdStartDateTime :: Maybe POSIX
, _jfesdState :: JobFlowExecutionState
} deriving (Eq, Show)
jobFlowExecutionStatusDetail :: JobFlowExecutionState
-> UTCTime
-> JobFlowExecutionStatusDetail
jobFlowExecutionStatusDetail p1 p2 = JobFlowExecutionStatusDetail
{ _jfesdState = p1
, _jfesdCreationDateTime = withIso _Time (const id) p2
, _jfesdStartDateTime = Nothing
, _jfesdReadyDateTime = Nothing
, _jfesdEndDateTime = Nothing
, _jfesdLastStateChangeReason = Nothing
}
jfesdCreationDateTime :: Lens' JobFlowExecutionStatusDetail UTCTime
jfesdCreationDateTime =
lens _jfesdCreationDateTime (\s a -> s { _jfesdCreationDateTime = a })
. _Time
jfesdEndDateTime :: Lens' JobFlowExecutionStatusDetail (Maybe UTCTime)
jfesdEndDateTime = lens _jfesdEndDateTime (\s a -> s { _jfesdEndDateTime = a }) . mapping _Time
jfesdLastStateChangeReason :: Lens' JobFlowExecutionStatusDetail (Maybe Text)
jfesdLastStateChangeReason =
lens _jfesdLastStateChangeReason
(\s a -> s { _jfesdLastStateChangeReason = a })
jfesdReadyDateTime :: Lens' JobFlowExecutionStatusDetail (Maybe UTCTime)
jfesdReadyDateTime =
lens _jfesdReadyDateTime (\s a -> s { _jfesdReadyDateTime = a })
. mapping _Time
jfesdStartDateTime :: Lens' JobFlowExecutionStatusDetail (Maybe UTCTime)
jfesdStartDateTime =
lens _jfesdStartDateTime (\s a -> s { _jfesdStartDateTime = a })
. mapping _Time
jfesdState :: Lens' JobFlowExecutionStatusDetail JobFlowExecutionState
jfesdState = lens _jfesdState (\s a -> s { _jfesdState = a })
instance FromJSON JobFlowExecutionStatusDetail where
parseJSON = withObject "JobFlowExecutionStatusDetail" $ \o -> JobFlowExecutionStatusDetail
<$> o .: "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "LastStateChangeReason"
<*> o .:? "ReadyDateTime"
<*> o .:? "StartDateTime"
<*> o .: "State"
instance ToJSON JobFlowExecutionStatusDetail where
toJSON JobFlowExecutionStatusDetail{..} = object
[ "State" .= _jfesdState
, "CreationDateTime" .= _jfesdCreationDateTime
, "StartDateTime" .= _jfesdStartDateTime
, "ReadyDateTime" .= _jfesdReadyDateTime
, "EndDateTime" .= _jfesdEndDateTime
, "LastStateChangeReason" .= _jfesdLastStateChangeReason
]
data InstanceGroupStatus = InstanceGroupStatus
{ _igsState :: Maybe InstanceGroupState
, _igsStateChangeReason :: Maybe InstanceGroupStateChangeReason
, _igsTimeline :: Maybe InstanceGroupTimeline
} deriving (Eq, Show)
instanceGroupStatus :: InstanceGroupStatus
instanceGroupStatus = InstanceGroupStatus
{ _igsState = Nothing
, _igsStateChangeReason = Nothing
, _igsTimeline = Nothing
}
igsState :: Lens' InstanceGroupStatus (Maybe InstanceGroupState)
igsState = lens _igsState (\s a -> s { _igsState = a })
igsStateChangeReason :: Lens' InstanceGroupStatus (Maybe InstanceGroupStateChangeReason)
igsStateChangeReason =
lens _igsStateChangeReason (\s a -> s { _igsStateChangeReason = a })
igsTimeline :: Lens' InstanceGroupStatus (Maybe InstanceGroupTimeline)
igsTimeline = lens _igsTimeline (\s a -> s { _igsTimeline = a })
instance FromJSON InstanceGroupStatus where
parseJSON = withObject "InstanceGroupStatus" $ \o -> InstanceGroupStatus
<$> o .:? "State"
<*> o .:? "StateChangeReason"
<*> o .:? "Timeline"
instance ToJSON InstanceGroupStatus where
toJSON InstanceGroupStatus{..} = object
[ "State" .= _igsState
, "StateChangeReason" .= _igsStateChangeReason
, "Timeline" .= _igsTimeline
]
data Cluster = Cluster
{ _c1Applications :: List "Applications" Application
, _c1AutoTerminate :: Maybe Bool
, _c1Ec2InstanceAttributes :: Maybe Ec2InstanceAttributes
, _c1Id :: Text
, _c1LogUri :: Maybe Text
, _c1MasterPublicDnsName :: Maybe Text
, _c1Name :: Text
, _c1NormalizedInstanceHours :: Maybe Int
, _c1RequestedAmiVersion :: Maybe Text
, _c1RunningAmiVersion :: Maybe Text
, _c1ServiceRole :: Maybe Text
, _c1Status :: ClusterStatus
, _c1Tags :: List "Tags" Tag
, _c1TerminationProtected :: Maybe Bool
, _c1VisibleToAllUsers :: Maybe Bool
} deriving (Eq, Show)
cluster :: Text
-> Text
-> ClusterStatus
-> Cluster
cluster p1 p2 p3 = Cluster
{ _c1Id = p1
, _c1Name = p2
, _c1Status = p3
, _c1Ec2InstanceAttributes = Nothing
, _c1LogUri = Nothing
, _c1RequestedAmiVersion = Nothing
, _c1RunningAmiVersion = Nothing
, _c1AutoTerminate = Nothing
, _c1TerminationProtected = Nothing
, _c1VisibleToAllUsers = Nothing
, _c1Applications = mempty
, _c1Tags = mempty
, _c1ServiceRole = Nothing
, _c1NormalizedInstanceHours = Nothing
, _c1MasterPublicDnsName = Nothing
}
c1Applications :: Lens' Cluster [Application]
c1Applications = lens _c1Applications (\s a -> s { _c1Applications = a }) . _List
c1AutoTerminate :: Lens' Cluster (Maybe Bool)
c1AutoTerminate = lens _c1AutoTerminate (\s a -> s { _c1AutoTerminate = a })
c1Ec2InstanceAttributes :: Lens' Cluster (Maybe Ec2InstanceAttributes)
c1Ec2InstanceAttributes =
lens _c1Ec2InstanceAttributes (\s a -> s { _c1Ec2InstanceAttributes = a })
c1Id :: Lens' Cluster Text
c1Id = lens _c1Id (\s a -> s { _c1Id = a })
c1LogUri :: Lens' Cluster (Maybe Text)
c1LogUri = lens _c1LogUri (\s a -> s { _c1LogUri = a })
c1MasterPublicDnsName :: Lens' Cluster (Maybe Text)
c1MasterPublicDnsName =
lens _c1MasterPublicDnsName (\s a -> s { _c1MasterPublicDnsName = a })
c1Name :: Lens' Cluster Text
c1Name = lens _c1Name (\s a -> s { _c1Name = a })
c1NormalizedInstanceHours :: Lens' Cluster (Maybe Int)
c1NormalizedInstanceHours =
lens _c1NormalizedInstanceHours
(\s a -> s { _c1NormalizedInstanceHours = a })
c1RequestedAmiVersion :: Lens' Cluster (Maybe Text)
c1RequestedAmiVersion =
lens _c1RequestedAmiVersion (\s a -> s { _c1RequestedAmiVersion = a })
c1RunningAmiVersion :: Lens' Cluster (Maybe Text)
c1RunningAmiVersion =
lens _c1RunningAmiVersion (\s a -> s { _c1RunningAmiVersion = a })
c1ServiceRole :: Lens' Cluster (Maybe Text)
c1ServiceRole = lens _c1ServiceRole (\s a -> s { _c1ServiceRole = a })
c1Status :: Lens' Cluster ClusterStatus
c1Status = lens _c1Status (\s a -> s { _c1Status = a })
c1Tags :: Lens' Cluster [Tag]
c1Tags = lens _c1Tags (\s a -> s { _c1Tags = a }) . _List
c1TerminationProtected :: Lens' Cluster (Maybe Bool)
c1TerminationProtected =
lens _c1TerminationProtected (\s a -> s { _c1TerminationProtected = a })
c1VisibleToAllUsers :: Lens' Cluster (Maybe Bool)
c1VisibleToAllUsers =
lens _c1VisibleToAllUsers (\s a -> s { _c1VisibleToAllUsers = a })
instance FromJSON Cluster where
parseJSON = withObject "Cluster" $ \o -> Cluster
<$> o .:? "Applications" .!= mempty
<*> o .:? "AutoTerminate"
<*> o .:? "Ec2InstanceAttributes"
<*> o .: "Id"
<*> o .:? "LogUri"
<*> o .:? "MasterPublicDnsName"
<*> o .: "Name"
<*> o .:? "NormalizedInstanceHours"
<*> o .:? "RequestedAmiVersion"
<*> o .:? "RunningAmiVersion"
<*> o .:? "ServiceRole"
<*> o .: "Status"
<*> o .:? "Tags" .!= mempty
<*> o .:? "TerminationProtected"
<*> o .:? "VisibleToAllUsers"
instance ToJSON Cluster where
toJSON Cluster{..} = object
[ "Id" .= _c1Id
, "Name" .= _c1Name
, "Status" .= _c1Status
, "Ec2InstanceAttributes" .= _c1Ec2InstanceAttributes
, "LogUri" .= _c1LogUri
, "RequestedAmiVersion" .= _c1RequestedAmiVersion
, "RunningAmiVersion" .= _c1RunningAmiVersion
, "AutoTerminate" .= _c1AutoTerminate
, "TerminationProtected" .= _c1TerminationProtected
, "VisibleToAllUsers" .= _c1VisibleToAllUsers
, "Applications" .= _c1Applications
, "Tags" .= _c1Tags
, "ServiceRole" .= _c1ServiceRole
, "NormalizedInstanceHours" .= _c1NormalizedInstanceHours
, "MasterPublicDnsName" .= _c1MasterPublicDnsName
]
data InstanceTimeline = InstanceTimeline
{ _itCreationDateTime :: Maybe POSIX
, _itEndDateTime :: Maybe POSIX
, _itReadyDateTime :: Maybe POSIX
} deriving (Eq, Ord, Show)
instanceTimeline :: InstanceTimeline
instanceTimeline = InstanceTimeline
{ _itCreationDateTime = Nothing
, _itReadyDateTime = Nothing
, _itEndDateTime = Nothing
}
itCreationDateTime :: Lens' InstanceTimeline (Maybe UTCTime)
itCreationDateTime =
lens _itCreationDateTime (\s a -> s { _itCreationDateTime = a })
. mapping _Time
itEndDateTime :: Lens' InstanceTimeline (Maybe UTCTime)
itEndDateTime = lens _itEndDateTime (\s a -> s { _itEndDateTime = a }) . mapping _Time
itReadyDateTime :: Lens' InstanceTimeline (Maybe UTCTime)
itReadyDateTime = lens _itReadyDateTime (\s a -> s { _itReadyDateTime = a }) . mapping _Time
instance FromJSON InstanceTimeline where
parseJSON = withObject "InstanceTimeline" $ \o -> InstanceTimeline
<$> o .:? "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "ReadyDateTime"
instance ToJSON InstanceTimeline where
toJSON InstanceTimeline{..} = object
[ "CreationDateTime" .= _itCreationDateTime
, "ReadyDateTime" .= _itReadyDateTime
, "EndDateTime" .= _itEndDateTime
]
data Ec2InstanceAttributes = Ec2InstanceAttributes
{ _eiaEc2AvailabilityZone :: Maybe Text
, _eiaEc2KeyName :: Maybe Text
, _eiaEc2SubnetId :: Maybe Text
, _eiaIamInstanceProfile :: Maybe Text
} deriving (Eq, Ord, Show)
ec2InstanceAttributes :: Ec2InstanceAttributes
ec2InstanceAttributes = Ec2InstanceAttributes
{ _eiaEc2KeyName = Nothing
, _eiaEc2SubnetId = Nothing
, _eiaEc2AvailabilityZone = Nothing
, _eiaIamInstanceProfile = Nothing
}
eiaEc2AvailabilityZone :: Lens' Ec2InstanceAttributes (Maybe Text)
eiaEc2AvailabilityZone =
lens _eiaEc2AvailabilityZone (\s a -> s { _eiaEc2AvailabilityZone = a })
eiaEc2KeyName :: Lens' Ec2InstanceAttributes (Maybe Text)
eiaEc2KeyName = lens _eiaEc2KeyName (\s a -> s { _eiaEc2KeyName = a })
eiaEc2SubnetId :: Lens' Ec2InstanceAttributes (Maybe Text)
eiaEc2SubnetId = lens _eiaEc2SubnetId (\s a -> s { _eiaEc2SubnetId = a })
eiaIamInstanceProfile :: Lens' Ec2InstanceAttributes (Maybe Text)
eiaIamInstanceProfile =
lens _eiaIamInstanceProfile (\s a -> s { _eiaIamInstanceProfile = a })
instance FromJSON Ec2InstanceAttributes where
parseJSON = withObject "Ec2InstanceAttributes" $ \o -> Ec2InstanceAttributes
<$> o .:? "Ec2AvailabilityZone"
<*> o .:? "Ec2KeyName"
<*> o .:? "Ec2SubnetId"
<*> o .:? "IamInstanceProfile"
instance ToJSON Ec2InstanceAttributes where
toJSON Ec2InstanceAttributes{..} = object
[ "Ec2KeyName" .= _eiaEc2KeyName
, "Ec2SubnetId" .= _eiaEc2SubnetId
, "Ec2AvailabilityZone" .= _eiaEc2AvailabilityZone
, "IamInstanceProfile" .= _eiaIamInstanceProfile
]
data StepStateChangeReasonCode
= None
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable StepStateChangeReasonCode
instance FromText StepStateChangeReasonCode where
parser = takeText >>= \case
"NONE" -> pure None
e -> fail $
"Failure parsing StepStateChangeReasonCode from " ++ show e
instance ToText StepStateChangeReasonCode where
toText None = "NONE"
instance ToByteString StepStateChangeReasonCode
instance ToHeader StepStateChangeReasonCode
instance ToQuery StepStateChangeReasonCode
instance FromJSON StepStateChangeReasonCode where
parseJSON = parseJSONText "StepStateChangeReasonCode"
instance ToJSON StepStateChangeReasonCode where
toJSON = toJSONText
data ClusterState
= CSBootstrapping
| CSRunning
| CSStarting
| CSTerminated
| CSTerminatedWithErrors
| CSTerminating
| CSWaiting
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable ClusterState
instance FromText ClusterState where
parser = takeText >>= \case
"BOOTSTRAPPING" -> pure CSBootstrapping
"RUNNING" -> pure CSRunning
"STARTING" -> pure CSStarting
"TERMINATED" -> pure CSTerminated
"TERMINATED_WITH_ERRORS" -> pure CSTerminatedWithErrors
"TERMINATING" -> pure CSTerminating
"WAITING" -> pure CSWaiting
e -> fail $
"Failure parsing ClusterState from " ++ show e
instance ToText ClusterState where
toText = \case
CSBootstrapping -> "BOOTSTRAPPING"
CSRunning -> "RUNNING"
CSStarting -> "STARTING"
CSTerminated -> "TERMINATED"
CSTerminatedWithErrors -> "TERMINATED_WITH_ERRORS"
CSTerminating -> "TERMINATING"
CSWaiting -> "WAITING"
instance ToByteString ClusterState
instance ToHeader ClusterState
instance ToQuery ClusterState
instance FromJSON ClusterState where
parseJSON = parseJSONText "ClusterState"
instance ToJSON ClusterState where
toJSON = toJSONText
data HadoopStepConfig = HadoopStepConfig
{ _hscArgs :: List "Args" Text
, _hscJar :: Maybe Text
, _hscMainClass :: Maybe Text
, _hscProperties :: Map Text Text
} deriving (Eq, Show)
hadoopStepConfig :: HadoopStepConfig
hadoopStepConfig = HadoopStepConfig
{ _hscJar = Nothing
, _hscProperties = mempty
, _hscMainClass = Nothing
, _hscArgs = mempty
}
hscArgs :: Lens' HadoopStepConfig [Text]
hscArgs = lens _hscArgs (\s a -> s { _hscArgs = a }) . _List
hscJar :: Lens' HadoopStepConfig (Maybe Text)
hscJar = lens _hscJar (\s a -> s { _hscJar = a })
hscMainClass :: Lens' HadoopStepConfig (Maybe Text)
hscMainClass = lens _hscMainClass (\s a -> s { _hscMainClass = a })
hscProperties :: Lens' HadoopStepConfig (HashMap Text Text)
hscProperties = lens _hscProperties (\s a -> s { _hscProperties = a }) . _Map
instance FromJSON HadoopStepConfig where
parseJSON = withObject "HadoopStepConfig" $ \o -> HadoopStepConfig
<$> o .:? "Args" .!= mempty
<*> o .:? "Jar"
<*> o .:? "MainClass"
<*> o .:? "Properties" .!= mempty
instance ToJSON HadoopStepConfig where
toJSON HadoopStepConfig{..} = object
[ "Jar" .= _hscJar
, "Properties" .= _hscProperties
, "MainClass" .= _hscMainClass
, "Args" .= _hscArgs
]
data JobFlowExecutionState
= JFESBootstrapping
| JFESCompleted
| JFESFailed
| JFESRunning
| JFESShuttingDown
| JFESStarting
| JFESTerminated
| JFESWaiting
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable JobFlowExecutionState
instance FromText JobFlowExecutionState where
parser = takeText >>= \case
"BOOTSTRAPPING" -> pure JFESBootstrapping
"COMPLETED" -> pure JFESCompleted
"FAILED" -> pure JFESFailed
"RUNNING" -> pure JFESRunning
"SHUTTING_DOWN" -> pure JFESShuttingDown
"STARTING" -> pure JFESStarting
"TERMINATED" -> pure JFESTerminated
"WAITING" -> pure JFESWaiting
e -> fail $
"Failure parsing JobFlowExecutionState from " ++ show e
instance ToText JobFlowExecutionState where
toText = \case
JFESBootstrapping -> "BOOTSTRAPPING"
JFESCompleted -> "COMPLETED"
JFESFailed -> "FAILED"
JFESRunning -> "RUNNING"
JFESShuttingDown -> "SHUTTING_DOWN"
JFESStarting -> "STARTING"
JFESTerminated -> "TERMINATED"
JFESWaiting -> "WAITING"
instance ToByteString JobFlowExecutionState
instance ToHeader JobFlowExecutionState
instance ToQuery JobFlowExecutionState
instance FromJSON JobFlowExecutionState where
parseJSON = parseJSONText "JobFlowExecutionState"
instance ToJSON JobFlowExecutionState where
toJSON = toJSONText
data StepDetail = StepDetail
{ _sdExecutionStatusDetail :: StepExecutionStatusDetail
, _sdStepConfig :: StepConfig
} deriving (Eq, Show)
stepDetail :: StepConfig
-> StepExecutionStatusDetail
-> StepDetail
stepDetail p1 p2 = StepDetail
{ _sdStepConfig = p1
, _sdExecutionStatusDetail = p2
}
sdExecutionStatusDetail :: Lens' StepDetail StepExecutionStatusDetail
sdExecutionStatusDetail =
lens _sdExecutionStatusDetail (\s a -> s { _sdExecutionStatusDetail = a })
sdStepConfig :: Lens' StepDetail StepConfig
sdStepConfig = lens _sdStepConfig (\s a -> s { _sdStepConfig = a })
instance FromJSON StepDetail where
parseJSON = withObject "StepDetail" $ \o -> StepDetail
<$> o .: "ExecutionStatusDetail"
<*> o .: "StepConfig"
instance ToJSON StepDetail where
toJSON StepDetail{..} = object
[ "StepConfig" .= _sdStepConfig
, "ExecutionStatusDetail" .= _sdExecutionStatusDetail
]
data InstanceGroupStateChangeReason = InstanceGroupStateChangeReason
{ _igscrCode :: Maybe InstanceGroupStateChangeReasonCode
, _igscrMessage :: Maybe Text
} deriving (Eq, Show)
instanceGroupStateChangeReason :: InstanceGroupStateChangeReason
instanceGroupStateChangeReason = InstanceGroupStateChangeReason
{ _igscrCode = Nothing
, _igscrMessage = Nothing
}
igscrCode :: Lens' InstanceGroupStateChangeReason (Maybe InstanceGroupStateChangeReasonCode)
igscrCode = lens _igscrCode (\s a -> s { _igscrCode = a })
igscrMessage :: Lens' InstanceGroupStateChangeReason (Maybe Text)
igscrMessage = lens _igscrMessage (\s a -> s { _igscrMessage = a })
instance FromJSON InstanceGroupStateChangeReason where
parseJSON = withObject "InstanceGroupStateChangeReason" $ \o -> InstanceGroupStateChangeReason
<$> o .:? "Code"
<*> o .:? "Message"
instance ToJSON InstanceGroupStateChangeReason where
toJSON InstanceGroupStateChangeReason{..} = object
[ "Code" .= _igscrCode
, "Message" .= _igscrMessage
]
data InstanceGroupType
= Core
| Master
| Task
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable InstanceGroupType
instance FromText InstanceGroupType where
parser = takeText >>= \case
"CORE" -> pure Core
"MASTER" -> pure Master
"TASK" -> pure Task
e -> fail $
"Failure parsing InstanceGroupType from " ++ show e
instance ToText InstanceGroupType where
toText = \case
Core -> "CORE"
Master -> "MASTER"
Task -> "TASK"
instance ToByteString InstanceGroupType
instance ToHeader InstanceGroupType
instance ToQuery InstanceGroupType
instance FromJSON InstanceGroupType where
parseJSON = parseJSONText "InstanceGroupType"
instance ToJSON InstanceGroupType where
toJSON = toJSONText
data InstanceGroupStateChangeReasonCode
= ClusterTerminated
| InstanceFailure
| InternalError
| ValidationError
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable InstanceGroupStateChangeReasonCode
instance FromText InstanceGroupStateChangeReasonCode where
parser = takeText >>= \case
"CLUSTER_TERMINATED" -> pure ClusterTerminated
"INSTANCE_FAILURE" -> pure InstanceFailure
"INTERNAL_ERROR" -> pure InternalError
"VALIDATION_ERROR" -> pure ValidationError
e -> fail $
"Failure parsing InstanceGroupStateChangeReasonCode from " ++ show e
instance ToText InstanceGroupStateChangeReasonCode where
toText = \case
ClusterTerminated -> "CLUSTER_TERMINATED"
InstanceFailure -> "INSTANCE_FAILURE"
InternalError -> "INTERNAL_ERROR"
ValidationError -> "VALIDATION_ERROR"
instance ToByteString InstanceGroupStateChangeReasonCode
instance ToHeader InstanceGroupStateChangeReasonCode
instance ToQuery InstanceGroupStateChangeReasonCode
instance FromJSON InstanceGroupStateChangeReasonCode where
parseJSON = parseJSONText "InstanceGroupStateChangeReasonCode"
instance ToJSON InstanceGroupStateChangeReasonCode where
toJSON = toJSONText
data StepStatus = StepStatus
{ _ssState :: Maybe StepState
, _ssStateChangeReason :: Maybe StepStateChangeReason
, _ssTimeline :: Maybe StepTimeline
} deriving (Eq, Show)
stepStatus :: StepStatus
stepStatus = StepStatus
{ _ssState = Nothing
, _ssStateChangeReason = Nothing
, _ssTimeline = Nothing
}
ssState :: Lens' StepStatus (Maybe StepState)
ssState = lens _ssState (\s a -> s { _ssState = a })
ssStateChangeReason :: Lens' StepStatus (Maybe StepStateChangeReason)
ssStateChangeReason =
lens _ssStateChangeReason (\s a -> s { _ssStateChangeReason = a })
ssTimeline :: Lens' StepStatus (Maybe StepTimeline)
ssTimeline = lens _ssTimeline (\s a -> s { _ssTimeline = a })
instance FromJSON StepStatus where
parseJSON = withObject "StepStatus" $ \o -> StepStatus
<$> o .:? "State"
<*> o .:? "StateChangeReason"
<*> o .:? "Timeline"
instance ToJSON StepStatus where
toJSON StepStatus{..} = object
[ "State" .= _ssState
, "StateChangeReason" .= _ssStateChangeReason
, "Timeline" .= _ssTimeline
]
data StepSummary = StepSummary
{ _ssActionOnFailure :: Maybe ActionOnFailure
, _ssConfig :: Maybe HadoopStepConfig
, _ssId :: Maybe Text
, _ssName :: Maybe Text
, _ssStatus :: Maybe StepStatus
} deriving (Eq, Show)
stepSummary :: StepSummary
stepSummary = StepSummary
{ _ssId = Nothing
, _ssName = Nothing
, _ssConfig = Nothing
, _ssActionOnFailure = Nothing
, _ssStatus = Nothing
}
ssActionOnFailure :: Lens' StepSummary (Maybe ActionOnFailure)
ssActionOnFailure =
lens _ssActionOnFailure (\s a -> s { _ssActionOnFailure = a })
ssConfig :: Lens' StepSummary (Maybe HadoopStepConfig)
ssConfig = lens _ssConfig (\s a -> s { _ssConfig = a })
ssId :: Lens' StepSummary (Maybe Text)
ssId = lens _ssId (\s a -> s { _ssId = a })
ssName :: Lens' StepSummary (Maybe Text)
ssName = lens _ssName (\s a -> s { _ssName = a })
ssStatus :: Lens' StepSummary (Maybe StepStatus)
ssStatus = lens _ssStatus (\s a -> s { _ssStatus = a })
instance FromJSON StepSummary where
parseJSON = withObject "StepSummary" $ \o -> StepSummary
<$> o .:? "ActionOnFailure"
<*> o .:? "Config"
<*> o .:? "Id"
<*> o .:? "Name"
<*> o .:? "Status"
instance ToJSON StepSummary where
toJSON StepSummary{..} = object
[ "Id" .= _ssId
, "Name" .= _ssName
, "Config" .= _ssConfig
, "ActionOnFailure" .= _ssActionOnFailure
, "Status" .= _ssStatus
]
data InstanceGroupState
= IGSArrested
| IGSBootstrapping
| IGSEnded
| IGSProvisioning
| IGSResizing
| IGSRunning
| IGSShuttingDown
| IGSSuspended
| IGSTerminated
| IGSTerminating
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable InstanceGroupState
instance FromText InstanceGroupState where
parser = takeText >>= \case
"ARRESTED" -> pure IGSArrested
"BOOTSTRAPPING" -> pure IGSBootstrapping
"ENDED" -> pure IGSEnded
"PROVISIONING" -> pure IGSProvisioning
"RESIZING" -> pure IGSResizing
"RUNNING" -> pure IGSRunning
"SHUTTING_DOWN" -> pure IGSShuttingDown
"SUSPENDED" -> pure IGSSuspended
"TERMINATED" -> pure IGSTerminated
"TERMINATING" -> pure IGSTerminating
e -> fail $
"Failure parsing InstanceGroupState from " ++ show e
instance ToText InstanceGroupState where
toText = \case
IGSArrested -> "ARRESTED"
IGSBootstrapping -> "BOOTSTRAPPING"
IGSEnded -> "ENDED"
IGSProvisioning -> "PROVISIONING"
IGSResizing -> "RESIZING"
IGSRunning -> "RUNNING"
IGSShuttingDown -> "SHUTTING_DOWN"
IGSSuspended -> "SUSPENDED"
IGSTerminated -> "TERMINATED"
IGSTerminating -> "TERMINATING"
instance ToByteString InstanceGroupState
instance ToHeader InstanceGroupState
instance ToQuery InstanceGroupState
instance FromJSON InstanceGroupState where
parseJSON = parseJSONText "InstanceGroupState"
instance ToJSON InstanceGroupState where
toJSON = toJSONText
data StepTimeline = StepTimeline
{ _stCreationDateTime :: Maybe POSIX
, _stEndDateTime :: Maybe POSIX
, _stStartDateTime :: Maybe POSIX
} deriving (Eq, Ord, Show)
stepTimeline :: StepTimeline
stepTimeline = StepTimeline
{ _stCreationDateTime = Nothing
, _stStartDateTime = Nothing
, _stEndDateTime = Nothing
}
stCreationDateTime :: Lens' StepTimeline (Maybe UTCTime)
stCreationDateTime =
lens _stCreationDateTime (\s a -> s { _stCreationDateTime = a })
. mapping _Time
stEndDateTime :: Lens' StepTimeline (Maybe UTCTime)
stEndDateTime = lens _stEndDateTime (\s a -> s { _stEndDateTime = a }) . mapping _Time
stStartDateTime :: Lens' StepTimeline (Maybe UTCTime)
stStartDateTime = lens _stStartDateTime (\s a -> s { _stStartDateTime = a }) . mapping _Time
instance FromJSON StepTimeline where
parseJSON = withObject "StepTimeline" $ \o -> StepTimeline
<$> o .:? "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "StartDateTime"
instance ToJSON StepTimeline where
toJSON StepTimeline{..} = object
[ "CreationDateTime" .= _stCreationDateTime
, "StartDateTime" .= _stStartDateTime
, "EndDateTime" .= _stEndDateTime
]
newtype PlacementType = PlacementType
{ _ptAvailabilityZone :: Text
} deriving (Eq, Ord, Show, Monoid, IsString)
placementType :: Text
-> PlacementType
placementType p1 = PlacementType
{ _ptAvailabilityZone = p1
}
ptAvailabilityZone :: Lens' PlacementType Text
ptAvailabilityZone =
lens _ptAvailabilityZone (\s a -> s { _ptAvailabilityZone = a })
instance FromJSON PlacementType where
parseJSON = withObject "PlacementType" $ \o -> PlacementType
<$> o .: "AvailabilityZone"
instance ToJSON PlacementType where
toJSON PlacementType{..} = object
[ "AvailabilityZone" .= _ptAvailabilityZone
]
data HadoopJarStepConfig = HadoopJarStepConfig
{ _hjscArgs :: List "Args" Text
, _hjscJar :: Text
, _hjscMainClass :: Maybe Text
, _hjscProperties :: List "Properties" KeyValue
} deriving (Eq, Show)
hadoopJarStepConfig :: Text
-> HadoopJarStepConfig
hadoopJarStepConfig p1 = HadoopJarStepConfig
{ _hjscJar = p1
, _hjscProperties = mempty
, _hjscMainClass = Nothing
, _hjscArgs = mempty
}
hjscArgs :: Lens' HadoopJarStepConfig [Text]
hjscArgs = lens _hjscArgs (\s a -> s { _hjscArgs = a }) . _List
hjscJar :: Lens' HadoopJarStepConfig Text
hjscJar = lens _hjscJar (\s a -> s { _hjscJar = a })
hjscMainClass :: Lens' HadoopJarStepConfig (Maybe Text)
hjscMainClass = lens _hjscMainClass (\s a -> s { _hjscMainClass = a })
hjscProperties :: Lens' HadoopJarStepConfig [KeyValue]
hjscProperties = lens _hjscProperties (\s a -> s { _hjscProperties = a }) . _List
instance FromJSON HadoopJarStepConfig where
parseJSON = withObject "HadoopJarStepConfig" $ \o -> HadoopJarStepConfig
<$> o .:? "Args" .!= mempty
<*> o .: "Jar"
<*> o .:? "MainClass"
<*> o .:? "Properties" .!= mempty
instance ToJSON HadoopJarStepConfig where
toJSON HadoopJarStepConfig{..} = object
[ "Properties" .= _hjscProperties
, "Jar" .= _hjscJar
, "MainClass" .= _hjscMainClass
, "Args" .= _hjscArgs
]
data InstanceGroupModifyConfig = InstanceGroupModifyConfig
{ _igmcEC2InstanceIdsToTerminate :: List "EC2InstanceIdsToTerminate" Text
, _igmcInstanceCount :: Maybe Int
, _igmcInstanceGroupId :: Text
} deriving (Eq, Ord, Show)
instanceGroupModifyConfig :: Text
-> InstanceGroupModifyConfig
instanceGroupModifyConfig p1 = InstanceGroupModifyConfig
{ _igmcInstanceGroupId = p1
, _igmcInstanceCount = Nothing
, _igmcEC2InstanceIdsToTerminate = mempty
}
igmcEC2InstanceIdsToTerminate :: Lens' InstanceGroupModifyConfig [Text]
igmcEC2InstanceIdsToTerminate =
lens _igmcEC2InstanceIdsToTerminate
(\s a -> s { _igmcEC2InstanceIdsToTerminate = a })
. _List
igmcInstanceCount :: Lens' InstanceGroupModifyConfig (Maybe Int)
igmcInstanceCount =
lens _igmcInstanceCount (\s a -> s { _igmcInstanceCount = a })
igmcInstanceGroupId :: Lens' InstanceGroupModifyConfig Text
igmcInstanceGroupId =
lens _igmcInstanceGroupId (\s a -> s { _igmcInstanceGroupId = a })
instance FromJSON InstanceGroupModifyConfig where
parseJSON = withObject "InstanceGroupModifyConfig" $ \o -> InstanceGroupModifyConfig
<$> o .:? "EC2InstanceIdsToTerminate" .!= mempty
<*> o .:? "InstanceCount"
<*> o .: "InstanceGroupId"
instance ToJSON InstanceGroupModifyConfig where
toJSON InstanceGroupModifyConfig{..} = object
[ "InstanceGroupId" .= _igmcInstanceGroupId
, "InstanceCount" .= _igmcInstanceCount
, "EC2InstanceIdsToTerminate" .= _igmcEC2InstanceIdsToTerminate
]
data InstanceGroupDetail = InstanceGroupDetail
{ _igdBidPrice :: Maybe Text
, _igdCreationDateTime :: POSIX
, _igdEndDateTime :: Maybe POSIX
, _igdInstanceGroupId :: Maybe Text
, _igdInstanceRequestCount :: Int
, _igdInstanceRole :: InstanceRoleType
, _igdInstanceRunningCount :: Int
, _igdInstanceType :: Text
, _igdLastStateChangeReason :: Maybe Text
, _igdMarket :: MarketType
, _igdName :: Maybe Text
, _igdReadyDateTime :: Maybe POSIX
, _igdStartDateTime :: Maybe POSIX
, _igdState :: InstanceGroupState
} deriving (Eq, Show)
instanceGroupDetail :: MarketType
-> InstanceRoleType
-> Text
-> Int
-> Int
-> InstanceGroupState
-> UTCTime
-> InstanceGroupDetail
instanceGroupDetail p1 p2 p3 p4 p5 p6 p7 = InstanceGroupDetail
{ _igdMarket = p1
, _igdInstanceRole = p2
, _igdInstanceType = p3
, _igdInstanceRequestCount = p4
, _igdInstanceRunningCount = p5
, _igdState = p6
, _igdCreationDateTime = withIso _Time (const id) p7
, _igdInstanceGroupId = Nothing
, _igdName = Nothing
, _igdBidPrice = Nothing
, _igdLastStateChangeReason = Nothing
, _igdStartDateTime = Nothing
, _igdReadyDateTime = Nothing
, _igdEndDateTime = Nothing
}
igdBidPrice :: Lens' InstanceGroupDetail (Maybe Text)
igdBidPrice = lens _igdBidPrice (\s a -> s { _igdBidPrice = a })
igdCreationDateTime :: Lens' InstanceGroupDetail UTCTime
igdCreationDateTime =
lens _igdCreationDateTime (\s a -> s { _igdCreationDateTime = a })
. _Time
igdEndDateTime :: Lens' InstanceGroupDetail (Maybe UTCTime)
igdEndDateTime = lens _igdEndDateTime (\s a -> s { _igdEndDateTime = a }) . mapping _Time
igdInstanceGroupId :: Lens' InstanceGroupDetail (Maybe Text)
igdInstanceGroupId =
lens _igdInstanceGroupId (\s a -> s { _igdInstanceGroupId = a })
igdInstanceRequestCount :: Lens' InstanceGroupDetail Int
igdInstanceRequestCount =
lens _igdInstanceRequestCount (\s a -> s { _igdInstanceRequestCount = a })
igdInstanceRole :: Lens' InstanceGroupDetail InstanceRoleType
igdInstanceRole = lens _igdInstanceRole (\s a -> s { _igdInstanceRole = a })
igdInstanceRunningCount :: Lens' InstanceGroupDetail Int
igdInstanceRunningCount =
lens _igdInstanceRunningCount (\s a -> s { _igdInstanceRunningCount = a })
igdInstanceType :: Lens' InstanceGroupDetail Text
igdInstanceType = lens _igdInstanceType (\s a -> s { _igdInstanceType = a })
igdLastStateChangeReason :: Lens' InstanceGroupDetail (Maybe Text)
igdLastStateChangeReason =
lens _igdLastStateChangeReason
(\s a -> s { _igdLastStateChangeReason = a })
igdMarket :: Lens' InstanceGroupDetail MarketType
igdMarket = lens _igdMarket (\s a -> s { _igdMarket = a })
igdName :: Lens' InstanceGroupDetail (Maybe Text)
igdName = lens _igdName (\s a -> s { _igdName = a })
igdReadyDateTime :: Lens' InstanceGroupDetail (Maybe UTCTime)
igdReadyDateTime = lens _igdReadyDateTime (\s a -> s { _igdReadyDateTime = a }) . mapping _Time
igdStartDateTime :: Lens' InstanceGroupDetail (Maybe UTCTime)
igdStartDateTime = lens _igdStartDateTime (\s a -> s { _igdStartDateTime = a }) . mapping _Time
igdState :: Lens' InstanceGroupDetail InstanceGroupState
igdState = lens _igdState (\s a -> s { _igdState = a })
instance FromJSON InstanceGroupDetail where
parseJSON = withObject "InstanceGroupDetail" $ \o -> InstanceGroupDetail
<$> o .:? "BidPrice"
<*> o .: "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "InstanceGroupId"
<*> o .: "InstanceRequestCount"
<*> o .: "InstanceRole"
<*> o .: "InstanceRunningCount"
<*> o .: "InstanceType"
<*> o .:? "LastStateChangeReason"
<*> o .: "Market"
<*> o .:? "Name"
<*> o .:? "ReadyDateTime"
<*> o .:? "StartDateTime"
<*> o .: "State"
instance ToJSON InstanceGroupDetail where
toJSON InstanceGroupDetail{..} = object
[ "InstanceGroupId" .= _igdInstanceGroupId
, "Name" .= _igdName
, "Market" .= _igdMarket
, "InstanceRole" .= _igdInstanceRole
, "BidPrice" .= _igdBidPrice
, "InstanceType" .= _igdInstanceType
, "InstanceRequestCount" .= _igdInstanceRequestCount
, "InstanceRunningCount" .= _igdInstanceRunningCount
, "State" .= _igdState
, "LastStateChangeReason" .= _igdLastStateChangeReason
, "CreationDateTime" .= _igdCreationDateTime
, "StartDateTime" .= _igdStartDateTime
, "ReadyDateTime" .= _igdReadyDateTime
, "EndDateTime" .= _igdEndDateTime
]
data StepStateChangeReason = StepStateChangeReason
{ _sscrCode :: Maybe StepStateChangeReasonCode
, _sscrMessage :: Maybe Text
} deriving (Eq, Show)
stepStateChangeReason :: StepStateChangeReason
stepStateChangeReason = StepStateChangeReason
{ _sscrCode = Nothing
, _sscrMessage = Nothing
}
sscrCode :: Lens' StepStateChangeReason (Maybe StepStateChangeReasonCode)
sscrCode = lens _sscrCode (\s a -> s { _sscrCode = a })
sscrMessage :: Lens' StepStateChangeReason (Maybe Text)
sscrMessage = lens _sscrMessage (\s a -> s { _sscrMessage = a })
instance FromJSON StepStateChangeReason where
parseJSON = withObject "StepStateChangeReason" $ \o -> StepStateChangeReason
<$> o .:? "Code"
<*> o .:? "Message"
instance ToJSON StepStateChangeReason where
toJSON StepStateChangeReason{..} = object
[ "Code" .= _sscrCode
, "Message" .= _sscrMessage
]
data ClusterStateChangeReasonCode
= CSCRCAllStepsCompleted
| CSCRCBootstrapFailure
| CSCRCInstanceFailure
| CSCRCInternalError
| CSCRCStepFailure
| CSCRCUserRequest
| CSCRCValidationError
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable ClusterStateChangeReasonCode
instance FromText ClusterStateChangeReasonCode where
parser = takeText >>= \case
"ALL_STEPS_COMPLETED" -> pure CSCRCAllStepsCompleted
"BOOTSTRAP_FAILURE" -> pure CSCRCBootstrapFailure
"INSTANCE_FAILURE" -> pure CSCRCInstanceFailure
"INTERNAL_ERROR" -> pure CSCRCInternalError
"STEP_FAILURE" -> pure CSCRCStepFailure
"USER_REQUEST" -> pure CSCRCUserRequest
"VALIDATION_ERROR" -> pure CSCRCValidationError
e -> fail $
"Failure parsing ClusterStateChangeReasonCode from " ++ show e
instance ToText ClusterStateChangeReasonCode where
toText = \case
CSCRCAllStepsCompleted -> "ALL_STEPS_COMPLETED"
CSCRCBootstrapFailure -> "BOOTSTRAP_FAILURE"
CSCRCInstanceFailure -> "INSTANCE_FAILURE"
CSCRCInternalError -> "INTERNAL_ERROR"
CSCRCStepFailure -> "STEP_FAILURE"
CSCRCUserRequest -> "USER_REQUEST"
CSCRCValidationError -> "VALIDATION_ERROR"
instance ToByteString ClusterStateChangeReasonCode
instance ToHeader ClusterStateChangeReasonCode
instance ToQuery ClusterStateChangeReasonCode
instance FromJSON ClusterStateChangeReasonCode where
parseJSON = parseJSONText "ClusterStateChangeReasonCode"
instance ToJSON ClusterStateChangeReasonCode where
toJSON = toJSONText
data Step = Step
{ _sActionOnFailure :: Maybe ActionOnFailure
, _sConfig :: Maybe HadoopStepConfig
, _sId :: Maybe Text
, _sName :: Maybe Text
, _sStatus :: Maybe StepStatus
} deriving (Eq, Show)
step :: Step
step = Step
{ _sId = Nothing
, _sName = Nothing
, _sConfig = Nothing
, _sActionOnFailure = Nothing
, _sStatus = Nothing
}
sActionOnFailure :: Lens' Step (Maybe ActionOnFailure)
sActionOnFailure = lens _sActionOnFailure (\s a -> s { _sActionOnFailure = a })
sConfig :: Lens' Step (Maybe HadoopStepConfig)
sConfig = lens _sConfig (\s a -> s { _sConfig = a })
sId :: Lens' Step (Maybe Text)
sId = lens _sId (\s a -> s { _sId = a })
sName :: Lens' Step (Maybe Text)
sName = lens _sName (\s a -> s { _sName = a })
sStatus :: Lens' Step (Maybe StepStatus)
sStatus = lens _sStatus (\s a -> s { _sStatus = a })
instance FromJSON Step where
parseJSON = withObject "Step" $ \o -> Step
<$> o .:? "ActionOnFailure"
<*> o .:? "Config"
<*> o .:? "Id"
<*> o .:? "Name"
<*> o .:? "Status"
instance ToJSON Step where
toJSON Step{..} = object
[ "Id" .= _sId
, "Name" .= _sName
, "Config" .= _sConfig
, "ActionOnFailure" .= _sActionOnFailure
, "Status" .= _sStatus
]
data StepState
= SSCancelled
| SSCompleted
| SSFailed
| SSInterrupted
| SSPending
| SSRunning
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable StepState
instance FromText StepState where
parser = takeText >>= \case
"CANCELLED" -> pure SSCancelled
"COMPLETED" -> pure SSCompleted
"FAILED" -> pure SSFailed
"INTERRUPTED" -> pure SSInterrupted
"PENDING" -> pure SSPending
"RUNNING" -> pure SSRunning
e -> fail $
"Failure parsing StepState from " ++ show e
instance ToText StepState where
toText = \case
SSCancelled -> "CANCELLED"
SSCompleted -> "COMPLETED"
SSFailed -> "FAILED"
SSInterrupted -> "INTERRUPTED"
SSPending -> "PENDING"
SSRunning -> "RUNNING"
instance ToByteString StepState
instance ToHeader StepState
instance ToQuery StepState
instance FromJSON StepState where
parseJSON = parseJSONText "StepState"
instance ToJSON StepState where
toJSON = toJSONText
data InstanceGroupTimeline = InstanceGroupTimeline
{ _igtCreationDateTime :: Maybe POSIX
, _igtEndDateTime :: Maybe POSIX
, _igtReadyDateTime :: Maybe POSIX
} deriving (Eq, Ord, Show)
instanceGroupTimeline :: InstanceGroupTimeline
instanceGroupTimeline = InstanceGroupTimeline
{ _igtCreationDateTime = Nothing
, _igtReadyDateTime = Nothing
, _igtEndDateTime = Nothing
}
igtCreationDateTime :: Lens' InstanceGroupTimeline (Maybe UTCTime)
igtCreationDateTime =
lens _igtCreationDateTime (\s a -> s { _igtCreationDateTime = a })
. mapping _Time
igtEndDateTime :: Lens' InstanceGroupTimeline (Maybe UTCTime)
igtEndDateTime = lens _igtEndDateTime (\s a -> s { _igtEndDateTime = a }) . mapping _Time
igtReadyDateTime :: Lens' InstanceGroupTimeline (Maybe UTCTime)
igtReadyDateTime = lens _igtReadyDateTime (\s a -> s { _igtReadyDateTime = a }) . mapping _Time
instance FromJSON InstanceGroupTimeline where
parseJSON = withObject "InstanceGroupTimeline" $ \o -> InstanceGroupTimeline
<$> o .:? "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "ReadyDateTime"
instance ToJSON InstanceGroupTimeline where
toJSON InstanceGroupTimeline{..} = object
[ "CreationDateTime" .= _igtCreationDateTime
, "ReadyDateTime" .= _igtReadyDateTime
, "EndDateTime" .= _igtEndDateTime
]
newtype BootstrapActionDetail = BootstrapActionDetail
{ _badBootstrapActionConfig :: Maybe BootstrapActionConfig
} deriving (Eq, Show)
bootstrapActionDetail :: BootstrapActionDetail
bootstrapActionDetail = BootstrapActionDetail
{ _badBootstrapActionConfig = Nothing
}
badBootstrapActionConfig :: Lens' BootstrapActionDetail (Maybe BootstrapActionConfig)
badBootstrapActionConfig =
lens _badBootstrapActionConfig
(\s a -> s { _badBootstrapActionConfig = a })
instance FromJSON BootstrapActionDetail where
parseJSON = withObject "BootstrapActionDetail" $ \o -> BootstrapActionDetail
<$> o .:? "BootstrapActionConfig"
instance ToJSON BootstrapActionDetail where
toJSON BootstrapActionDetail{..} = object
[ "BootstrapActionConfig" .= _badBootstrapActionConfig
]
data StepExecutionStatusDetail = StepExecutionStatusDetail
{ _sesdCreationDateTime :: POSIX
, _sesdEndDateTime :: Maybe POSIX
, _sesdLastStateChangeReason :: Maybe Text
, _sesdStartDateTime :: Maybe POSIX
, _sesdState :: StepExecutionState
} deriving (Eq, Show)
stepExecutionStatusDetail :: StepExecutionState
-> UTCTime
-> StepExecutionStatusDetail
stepExecutionStatusDetail p1 p2 = StepExecutionStatusDetail
{ _sesdState = p1
, _sesdCreationDateTime = withIso _Time (const id) p2
, _sesdStartDateTime = Nothing
, _sesdEndDateTime = Nothing
, _sesdLastStateChangeReason = Nothing
}
sesdCreationDateTime :: Lens' StepExecutionStatusDetail UTCTime
sesdCreationDateTime =
lens _sesdCreationDateTime (\s a -> s { _sesdCreationDateTime = a })
. _Time
sesdEndDateTime :: Lens' StepExecutionStatusDetail (Maybe UTCTime)
sesdEndDateTime = lens _sesdEndDateTime (\s a -> s { _sesdEndDateTime = a }) . mapping _Time
sesdLastStateChangeReason :: Lens' StepExecutionStatusDetail (Maybe Text)
sesdLastStateChangeReason =
lens _sesdLastStateChangeReason
(\s a -> s { _sesdLastStateChangeReason = a })
sesdStartDateTime :: Lens' StepExecutionStatusDetail (Maybe UTCTime)
sesdStartDateTime =
lens _sesdStartDateTime (\s a -> s { _sesdStartDateTime = a })
. mapping _Time
sesdState :: Lens' StepExecutionStatusDetail StepExecutionState
sesdState = lens _sesdState (\s a -> s { _sesdState = a })
instance FromJSON StepExecutionStatusDetail where
parseJSON = withObject "StepExecutionStatusDetail" $ \o -> StepExecutionStatusDetail
<$> o .: "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "LastStateChangeReason"
<*> o .:? "StartDateTime"
<*> o .: "State"
instance ToJSON StepExecutionStatusDetail where
toJSON StepExecutionStatusDetail{..} = object
[ "State" .= _sesdState
, "CreationDateTime" .= _sesdCreationDateTime
, "StartDateTime" .= _sesdStartDateTime
, "EndDateTime" .= _sesdEndDateTime
, "LastStateChangeReason" .= _sesdLastStateChangeReason
]
data InstanceStatus = InstanceStatus
{ _isState :: Maybe InstanceState
, _isStateChangeReason :: Maybe InstanceStateChangeReason
, _isTimeline :: Maybe InstanceTimeline
} deriving (Eq, Show)
instanceStatus :: InstanceStatus
instanceStatus = InstanceStatus
{ _isState = Nothing
, _isStateChangeReason = Nothing
, _isTimeline = Nothing
}
isState :: Lens' InstanceStatus (Maybe InstanceState)
isState = lens _isState (\s a -> s { _isState = a })
isStateChangeReason :: Lens' InstanceStatus (Maybe InstanceStateChangeReason)
isStateChangeReason =
lens _isStateChangeReason (\s a -> s { _isStateChangeReason = a })
isTimeline :: Lens' InstanceStatus (Maybe InstanceTimeline)
isTimeline = lens _isTimeline (\s a -> s { _isTimeline = a })
instance FromJSON InstanceStatus where
parseJSON = withObject "InstanceStatus" $ \o -> InstanceStatus
<$> o .:? "State"
<*> o .:? "StateChangeReason"
<*> o .:? "Timeline"
instance ToJSON InstanceStatus where
toJSON InstanceStatus{..} = object
[ "State" .= _isState
, "StateChangeReason" .= _isStateChangeReason
, "Timeline" .= _isTimeline
]
data InstanceRoleType
= IRTCore
| IRTMaster
| IRTTask
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable InstanceRoleType
instance FromText InstanceRoleType where
parser = takeText >>= \case
"CORE" -> pure IRTCore
"MASTER" -> pure IRTMaster
"TASK" -> pure IRTTask
e -> fail $
"Failure parsing InstanceRoleType from " ++ show e
instance ToText InstanceRoleType where
toText = \case
IRTCore -> "CORE"
IRTMaster -> "MASTER"
IRTTask -> "TASK"
instance ToByteString InstanceRoleType
instance ToHeader InstanceRoleType
instance ToQuery InstanceRoleType
instance FromJSON InstanceRoleType where
parseJSON = parseJSONText "InstanceRoleType"
instance ToJSON InstanceRoleType where
toJSON = toJSONText
data JobFlowInstancesConfig = JobFlowInstancesConfig
{ _jficEc2KeyName :: Maybe Text
, _jficEc2SubnetId :: Maybe Text
, _jficHadoopVersion :: Maybe Text
, _jficInstanceCount :: Maybe Int
, _jficInstanceGroups :: List "InstanceGroups" InstanceGroupConfig
, _jficKeepJobFlowAliveWhenNoSteps :: Maybe Bool
, _jficMasterInstanceType :: Maybe Text
, _jficPlacement :: Maybe PlacementType
, _jficSlaveInstanceType :: Maybe Text
, _jficTerminationProtected :: Maybe Bool
} deriving (Eq, Show)
jobFlowInstancesConfig :: JobFlowInstancesConfig
jobFlowInstancesConfig = JobFlowInstancesConfig
{ _jficMasterInstanceType = Nothing
, _jficSlaveInstanceType = Nothing
, _jficInstanceCount = Nothing
, _jficInstanceGroups = mempty
, _jficEc2KeyName = Nothing
, _jficPlacement = Nothing
, _jficKeepJobFlowAliveWhenNoSteps = Nothing
, _jficTerminationProtected = Nothing
, _jficHadoopVersion = Nothing
, _jficEc2SubnetId = Nothing
}
jficEc2KeyName :: Lens' JobFlowInstancesConfig (Maybe Text)
jficEc2KeyName = lens _jficEc2KeyName (\s a -> s { _jficEc2KeyName = a })
jficEc2SubnetId :: Lens' JobFlowInstancesConfig (Maybe Text)
jficEc2SubnetId = lens _jficEc2SubnetId (\s a -> s { _jficEc2SubnetId = a })
jficHadoopVersion :: Lens' JobFlowInstancesConfig (Maybe Text)
jficHadoopVersion =
lens _jficHadoopVersion (\s a -> s { _jficHadoopVersion = a })
jficInstanceCount :: Lens' JobFlowInstancesConfig (Maybe Int)
jficInstanceCount =
lens _jficInstanceCount (\s a -> s { _jficInstanceCount = a })
jficInstanceGroups :: Lens' JobFlowInstancesConfig [InstanceGroupConfig]
jficInstanceGroups =
lens _jficInstanceGroups (\s a -> s { _jficInstanceGroups = a })
. _List
jficKeepJobFlowAliveWhenNoSteps :: Lens' JobFlowInstancesConfig (Maybe Bool)
jficKeepJobFlowAliveWhenNoSteps =
lens _jficKeepJobFlowAliveWhenNoSteps
(\s a -> s { _jficKeepJobFlowAliveWhenNoSteps = a })
jficMasterInstanceType :: Lens' JobFlowInstancesConfig (Maybe Text)
jficMasterInstanceType =
lens _jficMasterInstanceType (\s a -> s { _jficMasterInstanceType = a })
jficPlacement :: Lens' JobFlowInstancesConfig (Maybe PlacementType)
jficPlacement = lens _jficPlacement (\s a -> s { _jficPlacement = a })
jficSlaveInstanceType :: Lens' JobFlowInstancesConfig (Maybe Text)
jficSlaveInstanceType =
lens _jficSlaveInstanceType (\s a -> s { _jficSlaveInstanceType = a })
jficTerminationProtected :: Lens' JobFlowInstancesConfig (Maybe Bool)
jficTerminationProtected =
lens _jficTerminationProtected
(\s a -> s { _jficTerminationProtected = a })
instance FromJSON JobFlowInstancesConfig where
parseJSON = withObject "JobFlowInstancesConfig" $ \o -> JobFlowInstancesConfig
<$> o .:? "Ec2KeyName"
<*> o .:? "Ec2SubnetId"
<*> o .:? "HadoopVersion"
<*> o .:? "InstanceCount"
<*> o .:? "InstanceGroups" .!= mempty
<*> o .:? "KeepJobFlowAliveWhenNoSteps"
<*> o .:? "MasterInstanceType"
<*> o .:? "Placement"
<*> o .:? "SlaveInstanceType"
<*> o .:? "TerminationProtected"
instance ToJSON JobFlowInstancesConfig where
toJSON JobFlowInstancesConfig{..} = object
[ "MasterInstanceType" .= _jficMasterInstanceType
, "SlaveInstanceType" .= _jficSlaveInstanceType
, "InstanceCount" .= _jficInstanceCount
, "InstanceGroups" .= _jficInstanceGroups
, "Ec2KeyName" .= _jficEc2KeyName
, "Placement" .= _jficPlacement
, "KeepJobFlowAliveWhenNoSteps" .= _jficKeepJobFlowAliveWhenNoSteps
, "TerminationProtected" .= _jficTerminationProtected
, "HadoopVersion" .= _jficHadoopVersion
, "Ec2SubnetId" .= _jficEc2SubnetId
]
data StepConfig = StepConfig
{ _scActionOnFailure :: Maybe ActionOnFailure
, _scHadoopJarStep :: HadoopJarStepConfig
, _scName :: Text
} deriving (Eq, Show)
stepConfig :: Text
-> HadoopJarStepConfig
-> StepConfig
stepConfig p1 p2 = StepConfig
{ _scName = p1
, _scHadoopJarStep = p2
, _scActionOnFailure = Nothing
}
scActionOnFailure :: Lens' StepConfig (Maybe ActionOnFailure)
scActionOnFailure =
lens _scActionOnFailure (\s a -> s { _scActionOnFailure = a })
scHadoopJarStep :: Lens' StepConfig HadoopJarStepConfig
scHadoopJarStep = lens _scHadoopJarStep (\s a -> s { _scHadoopJarStep = a })
scName :: Lens' StepConfig Text
scName = lens _scName (\s a -> s { _scName = a })
instance FromJSON StepConfig where
parseJSON = withObject "StepConfig" $ \o -> StepConfig
<$> o .:? "ActionOnFailure"
<*> o .: "HadoopJarStep"
<*> o .: "Name"
instance ToJSON StepConfig where
toJSON StepConfig{..} = object
[ "Name" .= _scName
, "ActionOnFailure" .= _scActionOnFailure
, "HadoopJarStep" .= _scHadoopJarStep
]
data InstanceGroup = InstanceGroup
{ _igBidPrice :: Maybe Text
, _igId :: Maybe Text
, _igInstanceGroupType :: Maybe InstanceGroupType
, _igInstanceType :: Maybe Text
, _igMarket :: Maybe MarketType
, _igName :: Maybe Text
, _igRequestedInstanceCount :: Maybe Int
, _igRunningInstanceCount :: Maybe Int
, _igStatus :: Maybe InstanceGroupStatus
} deriving (Eq, Show)
instanceGroup :: InstanceGroup
instanceGroup = InstanceGroup
{ _igId = Nothing
, _igName = Nothing
, _igMarket = Nothing
, _igInstanceGroupType = Nothing
, _igBidPrice = Nothing
, _igInstanceType = Nothing
, _igRequestedInstanceCount = Nothing
, _igRunningInstanceCount = Nothing
, _igStatus = Nothing
}
igBidPrice :: Lens' InstanceGroup (Maybe Text)
igBidPrice = lens _igBidPrice (\s a -> s { _igBidPrice = a })
igId :: Lens' InstanceGroup (Maybe Text)
igId = lens _igId (\s a -> s { _igId = a })
igInstanceGroupType :: Lens' InstanceGroup (Maybe InstanceGroupType)
igInstanceGroupType =
lens _igInstanceGroupType (\s a -> s { _igInstanceGroupType = a })
igInstanceType :: Lens' InstanceGroup (Maybe Text)
igInstanceType = lens _igInstanceType (\s a -> s { _igInstanceType = a })
igMarket :: Lens' InstanceGroup (Maybe MarketType)
igMarket = lens _igMarket (\s a -> s { _igMarket = a })
igName :: Lens' InstanceGroup (Maybe Text)
igName = lens _igName (\s a -> s { _igName = a })
igRequestedInstanceCount :: Lens' InstanceGroup (Maybe Int)
igRequestedInstanceCount =
lens _igRequestedInstanceCount
(\s a -> s { _igRequestedInstanceCount = a })
igRunningInstanceCount :: Lens' InstanceGroup (Maybe Int)
igRunningInstanceCount =
lens _igRunningInstanceCount (\s a -> s { _igRunningInstanceCount = a })
igStatus :: Lens' InstanceGroup (Maybe InstanceGroupStatus)
igStatus = lens _igStatus (\s a -> s { _igStatus = a })
instance FromJSON InstanceGroup where
parseJSON = withObject "InstanceGroup" $ \o -> InstanceGroup
<$> o .:? "BidPrice"
<*> o .:? "Id"
<*> o .:? "InstanceGroupType"
<*> o .:? "InstanceType"
<*> o .:? "Market"
<*> o .:? "Name"
<*> o .:? "RequestedInstanceCount"
<*> o .:? "RunningInstanceCount"
<*> o .:? "Status"
instance ToJSON InstanceGroup where
toJSON InstanceGroup{..} = object
[ "Id" .= _igId
, "Name" .= _igName
, "Market" .= _igMarket
, "InstanceGroupType" .= _igInstanceGroupType
, "BidPrice" .= _igBidPrice
, "InstanceType" .= _igInstanceType
, "RequestedInstanceCount" .= _igRequestedInstanceCount
, "RunningInstanceCount" .= _igRunningInstanceCount
, "Status" .= _igStatus
]
data BootstrapActionConfig = BootstrapActionConfig
{ _bacName :: Text
, _bacScriptBootstrapAction :: ScriptBootstrapActionConfig
} deriving (Eq, Show)
bootstrapActionConfig :: Text
-> ScriptBootstrapActionConfig
-> BootstrapActionConfig
bootstrapActionConfig p1 p2 = BootstrapActionConfig
{ _bacName = p1
, _bacScriptBootstrapAction = p2
}
bacName :: Lens' BootstrapActionConfig Text
bacName = lens _bacName (\s a -> s { _bacName = a })
bacScriptBootstrapAction :: Lens' BootstrapActionConfig ScriptBootstrapActionConfig
bacScriptBootstrapAction =
lens _bacScriptBootstrapAction
(\s a -> s { _bacScriptBootstrapAction = a })
instance FromJSON BootstrapActionConfig where
parseJSON = withObject "BootstrapActionConfig" $ \o -> BootstrapActionConfig
<$> o .: "Name"
<*> o .: "ScriptBootstrapAction"
instance ToJSON BootstrapActionConfig where
toJSON BootstrapActionConfig{..} = object
[ "Name" .= _bacName
, "ScriptBootstrapAction" .= _bacScriptBootstrapAction
]
data ClusterSummary = ClusterSummary
{ _csId :: Maybe Text
, _csName :: Maybe Text
, _csNormalizedInstanceHours :: Maybe Int
, _csStatus :: Maybe ClusterStatus
} deriving (Eq, Show)
clusterSummary :: ClusterSummary
clusterSummary = ClusterSummary
{ _csId = Nothing
, _csName = Nothing
, _csStatus = Nothing
, _csNormalizedInstanceHours = Nothing
}
csId :: Lens' ClusterSummary (Maybe Text)
csId = lens _csId (\s a -> s { _csId = a })
csName :: Lens' ClusterSummary (Maybe Text)
csName = lens _csName (\s a -> s { _csName = a })
csNormalizedInstanceHours :: Lens' ClusterSummary (Maybe Int)
csNormalizedInstanceHours =
lens _csNormalizedInstanceHours
(\s a -> s { _csNormalizedInstanceHours = a })
csStatus :: Lens' ClusterSummary (Maybe ClusterStatus)
csStatus = lens _csStatus (\s a -> s { _csStatus = a })
instance FromJSON ClusterSummary where
parseJSON = withObject "ClusterSummary" $ \o -> ClusterSummary
<$> o .:? "Id"
<*> o .:? "Name"
<*> o .:? "NormalizedInstanceHours"
<*> o .:? "Status"
instance ToJSON ClusterSummary where
toJSON ClusterSummary{..} = object
[ "Id" .= _csId
, "Name" .= _csName
, "Status" .= _csStatus
, "NormalizedInstanceHours" .= _csNormalizedInstanceHours
]
data JobFlowInstancesDetail = JobFlowInstancesDetail
{ _jfidEc2KeyName :: Maybe Text
, _jfidEc2SubnetId :: Maybe Text
, _jfidHadoopVersion :: Maybe Text
, _jfidInstanceCount :: Int
, _jfidInstanceGroups :: List "InstanceGroups" InstanceGroupDetail
, _jfidKeepJobFlowAliveWhenNoSteps :: Maybe Bool
, _jfidMasterInstanceId :: Maybe Text
, _jfidMasterInstanceType :: Text
, _jfidMasterPublicDnsName :: Maybe Text
, _jfidNormalizedInstanceHours :: Maybe Int
, _jfidPlacement :: Maybe PlacementType
, _jfidSlaveInstanceType :: Text
, _jfidTerminationProtected :: Maybe Bool
} deriving (Eq, Show)
jobFlowInstancesDetail :: Text
-> Text
-> Int
-> JobFlowInstancesDetail
jobFlowInstancesDetail p1 p2 p3 = JobFlowInstancesDetail
{ _jfidMasterInstanceType = p1
, _jfidSlaveInstanceType = p2
, _jfidInstanceCount = p3
, _jfidMasterPublicDnsName = Nothing
, _jfidMasterInstanceId = Nothing
, _jfidInstanceGroups = mempty
, _jfidNormalizedInstanceHours = Nothing
, _jfidEc2KeyName = Nothing
, _jfidEc2SubnetId = Nothing
, _jfidPlacement = Nothing
, _jfidKeepJobFlowAliveWhenNoSteps = Nothing
, _jfidTerminationProtected = Nothing
, _jfidHadoopVersion = Nothing
}
jfidEc2KeyName :: Lens' JobFlowInstancesDetail (Maybe Text)
jfidEc2KeyName = lens _jfidEc2KeyName (\s a -> s { _jfidEc2KeyName = a })
jfidEc2SubnetId :: Lens' JobFlowInstancesDetail (Maybe Text)
jfidEc2SubnetId = lens _jfidEc2SubnetId (\s a -> s { _jfidEc2SubnetId = a })
jfidHadoopVersion :: Lens' JobFlowInstancesDetail (Maybe Text)
jfidHadoopVersion =
lens _jfidHadoopVersion (\s a -> s { _jfidHadoopVersion = a })
jfidInstanceCount :: Lens' JobFlowInstancesDetail Int
jfidInstanceCount =
lens _jfidInstanceCount (\s a -> s { _jfidInstanceCount = a })
jfidInstanceGroups :: Lens' JobFlowInstancesDetail [InstanceGroupDetail]
jfidInstanceGroups =
lens _jfidInstanceGroups (\s a -> s { _jfidInstanceGroups = a })
. _List
jfidKeepJobFlowAliveWhenNoSteps :: Lens' JobFlowInstancesDetail (Maybe Bool)
jfidKeepJobFlowAliveWhenNoSteps =
lens _jfidKeepJobFlowAliveWhenNoSteps
(\s a -> s { _jfidKeepJobFlowAliveWhenNoSteps = a })
jfidMasterInstanceId :: Lens' JobFlowInstancesDetail (Maybe Text)
jfidMasterInstanceId =
lens _jfidMasterInstanceId (\s a -> s { _jfidMasterInstanceId = a })
jfidMasterInstanceType :: Lens' JobFlowInstancesDetail Text
jfidMasterInstanceType =
lens _jfidMasterInstanceType (\s a -> s { _jfidMasterInstanceType = a })
jfidMasterPublicDnsName :: Lens' JobFlowInstancesDetail (Maybe Text)
jfidMasterPublicDnsName =
lens _jfidMasterPublicDnsName (\s a -> s { _jfidMasterPublicDnsName = a })
jfidNormalizedInstanceHours :: Lens' JobFlowInstancesDetail (Maybe Int)
jfidNormalizedInstanceHours =
lens _jfidNormalizedInstanceHours
(\s a -> s { _jfidNormalizedInstanceHours = a })
jfidPlacement :: Lens' JobFlowInstancesDetail (Maybe PlacementType)
jfidPlacement = lens _jfidPlacement (\s a -> s { _jfidPlacement = a })
jfidSlaveInstanceType :: Lens' JobFlowInstancesDetail Text
jfidSlaveInstanceType =
lens _jfidSlaveInstanceType (\s a -> s { _jfidSlaveInstanceType = a })
jfidTerminationProtected :: Lens' JobFlowInstancesDetail (Maybe Bool)
jfidTerminationProtected =
lens _jfidTerminationProtected
(\s a -> s { _jfidTerminationProtected = a })
instance FromJSON JobFlowInstancesDetail where
parseJSON = withObject "JobFlowInstancesDetail" $ \o -> JobFlowInstancesDetail
<$> o .:? "Ec2KeyName"
<*> o .:? "Ec2SubnetId"
<*> o .:? "HadoopVersion"
<*> o .: "InstanceCount"
<*> o .:? "InstanceGroups" .!= mempty
<*> o .:? "KeepJobFlowAliveWhenNoSteps"
<*> o .:? "MasterInstanceId"
<*> o .: "MasterInstanceType"
<*> o .:? "MasterPublicDnsName"
<*> o .:? "NormalizedInstanceHours"
<*> o .:? "Placement"
<*> o .: "SlaveInstanceType"
<*> o .:? "TerminationProtected"
instance ToJSON JobFlowInstancesDetail where
toJSON JobFlowInstancesDetail{..} = object
[ "MasterInstanceType" .= _jfidMasterInstanceType
, "MasterPublicDnsName" .= _jfidMasterPublicDnsName
, "MasterInstanceId" .= _jfidMasterInstanceId
, "SlaveInstanceType" .= _jfidSlaveInstanceType
, "InstanceCount" .= _jfidInstanceCount
, "InstanceGroups" .= _jfidInstanceGroups
, "NormalizedInstanceHours" .= _jfidNormalizedInstanceHours
, "Ec2KeyName" .= _jfidEc2KeyName
, "Ec2SubnetId" .= _jfidEc2SubnetId
, "Placement" .= _jfidPlacement
, "KeepJobFlowAliveWhenNoSteps" .= _jfidKeepJobFlowAliveWhenNoSteps
, "TerminationProtected" .= _jfidTerminationProtected
, "HadoopVersion" .= _jfidHadoopVersion
]
data ClusterStatus = ClusterStatus
{ _csState :: Maybe ClusterState
, _csStateChangeReason :: Maybe ClusterStateChangeReason
, _csTimeline :: Maybe ClusterTimeline
} deriving (Eq, Show)
clusterStatus :: ClusterStatus
clusterStatus = ClusterStatus
{ _csState = Nothing
, _csStateChangeReason = Nothing
, _csTimeline = Nothing
}
csState :: Lens' ClusterStatus (Maybe ClusterState)
csState = lens _csState (\s a -> s { _csState = a })
csStateChangeReason :: Lens' ClusterStatus (Maybe ClusterStateChangeReason)
csStateChangeReason =
lens _csStateChangeReason (\s a -> s { _csStateChangeReason = a })
csTimeline :: Lens' ClusterStatus (Maybe ClusterTimeline)
csTimeline = lens _csTimeline (\s a -> s { _csTimeline = a })
instance FromJSON ClusterStatus where
parseJSON = withObject "ClusterStatus" $ \o -> ClusterStatus
<$> o .:? "State"
<*> o .:? "StateChangeReason"
<*> o .:? "Timeline"
instance ToJSON ClusterStatus where
toJSON ClusterStatus{..} = object
[ "State" .= _csState
, "StateChangeReason" .= _csStateChangeReason
, "Timeline" .= _csTimeline
]
data InstanceState
= ISAwaitingFulfillment
| ISBootstrapping
| ISProvisioning
| ISRunning
| ISTerminated
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable InstanceState
instance FromText InstanceState where
parser = takeText >>= \case
"AWAITING_FULFILLMENT" -> pure ISAwaitingFulfillment
"BOOTSTRAPPING" -> pure ISBootstrapping
"PROVISIONING" -> pure ISProvisioning
"RUNNING" -> pure ISRunning
"TERMINATED" -> pure ISTerminated
e -> fail $
"Failure parsing InstanceState from " ++ show e
instance ToText InstanceState where
toText = \case
ISAwaitingFulfillment -> "AWAITING_FULFILLMENT"
ISBootstrapping -> "BOOTSTRAPPING"
ISProvisioning -> "PROVISIONING"
ISRunning -> "RUNNING"
ISTerminated -> "TERMINATED"
instance ToByteString InstanceState
instance ToHeader InstanceState
instance ToQuery InstanceState
instance FromJSON InstanceState where
parseJSON = parseJSONText "InstanceState"
instance ToJSON InstanceState where
toJSON = toJSONText
data ClusterTimeline = ClusterTimeline
{ _ctCreationDateTime :: Maybe POSIX
, _ctEndDateTime :: Maybe POSIX
, _ctReadyDateTime :: Maybe POSIX
} deriving (Eq, Ord, Show)
clusterTimeline :: ClusterTimeline
clusterTimeline = ClusterTimeline
{ _ctCreationDateTime = Nothing
, _ctReadyDateTime = Nothing
, _ctEndDateTime = Nothing
}
ctCreationDateTime :: Lens' ClusterTimeline (Maybe UTCTime)
ctCreationDateTime =
lens _ctCreationDateTime (\s a -> s { _ctCreationDateTime = a })
. mapping _Time
ctEndDateTime :: Lens' ClusterTimeline (Maybe UTCTime)
ctEndDateTime = lens _ctEndDateTime (\s a -> s { _ctEndDateTime = a }) . mapping _Time
ctReadyDateTime :: Lens' ClusterTimeline (Maybe UTCTime)
ctReadyDateTime = lens _ctReadyDateTime (\s a -> s { _ctReadyDateTime = a }) . mapping _Time
instance FromJSON ClusterTimeline where
parseJSON = withObject "ClusterTimeline" $ \o -> ClusterTimeline
<$> o .:? "CreationDateTime"
<*> o .:? "EndDateTime"
<*> o .:? "ReadyDateTime"
instance ToJSON ClusterTimeline where
toJSON ClusterTimeline{..} = object
[ "CreationDateTime" .= _ctCreationDateTime
, "ReadyDateTime" .= _ctReadyDateTime
, "EndDateTime" .= _ctEndDateTime
]
data InstanceStateChangeReasonCode
= ISCRCBootstrapFailure
| ISCRCClusterTerminated
| ISCRCInstanceFailure
| ISCRCInternalError
| ISCRCValidationError
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable InstanceStateChangeReasonCode
instance FromText InstanceStateChangeReasonCode where
parser = takeText >>= \case
"BOOTSTRAP_FAILURE" -> pure ISCRCBootstrapFailure
"CLUSTER_TERMINATED" -> pure ISCRCClusterTerminated
"INSTANCE_FAILURE" -> pure ISCRCInstanceFailure
"INTERNAL_ERROR" -> pure ISCRCInternalError
"VALIDATION_ERROR" -> pure ISCRCValidationError
e -> fail $
"Failure parsing InstanceStateChangeReasonCode from " ++ show e
instance ToText InstanceStateChangeReasonCode where
toText = \case
ISCRCBootstrapFailure -> "BOOTSTRAP_FAILURE"
ISCRCClusterTerminated -> "CLUSTER_TERMINATED"
ISCRCInstanceFailure -> "INSTANCE_FAILURE"
ISCRCInternalError -> "INTERNAL_ERROR"
ISCRCValidationError -> "VALIDATION_ERROR"
instance ToByteString InstanceStateChangeReasonCode
instance ToHeader InstanceStateChangeReasonCode
instance ToQuery InstanceStateChangeReasonCode
instance FromJSON InstanceStateChangeReasonCode where
parseJSON = parseJSONText "InstanceStateChangeReasonCode"
instance ToJSON InstanceStateChangeReasonCode where
toJSON = toJSONText
data Instance = Instance
{ _iEc2InstanceId :: Maybe Text
, _iId :: Maybe Text
, _iPrivateDnsName :: Maybe Text
, _iPrivateIpAddress :: Maybe Text
, _iPublicDnsName :: Maybe Text
, _iPublicIpAddress :: Maybe Text
, _iStatus :: Maybe InstanceStatus
} deriving (Eq, Show)
instance' :: Instance
instance' = Instance
{ _iId = Nothing
, _iEc2InstanceId = Nothing
, _iPublicDnsName = Nothing
, _iPublicIpAddress = Nothing
, _iPrivateDnsName = Nothing
, _iPrivateIpAddress = Nothing
, _iStatus = Nothing
}
iEc2InstanceId :: Lens' Instance (Maybe Text)
iEc2InstanceId = lens _iEc2InstanceId (\s a -> s { _iEc2InstanceId = a })
iId :: Lens' Instance (Maybe Text)
iId = lens _iId (\s a -> s { _iId = a })
iPrivateDnsName :: Lens' Instance (Maybe Text)
iPrivateDnsName = lens _iPrivateDnsName (\s a -> s { _iPrivateDnsName = a })
iPrivateIpAddress :: Lens' Instance (Maybe Text)
iPrivateIpAddress =
lens _iPrivateIpAddress (\s a -> s { _iPrivateIpAddress = a })
iPublicDnsName :: Lens' Instance (Maybe Text)
iPublicDnsName = lens _iPublicDnsName (\s a -> s { _iPublicDnsName = a })
iPublicIpAddress :: Lens' Instance (Maybe Text)
iPublicIpAddress = lens _iPublicIpAddress (\s a -> s { _iPublicIpAddress = a })
iStatus :: Lens' Instance (Maybe InstanceStatus)
iStatus = lens _iStatus (\s a -> s { _iStatus = a })
instance FromJSON Instance where
parseJSON = withObject "Instance" $ \o -> Instance
<$> o .:? "Ec2InstanceId"
<*> o .:? "Id"
<*> o .:? "PrivateDnsName"
<*> o .:? "PrivateIpAddress"
<*> o .:? "PublicDnsName"
<*> o .:? "PublicIpAddress"
<*> o .:? "Status"
instance ToJSON Instance where
toJSON Instance{..} = object
[ "Id" .= _iId
, "Ec2InstanceId" .= _iEc2InstanceId
, "PublicDnsName" .= _iPublicDnsName
, "PublicIpAddress" .= _iPublicIpAddress
, "PrivateDnsName" .= _iPrivateDnsName
, "PrivateIpAddress" .= _iPrivateIpAddress
, "Status" .= _iStatus
]
data ScriptBootstrapActionConfig = ScriptBootstrapActionConfig
{ _sbacArgs :: List "Args" Text
, _sbacPath :: Text
} deriving (Eq, Ord, Show)
scriptBootstrapActionConfig :: Text
-> ScriptBootstrapActionConfig
scriptBootstrapActionConfig p1 = ScriptBootstrapActionConfig
{ _sbacPath = p1
, _sbacArgs = mempty
}
sbacArgs :: Lens' ScriptBootstrapActionConfig [Text]
sbacArgs = lens _sbacArgs (\s a -> s { _sbacArgs = a }) . _List
sbacPath :: Lens' ScriptBootstrapActionConfig Text
sbacPath = lens _sbacPath (\s a -> s { _sbacPath = a })
instance FromJSON ScriptBootstrapActionConfig where
parseJSON = withObject "ScriptBootstrapActionConfig" $ \o -> ScriptBootstrapActionConfig
<$> o .:? "Args" .!= mempty
<*> o .: "Path"
instance ToJSON ScriptBootstrapActionConfig where
toJSON ScriptBootstrapActionConfig{..} = object
[ "Path" .= _sbacPath
, "Args" .= _sbacArgs
]