{-# 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.CreateDocumentationVersion
(
CreateDocumentationVersion (..),
newCreateDocumentationVersion,
createDocumentationVersion_stageName,
createDocumentationVersion_description,
createDocumentationVersion_restApiId,
createDocumentationVersion_documentationVersion,
DocumentationVersion (..),
newDocumentationVersion,
documentationVersion_createdDate,
documentationVersion_version,
documentationVersion_description,
)
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 CreateDocumentationVersion = CreateDocumentationVersion'
{
CreateDocumentationVersion -> Maybe Text
stageName :: Prelude.Maybe Prelude.Text,
CreateDocumentationVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateDocumentationVersion -> Text
restApiId :: Prelude.Text,
CreateDocumentationVersion -> Text
documentationVersion :: Prelude.Text
}
deriving (CreateDocumentationVersion -> CreateDocumentationVersion -> Bool
(CreateDocumentationVersion -> CreateDocumentationVersion -> Bool)
-> (CreateDocumentationVersion
-> CreateDocumentationVersion -> Bool)
-> Eq CreateDocumentationVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDocumentationVersion -> CreateDocumentationVersion -> Bool
$c/= :: CreateDocumentationVersion -> CreateDocumentationVersion -> Bool
== :: CreateDocumentationVersion -> CreateDocumentationVersion -> Bool
$c== :: CreateDocumentationVersion -> CreateDocumentationVersion -> Bool
Prelude.Eq, ReadPrec [CreateDocumentationVersion]
ReadPrec CreateDocumentationVersion
Int -> ReadS CreateDocumentationVersion
ReadS [CreateDocumentationVersion]
(Int -> ReadS CreateDocumentationVersion)
-> ReadS [CreateDocumentationVersion]
-> ReadPrec CreateDocumentationVersion
-> ReadPrec [CreateDocumentationVersion]
-> Read CreateDocumentationVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDocumentationVersion]
$creadListPrec :: ReadPrec [CreateDocumentationVersion]
readPrec :: ReadPrec CreateDocumentationVersion
$creadPrec :: ReadPrec CreateDocumentationVersion
readList :: ReadS [CreateDocumentationVersion]
$creadList :: ReadS [CreateDocumentationVersion]
readsPrec :: Int -> ReadS CreateDocumentationVersion
$creadsPrec :: Int -> ReadS CreateDocumentationVersion
Prelude.Read, Int -> CreateDocumentationVersion -> ShowS
[CreateDocumentationVersion] -> ShowS
CreateDocumentationVersion -> String
(Int -> CreateDocumentationVersion -> ShowS)
-> (CreateDocumentationVersion -> String)
-> ([CreateDocumentationVersion] -> ShowS)
-> Show CreateDocumentationVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDocumentationVersion] -> ShowS
$cshowList :: [CreateDocumentationVersion] -> ShowS
show :: CreateDocumentationVersion -> String
$cshow :: CreateDocumentationVersion -> String
showsPrec :: Int -> CreateDocumentationVersion -> ShowS
$cshowsPrec :: Int -> CreateDocumentationVersion -> ShowS
Prelude.Show, (forall x.
CreateDocumentationVersion -> Rep CreateDocumentationVersion x)
-> (forall x.
Rep CreateDocumentationVersion x -> CreateDocumentationVersion)
-> Generic CreateDocumentationVersion
forall x.
Rep CreateDocumentationVersion x -> CreateDocumentationVersion
forall x.
CreateDocumentationVersion -> Rep CreateDocumentationVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDocumentationVersion x -> CreateDocumentationVersion
$cfrom :: forall x.
CreateDocumentationVersion -> Rep CreateDocumentationVersion x
Prelude.Generic)
newCreateDocumentationVersion ::
Prelude.Text ->
Prelude.Text ->
CreateDocumentationVersion
newCreateDocumentationVersion :: Text -> Text -> CreateDocumentationVersion
newCreateDocumentationVersion
Text
pRestApiId_
Text
pDocumentationVersion_ =
CreateDocumentationVersion' :: Maybe Text
-> Maybe Text -> Text -> Text -> CreateDocumentationVersion
CreateDocumentationVersion'
{ $sel:stageName:CreateDocumentationVersion' :: Maybe Text
stageName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateDocumentationVersion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:CreateDocumentationVersion' :: Text
restApiId = Text
pRestApiId_,
$sel:documentationVersion:CreateDocumentationVersion' :: Text
documentationVersion = Text
pDocumentationVersion_
}
createDocumentationVersion_stageName :: Lens.Lens' CreateDocumentationVersion (Prelude.Maybe Prelude.Text)
createDocumentationVersion_stageName :: (Maybe Text -> f (Maybe Text))
-> CreateDocumentationVersion -> f CreateDocumentationVersion
createDocumentationVersion_stageName = (CreateDocumentationVersion -> Maybe Text)
-> (CreateDocumentationVersion
-> Maybe Text -> CreateDocumentationVersion)
-> Lens
CreateDocumentationVersion
CreateDocumentationVersion
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationVersion' {Maybe Text
stageName :: Maybe Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
stageName} -> Maybe Text
stageName) (\s :: CreateDocumentationVersion
s@CreateDocumentationVersion' {} Maybe Text
a -> CreateDocumentationVersion
s {$sel:stageName:CreateDocumentationVersion' :: Maybe Text
stageName = Maybe Text
a} :: CreateDocumentationVersion)
createDocumentationVersion_description :: Lens.Lens' CreateDocumentationVersion (Prelude.Maybe Prelude.Text)
createDocumentationVersion_description :: (Maybe Text -> f (Maybe Text))
-> CreateDocumentationVersion -> f CreateDocumentationVersion
createDocumentationVersion_description = (CreateDocumentationVersion -> Maybe Text)
-> (CreateDocumentationVersion
-> Maybe Text -> CreateDocumentationVersion)
-> Lens
CreateDocumentationVersion
CreateDocumentationVersion
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationVersion' {Maybe Text
description :: Maybe Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDocumentationVersion
s@CreateDocumentationVersion' {} Maybe Text
a -> CreateDocumentationVersion
s {$sel:description:CreateDocumentationVersion' :: Maybe Text
description = Maybe Text
a} :: CreateDocumentationVersion)
createDocumentationVersion_restApiId :: Lens.Lens' CreateDocumentationVersion Prelude.Text
createDocumentationVersion_restApiId :: (Text -> f Text)
-> CreateDocumentationVersion -> f CreateDocumentationVersion
createDocumentationVersion_restApiId = (CreateDocumentationVersion -> Text)
-> (CreateDocumentationVersion
-> Text -> CreateDocumentationVersion)
-> Lens
CreateDocumentationVersion CreateDocumentationVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationVersion' {Text
restApiId :: Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
restApiId} -> Text
restApiId) (\s :: CreateDocumentationVersion
s@CreateDocumentationVersion' {} Text
a -> CreateDocumentationVersion
s {$sel:restApiId:CreateDocumentationVersion' :: Text
restApiId = Text
a} :: CreateDocumentationVersion)
createDocumentationVersion_documentationVersion :: Lens.Lens' CreateDocumentationVersion Prelude.Text
createDocumentationVersion_documentationVersion :: (Text -> f Text)
-> CreateDocumentationVersion -> f CreateDocumentationVersion
createDocumentationVersion_documentationVersion = (CreateDocumentationVersion -> Text)
-> (CreateDocumentationVersion
-> Text -> CreateDocumentationVersion)
-> Lens
CreateDocumentationVersion CreateDocumentationVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDocumentationVersion' {Text
documentationVersion :: Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
documentationVersion} -> Text
documentationVersion) (\s :: CreateDocumentationVersion
s@CreateDocumentationVersion' {} Text
a -> CreateDocumentationVersion
s {$sel:documentationVersion:CreateDocumentationVersion' :: Text
documentationVersion = Text
a} :: CreateDocumentationVersion)
instance Core.AWSRequest CreateDocumentationVersion where
type
AWSResponse CreateDocumentationVersion =
DocumentationVersion
request :: CreateDocumentationVersion -> Request CreateDocumentationVersion
request = Service
-> CreateDocumentationVersion -> Request CreateDocumentationVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDocumentationVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDocumentationVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDocumentationVersion))
-> Logger
-> Service
-> Proxy CreateDocumentationVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDocumentationVersion)))
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 DocumentationVersion
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable CreateDocumentationVersion
instance Prelude.NFData CreateDocumentationVersion
instance Core.ToHeaders CreateDocumentationVersion where
toHeaders :: CreateDocumentationVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDocumentationVersion -> 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 CreateDocumentationVersion where
toJSON :: CreateDocumentationVersion -> Value
toJSON CreateDocumentationVersion' {Maybe Text
Text
documentationVersion :: Text
restApiId :: Text
description :: Maybe Text
stageName :: Maybe Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"stageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
stageName,
(Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"documentationVersion"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
documentationVersion
)
]
)
instance Core.ToPath CreateDocumentationVersion where
toPath :: CreateDocumentationVersion -> ByteString
toPath CreateDocumentationVersion' {Maybe Text
Text
documentationVersion :: Text
restApiId :: Text
description :: Maybe Text
stageName :: Maybe Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe 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/versions"
]
instance Core.ToQuery CreateDocumentationVersion where
toQuery :: CreateDocumentationVersion -> QueryString
toQuery = QueryString -> CreateDocumentationVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty