module Network.AWS.CognitoSync.ListRecords
(
ListRecords
, listRecords
, lrDatasetName
, lrIdentityId
, lrIdentityPoolId
, lrLastSyncCount
, lrMaxResults
, lrNextToken
, lrSyncSessionToken
, ListRecordsResponse
, listRecordsResponse
, lrrCount
, lrrDatasetDeletedAfterRequestedSyncCount
, lrrDatasetExists
, lrrDatasetSyncCount
, lrrLastModifiedBy
, lrrMergedDatasetNames
, lrrNextToken
, lrrRecords
, lrrSyncSessionToken
) where
import Network.AWS.Prelude
import Network.AWS.Request.RestJSON
import Network.AWS.CognitoSync.Types
import qualified GHC.Exts
data ListRecords = ListRecords
{ _lrDatasetName :: Text
, _lrIdentityId :: Text
, _lrIdentityPoolId :: Text
, _lrLastSyncCount :: Maybe Integer
, _lrMaxResults :: Maybe Int
, _lrNextToken :: Maybe Text
, _lrSyncSessionToken :: Maybe Text
} deriving (Eq, Ord, Read, Show)
listRecords :: Text
-> Text
-> Text
-> ListRecords
listRecords p1 p2 p3 = ListRecords
{ _lrIdentityPoolId = p1
, _lrIdentityId = p2
, _lrDatasetName = p3
, _lrLastSyncCount = Nothing
, _lrNextToken = Nothing
, _lrMaxResults = Nothing
, _lrSyncSessionToken = Nothing
}
lrDatasetName :: Lens' ListRecords Text
lrDatasetName = lens _lrDatasetName (\s a -> s { _lrDatasetName = a })
lrIdentityId :: Lens' ListRecords Text
lrIdentityId = lens _lrIdentityId (\s a -> s { _lrIdentityId = a })
lrIdentityPoolId :: Lens' ListRecords Text
lrIdentityPoolId = lens _lrIdentityPoolId (\s a -> s { _lrIdentityPoolId = a })
lrLastSyncCount :: Lens' ListRecords (Maybe Integer)
lrLastSyncCount = lens _lrLastSyncCount (\s a -> s { _lrLastSyncCount = a })
lrMaxResults :: Lens' ListRecords (Maybe Int)
lrMaxResults = lens _lrMaxResults (\s a -> s { _lrMaxResults = a })
lrNextToken :: Lens' ListRecords (Maybe Text)
lrNextToken = lens _lrNextToken (\s a -> s { _lrNextToken = a })
lrSyncSessionToken :: Lens' ListRecords (Maybe Text)
lrSyncSessionToken =
lens _lrSyncSessionToken (\s a -> s { _lrSyncSessionToken = a })
data ListRecordsResponse = ListRecordsResponse
{ _lrrCount :: Maybe Int
, _lrrDatasetDeletedAfterRequestedSyncCount :: Maybe Bool
, _lrrDatasetExists :: Maybe Bool
, _lrrDatasetSyncCount :: Maybe Integer
, _lrrLastModifiedBy :: Maybe Text
, _lrrMergedDatasetNames :: List "MergedDatasetNames" Text
, _lrrNextToken :: Maybe Text
, _lrrRecords :: List "Records" Record
, _lrrSyncSessionToken :: Maybe Text
} deriving (Eq, Read, Show)
listRecordsResponse :: ListRecordsResponse
listRecordsResponse = ListRecordsResponse
{ _lrrRecords = mempty
, _lrrNextToken = Nothing
, _lrrCount = Nothing
, _lrrDatasetSyncCount = Nothing
, _lrrLastModifiedBy = Nothing
, _lrrMergedDatasetNames = mempty
, _lrrDatasetExists = Nothing
, _lrrDatasetDeletedAfterRequestedSyncCount = Nothing
, _lrrSyncSessionToken = Nothing
}
lrrCount :: Lens' ListRecordsResponse (Maybe Int)
lrrCount = lens _lrrCount (\s a -> s { _lrrCount = a })
lrrDatasetDeletedAfterRequestedSyncCount :: Lens' ListRecordsResponse (Maybe Bool)
lrrDatasetDeletedAfterRequestedSyncCount =
lens _lrrDatasetDeletedAfterRequestedSyncCount
(\s a -> s { _lrrDatasetDeletedAfterRequestedSyncCount = a })
lrrDatasetExists :: Lens' ListRecordsResponse (Maybe Bool)
lrrDatasetExists = lens _lrrDatasetExists (\s a -> s { _lrrDatasetExists = a })
lrrDatasetSyncCount :: Lens' ListRecordsResponse (Maybe Integer)
lrrDatasetSyncCount =
lens _lrrDatasetSyncCount (\s a -> s { _lrrDatasetSyncCount = a })
lrrLastModifiedBy :: Lens' ListRecordsResponse (Maybe Text)
lrrLastModifiedBy =
lens _lrrLastModifiedBy (\s a -> s { _lrrLastModifiedBy = a })
lrrMergedDatasetNames :: Lens' ListRecordsResponse [Text]
lrrMergedDatasetNames =
lens _lrrMergedDatasetNames (\s a -> s { _lrrMergedDatasetNames = a })
. _List
lrrNextToken :: Lens' ListRecordsResponse (Maybe Text)
lrrNextToken = lens _lrrNextToken (\s a -> s { _lrrNextToken = a })
lrrRecords :: Lens' ListRecordsResponse [Record]
lrrRecords = lens _lrrRecords (\s a -> s { _lrrRecords = a }) . _List
lrrSyncSessionToken :: Lens' ListRecordsResponse (Maybe Text)
lrrSyncSessionToken =
lens _lrrSyncSessionToken (\s a -> s { _lrrSyncSessionToken = a })
instance ToPath ListRecords where
toPath ListRecords{..} = mconcat
[ "/identitypools/"
, toText _lrIdentityPoolId
, "/identities/"
, toText _lrIdentityId
, "/datasets/"
, toText _lrDatasetName
, "/records"
]
instance ToQuery ListRecords where
toQuery ListRecords{..} = mconcat
[ "lastSyncCount" =? _lrLastSyncCount
, "nextToken" =? _lrNextToken
, "maxResults" =? _lrMaxResults
, "syncSessionToken" =? _lrSyncSessionToken
]
instance ToHeaders ListRecords
instance ToJSON ListRecords where
toJSON = const (toJSON Empty)
instance AWSRequest ListRecords where
type Sv ListRecords = CognitoSync
type Rs ListRecords = ListRecordsResponse
request = get
response = jsonResponse
instance FromJSON ListRecordsResponse where
parseJSON = withObject "ListRecordsResponse" $ \o -> ListRecordsResponse
<$> o .:? "Count"
<*> o .:? "DatasetDeletedAfterRequestedSyncCount"
<*> o .:? "DatasetExists"
<*> o .:? "DatasetSyncCount"
<*> o .:? "LastModifiedBy"
<*> o .:? "MergedDatasetNames" .!= mempty
<*> o .:? "NextToken"
<*> o .:? "Records" .!= mempty
<*> o .:? "SyncSessionToken"