module Network.AWS.Config.Types
(
Config
, JSONError
, ConfigExportDeliveryInfo
, configExportDeliveryInfo
, cediLastAttemptTime
, cediLastErrorCode
, cediLastErrorMessage
, cediLastStatus
, cediLastSuccessfulTime
, ConfigStreamDeliveryInfo
, configStreamDeliveryInfo
, csdiLastErrorCode
, csdiLastErrorMessage
, csdiLastStatus
, csdiLastStatusChangeTime
, Relationship
, relationship
, rRelationshipName
, rResourceId
, rResourceType
, DeliveryChannel
, deliveryChannel
, dcName
, dcS3BucketName
, dcS3KeyPrefix
, dcSnsTopicARN
, ChronologicalOrder (..)
, ResourceType (..)
, ConfigurationItem
, configurationItem
, ciAccountId
, ciArn
, ciAvailabilityZone
, ciConfiguration
, ciConfigurationItemCaptureTime
, ciConfigurationItemMD5Hash
, ciConfigurationItemStatus
, ciConfigurationStateId
, ciRelatedEvents
, ciRelationships
, ciResourceCreationTime
, ciResourceId
, ciResourceType
, ciTags
, ciVersion
, DeliveryStatus (..)
, DeliveryChannelStatus
, deliveryChannelStatus
, dcsConfigHistoryDeliveryInfo
, dcsConfigSnapshotDeliveryInfo
, dcsConfigStreamDeliveryInfo
, dcsName
, ConfigurationRecorderStatus
, configurationRecorderStatus
, crsLastErrorCode
, crsLastErrorMessage
, crsLastStartTime
, crsLastStatus
, crsLastStatusChangeTime
, crsLastStopTime
, crsName
, crsRecording
, ConfigurationItemStatus (..)
, ConfigurationRecorder
, configurationRecorder
, crName
, crRoleARN
, RecorderStatus (..)
) where
import Network.AWS.Prelude
import Network.AWS.Signing
import qualified GHC.Exts
data Config
instance AWSService Config where
type Sg Config = V4
type Er Config = JSONError
service = service'
where
service' :: Service Config
service' = Service
{ _svcAbbrev = "Config"
, _svcPrefix = "config"
, _svcVersion = "2014-11-12"
, _svcTargetPrefix = Just "StarlingDoveService"
, _svcJSONVersion = Just "1.1"
, _svcHandle = handle
, _svcRetry = retry
}
handle :: Status
-> Maybe (LazyByteString -> ServiceError JSONError)
handle = jsonError statusSuccess service'
retry :: Retry Config
retry = Exponential
{ _retryBase = 0.05
, _retryGrowth = 2
, _retryAttempts = 5
, _retryCheck = check
}
check :: Status
-> JSONError
-> Bool
check (statusCode -> s) (awsErrorCode -> e)
| s == 500 = True
| s == 509 = True
| s == 503 = True
| otherwise = False
data ConfigExportDeliveryInfo = ConfigExportDeliveryInfo
{ _cediLastAttemptTime :: Maybe POSIX
, _cediLastErrorCode :: Maybe Text
, _cediLastErrorMessage :: Maybe Text
, _cediLastStatus :: Maybe DeliveryStatus
, _cediLastSuccessfulTime :: Maybe POSIX
} deriving (Eq, Read, Show)
configExportDeliveryInfo :: ConfigExportDeliveryInfo
configExportDeliveryInfo = ConfigExportDeliveryInfo
{ _cediLastStatus = Nothing
, _cediLastErrorCode = Nothing
, _cediLastErrorMessage = Nothing
, _cediLastAttemptTime = Nothing
, _cediLastSuccessfulTime = Nothing
}
cediLastAttemptTime :: Lens' ConfigExportDeliveryInfo (Maybe UTCTime)
cediLastAttemptTime =
lens _cediLastAttemptTime (\s a -> s { _cediLastAttemptTime = a })
. mapping _Time
cediLastErrorCode :: Lens' ConfigExportDeliveryInfo (Maybe Text)
cediLastErrorCode =
lens _cediLastErrorCode (\s a -> s { _cediLastErrorCode = a })
cediLastErrorMessage :: Lens' ConfigExportDeliveryInfo (Maybe Text)
cediLastErrorMessage =
lens _cediLastErrorMessage (\s a -> s { _cediLastErrorMessage = a })
cediLastStatus :: Lens' ConfigExportDeliveryInfo (Maybe DeliveryStatus)
cediLastStatus = lens _cediLastStatus (\s a -> s { _cediLastStatus = a })
cediLastSuccessfulTime :: Lens' ConfigExportDeliveryInfo (Maybe UTCTime)
cediLastSuccessfulTime =
lens _cediLastSuccessfulTime (\s a -> s { _cediLastSuccessfulTime = a })
. mapping _Time
instance FromJSON ConfigExportDeliveryInfo where
parseJSON = withObject "ConfigExportDeliveryInfo" $ \o -> ConfigExportDeliveryInfo
<$> o .:? "lastAttemptTime"
<*> o .:? "lastErrorCode"
<*> o .:? "lastErrorMessage"
<*> o .:? "lastStatus"
<*> o .:? "lastSuccessfulTime"
instance ToJSON ConfigExportDeliveryInfo where
toJSON ConfigExportDeliveryInfo{..} = object
[ "lastStatus" .= _cediLastStatus
, "lastErrorCode" .= _cediLastErrorCode
, "lastErrorMessage" .= _cediLastErrorMessage
, "lastAttemptTime" .= _cediLastAttemptTime
, "lastSuccessfulTime" .= _cediLastSuccessfulTime
]
data ConfigStreamDeliveryInfo = ConfigStreamDeliveryInfo
{ _csdiLastErrorCode :: Maybe Text
, _csdiLastErrorMessage :: Maybe Text
, _csdiLastStatus :: Maybe DeliveryStatus
, _csdiLastStatusChangeTime :: Maybe POSIX
} deriving (Eq, Read, Show)
configStreamDeliveryInfo :: ConfigStreamDeliveryInfo
configStreamDeliveryInfo = ConfigStreamDeliveryInfo
{ _csdiLastStatus = Nothing
, _csdiLastErrorCode = Nothing
, _csdiLastErrorMessage = Nothing
, _csdiLastStatusChangeTime = Nothing
}
csdiLastErrorCode :: Lens' ConfigStreamDeliveryInfo (Maybe Text)
csdiLastErrorCode =
lens _csdiLastErrorCode (\s a -> s { _csdiLastErrorCode = a })
csdiLastErrorMessage :: Lens' ConfigStreamDeliveryInfo (Maybe Text)
csdiLastErrorMessage =
lens _csdiLastErrorMessage (\s a -> s { _csdiLastErrorMessage = a })
csdiLastStatus :: Lens' ConfigStreamDeliveryInfo (Maybe DeliveryStatus)
csdiLastStatus = lens _csdiLastStatus (\s a -> s { _csdiLastStatus = a })
csdiLastStatusChangeTime :: Lens' ConfigStreamDeliveryInfo (Maybe UTCTime)
csdiLastStatusChangeTime =
lens _csdiLastStatusChangeTime
(\s a -> s { _csdiLastStatusChangeTime = a })
. mapping _Time
instance FromJSON ConfigStreamDeliveryInfo where
parseJSON = withObject "ConfigStreamDeliveryInfo" $ \o -> ConfigStreamDeliveryInfo
<$> o .:? "lastErrorCode"
<*> o .:? "lastErrorMessage"
<*> o .:? "lastStatus"
<*> o .:? "lastStatusChangeTime"
instance ToJSON ConfigStreamDeliveryInfo where
toJSON ConfigStreamDeliveryInfo{..} = object
[ "lastStatus" .= _csdiLastStatus
, "lastErrorCode" .= _csdiLastErrorCode
, "lastErrorMessage" .= _csdiLastErrorMessage
, "lastStatusChangeTime" .= _csdiLastStatusChangeTime
]
data Relationship = Relationship
{ _rRelationshipName :: Maybe Text
, _rResourceId :: Maybe Text
, _rResourceType :: Maybe ResourceType
} deriving (Eq, Read, Show)
relationship :: Relationship
relationship = Relationship
{ _rResourceType = Nothing
, _rResourceId = Nothing
, _rRelationshipName = Nothing
}
rRelationshipName :: Lens' Relationship (Maybe Text)
rRelationshipName =
lens _rRelationshipName (\s a -> s { _rRelationshipName = a })
rResourceId :: Lens' Relationship (Maybe Text)
rResourceId = lens _rResourceId (\s a -> s { _rResourceId = a })
rResourceType :: Lens' Relationship (Maybe ResourceType)
rResourceType = lens _rResourceType (\s a -> s { _rResourceType = a })
instance FromJSON Relationship where
parseJSON = withObject "Relationship" $ \o -> Relationship
<$> o .:? "relationshipName"
<*> o .:? "resourceId"
<*> o .:? "resourceType"
instance ToJSON Relationship where
toJSON Relationship{..} = object
[ "resourceType" .= _rResourceType
, "resourceId" .= _rResourceId
, "relationshipName" .= _rRelationshipName
]
data DeliveryChannel = DeliveryChannel
{ _dcName :: Maybe Text
, _dcS3BucketName :: Maybe Text
, _dcS3KeyPrefix :: Maybe Text
, _dcSnsTopicARN :: Maybe Text
} deriving (Eq, Ord, Read, Show)
deliveryChannel :: DeliveryChannel
deliveryChannel = DeliveryChannel
{ _dcName = Nothing
, _dcS3BucketName = Nothing
, _dcS3KeyPrefix = Nothing
, _dcSnsTopicARN = Nothing
}
dcName :: Lens' DeliveryChannel (Maybe Text)
dcName = lens _dcName (\s a -> s { _dcName = a })
dcS3BucketName :: Lens' DeliveryChannel (Maybe Text)
dcS3BucketName = lens _dcS3BucketName (\s a -> s { _dcS3BucketName = a })
dcS3KeyPrefix :: Lens' DeliveryChannel (Maybe Text)
dcS3KeyPrefix = lens _dcS3KeyPrefix (\s a -> s { _dcS3KeyPrefix = a })
dcSnsTopicARN :: Lens' DeliveryChannel (Maybe Text)
dcSnsTopicARN = lens _dcSnsTopicARN (\s a -> s { _dcSnsTopicARN = a })
instance FromJSON DeliveryChannel where
parseJSON = withObject "DeliveryChannel" $ \o -> DeliveryChannel
<$> o .:? "name"
<*> o .:? "s3BucketName"
<*> o .:? "s3KeyPrefix"
<*> o .:? "snsTopicARN"
instance ToJSON DeliveryChannel where
toJSON DeliveryChannel{..} = object
[ "name" .= _dcName
, "s3BucketName" .= _dcS3BucketName
, "s3KeyPrefix" .= _dcS3KeyPrefix
, "snsTopicARN" .= _dcSnsTopicARN
]
data ChronologicalOrder
= Forward
| Reverse
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable ChronologicalOrder
instance FromText ChronologicalOrder where
parser = takeLowerText >>= \case
"forward" -> pure Forward
"reverse" -> pure Reverse
e -> fail $
"Failure parsing ChronologicalOrder from " ++ show e
instance ToText ChronologicalOrder where
toText = \case
Forward -> "Forward"
Reverse -> "Reverse"
instance ToByteString ChronologicalOrder
instance ToHeader ChronologicalOrder
instance ToQuery ChronologicalOrder
instance FromJSON ChronologicalOrder where
parseJSON = parseJSONText "ChronologicalOrder"
instance ToJSON ChronologicalOrder where
toJSON = toJSONText
data ResourceType
= AWSCloudTrailTrail
| AWSEC2CustomerGateway
| AWSEC2EIP
| AWSEC2Instance
| AWSEC2InternetGateway
| AWSEC2NetworkAcl
| AWSEC2NetworkInterface
| AWSEC2RouteTable
| AWSEC2SecurityGroup
| AWSEC2Subnet
| AWSEC2VPC
| AWSEC2VPNConnection
| AWSEC2VPNGateway
| AWSEC2Volume
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable ResourceType
instance FromText ResourceType where
parser = takeLowerText >>= \case
"aws::cloudtrail::trail" -> pure AWSCloudTrailTrail
"aws::ec2::customergateway" -> pure AWSEC2CustomerGateway
"aws::ec2::eip" -> pure AWSEC2EIP
"aws::ec2::instance" -> pure AWSEC2Instance
"aws::ec2::internetgateway" -> pure AWSEC2InternetGateway
"aws::ec2::networkacl" -> pure AWSEC2NetworkAcl
"aws::ec2::networkinterface" -> pure AWSEC2NetworkInterface
"aws::ec2::routetable" -> pure AWSEC2RouteTable
"aws::ec2::securitygroup" -> pure AWSEC2SecurityGroup
"aws::ec2::subnet" -> pure AWSEC2Subnet
"aws::ec2::vpc" -> pure AWSEC2VPC
"aws::ec2::vpnconnection" -> pure AWSEC2VPNConnection
"aws::ec2::vpngateway" -> pure AWSEC2VPNGateway
"aws::ec2::volume" -> pure AWSEC2Volume
e -> fail $
"Failure parsing ResourceType from " ++ show e
instance ToText ResourceType where
toText = \case
AWSCloudTrailTrail -> "AWS::CloudTrail::Trail"
AWSEC2CustomerGateway -> "AWS::EC2::CustomerGateway"
AWSEC2EIP -> "AWS::EC2::EIP"
AWSEC2Instance -> "AWS::EC2::Instance"
AWSEC2InternetGateway -> "AWS::EC2::InternetGateway"
AWSEC2NetworkAcl -> "AWS::EC2::NetworkAcl"
AWSEC2NetworkInterface -> "AWS::EC2::NetworkInterface"
AWSEC2RouteTable -> "AWS::EC2::RouteTable"
AWSEC2SecurityGroup -> "AWS::EC2::SecurityGroup"
AWSEC2Subnet -> "AWS::EC2::Subnet"
AWSEC2VPC -> "AWS::EC2::VPC"
AWSEC2VPNConnection -> "AWS::EC2::VPNConnection"
AWSEC2VPNGateway -> "AWS::EC2::VPNGateway"
AWSEC2Volume -> "AWS::EC2::Volume"
instance ToByteString ResourceType
instance ToHeader ResourceType
instance ToQuery ResourceType
instance FromJSON ResourceType where
parseJSON = parseJSONText "ResourceType"
instance ToJSON ResourceType where
toJSON = toJSONText
data ConfigurationItem = ConfigurationItem
{ _ciAccountId :: Maybe Text
, _ciArn :: Maybe Text
, _ciAvailabilityZone :: Maybe Text
, _ciConfiguration :: Maybe Text
, _ciConfigurationItemCaptureTime :: Maybe POSIX
, _ciConfigurationItemMD5Hash :: Maybe Text
, _ciConfigurationItemStatus :: Maybe ConfigurationItemStatus
, _ciConfigurationStateId :: Maybe Text
, _ciRelatedEvents :: List "relatedEvents" Text
, _ciRelationships :: List "relationships" Relationship
, _ciResourceCreationTime :: Maybe POSIX
, _ciResourceId :: Maybe Text
, _ciResourceType :: Maybe ResourceType
, _ciTags :: Map Text Text
, _ciVersion :: Maybe Text
} deriving (Eq, Read, Show)
configurationItem :: ConfigurationItem
configurationItem = ConfigurationItem
{ _ciVersion = Nothing
, _ciAccountId = Nothing
, _ciConfigurationItemCaptureTime = Nothing
, _ciConfigurationItemStatus = Nothing
, _ciConfigurationStateId = Nothing
, _ciConfigurationItemMD5Hash = Nothing
, _ciArn = Nothing
, _ciResourceType = Nothing
, _ciResourceId = Nothing
, _ciAvailabilityZone = Nothing
, _ciResourceCreationTime = Nothing
, _ciTags = mempty
, _ciRelatedEvents = mempty
, _ciRelationships = mempty
, _ciConfiguration = Nothing
}
ciAccountId :: Lens' ConfigurationItem (Maybe Text)
ciAccountId = lens _ciAccountId (\s a -> s { _ciAccountId = a })
ciArn :: Lens' ConfigurationItem (Maybe Text)
ciArn = lens _ciArn (\s a -> s { _ciArn = a })
ciAvailabilityZone :: Lens' ConfigurationItem (Maybe Text)
ciAvailabilityZone =
lens _ciAvailabilityZone (\s a -> s { _ciAvailabilityZone = a })
ciConfiguration :: Lens' ConfigurationItem (Maybe Text)
ciConfiguration = lens _ciConfiguration (\s a -> s { _ciConfiguration = a })
ciConfigurationItemCaptureTime :: Lens' ConfigurationItem (Maybe UTCTime)
ciConfigurationItemCaptureTime =
lens _ciConfigurationItemCaptureTime
(\s a -> s { _ciConfigurationItemCaptureTime = a })
. mapping _Time
ciConfigurationItemMD5Hash :: Lens' ConfigurationItem (Maybe Text)
ciConfigurationItemMD5Hash =
lens _ciConfigurationItemMD5Hash
(\s a -> s { _ciConfigurationItemMD5Hash = a })
ciConfigurationItemStatus :: Lens' ConfigurationItem (Maybe ConfigurationItemStatus)
ciConfigurationItemStatus =
lens _ciConfigurationItemStatus
(\s a -> s { _ciConfigurationItemStatus = a })
ciConfigurationStateId :: Lens' ConfigurationItem (Maybe Text)
ciConfigurationStateId =
lens _ciConfigurationStateId (\s a -> s { _ciConfigurationStateId = a })
ciRelatedEvents :: Lens' ConfigurationItem [Text]
ciRelatedEvents = lens _ciRelatedEvents (\s a -> s { _ciRelatedEvents = a }) . _List
ciRelationships :: Lens' ConfigurationItem [Relationship]
ciRelationships = lens _ciRelationships (\s a -> s { _ciRelationships = a }) . _List
ciResourceCreationTime :: Lens' ConfigurationItem (Maybe UTCTime)
ciResourceCreationTime =
lens _ciResourceCreationTime (\s a -> s { _ciResourceCreationTime = a })
. mapping _Time
ciResourceId :: Lens' ConfigurationItem (Maybe Text)
ciResourceId = lens _ciResourceId (\s a -> s { _ciResourceId = a })
ciResourceType :: Lens' ConfigurationItem (Maybe ResourceType)
ciResourceType = lens _ciResourceType (\s a -> s { _ciResourceType = a })
ciTags :: Lens' ConfigurationItem (HashMap Text Text)
ciTags = lens _ciTags (\s a -> s { _ciTags = a }) . _Map
ciVersion :: Lens' ConfigurationItem (Maybe Text)
ciVersion = lens _ciVersion (\s a -> s { _ciVersion = a })
instance FromJSON ConfigurationItem where
parseJSON = withObject "ConfigurationItem" $ \o -> ConfigurationItem
<$> o .:? "accountId"
<*> o .:? "arn"
<*> o .:? "availabilityZone"
<*> o .:? "configuration"
<*> o .:? "configurationItemCaptureTime"
<*> o .:? "configurationItemMD5Hash"
<*> o .:? "configurationItemStatus"
<*> o .:? "configurationStateId"
<*> o .:? "relatedEvents" .!= mempty
<*> o .:? "relationships" .!= mempty
<*> o .:? "resourceCreationTime"
<*> o .:? "resourceId"
<*> o .:? "resourceType"
<*> o .:? "tags" .!= mempty
<*> o .:? "version"
instance ToJSON ConfigurationItem where
toJSON ConfigurationItem{..} = object
[ "version" .= _ciVersion
, "accountId" .= _ciAccountId
, "configurationItemCaptureTime" .= _ciConfigurationItemCaptureTime
, "configurationItemStatus" .= _ciConfigurationItemStatus
, "configurationStateId" .= _ciConfigurationStateId
, "configurationItemMD5Hash" .= _ciConfigurationItemMD5Hash
, "arn" .= _ciArn
, "resourceType" .= _ciResourceType
, "resourceId" .= _ciResourceId
, "availabilityZone" .= _ciAvailabilityZone
, "resourceCreationTime" .= _ciResourceCreationTime
, "tags" .= _ciTags
, "relatedEvents" .= _ciRelatedEvents
, "relationships" .= _ciRelationships
, "configuration" .= _ciConfiguration
]
data DeliveryStatus
= Failure
| Success
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable DeliveryStatus
instance FromText DeliveryStatus where
parser = takeLowerText >>= \case
"failure" -> pure Failure
"success" -> pure Success
e -> fail $
"Failure parsing DeliveryStatus from " ++ show e
instance ToText DeliveryStatus where
toText = \case
Failure -> "Failure"
Success -> "Success"
instance ToByteString DeliveryStatus
instance ToHeader DeliveryStatus
instance ToQuery DeliveryStatus
instance FromJSON DeliveryStatus where
parseJSON = parseJSONText "DeliveryStatus"
instance ToJSON DeliveryStatus where
toJSON = toJSONText
data DeliveryChannelStatus = DeliveryChannelStatus
{ _dcsConfigHistoryDeliveryInfo :: Maybe ConfigExportDeliveryInfo
, _dcsConfigSnapshotDeliveryInfo :: Maybe ConfigExportDeliveryInfo
, _dcsConfigStreamDeliveryInfo :: Maybe ConfigStreamDeliveryInfo
, _dcsName :: Maybe Text
} deriving (Eq, Read, Show)
deliveryChannelStatus :: DeliveryChannelStatus
deliveryChannelStatus = DeliveryChannelStatus
{ _dcsName = Nothing
, _dcsConfigSnapshotDeliveryInfo = Nothing
, _dcsConfigHistoryDeliveryInfo = Nothing
, _dcsConfigStreamDeliveryInfo = Nothing
}
dcsConfigHistoryDeliveryInfo :: Lens' DeliveryChannelStatus (Maybe ConfigExportDeliveryInfo)
dcsConfigHistoryDeliveryInfo =
lens _dcsConfigHistoryDeliveryInfo
(\s a -> s { _dcsConfigHistoryDeliveryInfo = a })
dcsConfigSnapshotDeliveryInfo :: Lens' DeliveryChannelStatus (Maybe ConfigExportDeliveryInfo)
dcsConfigSnapshotDeliveryInfo =
lens _dcsConfigSnapshotDeliveryInfo
(\s a -> s { _dcsConfigSnapshotDeliveryInfo = a })
dcsConfigStreamDeliveryInfo :: Lens' DeliveryChannelStatus (Maybe ConfigStreamDeliveryInfo)
dcsConfigStreamDeliveryInfo =
lens _dcsConfigStreamDeliveryInfo
(\s a -> s { _dcsConfigStreamDeliveryInfo = a })
dcsName :: Lens' DeliveryChannelStatus (Maybe Text)
dcsName = lens _dcsName (\s a -> s { _dcsName = a })
instance FromJSON DeliveryChannelStatus where
parseJSON = withObject "DeliveryChannelStatus" $ \o -> DeliveryChannelStatus
<$> o .:? "configHistoryDeliveryInfo"
<*> o .:? "configSnapshotDeliveryInfo"
<*> o .:? "configStreamDeliveryInfo"
<*> o .:? "name"
instance ToJSON DeliveryChannelStatus where
toJSON DeliveryChannelStatus{..} = object
[ "name" .= _dcsName
, "configSnapshotDeliveryInfo" .= _dcsConfigSnapshotDeliveryInfo
, "configHistoryDeliveryInfo" .= _dcsConfigHistoryDeliveryInfo
, "configStreamDeliveryInfo" .= _dcsConfigStreamDeliveryInfo
]
data ConfigurationRecorderStatus = ConfigurationRecorderStatus
{ _crsLastErrorCode :: Maybe Text
, _crsLastErrorMessage :: Maybe Text
, _crsLastStartTime :: Maybe POSIX
, _crsLastStatus :: Maybe RecorderStatus
, _crsLastStatusChangeTime :: Maybe POSIX
, _crsLastStopTime :: Maybe POSIX
, _crsName :: Maybe Text
, _crsRecording :: Maybe Bool
} deriving (Eq, Read, Show)
configurationRecorderStatus :: ConfigurationRecorderStatus
configurationRecorderStatus = ConfigurationRecorderStatus
{ _crsName = Nothing
, _crsLastStartTime = Nothing
, _crsLastStopTime = Nothing
, _crsRecording = Nothing
, _crsLastStatus = Nothing
, _crsLastErrorCode = Nothing
, _crsLastErrorMessage = Nothing
, _crsLastStatusChangeTime = Nothing
}
crsLastErrorCode :: Lens' ConfigurationRecorderStatus (Maybe Text)
crsLastErrorCode = lens _crsLastErrorCode (\s a -> s { _crsLastErrorCode = a })
crsLastErrorMessage :: Lens' ConfigurationRecorderStatus (Maybe Text)
crsLastErrorMessage =
lens _crsLastErrorMessage (\s a -> s { _crsLastErrorMessage = a })
crsLastStartTime :: Lens' ConfigurationRecorderStatus (Maybe UTCTime)
crsLastStartTime = lens _crsLastStartTime (\s a -> s { _crsLastStartTime = a }) . mapping _Time
crsLastStatus :: Lens' ConfigurationRecorderStatus (Maybe RecorderStatus)
crsLastStatus = lens _crsLastStatus (\s a -> s { _crsLastStatus = a })
crsLastStatusChangeTime :: Lens' ConfigurationRecorderStatus (Maybe UTCTime)
crsLastStatusChangeTime =
lens _crsLastStatusChangeTime (\s a -> s { _crsLastStatusChangeTime = a })
. mapping _Time
crsLastStopTime :: Lens' ConfigurationRecorderStatus (Maybe UTCTime)
crsLastStopTime = lens _crsLastStopTime (\s a -> s { _crsLastStopTime = a }) . mapping _Time
crsName :: Lens' ConfigurationRecorderStatus (Maybe Text)
crsName = lens _crsName (\s a -> s { _crsName = a })
crsRecording :: Lens' ConfigurationRecorderStatus (Maybe Bool)
crsRecording = lens _crsRecording (\s a -> s { _crsRecording = a })
instance FromJSON ConfigurationRecorderStatus where
parseJSON = withObject "ConfigurationRecorderStatus" $ \o -> ConfigurationRecorderStatus
<$> o .:? "lastErrorCode"
<*> o .:? "lastErrorMessage"
<*> o .:? "lastStartTime"
<*> o .:? "lastStatus"
<*> o .:? "lastStatusChangeTime"
<*> o .:? "lastStopTime"
<*> o .:? "name"
<*> o .:? "recording"
instance ToJSON ConfigurationRecorderStatus where
toJSON ConfigurationRecorderStatus{..} = object
[ "name" .= _crsName
, "lastStartTime" .= _crsLastStartTime
, "lastStopTime" .= _crsLastStopTime
, "recording" .= _crsRecording
, "lastStatus" .= _crsLastStatus
, "lastErrorCode" .= _crsLastErrorCode
, "lastErrorMessage" .= _crsLastErrorMessage
, "lastStatusChangeTime" .= _crsLastStatusChangeTime
]
data ConfigurationItemStatus
= Deleted
| Discovered
| Failed
| Ok
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable ConfigurationItemStatus
instance FromText ConfigurationItemStatus where
parser = takeLowerText >>= \case
"deleted" -> pure Deleted
"discovered" -> pure Discovered
"failed" -> pure Failed
"ok" -> pure Ok
e -> fail $
"Failure parsing ConfigurationItemStatus from " ++ show e
instance ToText ConfigurationItemStatus where
toText = \case
Deleted -> "Deleted"
Discovered -> "Discovered"
Failed -> "Failed"
Ok -> "Ok"
instance ToByteString ConfigurationItemStatus
instance ToHeader ConfigurationItemStatus
instance ToQuery ConfigurationItemStatus
instance FromJSON ConfigurationItemStatus where
parseJSON = parseJSONText "ConfigurationItemStatus"
instance ToJSON ConfigurationItemStatus where
toJSON = toJSONText
data ConfigurationRecorder = ConfigurationRecorder
{ _crName :: Maybe Text
, _crRoleARN :: Maybe Text
} deriving (Eq, Ord, Read, Show)
configurationRecorder :: ConfigurationRecorder
configurationRecorder = ConfigurationRecorder
{ _crName = Nothing
, _crRoleARN = Nothing
}
crName :: Lens' ConfigurationRecorder (Maybe Text)
crName = lens _crName (\s a -> s { _crName = a })
crRoleARN :: Lens' ConfigurationRecorder (Maybe Text)
crRoleARN = lens _crRoleARN (\s a -> s { _crRoleARN = a })
instance FromJSON ConfigurationRecorder where
parseJSON = withObject "ConfigurationRecorder" $ \o -> ConfigurationRecorder
<$> o .:? "name"
<*> o .:? "roleARN"
instance ToJSON ConfigurationRecorder where
toJSON ConfigurationRecorder{..} = object
[ "name" .= _crName
, "roleARN" .= _crRoleARN
]
data RecorderStatus
= RSFailure
| RSPending
| RSSuccess
deriving (Eq, Ord, Read, Show, Generic, Enum)
instance Hashable RecorderStatus
instance FromText RecorderStatus where
parser = takeLowerText >>= \case
"failure" -> pure RSFailure
"pending" -> pure RSPending
"success" -> pure RSSuccess
e -> fail $
"Failure parsing RecorderStatus from " ++ show e
instance ToText RecorderStatus where
toText = \case
RSFailure -> "Failure"
RSPending -> "Pending"
RSSuccess -> "Success"
instance ToByteString RecorderStatus
instance ToHeader RecorderStatus
instance ToQuery RecorderStatus
instance FromJSON RecorderStatus where
parseJSON = parseJSONText "RecorderStatus"
instance ToJSON RecorderStatus where
toJSON = toJSONText