{-# 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.OpenSearchServerless.BatchGetCollection
(
BatchGetCollection (..),
newBatchGetCollection,
batchGetCollection_ids,
batchGetCollection_names,
BatchGetCollectionResponse (..),
newBatchGetCollectionResponse,
batchGetCollectionResponse_collectionDetails,
batchGetCollectionResponse_collectionErrorDetails,
batchGetCollectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearchServerless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchGetCollection = BatchGetCollection'
{
BatchGetCollection -> Maybe (NonEmpty Text)
ids :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
BatchGetCollection -> Maybe (NonEmpty Text)
names :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
}
deriving (BatchGetCollection -> BatchGetCollection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetCollection -> BatchGetCollection -> Bool
$c/= :: BatchGetCollection -> BatchGetCollection -> Bool
== :: BatchGetCollection -> BatchGetCollection -> Bool
$c== :: BatchGetCollection -> BatchGetCollection -> Bool
Prelude.Eq, ReadPrec [BatchGetCollection]
ReadPrec BatchGetCollection
Int -> ReadS BatchGetCollection
ReadS [BatchGetCollection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetCollection]
$creadListPrec :: ReadPrec [BatchGetCollection]
readPrec :: ReadPrec BatchGetCollection
$creadPrec :: ReadPrec BatchGetCollection
readList :: ReadS [BatchGetCollection]
$creadList :: ReadS [BatchGetCollection]
readsPrec :: Int -> ReadS BatchGetCollection
$creadsPrec :: Int -> ReadS BatchGetCollection
Prelude.Read, Int -> BatchGetCollection -> ShowS
[BatchGetCollection] -> ShowS
BatchGetCollection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetCollection] -> ShowS
$cshowList :: [BatchGetCollection] -> ShowS
show :: BatchGetCollection -> String
$cshow :: BatchGetCollection -> String
showsPrec :: Int -> BatchGetCollection -> ShowS
$cshowsPrec :: Int -> BatchGetCollection -> ShowS
Prelude.Show, forall x. Rep BatchGetCollection x -> BatchGetCollection
forall x. BatchGetCollection -> Rep BatchGetCollection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetCollection x -> BatchGetCollection
$cfrom :: forall x. BatchGetCollection -> Rep BatchGetCollection x
Prelude.Generic)
newBatchGetCollection ::
BatchGetCollection
newBatchGetCollection :: BatchGetCollection
newBatchGetCollection =
BatchGetCollection'
{ $sel:ids:BatchGetCollection' :: Maybe (NonEmpty Text)
ids = forall a. Maybe a
Prelude.Nothing,
$sel:names:BatchGetCollection' :: Maybe (NonEmpty Text)
names = forall a. Maybe a
Prelude.Nothing
}
batchGetCollection_ids :: Lens.Lens' BatchGetCollection (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchGetCollection_ids :: Lens' BatchGetCollection (Maybe (NonEmpty Text))
batchGetCollection_ids = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCollection' {Maybe (NonEmpty Text)
ids :: Maybe (NonEmpty Text)
$sel:ids:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
ids} -> Maybe (NonEmpty Text)
ids) (\s :: BatchGetCollection
s@BatchGetCollection' {} Maybe (NonEmpty Text)
a -> BatchGetCollection
s {$sel:ids:BatchGetCollection' :: Maybe (NonEmpty Text)
ids = Maybe (NonEmpty Text)
a} :: BatchGetCollection) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetCollection_names :: Lens.Lens' BatchGetCollection (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchGetCollection_names :: Lens' BatchGetCollection (Maybe (NonEmpty Text))
batchGetCollection_names = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCollection' {Maybe (NonEmpty Text)
names :: Maybe (NonEmpty Text)
$sel:names:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
names} -> Maybe (NonEmpty Text)
names) (\s :: BatchGetCollection
s@BatchGetCollection' {} Maybe (NonEmpty Text)
a -> BatchGetCollection
s {$sel:names:BatchGetCollection' :: Maybe (NonEmpty Text)
names = Maybe (NonEmpty Text)
a} :: BatchGetCollection) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchGetCollection where
type
AWSResponse BatchGetCollection =
BatchGetCollectionResponse
request :: (Service -> Service)
-> BatchGetCollection -> Request BatchGetCollection
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchGetCollection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetCollection)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [CollectionDetail]
-> Maybe [CollectionErrorDetail]
-> Int
-> BatchGetCollectionResponse
BatchGetCollectionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"collectionDetails"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"collectionErrorDetails"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchGetCollection where
hashWithSalt :: Int -> BatchGetCollection -> Int
hashWithSalt Int
_salt BatchGetCollection' {Maybe (NonEmpty Text)
names :: Maybe (NonEmpty Text)
ids :: Maybe (NonEmpty Text)
$sel:names:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
$sel:ids:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
ids
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
names
instance Prelude.NFData BatchGetCollection where
rnf :: BatchGetCollection -> ()
rnf BatchGetCollection' {Maybe (NonEmpty Text)
names :: Maybe (NonEmpty Text)
ids :: Maybe (NonEmpty Text)
$sel:names:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
$sel:ids:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
ids seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
names
instance Data.ToHeaders BatchGetCollection where
toHeaders :: BatchGetCollection -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"OpenSearchServerless.BatchGetCollection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchGetCollection where
toJSON :: BatchGetCollection -> Value
toJSON BatchGetCollection' {Maybe (NonEmpty Text)
names :: Maybe (NonEmpty Text)
ids :: Maybe (NonEmpty Text)
$sel:names:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
$sel:ids:BatchGetCollection' :: BatchGetCollection -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ids" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
ids,
(Key
"names" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
names
]
)
instance Data.ToPath BatchGetCollection where
toPath :: BatchGetCollection -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchGetCollection where
toQuery :: BatchGetCollection -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetCollectionResponse = BatchGetCollectionResponse'
{
BatchGetCollectionResponse -> Maybe [CollectionDetail]
collectionDetails :: Prelude.Maybe [CollectionDetail],
BatchGetCollectionResponse -> Maybe [CollectionErrorDetail]
collectionErrorDetails :: Prelude.Maybe [CollectionErrorDetail],
BatchGetCollectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetCollectionResponse -> BatchGetCollectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetCollectionResponse -> BatchGetCollectionResponse -> Bool
$c/= :: BatchGetCollectionResponse -> BatchGetCollectionResponse -> Bool
== :: BatchGetCollectionResponse -> BatchGetCollectionResponse -> Bool
$c== :: BatchGetCollectionResponse -> BatchGetCollectionResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetCollectionResponse]
ReadPrec BatchGetCollectionResponse
Int -> ReadS BatchGetCollectionResponse
ReadS [BatchGetCollectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetCollectionResponse]
$creadListPrec :: ReadPrec [BatchGetCollectionResponse]
readPrec :: ReadPrec BatchGetCollectionResponse
$creadPrec :: ReadPrec BatchGetCollectionResponse
readList :: ReadS [BatchGetCollectionResponse]
$creadList :: ReadS [BatchGetCollectionResponse]
readsPrec :: Int -> ReadS BatchGetCollectionResponse
$creadsPrec :: Int -> ReadS BatchGetCollectionResponse
Prelude.Read, Int -> BatchGetCollectionResponse -> ShowS
[BatchGetCollectionResponse] -> ShowS
BatchGetCollectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetCollectionResponse] -> ShowS
$cshowList :: [BatchGetCollectionResponse] -> ShowS
show :: BatchGetCollectionResponse -> String
$cshow :: BatchGetCollectionResponse -> String
showsPrec :: Int -> BatchGetCollectionResponse -> ShowS
$cshowsPrec :: Int -> BatchGetCollectionResponse -> ShowS
Prelude.Show, forall x.
Rep BatchGetCollectionResponse x -> BatchGetCollectionResponse
forall x.
BatchGetCollectionResponse -> Rep BatchGetCollectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetCollectionResponse x -> BatchGetCollectionResponse
$cfrom :: forall x.
BatchGetCollectionResponse -> Rep BatchGetCollectionResponse x
Prelude.Generic)
newBatchGetCollectionResponse ::
Prelude.Int ->
BatchGetCollectionResponse
newBatchGetCollectionResponse :: Int -> BatchGetCollectionResponse
newBatchGetCollectionResponse Int
pHttpStatus_ =
BatchGetCollectionResponse'
{ $sel:collectionDetails:BatchGetCollectionResponse' :: Maybe [CollectionDetail]
collectionDetails =
forall a. Maybe a
Prelude.Nothing,
$sel:collectionErrorDetails:BatchGetCollectionResponse' :: Maybe [CollectionErrorDetail]
collectionErrorDetails = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetCollectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetCollectionResponse_collectionDetails :: Lens.Lens' BatchGetCollectionResponse (Prelude.Maybe [CollectionDetail])
batchGetCollectionResponse_collectionDetails :: Lens' BatchGetCollectionResponse (Maybe [CollectionDetail])
batchGetCollectionResponse_collectionDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCollectionResponse' {Maybe [CollectionDetail]
collectionDetails :: Maybe [CollectionDetail]
$sel:collectionDetails:BatchGetCollectionResponse' :: BatchGetCollectionResponse -> Maybe [CollectionDetail]
collectionDetails} -> Maybe [CollectionDetail]
collectionDetails) (\s :: BatchGetCollectionResponse
s@BatchGetCollectionResponse' {} Maybe [CollectionDetail]
a -> BatchGetCollectionResponse
s {$sel:collectionDetails:BatchGetCollectionResponse' :: Maybe [CollectionDetail]
collectionDetails = Maybe [CollectionDetail]
a} :: BatchGetCollectionResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetCollectionResponse_collectionErrorDetails :: Lens.Lens' BatchGetCollectionResponse (Prelude.Maybe [CollectionErrorDetail])
batchGetCollectionResponse_collectionErrorDetails :: Lens' BatchGetCollectionResponse (Maybe [CollectionErrorDetail])
batchGetCollectionResponse_collectionErrorDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCollectionResponse' {Maybe [CollectionErrorDetail]
collectionErrorDetails :: Maybe [CollectionErrorDetail]
$sel:collectionErrorDetails:BatchGetCollectionResponse' :: BatchGetCollectionResponse -> Maybe [CollectionErrorDetail]
collectionErrorDetails} -> Maybe [CollectionErrorDetail]
collectionErrorDetails) (\s :: BatchGetCollectionResponse
s@BatchGetCollectionResponse' {} Maybe [CollectionErrorDetail]
a -> BatchGetCollectionResponse
s {$sel:collectionErrorDetails:BatchGetCollectionResponse' :: Maybe [CollectionErrorDetail]
collectionErrorDetails = Maybe [CollectionErrorDetail]
a} :: BatchGetCollectionResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetCollectionResponse_httpStatus :: Lens.Lens' BatchGetCollectionResponse Prelude.Int
batchGetCollectionResponse_httpStatus :: Lens' BatchGetCollectionResponse Int
batchGetCollectionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCollectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetCollectionResponse' :: BatchGetCollectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetCollectionResponse
s@BatchGetCollectionResponse' {} Int
a -> BatchGetCollectionResponse
s {$sel:httpStatus:BatchGetCollectionResponse' :: Int
httpStatus = Int
a} :: BatchGetCollectionResponse)
instance Prelude.NFData BatchGetCollectionResponse where
rnf :: BatchGetCollectionResponse -> ()
rnf BatchGetCollectionResponse' {Int
Maybe [CollectionErrorDetail]
Maybe [CollectionDetail]
httpStatus :: Int
collectionErrorDetails :: Maybe [CollectionErrorDetail]
collectionDetails :: Maybe [CollectionDetail]
$sel:httpStatus:BatchGetCollectionResponse' :: BatchGetCollectionResponse -> Int
$sel:collectionErrorDetails:BatchGetCollectionResponse' :: BatchGetCollectionResponse -> Maybe [CollectionErrorDetail]
$sel:collectionDetails:BatchGetCollectionResponse' :: BatchGetCollectionResponse -> Maybe [CollectionDetail]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CollectionDetail]
collectionDetails
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CollectionErrorDetail]
collectionErrorDetails
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus