{-# 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.UpdateCollection
(
UpdateCollection (..),
newUpdateCollection,
updateCollection_clientToken,
updateCollection_description,
updateCollection_id,
UpdateCollectionResponse (..),
newUpdateCollectionResponse,
updateCollectionResponse_updateCollectionDetail,
updateCollectionResponse_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 UpdateCollection = UpdateCollection'
{
UpdateCollection -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
UpdateCollection -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateCollection -> Text
id :: Prelude.Text
}
deriving (UpdateCollection -> UpdateCollection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCollection -> UpdateCollection -> Bool
$c/= :: UpdateCollection -> UpdateCollection -> Bool
== :: UpdateCollection -> UpdateCollection -> Bool
$c== :: UpdateCollection -> UpdateCollection -> Bool
Prelude.Eq, ReadPrec [UpdateCollection]
ReadPrec UpdateCollection
Int -> ReadS UpdateCollection
ReadS [UpdateCollection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCollection]
$creadListPrec :: ReadPrec [UpdateCollection]
readPrec :: ReadPrec UpdateCollection
$creadPrec :: ReadPrec UpdateCollection
readList :: ReadS [UpdateCollection]
$creadList :: ReadS [UpdateCollection]
readsPrec :: Int -> ReadS UpdateCollection
$creadsPrec :: Int -> ReadS UpdateCollection
Prelude.Read, Int -> UpdateCollection -> ShowS
[UpdateCollection] -> ShowS
UpdateCollection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCollection] -> ShowS
$cshowList :: [UpdateCollection] -> ShowS
show :: UpdateCollection -> String
$cshow :: UpdateCollection -> String
showsPrec :: Int -> UpdateCollection -> ShowS
$cshowsPrec :: Int -> UpdateCollection -> ShowS
Prelude.Show, forall x. Rep UpdateCollection x -> UpdateCollection
forall x. UpdateCollection -> Rep UpdateCollection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCollection x -> UpdateCollection
$cfrom :: forall x. UpdateCollection -> Rep UpdateCollection x
Prelude.Generic)
newUpdateCollection ::
Prelude.Text ->
UpdateCollection
newUpdateCollection :: Text -> UpdateCollection
newUpdateCollection Text
pId_ =
UpdateCollection'
{ $sel:clientToken:UpdateCollection' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateCollection' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:id:UpdateCollection' :: Text
id = Text
pId_
}
updateCollection_clientToken :: Lens.Lens' UpdateCollection (Prelude.Maybe Prelude.Text)
updateCollection_clientToken :: Lens' UpdateCollection (Maybe Text)
updateCollection_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCollection' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateCollection' :: UpdateCollection -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateCollection
s@UpdateCollection' {} Maybe Text
a -> UpdateCollection
s {$sel:clientToken:UpdateCollection' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateCollection)
updateCollection_description :: Lens.Lens' UpdateCollection (Prelude.Maybe Prelude.Text)
updateCollection_description :: Lens' UpdateCollection (Maybe Text)
updateCollection_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCollection' {Maybe Text
description :: Maybe Text
$sel:description:UpdateCollection' :: UpdateCollection -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateCollection
s@UpdateCollection' {} Maybe Text
a -> UpdateCollection
s {$sel:description:UpdateCollection' :: Maybe Text
description = Maybe Text
a} :: UpdateCollection)
updateCollection_id :: Lens.Lens' UpdateCollection Prelude.Text
updateCollection_id :: Lens' UpdateCollection Text
updateCollection_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCollection' {Text
id :: Text
$sel:id:UpdateCollection' :: UpdateCollection -> Text
id} -> Text
id) (\s :: UpdateCollection
s@UpdateCollection' {} Text
a -> UpdateCollection
s {$sel:id:UpdateCollection' :: Text
id = Text
a} :: UpdateCollection)
instance Core.AWSRequest UpdateCollection where
type
AWSResponse UpdateCollection =
UpdateCollectionResponse
request :: (Service -> Service)
-> UpdateCollection -> Request UpdateCollection
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 UpdateCollection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCollection)))
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 UpdateCollectionDetail -> Int -> UpdateCollectionResponse
UpdateCollectionResponse'
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
"updateCollectionDetail")
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 UpdateCollection where
hashWithSalt :: Int -> UpdateCollection -> Int
hashWithSalt Int
_salt UpdateCollection' {Maybe Text
Text
id :: Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:id:UpdateCollection' :: UpdateCollection -> Text
$sel:description:UpdateCollection' :: UpdateCollection -> Maybe Text
$sel:clientToken:UpdateCollection' :: UpdateCollection -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData UpdateCollection where
rnf :: UpdateCollection -> ()
rnf UpdateCollection' {Maybe Text
Text
id :: Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:id:UpdateCollection' :: UpdateCollection -> Text
$sel:description:UpdateCollection' :: UpdateCollection -> Maybe Text
$sel:clientToken:UpdateCollection' :: UpdateCollection -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders UpdateCollection where
toHeaders :: UpdateCollection -> 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.UpdateCollection" ::
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 UpdateCollection where
toJSON :: UpdateCollection -> Value
toJSON UpdateCollection' {Maybe Text
Text
id :: Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:id:UpdateCollection' :: UpdateCollection -> Text
$sel:description:UpdateCollection' :: UpdateCollection -> Maybe Text
$sel:clientToken:UpdateCollection' :: UpdateCollection -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"clientToken" 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 Text
clientToken,
(Key
"description" 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 Text
description,
forall a. a -> Maybe a
Prelude.Just (Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)
instance Data.ToPath UpdateCollection where
toPath :: UpdateCollection -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateCollection where
toQuery :: UpdateCollection -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateCollectionResponse = UpdateCollectionResponse'
{
UpdateCollectionResponse -> Maybe UpdateCollectionDetail
updateCollectionDetail :: Prelude.Maybe UpdateCollectionDetail,
UpdateCollectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateCollectionResponse -> UpdateCollectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCollectionResponse -> UpdateCollectionResponse -> Bool
$c/= :: UpdateCollectionResponse -> UpdateCollectionResponse -> Bool
== :: UpdateCollectionResponse -> UpdateCollectionResponse -> Bool
$c== :: UpdateCollectionResponse -> UpdateCollectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateCollectionResponse]
ReadPrec UpdateCollectionResponse
Int -> ReadS UpdateCollectionResponse
ReadS [UpdateCollectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCollectionResponse]
$creadListPrec :: ReadPrec [UpdateCollectionResponse]
readPrec :: ReadPrec UpdateCollectionResponse
$creadPrec :: ReadPrec UpdateCollectionResponse
readList :: ReadS [UpdateCollectionResponse]
$creadList :: ReadS [UpdateCollectionResponse]
readsPrec :: Int -> ReadS UpdateCollectionResponse
$creadsPrec :: Int -> ReadS UpdateCollectionResponse
Prelude.Read, Int -> UpdateCollectionResponse -> ShowS
[UpdateCollectionResponse] -> ShowS
UpdateCollectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCollectionResponse] -> ShowS
$cshowList :: [UpdateCollectionResponse] -> ShowS
show :: UpdateCollectionResponse -> String
$cshow :: UpdateCollectionResponse -> String
showsPrec :: Int -> UpdateCollectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateCollectionResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateCollectionResponse x -> UpdateCollectionResponse
forall x.
UpdateCollectionResponse -> Rep UpdateCollectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateCollectionResponse x -> UpdateCollectionResponse
$cfrom :: forall x.
UpdateCollectionResponse -> Rep UpdateCollectionResponse x
Prelude.Generic)
newUpdateCollectionResponse ::
Prelude.Int ->
UpdateCollectionResponse
newUpdateCollectionResponse :: Int -> UpdateCollectionResponse
newUpdateCollectionResponse Int
pHttpStatus_ =
UpdateCollectionResponse'
{ $sel:updateCollectionDetail:UpdateCollectionResponse' :: Maybe UpdateCollectionDetail
updateCollectionDetail =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateCollectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateCollectionResponse_updateCollectionDetail :: Lens.Lens' UpdateCollectionResponse (Prelude.Maybe UpdateCollectionDetail)
updateCollectionResponse_updateCollectionDetail :: Lens' UpdateCollectionResponse (Maybe UpdateCollectionDetail)
updateCollectionResponse_updateCollectionDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCollectionResponse' {Maybe UpdateCollectionDetail
updateCollectionDetail :: Maybe UpdateCollectionDetail
$sel:updateCollectionDetail:UpdateCollectionResponse' :: UpdateCollectionResponse -> Maybe UpdateCollectionDetail
updateCollectionDetail} -> Maybe UpdateCollectionDetail
updateCollectionDetail) (\s :: UpdateCollectionResponse
s@UpdateCollectionResponse' {} Maybe UpdateCollectionDetail
a -> UpdateCollectionResponse
s {$sel:updateCollectionDetail:UpdateCollectionResponse' :: Maybe UpdateCollectionDetail
updateCollectionDetail = Maybe UpdateCollectionDetail
a} :: UpdateCollectionResponse)
updateCollectionResponse_httpStatus :: Lens.Lens' UpdateCollectionResponse Prelude.Int
updateCollectionResponse_httpStatus :: Lens' UpdateCollectionResponse Int
updateCollectionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCollectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateCollectionResponse' :: UpdateCollectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateCollectionResponse
s@UpdateCollectionResponse' {} Int
a -> UpdateCollectionResponse
s {$sel:httpStatus:UpdateCollectionResponse' :: Int
httpStatus = Int
a} :: UpdateCollectionResponse)
instance Prelude.NFData UpdateCollectionResponse where
rnf :: UpdateCollectionResponse -> ()
rnf UpdateCollectionResponse' {Int
Maybe UpdateCollectionDetail
httpStatus :: Int
updateCollectionDetail :: Maybe UpdateCollectionDetail
$sel:httpStatus:UpdateCollectionResponse' :: UpdateCollectionResponse -> Int
$sel:updateCollectionDetail:UpdateCollectionResponse' :: UpdateCollectionResponse -> Maybe UpdateCollectionDetail
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateCollectionDetail
updateCollectionDetail
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus