{-# 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_description,
createDocumentationVersion_stageName,
createDocumentationVersion_restApiId,
createDocumentationVersion_documentationVersion,
DocumentationVersion (..),
newDocumentationVersion,
documentationVersion_createdDate,
documentationVersion_description,
documentationVersion_version,
)
where
import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDocumentationVersion = CreateDocumentationVersion'
{
CreateDocumentationVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateDocumentationVersion -> Maybe Text
stageName :: Prelude.Maybe Prelude.Text,
CreateDocumentationVersion -> Text
restApiId :: Prelude.Text,
CreateDocumentationVersion -> Text
documentationVersion :: Prelude.Text
}
deriving (CreateDocumentationVersion -> CreateDocumentationVersion -> Bool
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]
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
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.
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'
{ $sel:description:CreateDocumentationVersion' :: Maybe Text
description =
forall a. Maybe a
Prelude.Nothing,
$sel:stageName:CreateDocumentationVersion' :: Maybe Text
stageName = forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:CreateDocumentationVersion' :: Text
restApiId = Text
pRestApiId_,
$sel:documentationVersion:CreateDocumentationVersion' :: Text
documentationVersion = Text
pDocumentationVersion_
}
createDocumentationVersion_description :: Lens.Lens' CreateDocumentationVersion (Prelude.Maybe Prelude.Text)
createDocumentationVersion_description :: Lens' CreateDocumentationVersion (Maybe Text)
createDocumentationVersion_description = 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_stageName :: Lens.Lens' CreateDocumentationVersion (Prelude.Maybe Prelude.Text)
createDocumentationVersion_stageName :: Lens' CreateDocumentationVersion (Maybe Text)
createDocumentationVersion_stageName = 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_restApiId :: Lens.Lens' CreateDocumentationVersion Prelude.Text
createDocumentationVersion_restApiId :: Lens' CreateDocumentationVersion Text
createDocumentationVersion_restApiId = 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 :: Lens' CreateDocumentationVersion Text
createDocumentationVersion_documentationVersion = 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 :: (Service -> Service)
-> CreateDocumentationVersion -> Request CreateDocumentationVersion
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 CreateDocumentationVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDocumentationVersion)))
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 -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable CreateDocumentationVersion where
hashWithSalt :: Int -> CreateDocumentationVersion -> Int
hashWithSalt Int
_salt CreateDocumentationVersion' {Maybe Text
Text
documentationVersion :: Text
restApiId :: Text
stageName :: Maybe Text
description :: Maybe Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stageName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
restApiId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
documentationVersion
instance Prelude.NFData CreateDocumentationVersion where
rnf :: CreateDocumentationVersion -> ()
rnf CreateDocumentationVersion' {Maybe Text
Text
documentationVersion :: Text
restApiId :: Text
stageName :: Maybe Text
description :: Maybe Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
..} =
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 Maybe Text
stageName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
restApiId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
documentationVersion
instance Data.ToHeaders CreateDocumentationVersion where
toHeaders :: CreateDocumentationVersion -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Data.ToJSON CreateDocumentationVersion where
toJSON :: CreateDocumentationVersion -> Value
toJSON CreateDocumentationVersion' {Maybe Text
Text
documentationVersion :: Text
restApiId :: Text
stageName :: Maybe Text
description :: Maybe Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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,
(Key
"stageName" 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
stageName,
forall a. a -> Maybe a
Prelude.Just
( Key
"documentationVersion"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
documentationVersion
)
]
)
instance Data.ToPath CreateDocumentationVersion where
toPath :: CreateDocumentationVersion -> ByteString
toPath CreateDocumentationVersion' {Maybe Text
Text
documentationVersion :: Text
restApiId :: Text
stageName :: Maybe Text
description :: Maybe Text
$sel:documentationVersion:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:restApiId:CreateDocumentationVersion' :: CreateDocumentationVersion -> Text
$sel:stageName:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
$sel:description:CreateDocumentationVersion' :: CreateDocumentationVersion -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
restApiId,
ByteString
"/documentation/versions"
]
instance Data.ToQuery CreateDocumentationVersion where
toQuery :: CreateDocumentationVersion -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty