{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.AWS.CognitoIdentity.Types.Product where
import Network.AWS.CognitoIdentity.Types.Sum
import Network.AWS.Lens
import Network.AWS.Prelude
data CognitoIdentityProvider = CognitoIdentityProvider'
{ _cipClientId :: !(Maybe Text)
, _cipServerSideTokenCheck :: !(Maybe Bool)
, _cipProviderName :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cognitoIdentityProvider
:: CognitoIdentityProvider
cognitoIdentityProvider =
CognitoIdentityProvider'
{ _cipClientId = Nothing
, _cipServerSideTokenCheck = Nothing
, _cipProviderName = Nothing
}
cipClientId :: Lens' CognitoIdentityProvider (Maybe Text)
cipClientId = lens _cipClientId (\ s a -> s{_cipClientId = a})
cipServerSideTokenCheck :: Lens' CognitoIdentityProvider (Maybe Bool)
cipServerSideTokenCheck = lens _cipServerSideTokenCheck (\ s a -> s{_cipServerSideTokenCheck = a})
cipProviderName :: Lens' CognitoIdentityProvider (Maybe Text)
cipProviderName = lens _cipProviderName (\ s a -> s{_cipProviderName = a})
instance FromJSON CognitoIdentityProvider where
parseJSON
= withObject "CognitoIdentityProvider"
(\ x ->
CognitoIdentityProvider' <$>
(x .:? "ClientId") <*> (x .:? "ServerSideTokenCheck")
<*> (x .:? "ProviderName"))
instance Hashable CognitoIdentityProvider where
instance NFData CognitoIdentityProvider where
instance ToJSON CognitoIdentityProvider where
toJSON CognitoIdentityProvider'{..}
= object
(catMaybes
[("ClientId" .=) <$> _cipClientId,
("ServerSideTokenCheck" .=) <$>
_cipServerSideTokenCheck,
("ProviderName" .=) <$> _cipProviderName])
data Credentials = Credentials'
{ _cSessionToken :: !(Maybe Text)
, _cExpiration :: !(Maybe POSIX)
, _cSecretKey :: !(Maybe Text)
, _cAccessKeyId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
credentials
:: Credentials
credentials =
Credentials'
{ _cSessionToken = Nothing
, _cExpiration = Nothing
, _cSecretKey = Nothing
, _cAccessKeyId = Nothing
}
cSessionToken :: Lens' Credentials (Maybe Text)
cSessionToken = lens _cSessionToken (\ s a -> s{_cSessionToken = a})
cExpiration :: Lens' Credentials (Maybe UTCTime)
cExpiration = lens _cExpiration (\ s a -> s{_cExpiration = a}) . mapping _Time
cSecretKey :: Lens' Credentials (Maybe Text)
cSecretKey = lens _cSecretKey (\ s a -> s{_cSecretKey = a})
cAccessKeyId :: Lens' Credentials (Maybe Text)
cAccessKeyId = lens _cAccessKeyId (\ s a -> s{_cAccessKeyId = a})
instance FromJSON Credentials where
parseJSON
= withObject "Credentials"
(\ x ->
Credentials' <$>
(x .:? "SessionToken") <*> (x .:? "Expiration") <*>
(x .:? "SecretKey")
<*> (x .:? "AccessKeyId"))
instance Hashable Credentials where
instance NFData Credentials where
data IdentityDescription = IdentityDescription'
{ _idLastModifiedDate :: !(Maybe POSIX)
, _idCreationDate :: !(Maybe POSIX)
, _idLogins :: !(Maybe [Text])
, _idIdentityId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
identityDescription
:: IdentityDescription
identityDescription =
IdentityDescription'
{ _idLastModifiedDate = Nothing
, _idCreationDate = Nothing
, _idLogins = Nothing
, _idIdentityId = Nothing
}
idLastModifiedDate :: Lens' IdentityDescription (Maybe UTCTime)
idLastModifiedDate = lens _idLastModifiedDate (\ s a -> s{_idLastModifiedDate = a}) . mapping _Time
idCreationDate :: Lens' IdentityDescription (Maybe UTCTime)
idCreationDate = lens _idCreationDate (\ s a -> s{_idCreationDate = a}) . mapping _Time
idLogins :: Lens' IdentityDescription [Text]
idLogins = lens _idLogins (\ s a -> s{_idLogins = a}) . _Default . _Coerce
idIdentityId :: Lens' IdentityDescription (Maybe Text)
idIdentityId = lens _idIdentityId (\ s a -> s{_idIdentityId = a})
instance FromJSON IdentityDescription where
parseJSON
= withObject "IdentityDescription"
(\ x ->
IdentityDescription' <$>
(x .:? "LastModifiedDate") <*> (x .:? "CreationDate")
<*> (x .:? "Logins" .!= mempty)
<*> (x .:? "IdentityId"))
instance Hashable IdentityDescription where
instance NFData IdentityDescription where
data IdentityPool = IdentityPool'
{ _ipSamlProviderARNs :: !(Maybe [Text])
, _ipSupportedLoginProviders :: !(Maybe (Map Text Text))
, _ipDeveloperProviderName :: !(Maybe Text)
, _ipOpenIdConnectProviderARNs :: !(Maybe [Text])
, _ipCognitoIdentityProviders :: !(Maybe [CognitoIdentityProvider])
, _ipIdentityPoolId :: !Text
, _ipIdentityPoolName :: !Text
, _ipAllowUnauthenticatedIdentities :: !Bool
} deriving (Eq, Read, Show, Data, Typeable, Generic)
identityPool
:: Text
-> Text
-> Bool
-> IdentityPool
identityPool pIdentityPoolId_ pIdentityPoolName_ pAllowUnauthenticatedIdentities_ =
IdentityPool'
{ _ipSamlProviderARNs = Nothing
, _ipSupportedLoginProviders = Nothing
, _ipDeveloperProviderName = Nothing
, _ipOpenIdConnectProviderARNs = Nothing
, _ipCognitoIdentityProviders = Nothing
, _ipIdentityPoolId = pIdentityPoolId_
, _ipIdentityPoolName = pIdentityPoolName_
, _ipAllowUnauthenticatedIdentities = pAllowUnauthenticatedIdentities_
}
ipSamlProviderARNs :: Lens' IdentityPool [Text]
ipSamlProviderARNs = lens _ipSamlProviderARNs (\ s a -> s{_ipSamlProviderARNs = a}) . _Default . _Coerce
ipSupportedLoginProviders :: Lens' IdentityPool (HashMap Text Text)
ipSupportedLoginProviders = lens _ipSupportedLoginProviders (\ s a -> s{_ipSupportedLoginProviders = a}) . _Default . _Map
ipDeveloperProviderName :: Lens' IdentityPool (Maybe Text)
ipDeveloperProviderName = lens _ipDeveloperProviderName (\ s a -> s{_ipDeveloperProviderName = a})
ipOpenIdConnectProviderARNs :: Lens' IdentityPool [Text]
ipOpenIdConnectProviderARNs = lens _ipOpenIdConnectProviderARNs (\ s a -> s{_ipOpenIdConnectProviderARNs = a}) . _Default . _Coerce
ipCognitoIdentityProviders :: Lens' IdentityPool [CognitoIdentityProvider]
ipCognitoIdentityProviders = lens _ipCognitoIdentityProviders (\ s a -> s{_ipCognitoIdentityProviders = a}) . _Default . _Coerce
ipIdentityPoolId :: Lens' IdentityPool Text
ipIdentityPoolId = lens _ipIdentityPoolId (\ s a -> s{_ipIdentityPoolId = a})
ipIdentityPoolName :: Lens' IdentityPool Text
ipIdentityPoolName = lens _ipIdentityPoolName (\ s a -> s{_ipIdentityPoolName = a})
ipAllowUnauthenticatedIdentities :: Lens' IdentityPool Bool
ipAllowUnauthenticatedIdentities = lens _ipAllowUnauthenticatedIdentities (\ s a -> s{_ipAllowUnauthenticatedIdentities = a})
instance FromJSON IdentityPool where
parseJSON
= withObject "IdentityPool"
(\ x ->
IdentityPool' <$>
(x .:? "SamlProviderARNs" .!= mempty) <*>
(x .:? "SupportedLoginProviders" .!= mempty)
<*> (x .:? "DeveloperProviderName")
<*> (x .:? "OpenIdConnectProviderARNs" .!= mempty)
<*> (x .:? "CognitoIdentityProviders" .!= mempty)
<*> (x .: "IdentityPoolId")
<*> (x .: "IdentityPoolName")
<*> (x .: "AllowUnauthenticatedIdentities"))
instance Hashable IdentityPool where
instance NFData IdentityPool where
instance ToJSON IdentityPool where
toJSON IdentityPool'{..}
= object
(catMaybes
[("SamlProviderARNs" .=) <$> _ipSamlProviderARNs,
("SupportedLoginProviders" .=) <$>
_ipSupportedLoginProviders,
("DeveloperProviderName" .=) <$>
_ipDeveloperProviderName,
("OpenIdConnectProviderARNs" .=) <$>
_ipOpenIdConnectProviderARNs,
("CognitoIdentityProviders" .=) <$>
_ipCognitoIdentityProviders,
Just ("IdentityPoolId" .= _ipIdentityPoolId),
Just ("IdentityPoolName" .= _ipIdentityPoolName),
Just
("AllowUnauthenticatedIdentities" .=
_ipAllowUnauthenticatedIdentities)])
data IdentityPoolShortDescription = IdentityPoolShortDescription'
{ _ipsdIdentityPoolId :: !(Maybe Text)
, _ipsdIdentityPoolName :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
identityPoolShortDescription
:: IdentityPoolShortDescription
identityPoolShortDescription =
IdentityPoolShortDescription'
{_ipsdIdentityPoolId = Nothing, _ipsdIdentityPoolName = Nothing}
ipsdIdentityPoolId :: Lens' IdentityPoolShortDescription (Maybe Text)
ipsdIdentityPoolId = lens _ipsdIdentityPoolId (\ s a -> s{_ipsdIdentityPoolId = a})
ipsdIdentityPoolName :: Lens' IdentityPoolShortDescription (Maybe Text)
ipsdIdentityPoolName = lens _ipsdIdentityPoolName (\ s a -> s{_ipsdIdentityPoolName = a})
instance FromJSON IdentityPoolShortDescription where
parseJSON
= withObject "IdentityPoolShortDescription"
(\ x ->
IdentityPoolShortDescription' <$>
(x .:? "IdentityPoolId") <*>
(x .:? "IdentityPoolName"))
instance Hashable IdentityPoolShortDescription where
instance NFData IdentityPoolShortDescription where
data MappingRule = MappingRule'
{ _mrClaim :: !Text
, _mrMatchType :: !MappingRuleMatchType
, _mrValue :: !Text
, _mrRoleARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
mappingRule
:: Text
-> MappingRuleMatchType
-> Text
-> Text
-> MappingRule
mappingRule pClaim_ pMatchType_ pValue_ pRoleARN_ =
MappingRule'
{ _mrClaim = pClaim_
, _mrMatchType = pMatchType_
, _mrValue = pValue_
, _mrRoleARN = pRoleARN_
}
mrClaim :: Lens' MappingRule Text
mrClaim = lens _mrClaim (\ s a -> s{_mrClaim = a})
mrMatchType :: Lens' MappingRule MappingRuleMatchType
mrMatchType = lens _mrMatchType (\ s a -> s{_mrMatchType = a})
mrValue :: Lens' MappingRule Text
mrValue = lens _mrValue (\ s a -> s{_mrValue = a})
mrRoleARN :: Lens' MappingRule Text
mrRoleARN = lens _mrRoleARN (\ s a -> s{_mrRoleARN = a})
instance FromJSON MappingRule where
parseJSON
= withObject "MappingRule"
(\ x ->
MappingRule' <$>
(x .: "Claim") <*> (x .: "MatchType") <*>
(x .: "Value")
<*> (x .: "RoleARN"))
instance Hashable MappingRule where
instance NFData MappingRule where
instance ToJSON MappingRule where
toJSON MappingRule'{..}
= object
(catMaybes
[Just ("Claim" .= _mrClaim),
Just ("MatchType" .= _mrMatchType),
Just ("Value" .= _mrValue),
Just ("RoleARN" .= _mrRoleARN)])
data RoleMapping = RoleMapping'
{ _rmRulesConfiguration :: !(Maybe RulesConfigurationType)
, _rmAmbiguousRoleResolution :: !(Maybe AmbiguousRoleResolutionType)
, _rmType :: !RoleMappingType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
roleMapping
:: RoleMappingType
-> RoleMapping
roleMapping pType_ =
RoleMapping'
{ _rmRulesConfiguration = Nothing
, _rmAmbiguousRoleResolution = Nothing
, _rmType = pType_
}
rmRulesConfiguration :: Lens' RoleMapping (Maybe RulesConfigurationType)
rmRulesConfiguration = lens _rmRulesConfiguration (\ s a -> s{_rmRulesConfiguration = a})
rmAmbiguousRoleResolution :: Lens' RoleMapping (Maybe AmbiguousRoleResolutionType)
rmAmbiguousRoleResolution = lens _rmAmbiguousRoleResolution (\ s a -> s{_rmAmbiguousRoleResolution = a})
rmType :: Lens' RoleMapping RoleMappingType
rmType = lens _rmType (\ s a -> s{_rmType = a})
instance FromJSON RoleMapping where
parseJSON
= withObject "RoleMapping"
(\ x ->
RoleMapping' <$>
(x .:? "RulesConfiguration") <*>
(x .:? "AmbiguousRoleResolution")
<*> (x .: "Type"))
instance Hashable RoleMapping where
instance NFData RoleMapping where
instance ToJSON RoleMapping where
toJSON RoleMapping'{..}
= object
(catMaybes
[("RulesConfiguration" .=) <$> _rmRulesConfiguration,
("AmbiguousRoleResolution" .=) <$>
_rmAmbiguousRoleResolution,
Just ("Type" .= _rmType)])
newtype RulesConfigurationType = RulesConfigurationType'
{ _rctRules :: List1 MappingRule
} deriving (Eq, Read, Show, Data, Typeable, Generic)
rulesConfigurationType
:: NonEmpty MappingRule
-> RulesConfigurationType
rulesConfigurationType pRules_ =
RulesConfigurationType' {_rctRules = _List1 # pRules_}
rctRules :: Lens' RulesConfigurationType (NonEmpty MappingRule)
rctRules = lens _rctRules (\ s a -> s{_rctRules = a}) . _List1
instance FromJSON RulesConfigurationType where
parseJSON
= withObject "RulesConfigurationType"
(\ x -> RulesConfigurationType' <$> (x .: "Rules"))
instance Hashable RulesConfigurationType where
instance NFData RulesConfigurationType where
instance ToJSON RulesConfigurationType where
toJSON RulesConfigurationType'{..}
= object (catMaybes [Just ("Rules" .= _rctRules)])
data UnprocessedIdentityId = UnprocessedIdentityId'
{ _uiiErrorCode :: !(Maybe CognitoErrorCode)
, _uiiIdentityId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
unprocessedIdentityId
:: UnprocessedIdentityId
unprocessedIdentityId =
UnprocessedIdentityId' {_uiiErrorCode = Nothing, _uiiIdentityId = Nothing}
uiiErrorCode :: Lens' UnprocessedIdentityId (Maybe CognitoErrorCode)
uiiErrorCode = lens _uiiErrorCode (\ s a -> s{_uiiErrorCode = a})
uiiIdentityId :: Lens' UnprocessedIdentityId (Maybe Text)
uiiIdentityId = lens _uiiIdentityId (\ s a -> s{_uiiIdentityId = a})
instance FromJSON UnprocessedIdentityId where
parseJSON
= withObject "UnprocessedIdentityId"
(\ x ->
UnprocessedIdentityId' <$>
(x .:? "ErrorCode") <*> (x .:? "IdentityId"))
instance Hashable UnprocessedIdentityId where
instance NFData UnprocessedIdentityId where