module Network.AWS.CognitoIdentity.Types
(
CognitoIdentity
, JSONError
, IdentityDescription
, identityDescription
, idIdentityId
, idLogins
, IdentityPool
, identityPool
, ipAllowUnauthenticatedIdentities
, ipDeveloperProviderName
, ipIdentityPoolId
, ipIdentityPoolName
, ipOpenIdConnectProviderARNs
, ipSupportedLoginProviders
, IdentityPoolShortDescription
, identityPoolShortDescription
, ipsdIdentityPoolId
, ipsdIdentityPoolName
) where
import Data.Char (isUpper)
import Network.AWS.Error
import Network.AWS.Prelude
import Network.AWS.Signing
import qualified GHC.Exts
data CognitoIdentity
instance AWSService CognitoIdentity where
type Sg CognitoIdentity = V4
type Er CognitoIdentity = JSONError
service = Service
{ _svcAbbrev = "CognitoIdentity"
, _svcPrefix = "cognito-identity"
, _svcVersion = "2014-06-30"
, _svcTargetPrefix = Just "AWSCognitoIdentityService"
, _svcJSONVersion = Just "1.1"
}
handle = jsonError statusSuccess
data IdentityDescription = IdentityDescription
{ _idIdentityId :: Maybe Text
, _idLogins :: List "Logins" Text
} deriving (Eq, Ord, Show)
identityDescription :: IdentityDescription
identityDescription = IdentityDescription
{ _idIdentityId = Nothing
, _idLogins = mempty
}
idIdentityId :: Lens' IdentityDescription (Maybe Text)
idIdentityId = lens _idIdentityId (\s a -> s { _idIdentityId = a })
idLogins :: Lens' IdentityDescription [Text]
idLogins = lens _idLogins (\s a -> s { _idLogins = a }) . _List
instance FromJSON IdentityDescription where
parseJSON = withObject "IdentityDescription" $ \o -> IdentityDescription
<$> o .:? "IdentityId"
<*> o .: "Logins"
instance ToJSON IdentityDescription where
toJSON IdentityDescription{..} = object
[ "IdentityId" .= _idIdentityId
, "Logins" .= _idLogins
]
data IdentityPool = IdentityPool
{ _ipAllowUnauthenticatedIdentities :: Bool
, _ipDeveloperProviderName :: Maybe Text
, _ipIdentityPoolId :: Text
, _ipIdentityPoolName :: Text
, _ipOpenIdConnectProviderARNs :: List "OpenIdConnectProviderARNs" Text
, _ipSupportedLoginProviders :: Map Text Text
} deriving (Eq, Show)
identityPool :: Text
-> Text
-> Bool
-> IdentityPool
identityPool p1 p2 p3 = IdentityPool
{ _ipIdentityPoolId = p1
, _ipIdentityPoolName = p2
, _ipAllowUnauthenticatedIdentities = p3
, _ipSupportedLoginProviders = mempty
, _ipDeveloperProviderName = Nothing
, _ipOpenIdConnectProviderARNs = mempty
}
ipAllowUnauthenticatedIdentities :: Lens' IdentityPool Bool
ipAllowUnauthenticatedIdentities =
lens _ipAllowUnauthenticatedIdentities
(\s a -> s { _ipAllowUnauthenticatedIdentities = a })
ipDeveloperProviderName :: Lens' IdentityPool (Maybe Text)
ipDeveloperProviderName =
lens _ipDeveloperProviderName (\s a -> s { _ipDeveloperProviderName = a })
ipIdentityPoolId :: Lens' IdentityPool Text
ipIdentityPoolId = lens _ipIdentityPoolId (\s a -> s { _ipIdentityPoolId = a })
ipIdentityPoolName :: Lens' IdentityPool Text
ipIdentityPoolName =
lens _ipIdentityPoolName (\s a -> s { _ipIdentityPoolName = a })
ipOpenIdConnectProviderARNs :: Lens' IdentityPool [Text]
ipOpenIdConnectProviderARNs =
lens _ipOpenIdConnectProviderARNs
(\s a -> s { _ipOpenIdConnectProviderARNs = a })
. _List
ipSupportedLoginProviders :: Lens' IdentityPool (HashMap Text Text)
ipSupportedLoginProviders =
lens _ipSupportedLoginProviders
(\s a -> s { _ipSupportedLoginProviders = a })
. _Map
instance FromJSON IdentityPool where
parseJSON = withObject "IdentityPool" $ \o -> IdentityPool
<$> o .: "AllowUnauthenticatedIdentities"
<*> o .:? "DeveloperProviderName"
<*> o .: "IdentityPoolId"
<*> o .: "IdentityPoolName"
<*> o .: "OpenIdConnectProviderARNs"
<*> o .: "SupportedLoginProviders"
instance ToJSON IdentityPool where
toJSON IdentityPool{..} = object
[ "IdentityPoolId" .= _ipIdentityPoolId
, "IdentityPoolName" .= _ipIdentityPoolName
, "AllowUnauthenticatedIdentities" .= _ipAllowUnauthenticatedIdentities
, "SupportedLoginProviders" .= _ipSupportedLoginProviders
, "DeveloperProviderName" .= _ipDeveloperProviderName
, "OpenIdConnectProviderARNs" .= _ipOpenIdConnectProviderARNs
]
data IdentityPoolShortDescription = IdentityPoolShortDescription
{ _ipsdIdentityPoolId :: Maybe Text
, _ipsdIdentityPoolName :: Maybe Text
} deriving (Eq, Ord, Show)
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" $ \o -> IdentityPoolShortDescription
<$> o .:? "IdentityPoolId"
<*> o .:? "IdentityPoolName"
instance ToJSON IdentityPoolShortDescription where
toJSON IdentityPoolShortDescription{..} = object
[ "IdentityPoolId" .= _ipsdIdentityPoolId
, "IdentityPoolName" .= _ipsdIdentityPoolName
]