{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.AWS.Athena.Types.Product where
import Network.AWS.Athena.Types.Sum
import Network.AWS.Lens
import Network.AWS.Prelude
data ColumnInfo = ColumnInfo'
{ _ciScale :: !(Maybe Int)
, _ciPrecision :: !(Maybe Int)
, _ciSchemaName :: !(Maybe Text)
, _ciCatalogName :: !(Maybe Text)
, _ciCaseSensitive :: !(Maybe Bool)
, _ciLabel :: !(Maybe Text)
, _ciTableName :: !(Maybe Text)
, _ciNullable :: !(Maybe ColumnNullable)
, _ciName :: !Text
, _ciType :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
columnInfo
:: Text
-> Text
-> ColumnInfo
columnInfo pName_ pType_ =
ColumnInfo'
{ _ciScale = Nothing
, _ciPrecision = Nothing
, _ciSchemaName = Nothing
, _ciCatalogName = Nothing
, _ciCaseSensitive = Nothing
, _ciLabel = Nothing
, _ciTableName = Nothing
, _ciNullable = Nothing
, _ciName = pName_
, _ciType = pType_
}
ciScale :: Lens' ColumnInfo (Maybe Int)
ciScale = lens _ciScale (\ s a -> s{_ciScale = a})
ciPrecision :: Lens' ColumnInfo (Maybe Int)
ciPrecision = lens _ciPrecision (\ s a -> s{_ciPrecision = a})
ciSchemaName :: Lens' ColumnInfo (Maybe Text)
ciSchemaName = lens _ciSchemaName (\ s a -> s{_ciSchemaName = a})
ciCatalogName :: Lens' ColumnInfo (Maybe Text)
ciCatalogName = lens _ciCatalogName (\ s a -> s{_ciCatalogName = a})
ciCaseSensitive :: Lens' ColumnInfo (Maybe Bool)
ciCaseSensitive = lens _ciCaseSensitive (\ s a -> s{_ciCaseSensitive = a})
ciLabel :: Lens' ColumnInfo (Maybe Text)
ciLabel = lens _ciLabel (\ s a -> s{_ciLabel = a})
ciTableName :: Lens' ColumnInfo (Maybe Text)
ciTableName = lens _ciTableName (\ s a -> s{_ciTableName = a})
ciNullable :: Lens' ColumnInfo (Maybe ColumnNullable)
ciNullable = lens _ciNullable (\ s a -> s{_ciNullable = a})
ciName :: Lens' ColumnInfo Text
ciName = lens _ciName (\ s a -> s{_ciName = a})
ciType :: Lens' ColumnInfo Text
ciType = lens _ciType (\ s a -> s{_ciType = a})
instance FromJSON ColumnInfo where
parseJSON
= withObject "ColumnInfo"
(\ x ->
ColumnInfo' <$>
(x .:? "Scale") <*> (x .:? "Precision") <*>
(x .:? "SchemaName")
<*> (x .:? "CatalogName")
<*> (x .:? "CaseSensitive")
<*> (x .:? "Label")
<*> (x .:? "TableName")
<*> (x .:? "Nullable")
<*> (x .: "Name")
<*> (x .: "Type"))
instance Hashable ColumnInfo where
instance NFData ColumnInfo where
newtype Datum = Datum'
{ _dVarCharValue :: Maybe Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
datum
:: Datum
datum = Datum' {_dVarCharValue = Nothing}
dVarCharValue :: Lens' Datum (Maybe Text)
dVarCharValue = lens _dVarCharValue (\ s a -> s{_dVarCharValue = a})
instance FromJSON Datum where
parseJSON
= withObject "Datum"
(\ x -> Datum' <$> (x .:? "VarCharValue"))
instance Hashable Datum where
instance NFData Datum where
data EncryptionConfiguration = EncryptionConfiguration'
{ _ecKMSKey :: !(Maybe Text)
, _ecEncryptionOption :: !EncryptionOption
} deriving (Eq, Read, Show, Data, Typeable, Generic)
encryptionConfiguration
:: EncryptionOption
-> EncryptionConfiguration
encryptionConfiguration pEncryptionOption_ =
EncryptionConfiguration'
{_ecKMSKey = Nothing, _ecEncryptionOption = pEncryptionOption_}
ecKMSKey :: Lens' EncryptionConfiguration (Maybe Text)
ecKMSKey = lens _ecKMSKey (\ s a -> s{_ecKMSKey = a})
ecEncryptionOption :: Lens' EncryptionConfiguration EncryptionOption
ecEncryptionOption = lens _ecEncryptionOption (\ s a -> s{_ecEncryptionOption = a})
instance FromJSON EncryptionConfiguration where
parseJSON
= withObject "EncryptionConfiguration"
(\ x ->
EncryptionConfiguration' <$>
(x .:? "KmsKey") <*> (x .: "EncryptionOption"))
instance Hashable EncryptionConfiguration where
instance NFData EncryptionConfiguration where
instance ToJSON EncryptionConfiguration where
toJSON EncryptionConfiguration'{..}
= object
(catMaybes
[("KmsKey" .=) <$> _ecKMSKey,
Just ("EncryptionOption" .= _ecEncryptionOption)])
data NamedQuery = NamedQuery'
{ _nqNamedQueryId :: !(Maybe Text)
, _nqDescription :: !(Maybe Text)
, _nqName :: !Text
, _nqDatabase :: !Text
, _nqQueryString :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
namedQuery
:: Text
-> Text
-> Text
-> NamedQuery
namedQuery pName_ pDatabase_ pQueryString_ =
NamedQuery'
{ _nqNamedQueryId = Nothing
, _nqDescription = Nothing
, _nqName = pName_
, _nqDatabase = pDatabase_
, _nqQueryString = pQueryString_
}
nqNamedQueryId :: Lens' NamedQuery (Maybe Text)
nqNamedQueryId = lens _nqNamedQueryId (\ s a -> s{_nqNamedQueryId = a})
nqDescription :: Lens' NamedQuery (Maybe Text)
nqDescription = lens _nqDescription (\ s a -> s{_nqDescription = a})
nqName :: Lens' NamedQuery Text
nqName = lens _nqName (\ s a -> s{_nqName = a})
nqDatabase :: Lens' NamedQuery Text
nqDatabase = lens _nqDatabase (\ s a -> s{_nqDatabase = a})
nqQueryString :: Lens' NamedQuery Text
nqQueryString = lens _nqQueryString (\ s a -> s{_nqQueryString = a})
instance FromJSON NamedQuery where
parseJSON
= withObject "NamedQuery"
(\ x ->
NamedQuery' <$>
(x .:? "NamedQueryId") <*> (x .:? "Description") <*>
(x .: "Name")
<*> (x .: "Database")
<*> (x .: "QueryString"))
instance Hashable NamedQuery where
instance NFData NamedQuery where
data QueryExecution = QueryExecution'
{ _qeStatus :: !(Maybe QueryExecutionStatus)
, _qeQueryExecutionContext :: !(Maybe QueryExecutionContext)
, _qeResultConfiguration :: !(Maybe ResultConfiguration)
, _qeQuery :: !(Maybe Text)
, _qeStatistics :: !(Maybe QueryExecutionStatistics)
, _qeQueryExecutionId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
queryExecution
:: QueryExecution
queryExecution =
QueryExecution'
{ _qeStatus = Nothing
, _qeQueryExecutionContext = Nothing
, _qeResultConfiguration = Nothing
, _qeQuery = Nothing
, _qeStatistics = Nothing
, _qeQueryExecutionId = Nothing
}
qeStatus :: Lens' QueryExecution (Maybe QueryExecutionStatus)
qeStatus = lens _qeStatus (\ s a -> s{_qeStatus = a})
qeQueryExecutionContext :: Lens' QueryExecution (Maybe QueryExecutionContext)
qeQueryExecutionContext = lens _qeQueryExecutionContext (\ s a -> s{_qeQueryExecutionContext = a})
qeResultConfiguration :: Lens' QueryExecution (Maybe ResultConfiguration)
qeResultConfiguration = lens _qeResultConfiguration (\ s a -> s{_qeResultConfiguration = a})
qeQuery :: Lens' QueryExecution (Maybe Text)
qeQuery = lens _qeQuery (\ s a -> s{_qeQuery = a})
qeStatistics :: Lens' QueryExecution (Maybe QueryExecutionStatistics)
qeStatistics = lens _qeStatistics (\ s a -> s{_qeStatistics = a})
qeQueryExecutionId :: Lens' QueryExecution (Maybe Text)
qeQueryExecutionId = lens _qeQueryExecutionId (\ s a -> s{_qeQueryExecutionId = a})
instance FromJSON QueryExecution where
parseJSON
= withObject "QueryExecution"
(\ x ->
QueryExecution' <$>
(x .:? "Status") <*> (x .:? "QueryExecutionContext")
<*> (x .:? "ResultConfiguration")
<*> (x .:? "Query")
<*> (x .:? "Statistics")
<*> (x .:? "QueryExecutionId"))
instance Hashable QueryExecution where
instance NFData QueryExecution where
newtype QueryExecutionContext = QueryExecutionContext'
{ _qecDatabase :: Maybe Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
queryExecutionContext
:: QueryExecutionContext
queryExecutionContext = QueryExecutionContext' {_qecDatabase = Nothing}
qecDatabase :: Lens' QueryExecutionContext (Maybe Text)
qecDatabase = lens _qecDatabase (\ s a -> s{_qecDatabase = a})
instance FromJSON QueryExecutionContext where
parseJSON
= withObject "QueryExecutionContext"
(\ x ->
QueryExecutionContext' <$> (x .:? "Database"))
instance Hashable QueryExecutionContext where
instance NFData QueryExecutionContext where
instance ToJSON QueryExecutionContext where
toJSON QueryExecutionContext'{..}
= object
(catMaybes [("Database" .=) <$> _qecDatabase])
data QueryExecutionStatistics = QueryExecutionStatistics'
{ _qesEngineExecutionTimeInMillis :: !(Maybe Integer)
, _qesDataScannedInBytes :: !(Maybe Integer)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
queryExecutionStatistics
:: QueryExecutionStatistics
queryExecutionStatistics =
QueryExecutionStatistics'
{ _qesEngineExecutionTimeInMillis = Nothing
, _qesDataScannedInBytes = Nothing
}
qesEngineExecutionTimeInMillis :: Lens' QueryExecutionStatistics (Maybe Integer)
qesEngineExecutionTimeInMillis = lens _qesEngineExecutionTimeInMillis (\ s a -> s{_qesEngineExecutionTimeInMillis = a})
qesDataScannedInBytes :: Lens' QueryExecutionStatistics (Maybe Integer)
qesDataScannedInBytes = lens _qesDataScannedInBytes (\ s a -> s{_qesDataScannedInBytes = a})
instance FromJSON QueryExecutionStatistics where
parseJSON
= withObject "QueryExecutionStatistics"
(\ x ->
QueryExecutionStatistics' <$>
(x .:? "EngineExecutionTimeInMillis") <*>
(x .:? "DataScannedInBytes"))
instance Hashable QueryExecutionStatistics where
instance NFData QueryExecutionStatistics where
data QueryExecutionStatus = QueryExecutionStatus'
{ _qesState :: !(Maybe QueryExecutionState)
, _qesStateChangeReason :: !(Maybe Text)
, _qesSubmissionDateTime :: !(Maybe POSIX)
, _qesCompletionDateTime :: !(Maybe POSIX)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
queryExecutionStatus
:: QueryExecutionStatus
queryExecutionStatus =
QueryExecutionStatus'
{ _qesState = Nothing
, _qesStateChangeReason = Nothing
, _qesSubmissionDateTime = Nothing
, _qesCompletionDateTime = Nothing
}
qesState :: Lens' QueryExecutionStatus (Maybe QueryExecutionState)
qesState = lens _qesState (\ s a -> s{_qesState = a})
qesStateChangeReason :: Lens' QueryExecutionStatus (Maybe Text)
qesStateChangeReason = lens _qesStateChangeReason (\ s a -> s{_qesStateChangeReason = a})
qesSubmissionDateTime :: Lens' QueryExecutionStatus (Maybe UTCTime)
qesSubmissionDateTime = lens _qesSubmissionDateTime (\ s a -> s{_qesSubmissionDateTime = a}) . mapping _Time
qesCompletionDateTime :: Lens' QueryExecutionStatus (Maybe UTCTime)
qesCompletionDateTime = lens _qesCompletionDateTime (\ s a -> s{_qesCompletionDateTime = a}) . mapping _Time
instance FromJSON QueryExecutionStatus where
parseJSON
= withObject "QueryExecutionStatus"
(\ x ->
QueryExecutionStatus' <$>
(x .:? "State") <*> (x .:? "StateChangeReason") <*>
(x .:? "SubmissionDateTime")
<*> (x .:? "CompletionDateTime"))
instance Hashable QueryExecutionStatus where
instance NFData QueryExecutionStatus where
data ResultConfiguration = ResultConfiguration'
{ _rcEncryptionConfiguration :: !(Maybe EncryptionConfiguration)
, _rcOutputLocation :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resultConfiguration
:: Text
-> ResultConfiguration
resultConfiguration pOutputLocation_ =
ResultConfiguration'
{_rcEncryptionConfiguration = Nothing, _rcOutputLocation = pOutputLocation_}
rcEncryptionConfiguration :: Lens' ResultConfiguration (Maybe EncryptionConfiguration)
rcEncryptionConfiguration = lens _rcEncryptionConfiguration (\ s a -> s{_rcEncryptionConfiguration = a})
rcOutputLocation :: Lens' ResultConfiguration Text
rcOutputLocation = lens _rcOutputLocation (\ s a -> s{_rcOutputLocation = a})
instance FromJSON ResultConfiguration where
parseJSON
= withObject "ResultConfiguration"
(\ x ->
ResultConfiguration' <$>
(x .:? "EncryptionConfiguration") <*>
(x .: "OutputLocation"))
instance Hashable ResultConfiguration where
instance NFData ResultConfiguration where
instance ToJSON ResultConfiguration where
toJSON ResultConfiguration'{..}
= object
(catMaybes
[("EncryptionConfiguration" .=) <$>
_rcEncryptionConfiguration,
Just ("OutputLocation" .= _rcOutputLocation)])
data ResultSet = ResultSet'
{ _rsRows :: !(Maybe [Row])
, _rsResultSetMetadata :: !(Maybe ResultSetMetadata)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resultSet
:: ResultSet
resultSet = ResultSet' {_rsRows = Nothing, _rsResultSetMetadata = Nothing}
rsRows :: Lens' ResultSet [Row]
rsRows = lens _rsRows (\ s a -> s{_rsRows = a}) . _Default . _Coerce
rsResultSetMetadata :: Lens' ResultSet (Maybe ResultSetMetadata)
rsResultSetMetadata = lens _rsResultSetMetadata (\ s a -> s{_rsResultSetMetadata = a})
instance FromJSON ResultSet where
parseJSON
= withObject "ResultSet"
(\ x ->
ResultSet' <$>
(x .:? "Rows" .!= mempty) <*>
(x .:? "ResultSetMetadata"))
instance Hashable ResultSet where
instance NFData ResultSet where
newtype ResultSetMetadata = ResultSetMetadata'
{ _rsmColumnInfo :: Maybe [ColumnInfo]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resultSetMetadata
:: ResultSetMetadata
resultSetMetadata = ResultSetMetadata' {_rsmColumnInfo = Nothing}
rsmColumnInfo :: Lens' ResultSetMetadata [ColumnInfo]
rsmColumnInfo = lens _rsmColumnInfo (\ s a -> s{_rsmColumnInfo = a}) . _Default . _Coerce
instance FromJSON ResultSetMetadata where
parseJSON
= withObject "ResultSetMetadata"
(\ x ->
ResultSetMetadata' <$>
(x .:? "ColumnInfo" .!= mempty))
instance Hashable ResultSetMetadata where
instance NFData ResultSetMetadata where
newtype Row = Row'
{ _rowData :: Maybe [Datum]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
row
:: Row
row = Row' {_rowData = Nothing}
rowData :: Lens' Row [Datum]
rowData = lens _rowData (\ s a -> s{_rowData = a}) . _Default . _Coerce
instance FromJSON Row where
parseJSON
= withObject "Row"
(\ x -> Row' <$> (x .:? "Data" .!= mempty))
instance Hashable Row where
instance NFData Row where
data UnprocessedNamedQueryId = UnprocessedNamedQueryId'
{ _unqiNamedQueryId :: !(Maybe Text)
, _unqiErrorCode :: !(Maybe Text)
, _unqiErrorMessage :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
unprocessedNamedQueryId
:: UnprocessedNamedQueryId
unprocessedNamedQueryId =
UnprocessedNamedQueryId'
{ _unqiNamedQueryId = Nothing
, _unqiErrorCode = Nothing
, _unqiErrorMessage = Nothing
}
unqiNamedQueryId :: Lens' UnprocessedNamedQueryId (Maybe Text)
unqiNamedQueryId = lens _unqiNamedQueryId (\ s a -> s{_unqiNamedQueryId = a})
unqiErrorCode :: Lens' UnprocessedNamedQueryId (Maybe Text)
unqiErrorCode = lens _unqiErrorCode (\ s a -> s{_unqiErrorCode = a})
unqiErrorMessage :: Lens' UnprocessedNamedQueryId (Maybe Text)
unqiErrorMessage = lens _unqiErrorMessage (\ s a -> s{_unqiErrorMessage = a})
instance FromJSON UnprocessedNamedQueryId where
parseJSON
= withObject "UnprocessedNamedQueryId"
(\ x ->
UnprocessedNamedQueryId' <$>
(x .:? "NamedQueryId") <*> (x .:? "ErrorCode") <*>
(x .:? "ErrorMessage"))
instance Hashable UnprocessedNamedQueryId where
instance NFData UnprocessedNamedQueryId where
data UnprocessedQueryExecutionId = UnprocessedQueryExecutionId'
{ _uqeiErrorCode :: !(Maybe Text)
, _uqeiQueryExecutionId :: !(Maybe Text)
, _uqeiErrorMessage :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
unprocessedQueryExecutionId
:: UnprocessedQueryExecutionId
unprocessedQueryExecutionId =
UnprocessedQueryExecutionId'
{ _uqeiErrorCode = Nothing
, _uqeiQueryExecutionId = Nothing
, _uqeiErrorMessage = Nothing
}
uqeiErrorCode :: Lens' UnprocessedQueryExecutionId (Maybe Text)
uqeiErrorCode = lens _uqeiErrorCode (\ s a -> s{_uqeiErrorCode = a})
uqeiQueryExecutionId :: Lens' UnprocessedQueryExecutionId (Maybe Text)
uqeiQueryExecutionId = lens _uqeiQueryExecutionId (\ s a -> s{_uqeiQueryExecutionId = a})
uqeiErrorMessage :: Lens' UnprocessedQueryExecutionId (Maybe Text)
uqeiErrorMessage = lens _uqeiErrorMessage (\ s a -> s{_uqeiErrorMessage = a})
instance FromJSON UnprocessedQueryExecutionId where
parseJSON
= withObject "UnprocessedQueryExecutionId"
(\ x ->
UnprocessedQueryExecutionId' <$>
(x .:? "ErrorCode") <*> (x .:? "QueryExecutionId")
<*> (x .:? "ErrorMessage"))
instance Hashable UnprocessedQueryExecutionId where
instance NFData UnprocessedQueryExecutionId where