module Network.AWS.CognitoSync.Types
(
CognitoSync
, RESTError
, IdentityPoolUsage
, identityPoolUsage
, ipuDataStorage
, ipuIdentityPoolId
, ipuLastModifiedDate
, ipuSyncSessionsCount
, Platform (..)
, Dataset
, dataset
, dCreationDate
, dDataStorage
, dDatasetName
, dIdentityId
, dLastModifiedBy
, dLastModifiedDate
, dNumRecords
, Operation (..)
, Record
, record
, rDeviceLastModifiedDate
, rKey
, rLastModifiedBy
, rLastModifiedDate
, rSyncCount
, rValue
, IdentityUsage
, identityUsage
, iuDataStorage
, iuDatasetCount
, iuIdentityId
, iuIdentityPoolId
, iuLastModifiedDate
, RecordPatch
, recordPatch
, rpDeviceLastModifiedDate
, rpKey
, rpOp
, rpSyncCount
, rpValue
, PushSync
, pushSync
, psApplicationArns
, psRoleArn
) where
import Data.Char (isUpper)
import Network.AWS.Error
import Network.AWS.Prelude
import Network.AWS.Signing.V4
import qualified GHC.Exts
data CognitoSync
instance AWSService CognitoSync where
type Sg CognitoSync = V4
type Er CognitoSync = RESTError
service = Service
{ _svcEndpoint = regional
, _svcAbbrev = "CognitoSync"
, _svcPrefix = "cognito-sync"
, _svcVersion = "2014-06-30"
, _svcTargetPrefix = Nothing
, _svcJSONVersion = Just "1.1"
}
handle = restError statusSuccess
data IdentityPoolUsage = IdentityPoolUsage
{ _ipuDataStorage :: Maybe Integer
, _ipuIdentityPoolId :: Maybe Text
, _ipuLastModifiedDate :: Maybe RFC822
, _ipuSyncSessionsCount :: Maybe Integer
} deriving (Eq, Ord, Show)
identityPoolUsage :: IdentityPoolUsage
identityPoolUsage = IdentityPoolUsage
{ _ipuIdentityPoolId = Nothing
, _ipuSyncSessionsCount = Nothing
, _ipuDataStorage = Nothing
, _ipuLastModifiedDate = Nothing
}
ipuDataStorage :: Lens' IdentityPoolUsage (Maybe Integer)
ipuDataStorage = lens _ipuDataStorage (\s a -> s { _ipuDataStorage = a })
ipuIdentityPoolId :: Lens' IdentityPoolUsage (Maybe Text)
ipuIdentityPoolId =
lens _ipuIdentityPoolId (\s a -> s { _ipuIdentityPoolId = a })
ipuLastModifiedDate :: Lens' IdentityPoolUsage (Maybe UTCTime)
ipuLastModifiedDate =
lens _ipuLastModifiedDate (\s a -> s { _ipuLastModifiedDate = a })
. mapping _Time
ipuSyncSessionsCount :: Lens' IdentityPoolUsage (Maybe Integer)
ipuSyncSessionsCount =
lens _ipuSyncSessionsCount (\s a -> s { _ipuSyncSessionsCount = a })
instance FromJSON IdentityPoolUsage where
parseJSON = withObject "IdentityPoolUsage" $ \o -> IdentityPoolUsage
<$> o .:? "DataStorage"
<*> o .:? "IdentityPoolId"
<*> o .:? "LastModifiedDate"
<*> o .:? "SyncSessionsCount"
instance ToJSON IdentityPoolUsage where
toJSON IdentityPoolUsage{..} = object
[ "IdentityPoolId" .= _ipuIdentityPoolId
, "SyncSessionsCount" .= _ipuSyncSessionsCount
, "DataStorage" .= _ipuDataStorage
, "LastModifiedDate" .= _ipuLastModifiedDate
]
data Platform
= Adm
| Apns
| ApnsSandbox
| Gcm
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable Platform
instance FromText Platform where
parser = match "ADM" Adm
<|> match "APNS" Apns
<|> match "APNS_SANDBOX" ApnsSandbox
<|> match "GCM" Gcm
instance ToText Platform where
toText = \case
Adm -> "ADM"
Apns -> "APNS"
ApnsSandbox -> "APNS_SANDBOX"
Gcm -> "GCM"
instance FromJSON Platform where
parseJSON = parseJSONText "Platform"
instance ToJSON Platform where
toJSON = toJSONText
data Dataset = Dataset
{ _dCreationDate :: Maybe RFC822
, _dDataStorage :: Maybe Integer
, _dDatasetName :: Maybe Text
, _dIdentityId :: Maybe Text
, _dLastModifiedBy :: Maybe Text
, _dLastModifiedDate :: Maybe RFC822
, _dNumRecords :: Maybe Integer
} deriving (Eq, Ord, Show)
dataset :: Dataset
dataset = Dataset
{ _dIdentityId = Nothing
, _dDatasetName = Nothing
, _dCreationDate = Nothing
, _dLastModifiedDate = Nothing
, _dLastModifiedBy = Nothing
, _dDataStorage = Nothing
, _dNumRecords = Nothing
}
dCreationDate :: Lens' Dataset (Maybe UTCTime)
dCreationDate = lens _dCreationDate (\s a -> s { _dCreationDate = a }) . mapping _Time
dDataStorage :: Lens' Dataset (Maybe Integer)
dDataStorage = lens _dDataStorage (\s a -> s { _dDataStorage = a })
dDatasetName :: Lens' Dataset (Maybe Text)
dDatasetName = lens _dDatasetName (\s a -> s { _dDatasetName = a })
dIdentityId :: Lens' Dataset (Maybe Text)
dIdentityId = lens _dIdentityId (\s a -> s { _dIdentityId = a })
dLastModifiedBy :: Lens' Dataset (Maybe Text)
dLastModifiedBy = lens _dLastModifiedBy (\s a -> s { _dLastModifiedBy = a })
dLastModifiedDate :: Lens' Dataset (Maybe UTCTime)
dLastModifiedDate =
lens _dLastModifiedDate (\s a -> s { _dLastModifiedDate = a })
. mapping _Time
dNumRecords :: Lens' Dataset (Maybe Integer)
dNumRecords = lens _dNumRecords (\s a -> s { _dNumRecords = a })
instance FromJSON Dataset where
parseJSON = withObject "Dataset" $ \o -> Dataset
<$> o .:? "CreationDate"
<*> o .:? "DataStorage"
<*> o .:? "DatasetName"
<*> o .:? "IdentityId"
<*> o .:? "LastModifiedBy"
<*> o .:? "LastModifiedDate"
<*> o .:? "NumRecords"
instance ToJSON Dataset where
toJSON Dataset{..} = object
[ "IdentityId" .= _dIdentityId
, "DatasetName" .= _dDatasetName
, "CreationDate" .= _dCreationDate
, "LastModifiedDate" .= _dLastModifiedDate
, "LastModifiedBy" .= _dLastModifiedBy
, "DataStorage" .= _dDataStorage
, "NumRecords" .= _dNumRecords
]
data Operation
= Remove
| Replace
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable Operation
instance FromText Operation where
parser = match "remove" Remove
<|> match "replace" Replace
instance ToText Operation where
toText = \case
Remove -> "remove"
Replace -> "replace"
instance FromJSON Operation where
parseJSON = parseJSONText "Operation"
instance ToJSON Operation where
toJSON = toJSONText
data Record = Record
{ _rDeviceLastModifiedDate :: Maybe RFC822
, _rKey :: Maybe Text
, _rLastModifiedBy :: Maybe Text
, _rLastModifiedDate :: Maybe RFC822
, _rSyncCount :: Maybe Integer
, _rValue :: Maybe Text
} deriving (Eq, Ord, Show)
record :: Record
record = Record
{ _rKey = Nothing
, _rValue = Nothing
, _rSyncCount = Nothing
, _rLastModifiedDate = Nothing
, _rLastModifiedBy = Nothing
, _rDeviceLastModifiedDate = Nothing
}
rDeviceLastModifiedDate :: Lens' Record (Maybe UTCTime)
rDeviceLastModifiedDate =
lens _rDeviceLastModifiedDate (\s a -> s { _rDeviceLastModifiedDate = a })
. mapping _Time
rKey :: Lens' Record (Maybe Text)
rKey = lens _rKey (\s a -> s { _rKey = a })
rLastModifiedBy :: Lens' Record (Maybe Text)
rLastModifiedBy = lens _rLastModifiedBy (\s a -> s { _rLastModifiedBy = a })
rLastModifiedDate :: Lens' Record (Maybe UTCTime)
rLastModifiedDate =
lens _rLastModifiedDate (\s a -> s { _rLastModifiedDate = a })
. mapping _Time
rSyncCount :: Lens' Record (Maybe Integer)
rSyncCount = lens _rSyncCount (\s a -> s { _rSyncCount = a })
rValue :: Lens' Record (Maybe Text)
rValue = lens _rValue (\s a -> s { _rValue = a })
instance FromJSON Record where
parseJSON = withObject "Record" $ \o -> Record
<$> o .:? "DeviceLastModifiedDate"
<*> o .:? "Key"
<*> o .:? "LastModifiedBy"
<*> o .:? "LastModifiedDate"
<*> o .:? "SyncCount"
<*> o .:? "Value"
instance ToJSON Record where
toJSON Record{..} = object
[ "Key" .= _rKey
, "Value" .= _rValue
, "SyncCount" .= _rSyncCount
, "LastModifiedDate" .= _rLastModifiedDate
, "LastModifiedBy" .= _rLastModifiedBy
, "DeviceLastModifiedDate" .= _rDeviceLastModifiedDate
]
data IdentityUsage = IdentityUsage
{ _iuDataStorage :: Maybe Integer
, _iuDatasetCount :: Maybe Int
, _iuIdentityId :: Maybe Text
, _iuIdentityPoolId :: Maybe Text
, _iuLastModifiedDate :: Maybe RFC822
} deriving (Eq, Ord, Show)
identityUsage :: IdentityUsage
identityUsage = IdentityUsage
{ _iuIdentityId = Nothing
, _iuIdentityPoolId = Nothing
, _iuLastModifiedDate = Nothing
, _iuDatasetCount = Nothing
, _iuDataStorage = Nothing
}
iuDataStorage :: Lens' IdentityUsage (Maybe Integer)
iuDataStorage = lens _iuDataStorage (\s a -> s { _iuDataStorage = a })
iuDatasetCount :: Lens' IdentityUsage (Maybe Int)
iuDatasetCount = lens _iuDatasetCount (\s a -> s { _iuDatasetCount = a })
iuIdentityId :: Lens' IdentityUsage (Maybe Text)
iuIdentityId = lens _iuIdentityId (\s a -> s { _iuIdentityId = a })
iuIdentityPoolId :: Lens' IdentityUsage (Maybe Text)
iuIdentityPoolId = lens _iuIdentityPoolId (\s a -> s { _iuIdentityPoolId = a })
iuLastModifiedDate :: Lens' IdentityUsage (Maybe UTCTime)
iuLastModifiedDate =
lens _iuLastModifiedDate (\s a -> s { _iuLastModifiedDate = a })
. mapping _Time
instance FromJSON IdentityUsage where
parseJSON = withObject "IdentityUsage" $ \o -> IdentityUsage
<$> o .:? "DataStorage"
<*> o .:? "DatasetCount"
<*> o .:? "IdentityId"
<*> o .:? "IdentityPoolId"
<*> o .:? "LastModifiedDate"
instance ToJSON IdentityUsage where
toJSON IdentityUsage{..} = object
[ "IdentityId" .= _iuIdentityId
, "IdentityPoolId" .= _iuIdentityPoolId
, "LastModifiedDate" .= _iuLastModifiedDate
, "DatasetCount" .= _iuDatasetCount
, "DataStorage" .= _iuDataStorage
]
data RecordPatch = RecordPatch
{ _rpDeviceLastModifiedDate :: Maybe RFC822
, _rpKey :: Text
, _rpOp :: Text
, _rpSyncCount :: Integer
, _rpValue :: Maybe Text
} deriving (Eq, Ord, Show)
recordPatch :: Text
-> Text
-> Integer
-> RecordPatch
recordPatch p1 p2 p3 = RecordPatch
{ _rpOp = p1
, _rpKey = p2
, _rpSyncCount = p3
, _rpValue = Nothing
, _rpDeviceLastModifiedDate = Nothing
}
rpDeviceLastModifiedDate :: Lens' RecordPatch (Maybe UTCTime)
rpDeviceLastModifiedDate =
lens _rpDeviceLastModifiedDate
(\s a -> s { _rpDeviceLastModifiedDate = a })
. mapping _Time
rpKey :: Lens' RecordPatch Text
rpKey = lens _rpKey (\s a -> s { _rpKey = a })
rpOp :: Lens' RecordPatch Text
rpOp = lens _rpOp (\s a -> s { _rpOp = a })
rpSyncCount :: Lens' RecordPatch Integer
rpSyncCount = lens _rpSyncCount (\s a -> s { _rpSyncCount = a })
rpValue :: Lens' RecordPatch (Maybe Text)
rpValue = lens _rpValue (\s a -> s { _rpValue = a })
instance FromJSON RecordPatch where
parseJSON = withObject "RecordPatch" $ \o -> RecordPatch
<$> o .:? "DeviceLastModifiedDate"
<*> o .: "Key"
<*> o .: "Op"
<*> o .: "SyncCount"
<*> o .:? "Value"
instance ToJSON RecordPatch where
toJSON RecordPatch{..} = object
[ "Op" .= _rpOp
, "Key" .= _rpKey
, "Value" .= _rpValue
, "SyncCount" .= _rpSyncCount
, "DeviceLastModifiedDate" .= _rpDeviceLastModifiedDate
]
data PushSync = PushSync
{ _psApplicationArns :: List "ApplicationArns" Text
, _psRoleArn :: Maybe Text
} deriving (Eq, Ord, Show)
pushSync :: PushSync
pushSync = PushSync
{ _psApplicationArns = mempty
, _psRoleArn = Nothing
}
psApplicationArns :: Lens' PushSync [Text]
psApplicationArns =
lens _psApplicationArns (\s a -> s { _psApplicationArns = a })
. _List
psRoleArn :: Lens' PushSync (Maybe Text)
psRoleArn = lens _psRoleArn (\s a -> s { _psRoleArn = a })
instance FromJSON PushSync where
parseJSON = withObject "PushSync" $ \o -> PushSync
<$> o .: "ApplicationArns"
<*> o .:? "RoleArn"
instance ToJSON PushSync where
toJSON PushSync{..} = object
[ "ApplicationArns" .= _psApplicationArns
, "RoleArn" .= _psRoleArn
]