{-# 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.PutRestApi
(
PutRestApi (..),
newPutRestApi,
putRestApi_mode,
putRestApi_failOnWarnings,
putRestApi_parameters,
putRestApi_restApiId,
putRestApi_body,
RestApi (..),
newRestApi,
restApi_minimumCompressionSize,
restApi_disableExecuteApiEndpoint,
restApi_binaryMediaTypes,
restApi_warnings,
restApi_createdDate,
restApi_name,
restApi_version,
restApi_apiKeySource,
restApi_id,
restApi_policy,
restApi_endpointConfiguration,
restApi_description,
restApi_tags,
)
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 PutRestApi = PutRestApi'
{
PutRestApi -> Maybe PutMode
mode :: Prelude.Maybe PutMode,
PutRestApi -> Maybe Bool
failOnWarnings :: Prelude.Maybe Prelude.Bool,
PutRestApi -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
PutRestApi -> Text
restApiId :: Prelude.Text,
PutRestApi -> ByteString
body :: Prelude.ByteString
}
deriving (PutRestApi -> PutRestApi -> Bool
(PutRestApi -> PutRestApi -> Bool)
-> (PutRestApi -> PutRestApi -> Bool) -> Eq PutRestApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRestApi -> PutRestApi -> Bool
$c/= :: PutRestApi -> PutRestApi -> Bool
== :: PutRestApi -> PutRestApi -> Bool
$c== :: PutRestApi -> PutRestApi -> Bool
Prelude.Eq, Int -> PutRestApi -> ShowS
[PutRestApi] -> ShowS
PutRestApi -> String
(Int -> PutRestApi -> ShowS)
-> (PutRestApi -> String)
-> ([PutRestApi] -> ShowS)
-> Show PutRestApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRestApi] -> ShowS
$cshowList :: [PutRestApi] -> ShowS
show :: PutRestApi -> String
$cshow :: PutRestApi -> String
showsPrec :: Int -> PutRestApi -> ShowS
$cshowsPrec :: Int -> PutRestApi -> ShowS
Prelude.Show, (forall x. PutRestApi -> Rep PutRestApi x)
-> (forall x. Rep PutRestApi x -> PutRestApi) -> Generic PutRestApi
forall x. Rep PutRestApi x -> PutRestApi
forall x. PutRestApi -> Rep PutRestApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutRestApi x -> PutRestApi
$cfrom :: forall x. PutRestApi -> Rep PutRestApi x
Prelude.Generic)
newPutRestApi ::
Prelude.Text ->
Prelude.ByteString ->
PutRestApi
newPutRestApi :: Text -> ByteString -> PutRestApi
newPutRestApi Text
pRestApiId_ ByteString
pBody_ =
PutRestApi' :: Maybe PutMode
-> Maybe Bool
-> Maybe (HashMap Text Text)
-> Text
-> ByteString
-> PutRestApi
PutRestApi'
{ $sel:mode:PutRestApi' :: Maybe PutMode
mode = Maybe PutMode
forall a. Maybe a
Prelude.Nothing,
$sel:failOnWarnings:PutRestApi' :: Maybe Bool
failOnWarnings = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:PutRestApi' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:PutRestApi' :: Text
restApiId = Text
pRestApiId_,
$sel:body:PutRestApi' :: ByteString
body = ByteString
pBody_
}
putRestApi_mode :: Lens.Lens' PutRestApi (Prelude.Maybe PutMode)
putRestApi_mode :: (Maybe PutMode -> f (Maybe PutMode)) -> PutRestApi -> f PutRestApi
putRestApi_mode = (PutRestApi -> Maybe PutMode)
-> (PutRestApi -> Maybe PutMode -> PutRestApi)
-> Lens PutRestApi PutRestApi (Maybe PutMode) (Maybe PutMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRestApi' {Maybe PutMode
mode :: Maybe PutMode
$sel:mode:PutRestApi' :: PutRestApi -> Maybe PutMode
mode} -> Maybe PutMode
mode) (\s :: PutRestApi
s@PutRestApi' {} Maybe PutMode
a -> PutRestApi
s {$sel:mode:PutRestApi' :: Maybe PutMode
mode = Maybe PutMode
a} :: PutRestApi)
putRestApi_failOnWarnings :: Lens.Lens' PutRestApi (Prelude.Maybe Prelude.Bool)
putRestApi_failOnWarnings :: (Maybe Bool -> f (Maybe Bool)) -> PutRestApi -> f PutRestApi
putRestApi_failOnWarnings = (PutRestApi -> Maybe Bool)
-> (PutRestApi -> Maybe Bool -> PutRestApi)
-> Lens PutRestApi PutRestApi (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRestApi' {Maybe Bool
failOnWarnings :: Maybe Bool
$sel:failOnWarnings:PutRestApi' :: PutRestApi -> Maybe Bool
failOnWarnings} -> Maybe Bool
failOnWarnings) (\s :: PutRestApi
s@PutRestApi' {} Maybe Bool
a -> PutRestApi
s {$sel:failOnWarnings:PutRestApi' :: Maybe Bool
failOnWarnings = Maybe Bool
a} :: PutRestApi)
putRestApi_parameters :: Lens.Lens' PutRestApi (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putRestApi_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutRestApi -> f PutRestApi
putRestApi_parameters = (PutRestApi -> Maybe (HashMap Text Text))
-> (PutRestApi -> Maybe (HashMap Text Text) -> PutRestApi)
-> Lens
PutRestApi
PutRestApi
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRestApi' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:PutRestApi' :: PutRestApi -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: PutRestApi
s@PutRestApi' {} Maybe (HashMap Text Text)
a -> PutRestApi
s {$sel:parameters:PutRestApi' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: PutRestApi) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutRestApi -> f PutRestApi)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutRestApi
-> f PutRestApi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putRestApi_restApiId :: Lens.Lens' PutRestApi Prelude.Text
putRestApi_restApiId :: (Text -> f Text) -> PutRestApi -> f PutRestApi
putRestApi_restApiId = (PutRestApi -> Text)
-> (PutRestApi -> Text -> PutRestApi)
-> Lens PutRestApi PutRestApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRestApi' {Text
restApiId :: Text
$sel:restApiId:PutRestApi' :: PutRestApi -> Text
restApiId} -> Text
restApiId) (\s :: PutRestApi
s@PutRestApi' {} Text
a -> PutRestApi
s {$sel:restApiId:PutRestApi' :: Text
restApiId = Text
a} :: PutRestApi)
putRestApi_body :: Lens.Lens' PutRestApi Prelude.ByteString
putRestApi_body :: (ByteString -> f ByteString) -> PutRestApi -> f PutRestApi
putRestApi_body = (PutRestApi -> ByteString)
-> (PutRestApi -> ByteString -> PutRestApi)
-> Lens PutRestApi PutRestApi ByteString ByteString
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRestApi' {ByteString
body :: ByteString
$sel:body:PutRestApi' :: PutRestApi -> ByteString
body} -> ByteString
body) (\s :: PutRestApi
s@PutRestApi' {} ByteString
a -> PutRestApi
s {$sel:body:PutRestApi' :: ByteString
body = ByteString
a} :: PutRestApi)
instance Core.AWSRequest PutRestApi where
type AWSResponse PutRestApi = RestApi
request :: PutRestApi -> Request PutRestApi
request = Service -> PutRestApi -> Request PutRestApi
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.putBody Service
defaultService
response :: Logger
-> Service
-> Proxy PutRestApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutRestApi)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutRestApi))
-> Logger
-> Service
-> Proxy PutRestApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutRestApi)))
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 RestApi
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable PutRestApi
instance Prelude.NFData PutRestApi
instance Core.ToBody PutRestApi where
toBody :: PutRestApi -> RequestBody
toBody PutRestApi' {Maybe Bool
Maybe (HashMap Text Text)
Maybe PutMode
ByteString
Text
body :: ByteString
restApiId :: Text
parameters :: Maybe (HashMap Text Text)
failOnWarnings :: Maybe Bool
mode :: Maybe PutMode
$sel:body:PutRestApi' :: PutRestApi -> ByteString
$sel:restApiId:PutRestApi' :: PutRestApi -> Text
$sel:parameters:PutRestApi' :: PutRestApi -> Maybe (HashMap Text Text)
$sel:failOnWarnings:PutRestApi' :: PutRestApi -> Maybe Bool
$sel:mode:PutRestApi' :: PutRestApi -> Maybe PutMode
..} = ByteString -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody ByteString
body
instance Core.ToHeaders PutRestApi where
toHeaders :: PutRestApi -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutRestApi -> 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.ToPath PutRestApi where
toPath :: PutRestApi -> ByteString
toPath PutRestApi' {Maybe Bool
Maybe (HashMap Text Text)
Maybe PutMode
ByteString
Text
body :: ByteString
restApiId :: Text
parameters :: Maybe (HashMap Text Text)
failOnWarnings :: Maybe Bool
mode :: Maybe PutMode
$sel:body:PutRestApi' :: PutRestApi -> ByteString
$sel:restApiId:PutRestApi' :: PutRestApi -> Text
$sel:parameters:PutRestApi' :: PutRestApi -> Maybe (HashMap Text Text)
$sel:failOnWarnings:PutRestApi' :: PutRestApi -> Maybe Bool
$sel:mode:PutRestApi' :: PutRestApi -> Maybe PutMode
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/restapis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId]
instance Core.ToQuery PutRestApi where
toQuery :: PutRestApi -> QueryString
toQuery PutRestApi' {Maybe Bool
Maybe (HashMap Text Text)
Maybe PutMode
ByteString
Text
body :: ByteString
restApiId :: Text
parameters :: Maybe (HashMap Text Text)
failOnWarnings :: Maybe Bool
mode :: Maybe PutMode
$sel:body:PutRestApi' :: PutRestApi -> ByteString
$sel:restApiId:PutRestApi' :: PutRestApi -> Text
$sel:parameters:PutRestApi' :: PutRestApi -> Maybe (HashMap Text Text)
$sel:failOnWarnings:PutRestApi' :: PutRestApi -> Maybe Bool
$sel:mode:PutRestApi' :: PutRestApi -> Maybe PutMode
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"mode" ByteString -> Maybe PutMode -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe PutMode
mode,
ByteString
"failonwarnings" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
failOnWarnings,
ByteString
"parameters"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
( ByteString
-> ByteString -> ByteString -> HashMap Text Text -> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Core.toQueryMap ByteString
"entry" ByteString
"key" ByteString
"value"
(HashMap Text Text -> QueryString)
-> Maybe (HashMap Text Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
parameters
)
]