{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudSearchDomains.UploadDocuments
(
UploadDocuments (..),
newUploadDocuments,
uploadDocuments_contentType,
uploadDocuments_documents,
UploadDocumentsResponse (..),
newUploadDocumentsResponse,
uploadDocumentsResponse_status,
uploadDocumentsResponse_adds,
uploadDocumentsResponse_warnings,
uploadDocumentsResponse_deletes,
uploadDocumentsResponse_httpStatus,
)
where
import Amazonka.CloudSearchDomains.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UploadDocuments = UploadDocuments'
{
UploadDocuments -> ContentType
contentType :: ContentType,
UploadDocuments -> HashedBody
documents :: Core.HashedBody
}
deriving (Int -> UploadDocuments -> ShowS
[UploadDocuments] -> ShowS
UploadDocuments -> String
(Int -> UploadDocuments -> ShowS)
-> (UploadDocuments -> String)
-> ([UploadDocuments] -> ShowS)
-> Show UploadDocuments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadDocuments] -> ShowS
$cshowList :: [UploadDocuments] -> ShowS
show :: UploadDocuments -> String
$cshow :: UploadDocuments -> String
showsPrec :: Int -> UploadDocuments -> ShowS
$cshowsPrec :: Int -> UploadDocuments -> ShowS
Prelude.Show, (forall x. UploadDocuments -> Rep UploadDocuments x)
-> (forall x. Rep UploadDocuments x -> UploadDocuments)
-> Generic UploadDocuments
forall x. Rep UploadDocuments x -> UploadDocuments
forall x. UploadDocuments -> Rep UploadDocuments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadDocuments x -> UploadDocuments
$cfrom :: forall x. UploadDocuments -> Rep UploadDocuments x
Prelude.Generic)
newUploadDocuments ::
ContentType ->
Core.HashedBody ->
UploadDocuments
newUploadDocuments :: ContentType -> HashedBody -> UploadDocuments
newUploadDocuments ContentType
pContentType_ HashedBody
pDocuments_ =
UploadDocuments' :: ContentType -> HashedBody -> UploadDocuments
UploadDocuments'
{ $sel:contentType:UploadDocuments' :: ContentType
contentType = ContentType
pContentType_,
$sel:documents:UploadDocuments' :: HashedBody
documents = HashedBody
pDocuments_
}
uploadDocuments_contentType :: Lens.Lens' UploadDocuments ContentType
uploadDocuments_contentType :: (ContentType -> f ContentType)
-> UploadDocuments -> f UploadDocuments
uploadDocuments_contentType = (UploadDocuments -> ContentType)
-> (UploadDocuments -> ContentType -> UploadDocuments)
-> Lens UploadDocuments UploadDocuments ContentType ContentType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocuments' {ContentType
contentType :: ContentType
$sel:contentType:UploadDocuments' :: UploadDocuments -> ContentType
contentType} -> ContentType
contentType) (\s :: UploadDocuments
s@UploadDocuments' {} ContentType
a -> UploadDocuments
s {$sel:contentType:UploadDocuments' :: ContentType
contentType = ContentType
a} :: UploadDocuments)
uploadDocuments_documents :: Lens.Lens' UploadDocuments Core.HashedBody
uploadDocuments_documents :: (HashedBody -> f HashedBody)
-> UploadDocuments -> f UploadDocuments
uploadDocuments_documents = (UploadDocuments -> HashedBody)
-> (UploadDocuments -> HashedBody -> UploadDocuments)
-> Lens UploadDocuments UploadDocuments HashedBody HashedBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocuments' {HashedBody
documents :: HashedBody
$sel:documents:UploadDocuments' :: UploadDocuments -> HashedBody
documents} -> HashedBody
documents) (\s :: UploadDocuments
s@UploadDocuments' {} HashedBody
a -> UploadDocuments
s {$sel:documents:UploadDocuments' :: HashedBody
documents = HashedBody
a} :: UploadDocuments)
instance Core.AWSRequest UploadDocuments where
type
AWSResponse UploadDocuments =
UploadDocumentsResponse
request :: UploadDocuments -> Request UploadDocuments
request = Service -> UploadDocuments -> Request UploadDocuments
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.postBody Service
defaultService
response :: Logger
-> Service
-> Proxy UploadDocuments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UploadDocuments)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UploadDocuments))
-> Logger
-> Service
-> Proxy UploadDocuments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UploadDocuments)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe Integer
-> Maybe [DocumentServiceWarning]
-> Maybe Integer
-> Int
-> UploadDocumentsResponse
UploadDocumentsResponse'
(Maybe Text
-> Maybe Integer
-> Maybe [DocumentServiceWarning]
-> Maybe Integer
-> Int
-> UploadDocumentsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Integer
-> Maybe [DocumentServiceWarning]
-> Maybe Integer
-> Int
-> UploadDocumentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
Either
String
(Maybe Integer
-> Maybe [DocumentServiceWarning]
-> Maybe Integer
-> Int
-> UploadDocumentsResponse)
-> Either String (Maybe Integer)
-> Either
String
(Maybe [DocumentServiceWarning]
-> Maybe Integer -> Int -> UploadDocumentsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"adds")
Either
String
(Maybe [DocumentServiceWarning]
-> Maybe Integer -> Int -> UploadDocumentsResponse)
-> Either String (Maybe [DocumentServiceWarning])
-> Either String (Maybe Integer -> Int -> UploadDocumentsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [DocumentServiceWarning]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"warnings" Either String (Maybe (Maybe [DocumentServiceWarning]))
-> Maybe [DocumentServiceWarning]
-> Either String (Maybe [DocumentServiceWarning])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DocumentServiceWarning]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Integer -> Int -> UploadDocumentsResponse)
-> Either String (Maybe Integer)
-> Either String (Int -> UploadDocumentsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deletes")
Either String (Int -> UploadDocumentsResponse)
-> Either String Int -> Either String UploadDocumentsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Core.ToBody UploadDocuments where
toBody :: UploadDocuments -> RequestBody
toBody UploadDocuments' {HashedBody
ContentType
documents :: HashedBody
contentType :: ContentType
$sel:documents:UploadDocuments' :: UploadDocuments -> HashedBody
$sel:contentType:UploadDocuments' :: UploadDocuments -> ContentType
..} = HashedBody -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody HashedBody
documents
instance Core.ToHeaders UploadDocuments where
toHeaders :: UploadDocuments -> ResponseHeaders
toHeaders UploadDocuments' {HashedBody
ContentType
documents :: HashedBody
contentType :: ContentType
$sel:documents:UploadDocuments' :: UploadDocuments -> HashedBody
$sel:contentType:UploadDocuments' :: UploadDocuments -> ContentType
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"Content-Type" HeaderName -> ContentType -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ContentType
contentType]
instance Core.ToPath UploadDocuments where
toPath :: UploadDocuments -> ByteString
toPath = ByteString -> UploadDocuments -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-01-01/documents/batch"
instance Core.ToQuery UploadDocuments where
toQuery :: UploadDocuments -> QueryString
toQuery =
QueryString -> UploadDocuments -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"format=sdk"])
data UploadDocumentsResponse = UploadDocumentsResponse'
{
UploadDocumentsResponse -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
UploadDocumentsResponse -> Maybe Integer
adds :: Prelude.Maybe Prelude.Integer,
UploadDocumentsResponse -> Maybe [DocumentServiceWarning]
warnings :: Prelude.Maybe [DocumentServiceWarning],
UploadDocumentsResponse -> Maybe Integer
deletes :: Prelude.Maybe Prelude.Integer,
UploadDocumentsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UploadDocumentsResponse -> UploadDocumentsResponse -> Bool
(UploadDocumentsResponse -> UploadDocumentsResponse -> Bool)
-> (UploadDocumentsResponse -> UploadDocumentsResponse -> Bool)
-> Eq UploadDocumentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadDocumentsResponse -> UploadDocumentsResponse -> Bool
$c/= :: UploadDocumentsResponse -> UploadDocumentsResponse -> Bool
== :: UploadDocumentsResponse -> UploadDocumentsResponse -> Bool
$c== :: UploadDocumentsResponse -> UploadDocumentsResponse -> Bool
Prelude.Eq, ReadPrec [UploadDocumentsResponse]
ReadPrec UploadDocumentsResponse
Int -> ReadS UploadDocumentsResponse
ReadS [UploadDocumentsResponse]
(Int -> ReadS UploadDocumentsResponse)
-> ReadS [UploadDocumentsResponse]
-> ReadPrec UploadDocumentsResponse
-> ReadPrec [UploadDocumentsResponse]
-> Read UploadDocumentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploadDocumentsResponse]
$creadListPrec :: ReadPrec [UploadDocumentsResponse]
readPrec :: ReadPrec UploadDocumentsResponse
$creadPrec :: ReadPrec UploadDocumentsResponse
readList :: ReadS [UploadDocumentsResponse]
$creadList :: ReadS [UploadDocumentsResponse]
readsPrec :: Int -> ReadS UploadDocumentsResponse
$creadsPrec :: Int -> ReadS UploadDocumentsResponse
Prelude.Read, Int -> UploadDocumentsResponse -> ShowS
[UploadDocumentsResponse] -> ShowS
UploadDocumentsResponse -> String
(Int -> UploadDocumentsResponse -> ShowS)
-> (UploadDocumentsResponse -> String)
-> ([UploadDocumentsResponse] -> ShowS)
-> Show UploadDocumentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadDocumentsResponse] -> ShowS
$cshowList :: [UploadDocumentsResponse] -> ShowS
show :: UploadDocumentsResponse -> String
$cshow :: UploadDocumentsResponse -> String
showsPrec :: Int -> UploadDocumentsResponse -> ShowS
$cshowsPrec :: Int -> UploadDocumentsResponse -> ShowS
Prelude.Show, (forall x.
UploadDocumentsResponse -> Rep UploadDocumentsResponse x)
-> (forall x.
Rep UploadDocumentsResponse x -> UploadDocumentsResponse)
-> Generic UploadDocumentsResponse
forall x. Rep UploadDocumentsResponse x -> UploadDocumentsResponse
forall x. UploadDocumentsResponse -> Rep UploadDocumentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadDocumentsResponse x -> UploadDocumentsResponse
$cfrom :: forall x. UploadDocumentsResponse -> Rep UploadDocumentsResponse x
Prelude.Generic)
newUploadDocumentsResponse ::
Prelude.Int ->
UploadDocumentsResponse
newUploadDocumentsResponse :: Int -> UploadDocumentsResponse
newUploadDocumentsResponse Int
pHttpStatus_ =
UploadDocumentsResponse' :: Maybe Text
-> Maybe Integer
-> Maybe [DocumentServiceWarning]
-> Maybe Integer
-> Int
-> UploadDocumentsResponse
UploadDocumentsResponse'
{ $sel:status:UploadDocumentsResponse' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:adds:UploadDocumentsResponse' :: Maybe Integer
adds = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:warnings:UploadDocumentsResponse' :: Maybe [DocumentServiceWarning]
warnings = Maybe [DocumentServiceWarning]
forall a. Maybe a
Prelude.Nothing,
$sel:deletes:UploadDocumentsResponse' :: Maybe Integer
deletes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UploadDocumentsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
uploadDocumentsResponse_status :: Lens.Lens' UploadDocumentsResponse (Prelude.Maybe Prelude.Text)
uploadDocumentsResponse_status :: (Maybe Text -> f (Maybe Text))
-> UploadDocumentsResponse -> f UploadDocumentsResponse
uploadDocumentsResponse_status = (UploadDocumentsResponse -> Maybe Text)
-> (UploadDocumentsResponse
-> Maybe Text -> UploadDocumentsResponse)
-> Lens
UploadDocumentsResponse
UploadDocumentsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocumentsResponse' {Maybe Text
status :: Maybe Text
$sel:status:UploadDocumentsResponse' :: UploadDocumentsResponse -> Maybe Text
status} -> Maybe Text
status) (\s :: UploadDocumentsResponse
s@UploadDocumentsResponse' {} Maybe Text
a -> UploadDocumentsResponse
s {$sel:status:UploadDocumentsResponse' :: Maybe Text
status = Maybe Text
a} :: UploadDocumentsResponse)
uploadDocumentsResponse_adds :: Lens.Lens' UploadDocumentsResponse (Prelude.Maybe Prelude.Integer)
uploadDocumentsResponse_adds :: (Maybe Integer -> f (Maybe Integer))
-> UploadDocumentsResponse -> f UploadDocumentsResponse
uploadDocumentsResponse_adds = (UploadDocumentsResponse -> Maybe Integer)
-> (UploadDocumentsResponse
-> Maybe Integer -> UploadDocumentsResponse)
-> Lens
UploadDocumentsResponse
UploadDocumentsResponse
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocumentsResponse' {Maybe Integer
adds :: Maybe Integer
$sel:adds:UploadDocumentsResponse' :: UploadDocumentsResponse -> Maybe Integer
adds} -> Maybe Integer
adds) (\s :: UploadDocumentsResponse
s@UploadDocumentsResponse' {} Maybe Integer
a -> UploadDocumentsResponse
s {$sel:adds:UploadDocumentsResponse' :: Maybe Integer
adds = Maybe Integer
a} :: UploadDocumentsResponse)
uploadDocumentsResponse_warnings :: Lens.Lens' UploadDocumentsResponse (Prelude.Maybe [DocumentServiceWarning])
uploadDocumentsResponse_warnings :: (Maybe [DocumentServiceWarning]
-> f (Maybe [DocumentServiceWarning]))
-> UploadDocumentsResponse -> f UploadDocumentsResponse
uploadDocumentsResponse_warnings = (UploadDocumentsResponse -> Maybe [DocumentServiceWarning])
-> (UploadDocumentsResponse
-> Maybe [DocumentServiceWarning] -> UploadDocumentsResponse)
-> Lens
UploadDocumentsResponse
UploadDocumentsResponse
(Maybe [DocumentServiceWarning])
(Maybe [DocumentServiceWarning])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocumentsResponse' {Maybe [DocumentServiceWarning]
warnings :: Maybe [DocumentServiceWarning]
$sel:warnings:UploadDocumentsResponse' :: UploadDocumentsResponse -> Maybe [DocumentServiceWarning]
warnings} -> Maybe [DocumentServiceWarning]
warnings) (\s :: UploadDocumentsResponse
s@UploadDocumentsResponse' {} Maybe [DocumentServiceWarning]
a -> UploadDocumentsResponse
s {$sel:warnings:UploadDocumentsResponse' :: Maybe [DocumentServiceWarning]
warnings = Maybe [DocumentServiceWarning]
a} :: UploadDocumentsResponse) ((Maybe [DocumentServiceWarning]
-> f (Maybe [DocumentServiceWarning]))
-> UploadDocumentsResponse -> f UploadDocumentsResponse)
-> ((Maybe [DocumentServiceWarning]
-> f (Maybe [DocumentServiceWarning]))
-> Maybe [DocumentServiceWarning]
-> f (Maybe [DocumentServiceWarning]))
-> (Maybe [DocumentServiceWarning]
-> f (Maybe [DocumentServiceWarning]))
-> UploadDocumentsResponse
-> f UploadDocumentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DocumentServiceWarning]
[DocumentServiceWarning]
[DocumentServiceWarning]
[DocumentServiceWarning]
-> Iso
(Maybe [DocumentServiceWarning])
(Maybe [DocumentServiceWarning])
(Maybe [DocumentServiceWarning])
(Maybe [DocumentServiceWarning])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[DocumentServiceWarning]
[DocumentServiceWarning]
[DocumentServiceWarning]
[DocumentServiceWarning]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
uploadDocumentsResponse_deletes :: Lens.Lens' UploadDocumentsResponse (Prelude.Maybe Prelude.Integer)
uploadDocumentsResponse_deletes :: (Maybe Integer -> f (Maybe Integer))
-> UploadDocumentsResponse -> f UploadDocumentsResponse
uploadDocumentsResponse_deletes = (UploadDocumentsResponse -> Maybe Integer)
-> (UploadDocumentsResponse
-> Maybe Integer -> UploadDocumentsResponse)
-> Lens
UploadDocumentsResponse
UploadDocumentsResponse
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocumentsResponse' {Maybe Integer
deletes :: Maybe Integer
$sel:deletes:UploadDocumentsResponse' :: UploadDocumentsResponse -> Maybe Integer
deletes} -> Maybe Integer
deletes) (\s :: UploadDocumentsResponse
s@UploadDocumentsResponse' {} Maybe Integer
a -> UploadDocumentsResponse
s {$sel:deletes:UploadDocumentsResponse' :: Maybe Integer
deletes = Maybe Integer
a} :: UploadDocumentsResponse)
uploadDocumentsResponse_httpStatus :: Lens.Lens' UploadDocumentsResponse Prelude.Int
uploadDocumentsResponse_httpStatus :: (Int -> f Int)
-> UploadDocumentsResponse -> f UploadDocumentsResponse
uploadDocumentsResponse_httpStatus = (UploadDocumentsResponse -> Int)
-> (UploadDocumentsResponse -> Int -> UploadDocumentsResponse)
-> Lens UploadDocumentsResponse UploadDocumentsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadDocumentsResponse' {Int
httpStatus :: Int
$sel:httpStatus:UploadDocumentsResponse' :: UploadDocumentsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UploadDocumentsResponse
s@UploadDocumentsResponse' {} Int
a -> UploadDocumentsResponse
s {$sel:httpStatus:UploadDocumentsResponse' :: Int
httpStatus = Int
a} :: UploadDocumentsResponse)
instance Prelude.NFData UploadDocumentsResponse