module Network.AWS.CognitoIdentity.DescribeIdentity
(
DescribeIdentity
, describeIdentity
, diIdentityId
, DescribeIdentityResponse
, describeIdentityResponse
, dirCreationDate
, dirIdentityId
, dirLastModifiedDate
, dirLogins
) where
import Network.AWS.Data (Object)
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CognitoIdentity.Types
import qualified GHC.Exts
newtype DescribeIdentity = DescribeIdentity
{ _diIdentityId :: Text
} deriving (Eq, Ord, Read, Show, Monoid, IsString)
describeIdentity :: Text
-> DescribeIdentity
describeIdentity p1 = DescribeIdentity
{ _diIdentityId = p1
}
diIdentityId :: Lens' DescribeIdentity Text
diIdentityId = lens _diIdentityId (\s a -> s { _diIdentityId = a })
data DescribeIdentityResponse = DescribeIdentityResponse
{ _dirCreationDate :: Maybe POSIX
, _dirIdentityId :: Maybe Text
, _dirLastModifiedDate :: Maybe POSIX
, _dirLogins :: List "Logins" Text
} deriving (Eq, Ord, Read, Show)
describeIdentityResponse :: DescribeIdentityResponse
describeIdentityResponse = DescribeIdentityResponse
{ _dirIdentityId = Nothing
, _dirLogins = mempty
, _dirCreationDate = Nothing
, _dirLastModifiedDate = Nothing
}
dirCreationDate :: Lens' DescribeIdentityResponse (Maybe UTCTime)
dirCreationDate = lens _dirCreationDate (\s a -> s { _dirCreationDate = a }) . mapping _Time
dirIdentityId :: Lens' DescribeIdentityResponse (Maybe Text)
dirIdentityId = lens _dirIdentityId (\s a -> s { _dirIdentityId = a })
dirLastModifiedDate :: Lens' DescribeIdentityResponse (Maybe UTCTime)
dirLastModifiedDate =
lens _dirLastModifiedDate (\s a -> s { _dirLastModifiedDate = a })
. mapping _Time
dirLogins :: Lens' DescribeIdentityResponse [Text]
dirLogins = lens _dirLogins (\s a -> s { _dirLogins = a }) . _List
instance ToPath DescribeIdentity where
toPath = const "/"
instance ToQuery DescribeIdentity where
toQuery = const mempty
instance ToHeaders DescribeIdentity
instance ToJSON DescribeIdentity where
toJSON DescribeIdentity{..} = object
[ "IdentityId" .= _diIdentityId
]
instance AWSRequest DescribeIdentity where
type Sv DescribeIdentity = CognitoIdentity
type Rs DescribeIdentity = DescribeIdentityResponse
request = post "DescribeIdentity"
response = jsonResponse
instance FromJSON DescribeIdentityResponse where
parseJSON = withObject "DescribeIdentityResponse" $ \o -> DescribeIdentityResponse
<$> o .:? "CreationDate"
<*> o .:? "IdentityId"
<*> o .:? "LastModifiedDate"
<*> o .:? "Logins" .!= mempty