module Network.AWS.CloudSearch.IndexDocuments
(
IndexDocuments
, indexDocuments
, idDomainName
, IndexDocumentsResponse
, indexDocumentsResponse
, idrFieldNames
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.CloudSearch.Types
import qualified GHC.Exts
newtype IndexDocuments = IndexDocuments
{ _idDomainName :: Text
} deriving (Eq, Ord, Read, Show, Monoid, IsString)
indexDocuments :: Text
-> IndexDocuments
indexDocuments p1 = IndexDocuments
{ _idDomainName = p1
}
idDomainName :: Lens' IndexDocuments Text
idDomainName = lens _idDomainName (\s a -> s { _idDomainName = a })
newtype IndexDocumentsResponse = IndexDocumentsResponse
{ _idrFieldNames :: List "member" Text
} deriving (Eq, Ord, Read, Show, Monoid, Semigroup)
instance GHC.Exts.IsList IndexDocumentsResponse where
type Item IndexDocumentsResponse = Text
fromList = IndexDocumentsResponse . GHC.Exts.fromList
toList = GHC.Exts.toList . _idrFieldNames
indexDocumentsResponse :: IndexDocumentsResponse
indexDocumentsResponse = IndexDocumentsResponse
{ _idrFieldNames = mempty
}
idrFieldNames :: Lens' IndexDocumentsResponse [Text]
idrFieldNames = lens _idrFieldNames (\s a -> s { _idrFieldNames = a }) . _List
instance ToPath IndexDocuments where
toPath = const "/"
instance ToQuery IndexDocuments where
toQuery IndexDocuments{..} = mconcat
[ "DomainName" =? _idDomainName
]
instance ToHeaders IndexDocuments
instance AWSRequest IndexDocuments where
type Sv IndexDocuments = CloudSearch
type Rs IndexDocuments = IndexDocumentsResponse
request = post "IndexDocuments"
response = xmlResponse
instance FromXML IndexDocumentsResponse where
parseXML = withElement "IndexDocumentsResult" $ \x -> IndexDocumentsResponse
<$> x .@? "FieldNames" .!@ mempty