module Stratosphere.ResourceProperties.DynamoDBGlobalSecondaryIndex where
import Control.Lens
import Data.Aeson
import Data.Aeson.Types
import Data.Text
import GHC.Generics
import Stratosphere.Values
import Stratosphere.ResourceProperties.DynamoDBKeySchema
import Stratosphere.ResourceProperties.DynamoDBProjectionObject
import Stratosphere.ResourceProperties.DynamoDBProvisionedThroughput
data DynamoDBGlobalSecondaryIndex =
DynamoDBGlobalSecondaryIndex
{ _dynamoDBGlobalSecondaryIndexIndexName :: Val Text
, _dynamoDBGlobalSecondaryIndexKeySchema :: [DynamoDBKeySchema]
, _dynamoDBGlobalSecondaryIndexProjection :: DynamoDBProjectionObject
, _dynamoDBGlobalSecondaryIndexProvisionedThroughput :: DynamoDBProvisionedThroughput
} deriving (Show, Generic)
instance ToJSON DynamoDBGlobalSecondaryIndex where
toJSON = genericToJSON defaultOptions { fieldLabelModifier = Prelude.drop 29, omitNothingFields = True }
instance FromJSON DynamoDBGlobalSecondaryIndex where
parseJSON = genericParseJSON defaultOptions { fieldLabelModifier = Prelude.drop 29, omitNothingFields = True }
dynamoDBGlobalSecondaryIndex
:: Val Text
-> [DynamoDBKeySchema]
-> DynamoDBProjectionObject
-> DynamoDBProvisionedThroughput
-> DynamoDBGlobalSecondaryIndex
dynamoDBGlobalSecondaryIndex indexNamearg keySchemaarg projectionarg provisionedThroughputarg =
DynamoDBGlobalSecondaryIndex
{ _dynamoDBGlobalSecondaryIndexIndexName = indexNamearg
, _dynamoDBGlobalSecondaryIndexKeySchema = keySchemaarg
, _dynamoDBGlobalSecondaryIndexProjection = projectionarg
, _dynamoDBGlobalSecondaryIndexProvisionedThroughput = provisionedThroughputarg
}
ddbgsiIndexName :: Lens' DynamoDBGlobalSecondaryIndex (Val Text)
ddbgsiIndexName = lens _dynamoDBGlobalSecondaryIndexIndexName (\s a -> s { _dynamoDBGlobalSecondaryIndexIndexName = a })
ddbgsiKeySchema :: Lens' DynamoDBGlobalSecondaryIndex [DynamoDBKeySchema]
ddbgsiKeySchema = lens _dynamoDBGlobalSecondaryIndexKeySchema (\s a -> s { _dynamoDBGlobalSecondaryIndexKeySchema = a })
ddbgsiProjection :: Lens' DynamoDBGlobalSecondaryIndex DynamoDBProjectionObject
ddbgsiProjection = lens _dynamoDBGlobalSecondaryIndexProjection (\s a -> s { _dynamoDBGlobalSecondaryIndexProjection = a })
ddbgsiProvisionedThroughput :: Lens' DynamoDBGlobalSecondaryIndex DynamoDBProvisionedThroughput
ddbgsiProvisionedThroughput = lens _dynamoDBGlobalSecondaryIndexProvisionedThroughput (\s a -> s { _dynamoDBGlobalSecondaryIndexProvisionedThroughput = a })