{-# 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.APIGateway.UpdateDocumentationPart
(
UpdateDocumentationPart (..),
newUpdateDocumentationPart,
updateDocumentationPart_patchOperations,
updateDocumentationPart_restApiId,
updateDocumentationPart_documentationPartId,
DocumentationPart (..),
newDocumentationPart,
documentationPart_location,
documentationPart_id,
documentationPart_properties,
)
where
import Amazonka.APIGateway.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 UpdateDocumentationPart = UpdateDocumentationPart'
{
UpdateDocumentationPart -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateDocumentationPart -> Text
restApiId :: Prelude.Text,
UpdateDocumentationPart -> Text
documentationPartId :: Prelude.Text
}
deriving (UpdateDocumentationPart -> UpdateDocumentationPart -> Bool
(UpdateDocumentationPart -> UpdateDocumentationPart -> Bool)
-> (UpdateDocumentationPart -> UpdateDocumentationPart -> Bool)
-> Eq UpdateDocumentationPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDocumentationPart -> UpdateDocumentationPart -> Bool
$c/= :: UpdateDocumentationPart -> UpdateDocumentationPart -> Bool
== :: UpdateDocumentationPart -> UpdateDocumentationPart -> Bool
$c== :: UpdateDocumentationPart -> UpdateDocumentationPart -> Bool
Prelude.Eq, ReadPrec [UpdateDocumentationPart]
ReadPrec UpdateDocumentationPart
Int -> ReadS UpdateDocumentationPart
ReadS [UpdateDocumentationPart]
(Int -> ReadS UpdateDocumentationPart)
-> ReadS [UpdateDocumentationPart]
-> ReadPrec UpdateDocumentationPart
-> ReadPrec [UpdateDocumentationPart]
-> Read UpdateDocumentationPart
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDocumentationPart]
$creadListPrec :: ReadPrec [UpdateDocumentationPart]
readPrec :: ReadPrec UpdateDocumentationPart
$creadPrec :: ReadPrec UpdateDocumentationPart
readList :: ReadS [UpdateDocumentationPart]
$creadList :: ReadS [UpdateDocumentationPart]
readsPrec :: Int -> ReadS UpdateDocumentationPart
$creadsPrec :: Int -> ReadS UpdateDocumentationPart
Prelude.Read, Int -> UpdateDocumentationPart -> ShowS
[UpdateDocumentationPart] -> ShowS
UpdateDocumentationPart -> String
(Int -> UpdateDocumentationPart -> ShowS)
-> (UpdateDocumentationPart -> String)
-> ([UpdateDocumentationPart] -> ShowS)
-> Show UpdateDocumentationPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDocumentationPart] -> ShowS
$cshowList :: [UpdateDocumentationPart] -> ShowS
show :: UpdateDocumentationPart -> String
$cshow :: UpdateDocumentationPart -> String
showsPrec :: Int -> UpdateDocumentationPart -> ShowS
$cshowsPrec :: Int -> UpdateDocumentationPart -> ShowS
Prelude.Show, (forall x.
UpdateDocumentationPart -> Rep UpdateDocumentationPart x)
-> (forall x.
Rep UpdateDocumentationPart x -> UpdateDocumentationPart)
-> Generic UpdateDocumentationPart
forall x. Rep UpdateDocumentationPart x -> UpdateDocumentationPart
forall x. UpdateDocumentationPart -> Rep UpdateDocumentationPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDocumentationPart x -> UpdateDocumentationPart
$cfrom :: forall x. UpdateDocumentationPart -> Rep UpdateDocumentationPart x
Prelude.Generic)
newUpdateDocumentationPart ::
Prelude.Text ->
Prelude.Text ->
UpdateDocumentationPart
newUpdateDocumentationPart :: Text -> Text -> UpdateDocumentationPart
newUpdateDocumentationPart
Text
pRestApiId_
Text
pDocumentationPartId_ =
UpdateDocumentationPart' :: Maybe [PatchOperation] -> Text -> Text -> UpdateDocumentationPart
UpdateDocumentationPart'
{ $sel:patchOperations:UpdateDocumentationPart' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:UpdateDocumentationPart' :: Text
restApiId = Text
pRestApiId_,
$sel:documentationPartId:UpdateDocumentationPart' :: Text
documentationPartId = Text
pDocumentationPartId_
}
updateDocumentationPart_patchOperations :: Lens.Lens' UpdateDocumentationPart (Prelude.Maybe [PatchOperation])
updateDocumentationPart_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateDocumentationPart -> f UpdateDocumentationPart
updateDocumentationPart_patchOperations = (UpdateDocumentationPart -> Maybe [PatchOperation])
-> (UpdateDocumentationPart
-> Maybe [PatchOperation] -> UpdateDocumentationPart)
-> Lens
UpdateDocumentationPart
UpdateDocumentationPart
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocumentationPart' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateDocumentationPart' :: UpdateDocumentationPart -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateDocumentationPart
s@UpdateDocumentationPart' {} Maybe [PatchOperation]
a -> UpdateDocumentationPart
s {$sel:patchOperations:UpdateDocumentationPart' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateDocumentationPart) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateDocumentationPart -> f UpdateDocumentationPart)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateDocumentationPart
-> f UpdateDocumentationPart
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
-> Iso
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
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
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateDocumentationPart_restApiId :: Lens.Lens' UpdateDocumentationPart Prelude.Text
updateDocumentationPart_restApiId :: (Text -> f Text)
-> UpdateDocumentationPart -> f UpdateDocumentationPart
updateDocumentationPart_restApiId = (UpdateDocumentationPart -> Text)
-> (UpdateDocumentationPart -> Text -> UpdateDocumentationPart)
-> Lens UpdateDocumentationPart UpdateDocumentationPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocumentationPart' {Text
restApiId :: Text
$sel:restApiId:UpdateDocumentationPart' :: UpdateDocumentationPart -> Text
restApiId} -> Text
restApiId) (\s :: UpdateDocumentationPart
s@UpdateDocumentationPart' {} Text
a -> UpdateDocumentationPart
s {$sel:restApiId:UpdateDocumentationPart' :: Text
restApiId = Text
a} :: UpdateDocumentationPart)
updateDocumentationPart_documentationPartId :: Lens.Lens' UpdateDocumentationPart Prelude.Text
updateDocumentationPart_documentationPartId :: (Text -> f Text)
-> UpdateDocumentationPart -> f UpdateDocumentationPart
updateDocumentationPart_documentationPartId = (UpdateDocumentationPart -> Text)
-> (UpdateDocumentationPart -> Text -> UpdateDocumentationPart)
-> Lens UpdateDocumentationPart UpdateDocumentationPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocumentationPart' {Text
documentationPartId :: Text
$sel:documentationPartId:UpdateDocumentationPart' :: UpdateDocumentationPart -> Text
documentationPartId} -> Text
documentationPartId) (\s :: UpdateDocumentationPart
s@UpdateDocumentationPart' {} Text
a -> UpdateDocumentationPart
s {$sel:documentationPartId:UpdateDocumentationPart' :: Text
documentationPartId = Text
a} :: UpdateDocumentationPart)
instance Core.AWSRequest UpdateDocumentationPart where
type
AWSResponse UpdateDocumentationPart =
DocumentationPart
request :: UpdateDocumentationPart -> Request UpdateDocumentationPart
request = Service
-> UpdateDocumentationPart -> Request UpdateDocumentationPart
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDocumentationPart
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDocumentationPart)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDocumentationPart))
-> Logger
-> Service
-> Proxy UpdateDocumentationPart
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDocumentationPart)))
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 -> Object -> Either String DocumentationPart
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateDocumentationPart
instance Prelude.NFData UpdateDocumentationPart
instance Core.ToHeaders UpdateDocumentationPart where
toHeaders :: UpdateDocumentationPart -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDocumentationPart -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Core.ToJSON UpdateDocumentationPart where
toJSON :: UpdateDocumentationPart -> Value
toJSON UpdateDocumentationPart' {Maybe [PatchOperation]
Text
documentationPartId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:documentationPartId:UpdateDocumentationPart' :: UpdateDocumentationPart -> Text
$sel:restApiId:UpdateDocumentationPart' :: UpdateDocumentationPart -> Text
$sel:patchOperations:UpdateDocumentationPart' :: UpdateDocumentationPart -> Maybe [PatchOperation]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"patchOperations" Text -> [PatchOperation] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PatchOperation] -> Pair) -> Maybe [PatchOperation] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOperation]
patchOperations
]
)
instance Core.ToPath UpdateDocumentationPart where
toPath :: UpdateDocumentationPart -> ByteString
toPath UpdateDocumentationPart' {Maybe [PatchOperation]
Text
documentationPartId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:documentationPartId:UpdateDocumentationPart' :: UpdateDocumentationPart -> Text
$sel:restApiId:UpdateDocumentationPart' :: UpdateDocumentationPart -> Text
$sel:patchOperations:UpdateDocumentationPart' :: UpdateDocumentationPart -> Maybe [PatchOperation]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
ByteString
"/documentation/parts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
documentationPartId
]
instance Core.ToQuery UpdateDocumentationPart where
toQuery :: UpdateDocumentationPart -> QueryString
toQuery = QueryString -> UpdateDocumentationPart -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty