{-# 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.CreateDocumentationPart
(
CreateDocumentationPart (..),
newCreateDocumentationPart,
createDocumentationPart_restApiId,
createDocumentationPart_location,
createDocumentationPart_properties,
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 CreateDocumentationPart = CreateDocumentationPart'
{
CreateDocumentationPart -> Text
restApiId :: Prelude.Text,
CreateDocumentationPart -> DocumentationPartLocation
location :: DocumentationPartLocation,
CreateDocumentationPart -> Text
properties :: Prelude.Text
}
deriving (CreateDocumentationPart -> CreateDocumentationPart -> Bool
(CreateDocumentationPart -> CreateDocumentationPart -> Bool)
-> (CreateDocumentationPart -> CreateDocumentationPart -> Bool)
-> Eq CreateDocumentationPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDocumentationPart -> CreateDocumentationPart -> Bool
$c/= :: CreateDocumentationPart -> CreateDocumentationPart -> Bool
== :: CreateDocumentationPart -> CreateDocumentationPart -> Bool
$c== :: CreateDocumentationPart -> CreateDocumentationPart -> Bool
Prelude.Eq, ReadPrec [CreateDocumentationPart]
ReadPrec CreateDocumentationPart
Int -> ReadS CreateDocumentationPart
ReadS [CreateDocumentationPart]
(Int -> ReadS CreateDocumentationPart)
-> ReadS [CreateDocumentationPart]
-> ReadPrec CreateDocumentationPart
-> ReadPrec [CreateDocumentationPart]
-> Read CreateDocumentationPart
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDocumentationPart]
$creadListPrec :: ReadPrec [CreateDocumentationPart]
readPrec :: ReadPrec CreateDocumentationPart
$creadPrec :: ReadPrec CreateDocumentationPart
readList :: ReadS [CreateDocumentationPart]
$creadList :: ReadS [CreateDocumentationPart]
readsPrec :: Int -> ReadS CreateDocumentationPart
$creadsPrec :: Int -> ReadS CreateDocumentationPart
Prelude.Read, Int -> CreateDocumentationPart -> ShowS
[CreateDocumentationPart] -> ShowS
CreateDocumentationPart -> String
(Int -> CreateDocumentationPart -> ShowS)
-> (CreateDocumentationPart -> String)
-> ([CreateDocumentationPart] -> ShowS)
-> Show CreateDocumentationPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDocumentationPart] -> ShowS
$cshowList :: [CreateDocumentationPart] -> ShowS
show :: CreateDocumentationPart -> String
$cshow :: CreateDocumentationPart -> String
showsPrec :: Int -> CreateDocumentationPart -> ShowS
$cshowsPrec :: Int -> CreateDocumentationPart -> ShowS
Prelude.Show, (forall x.
CreateDocumentationPart -> Rep CreateDocumentationPart x)
-> (forall x.
Rep CreateDocumentationPart x -> CreateDocumentationPart)
-> Generic CreateDocumentationPart
forall x. Rep CreateDocumentationPart x -> CreateDocumentationPart
forall x. CreateDocumentationPart -> Rep CreateDocumentationPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDocumentationPart x -> CreateDocumentationPart
$cfrom :: forall x. CreateDocumentationPart -> Rep CreateDocumentationPart x
Prelude.Generic)
newCreateDocumentationPart ::
Prelude.Text ->
DocumentationPartLocation ->
Prelude.Text ->
CreateDocumentationPart
newCreateDocumentationPart :: Text
-> DocumentationPartLocation -> Text -> CreateDocumentationPart
newCreateDocumentationPart
Text
pRestApiId_
DocumentationPartLocation
pLocation_
Text
pProperties_ =
CreateDocumentationPart' :: Text
-> DocumentationPartLocation -> Text -> CreateDocumentationPart
CreateDocumentationPart'
{ $sel:restApiId:CreateDocumentationPart' :: Text
restApiId = Text
pRestApiId_,
$sel:location:CreateDocumentationPart' :: DocumentationPartLocation
location = DocumentationPartLocation
pLocation_,
$sel:properties:CreateDocumentationPart' :: Text
properties = Text
pProperties_
}
createDocumentationPart_restApiId :: Lens.Lens' CreateDocumentationPart Prelude.Text
createDocumentationPart_restApiId :: (Text -> f Text)
-> CreateDocumentationPart -> f CreateDocumentationPart
createDocumentationPart_restApiId = (CreateDocumentationPart -> Text)
-> (CreateDocumentationPart -> Text -> CreateDocumentationPart)
-> Lens CreateDocumentationPart CreateDocumentationPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationPart' {Text
restApiId :: Text
$sel:restApiId:CreateDocumentationPart' :: CreateDocumentationPart -> Text
restApiId} -> Text
restApiId) (\s :: CreateDocumentationPart
s@CreateDocumentationPart' {} Text
a -> CreateDocumentationPart
s {$sel:restApiId:CreateDocumentationPart' :: Text
restApiId = Text
a} :: CreateDocumentationPart)
createDocumentationPart_location :: Lens.Lens' CreateDocumentationPart DocumentationPartLocation
createDocumentationPart_location :: (DocumentationPartLocation -> f DocumentationPartLocation)
-> CreateDocumentationPart -> f CreateDocumentationPart
createDocumentationPart_location = (CreateDocumentationPart -> DocumentationPartLocation)
-> (CreateDocumentationPart
-> DocumentationPartLocation -> CreateDocumentationPart)
-> Lens
CreateDocumentationPart
CreateDocumentationPart
DocumentationPartLocation
DocumentationPartLocation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationPart' {DocumentationPartLocation
location :: DocumentationPartLocation
$sel:location:CreateDocumentationPart' :: CreateDocumentationPart -> DocumentationPartLocation
location} -> DocumentationPartLocation
location) (\s :: CreateDocumentationPart
s@CreateDocumentationPart' {} DocumentationPartLocation
a -> CreateDocumentationPart
s {$sel:location:CreateDocumentationPart' :: DocumentationPartLocation
location = DocumentationPartLocation
a} :: CreateDocumentationPart)
createDocumentationPart_properties :: Lens.Lens' CreateDocumentationPart Prelude.Text
createDocumentationPart_properties :: (Text -> f Text)
-> CreateDocumentationPart -> f CreateDocumentationPart
createDocumentationPart_properties = (CreateDocumentationPart -> Text)
-> (CreateDocumentationPart -> Text -> CreateDocumentationPart)
-> Lens CreateDocumentationPart CreateDocumentationPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationPart' {Text
properties :: Text
$sel:properties:CreateDocumentationPart' :: CreateDocumentationPart -> Text
properties} -> Text
properties) (\s :: CreateDocumentationPart
s@CreateDocumentationPart' {} Text
a -> CreateDocumentationPart
s {$sel:properties:CreateDocumentationPart' :: Text
properties = Text
a} :: CreateDocumentationPart)
instance Core.AWSRequest CreateDocumentationPart where
type
AWSResponse CreateDocumentationPart =
DocumentationPart
request :: CreateDocumentationPart -> Request CreateDocumentationPart
request = Service
-> CreateDocumentationPart -> Request CreateDocumentationPart
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDocumentationPart
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDocumentationPart)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDocumentationPart))
-> Logger
-> Service
-> Proxy CreateDocumentationPart
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDocumentationPart)))
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 CreateDocumentationPart
instance Prelude.NFData CreateDocumentationPart
instance Core.ToHeaders CreateDocumentationPart where
toHeaders :: CreateDocumentationPart -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDocumentationPart -> 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 CreateDocumentationPart where
toJSON :: CreateDocumentationPart -> Value
toJSON CreateDocumentationPart' {Text
DocumentationPartLocation
properties :: Text
location :: DocumentationPartLocation
restApiId :: Text
$sel:properties:CreateDocumentationPart' :: CreateDocumentationPart -> Text
$sel:location:CreateDocumentationPart' :: CreateDocumentationPart -> DocumentationPartLocation
$sel:restApiId:CreateDocumentationPart' :: CreateDocumentationPart -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"location" Text -> DocumentationPartLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DocumentationPartLocation
location),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"properties" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
properties)
]
)
instance Core.ToPath CreateDocumentationPart where
toPath :: CreateDocumentationPart -> ByteString
toPath CreateDocumentationPart' {Text
DocumentationPartLocation
properties :: Text
location :: DocumentationPartLocation
restApiId :: Text
$sel:properties:CreateDocumentationPart' :: CreateDocumentationPart -> Text
$sel:location:CreateDocumentationPart' :: CreateDocumentationPart -> DocumentationPartLocation
$sel:restApiId:CreateDocumentationPart' :: CreateDocumentationPart -> Text
..} =
[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"
]
instance Core.ToQuery CreateDocumentationPart where
toQuery :: CreateDocumentationPart -> QueryString
toQuery = QueryString -> CreateDocumentationPart -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty