{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.AWS.CloudHSMv2.Types.Product where
import Network.AWS.CloudHSMv2.Types.Sum
import Network.AWS.Lens
import Network.AWS.Prelude
data Backup = Backup'
{ _bClusterId :: !(Maybe Text)
, _bCreateTimestamp :: !(Maybe POSIX)
, _bBackupState :: !(Maybe BackupState)
, _bBackupId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
backup
:: Text
-> Backup
backup pBackupId_ =
Backup'
{ _bClusterId = Nothing
, _bCreateTimestamp = Nothing
, _bBackupState = Nothing
, _bBackupId = pBackupId_
}
bClusterId :: Lens' Backup (Maybe Text)
bClusterId = lens _bClusterId (\ s a -> s{_bClusterId = a})
bCreateTimestamp :: Lens' Backup (Maybe UTCTime)
bCreateTimestamp = lens _bCreateTimestamp (\ s a -> s{_bCreateTimestamp = a}) . mapping _Time
bBackupState :: Lens' Backup (Maybe BackupState)
bBackupState = lens _bBackupState (\ s a -> s{_bBackupState = a})
bBackupId :: Lens' Backup Text
bBackupId = lens _bBackupId (\ s a -> s{_bBackupId = a})
instance FromJSON Backup where
parseJSON
= withObject "Backup"
(\ x ->
Backup' <$>
(x .:? "ClusterId") <*> (x .:? "CreateTimestamp") <*>
(x .:? "BackupState")
<*> (x .: "BackupId"))
instance Hashable Backup where
instance NFData Backup where
data Certificates = Certificates'
{ _cManufacturerHardwareCertificate :: !(Maybe Text)
, _cClusterCSR :: !(Maybe Text)
, _cHSMCertificate :: !(Maybe Text)
, _cClusterCertificate :: !(Maybe Text)
, _cAWSHardwareCertificate :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
certificates
:: Certificates
certificates =
Certificates'
{ _cManufacturerHardwareCertificate = Nothing
, _cClusterCSR = Nothing
, _cHSMCertificate = Nothing
, _cClusterCertificate = Nothing
, _cAWSHardwareCertificate = Nothing
}
cManufacturerHardwareCertificate :: Lens' Certificates (Maybe Text)
cManufacturerHardwareCertificate = lens _cManufacturerHardwareCertificate (\ s a -> s{_cManufacturerHardwareCertificate = a})
cClusterCSR :: Lens' Certificates (Maybe Text)
cClusterCSR = lens _cClusterCSR (\ s a -> s{_cClusterCSR = a})
cHSMCertificate :: Lens' Certificates (Maybe Text)
cHSMCertificate = lens _cHSMCertificate (\ s a -> s{_cHSMCertificate = a})
cClusterCertificate :: Lens' Certificates (Maybe Text)
cClusterCertificate = lens _cClusterCertificate (\ s a -> s{_cClusterCertificate = a})
cAWSHardwareCertificate :: Lens' Certificates (Maybe Text)
cAWSHardwareCertificate = lens _cAWSHardwareCertificate (\ s a -> s{_cAWSHardwareCertificate = a})
instance FromJSON Certificates where
parseJSON
= withObject "Certificates"
(\ x ->
Certificates' <$>
(x .:? "ManufacturerHardwareCertificate") <*>
(x .:? "ClusterCsr")
<*> (x .:? "HsmCertificate")
<*> (x .:? "ClusterCertificate")
<*> (x .:? "AwsHardwareCertificate"))
instance Hashable Certificates where
instance NFData Certificates where
data Cluster = Cluster'
{ _cPreCoPassword :: !(Maybe Text)
, _cStateMessage :: !(Maybe Text)
, _cState :: !(Maybe ClusterState)
, _cSubnetMapping :: !(Maybe (Map Text Text))
, _cHSMs :: !(Maybe [HSM])
, _cVPCId :: !(Maybe Text)
, _cSourceBackupId :: !(Maybe Text)
, _cCertificates :: !(Maybe Certificates)
, _cSecurityGroup :: !(Maybe Text)
, _cClusterId :: !(Maybe Text)
, _cCreateTimestamp :: !(Maybe POSIX)
, _cBackupPolicy :: !(Maybe BackupPolicy)
, _cHSMType :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cluster
:: Cluster
cluster =
Cluster'
{ _cPreCoPassword = Nothing
, _cStateMessage = Nothing
, _cState = Nothing
, _cSubnetMapping = Nothing
, _cHSMs = Nothing
, _cVPCId = Nothing
, _cSourceBackupId = Nothing
, _cCertificates = Nothing
, _cSecurityGroup = Nothing
, _cClusterId = Nothing
, _cCreateTimestamp = Nothing
, _cBackupPolicy = Nothing
, _cHSMType = Nothing
}
cPreCoPassword :: Lens' Cluster (Maybe Text)
cPreCoPassword = lens _cPreCoPassword (\ s a -> s{_cPreCoPassword = a})
cStateMessage :: Lens' Cluster (Maybe Text)
cStateMessage = lens _cStateMessage (\ s a -> s{_cStateMessage = a})
cState :: Lens' Cluster (Maybe ClusterState)
cState = lens _cState (\ s a -> s{_cState = a})
cSubnetMapping :: Lens' Cluster (HashMap Text Text)
cSubnetMapping = lens _cSubnetMapping (\ s a -> s{_cSubnetMapping = a}) . _Default . _Map
cHSMs :: Lens' Cluster [HSM]
cHSMs = lens _cHSMs (\ s a -> s{_cHSMs = a}) . _Default . _Coerce
cVPCId :: Lens' Cluster (Maybe Text)
cVPCId = lens _cVPCId (\ s a -> s{_cVPCId = a})
cSourceBackupId :: Lens' Cluster (Maybe Text)
cSourceBackupId = lens _cSourceBackupId (\ s a -> s{_cSourceBackupId = a})
cCertificates :: Lens' Cluster (Maybe Certificates)
cCertificates = lens _cCertificates (\ s a -> s{_cCertificates = a})
cSecurityGroup :: Lens' Cluster (Maybe Text)
cSecurityGroup = lens _cSecurityGroup (\ s a -> s{_cSecurityGroup = a})
cClusterId :: Lens' Cluster (Maybe Text)
cClusterId = lens _cClusterId (\ s a -> s{_cClusterId = a})
cCreateTimestamp :: Lens' Cluster (Maybe UTCTime)
cCreateTimestamp = lens _cCreateTimestamp (\ s a -> s{_cCreateTimestamp = a}) . mapping _Time
cBackupPolicy :: Lens' Cluster (Maybe BackupPolicy)
cBackupPolicy = lens _cBackupPolicy (\ s a -> s{_cBackupPolicy = a})
cHSMType :: Lens' Cluster (Maybe Text)
cHSMType = lens _cHSMType (\ s a -> s{_cHSMType = a})
instance FromJSON Cluster where
parseJSON
= withObject "Cluster"
(\ x ->
Cluster' <$>
(x .:? "PreCoPassword") <*> (x .:? "StateMessage")
<*> (x .:? "State")
<*> (x .:? "SubnetMapping" .!= mempty)
<*> (x .:? "Hsms" .!= mempty)
<*> (x .:? "VpcId")
<*> (x .:? "SourceBackupId")
<*> (x .:? "Certificates")
<*> (x .:? "SecurityGroup")
<*> (x .:? "ClusterId")
<*> (x .:? "CreateTimestamp")
<*> (x .:? "BackupPolicy")
<*> (x .:? "HsmType"))
instance Hashable Cluster where
instance NFData Cluster where
data HSM = HSM'
{ _hsmStateMessage :: !(Maybe Text)
, _hsmState :: !(Maybe HSMState)
, _hsmEniId :: !(Maybe Text)
, _hsmSubnetId :: !(Maybe Text)
, _hsmAvailabilityZone :: !(Maybe Text)
, _hsmClusterId :: !(Maybe Text)
, _hsmEniIP :: !(Maybe Text)
, _hsmHSMId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
hsm
:: Text
-> HSM
hsm pHSMId_ =
HSM'
{ _hsmStateMessage = Nothing
, _hsmState = Nothing
, _hsmEniId = Nothing
, _hsmSubnetId = Nothing
, _hsmAvailabilityZone = Nothing
, _hsmClusterId = Nothing
, _hsmEniIP = Nothing
, _hsmHSMId = pHSMId_
}
hsmStateMessage :: Lens' HSM (Maybe Text)
hsmStateMessage = lens _hsmStateMessage (\ s a -> s{_hsmStateMessage = a})
hsmState :: Lens' HSM (Maybe HSMState)
hsmState = lens _hsmState (\ s a -> s{_hsmState = a})
hsmEniId :: Lens' HSM (Maybe Text)
hsmEniId = lens _hsmEniId (\ s a -> s{_hsmEniId = a})
hsmSubnetId :: Lens' HSM (Maybe Text)
hsmSubnetId = lens _hsmSubnetId (\ s a -> s{_hsmSubnetId = a})
hsmAvailabilityZone :: Lens' HSM (Maybe Text)
hsmAvailabilityZone = lens _hsmAvailabilityZone (\ s a -> s{_hsmAvailabilityZone = a})
hsmClusterId :: Lens' HSM (Maybe Text)
hsmClusterId = lens _hsmClusterId (\ s a -> s{_hsmClusterId = a})
hsmEniIP :: Lens' HSM (Maybe Text)
hsmEniIP = lens _hsmEniIP (\ s a -> s{_hsmEniIP = a})
hsmHSMId :: Lens' HSM Text
hsmHSMId = lens _hsmHSMId (\ s a -> s{_hsmHSMId = a})
instance FromJSON HSM where
parseJSON
= withObject "HSM"
(\ x ->
HSM' <$>
(x .:? "StateMessage") <*> (x .:? "State") <*>
(x .:? "EniId")
<*> (x .:? "SubnetId")
<*> (x .:? "AvailabilityZone")
<*> (x .:? "ClusterId")
<*> (x .:? "EniIp")
<*> (x .: "HsmId"))
instance Hashable HSM where
instance NFData HSM where
data Tag = Tag'
{ _tagKey :: !Text
, _tagValue :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
tag
:: Text
-> Text
-> Tag
tag pKey_ pValue_ = Tag' {_tagKey = pKey_, _tagValue = pValue_}
tagKey :: Lens' Tag Text
tagKey = lens _tagKey (\ s a -> s{_tagKey = a})
tagValue :: Lens' Tag Text
tagValue = lens _tagValue (\ s a -> s{_tagValue = a})
instance FromJSON Tag where
parseJSON
= withObject "Tag"
(\ x -> Tag' <$> (x .: "Key") <*> (x .: "Value"))
instance Hashable Tag where
instance NFData Tag where
instance ToJSON Tag where
toJSON Tag'{..}
= object
(catMaybes
[Just ("Key" .= _tagKey),
Just ("Value" .= _tagValue)])