{-# 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.ImportRestApi
(
ImportRestApi (..),
newImportRestApi,
importRestApi_failOnWarnings,
importRestApi_parameters,
importRestApi_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 ImportRestApi = ImportRestApi'
{
ImportRestApi -> Maybe Bool
failOnWarnings :: Prelude.Maybe Prelude.Bool,
ImportRestApi -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
ImportRestApi -> ByteString
body :: Prelude.ByteString
}
deriving (ImportRestApi -> ImportRestApi -> Bool
(ImportRestApi -> ImportRestApi -> Bool)
-> (ImportRestApi -> ImportRestApi -> Bool) -> Eq ImportRestApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportRestApi -> ImportRestApi -> Bool
$c/= :: ImportRestApi -> ImportRestApi -> Bool
== :: ImportRestApi -> ImportRestApi -> Bool
$c== :: ImportRestApi -> ImportRestApi -> Bool
Prelude.Eq, Int -> ImportRestApi -> ShowS
[ImportRestApi] -> ShowS
ImportRestApi -> String
(Int -> ImportRestApi -> ShowS)
-> (ImportRestApi -> String)
-> ([ImportRestApi] -> ShowS)
-> Show ImportRestApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportRestApi] -> ShowS
$cshowList :: [ImportRestApi] -> ShowS
show :: ImportRestApi -> String
$cshow :: ImportRestApi -> String
showsPrec :: Int -> ImportRestApi -> ShowS
$cshowsPrec :: Int -> ImportRestApi -> ShowS
Prelude.Show, (forall x. ImportRestApi -> Rep ImportRestApi x)
-> (forall x. Rep ImportRestApi x -> ImportRestApi)
-> Generic ImportRestApi
forall x. Rep ImportRestApi x -> ImportRestApi
forall x. ImportRestApi -> Rep ImportRestApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportRestApi x -> ImportRestApi
$cfrom :: forall x. ImportRestApi -> Rep ImportRestApi x
Prelude.Generic)
newImportRestApi ::
Prelude.ByteString ->
ImportRestApi
newImportRestApi :: ByteString -> ImportRestApi
newImportRestApi ByteString
pBody_ =
ImportRestApi' :: Maybe Bool
-> Maybe (HashMap Text Text) -> ByteString -> ImportRestApi
ImportRestApi'
{ $sel:failOnWarnings:ImportRestApi' :: Maybe Bool
failOnWarnings = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:ImportRestApi' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:body:ImportRestApi' :: ByteString
body = ByteString
pBody_
}
importRestApi_failOnWarnings :: Lens.Lens' ImportRestApi (Prelude.Maybe Prelude.Bool)
importRestApi_failOnWarnings :: (Maybe Bool -> f (Maybe Bool)) -> ImportRestApi -> f ImportRestApi
importRestApi_failOnWarnings = (ImportRestApi -> Maybe Bool)
-> (ImportRestApi -> Maybe Bool -> ImportRestApi)
-> Lens ImportRestApi ImportRestApi (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportRestApi' {Maybe Bool
failOnWarnings :: Maybe Bool
$sel:failOnWarnings:ImportRestApi' :: ImportRestApi -> Maybe Bool
failOnWarnings} -> Maybe Bool
failOnWarnings) (\s :: ImportRestApi
s@ImportRestApi' {} Maybe Bool
a -> ImportRestApi
s {$sel:failOnWarnings:ImportRestApi' :: Maybe Bool
failOnWarnings = Maybe Bool
a} :: ImportRestApi)
importRestApi_parameters :: Lens.Lens' ImportRestApi (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
importRestApi_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ImportRestApi -> f ImportRestApi
importRestApi_parameters = (ImportRestApi -> Maybe (HashMap Text Text))
-> (ImportRestApi -> Maybe (HashMap Text Text) -> ImportRestApi)
-> Lens
ImportRestApi
ImportRestApi
(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 (\ImportRestApi' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:ImportRestApi' :: ImportRestApi -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: ImportRestApi
s@ImportRestApi' {} Maybe (HashMap Text Text)
a -> ImportRestApi
s {$sel:parameters:ImportRestApi' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: ImportRestApi) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ImportRestApi -> f ImportRestApi)
-> ((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)))
-> ImportRestApi
-> f ImportRestApi
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
importRestApi_body :: Lens.Lens' ImportRestApi Prelude.ByteString
importRestApi_body :: (ByteString -> f ByteString) -> ImportRestApi -> f ImportRestApi
importRestApi_body = (ImportRestApi -> ByteString)
-> (ImportRestApi -> ByteString -> ImportRestApi)
-> Lens ImportRestApi ImportRestApi ByteString ByteString
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportRestApi' {ByteString
body :: ByteString
$sel:body:ImportRestApi' :: ImportRestApi -> ByteString
body} -> ByteString
body) (\s :: ImportRestApi
s@ImportRestApi' {} ByteString
a -> ImportRestApi
s {$sel:body:ImportRestApi' :: ByteString
body = ByteString
a} :: ImportRestApi)
instance Core.AWSRequest ImportRestApi where
type AWSResponse ImportRestApi = RestApi
request :: ImportRestApi -> Request ImportRestApi
request = Service -> ImportRestApi -> Request ImportRestApi
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.postBody Service
defaultService
response :: Logger
-> Service
-> Proxy ImportRestApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ImportRestApi)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ImportRestApi))
-> Logger
-> Service
-> Proxy ImportRestApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ImportRestApi)))
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 ImportRestApi
instance Prelude.NFData ImportRestApi
instance Core.ToBody ImportRestApi where
toBody :: ImportRestApi -> RequestBody
toBody ImportRestApi' {Maybe Bool
Maybe (HashMap Text Text)
ByteString
body :: ByteString
parameters :: Maybe (HashMap Text Text)
failOnWarnings :: Maybe Bool
$sel:body:ImportRestApi' :: ImportRestApi -> ByteString
$sel:parameters:ImportRestApi' :: ImportRestApi -> Maybe (HashMap Text Text)
$sel:failOnWarnings:ImportRestApi' :: ImportRestApi -> Maybe Bool
..} = ByteString -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody ByteString
body
instance Core.ToHeaders ImportRestApi where
toHeaders :: ImportRestApi -> ResponseHeaders
toHeaders =
ResponseHeaders -> ImportRestApi -> 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 ImportRestApi where
toPath :: ImportRestApi -> ByteString
toPath = ByteString -> ImportRestApi -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/restapis"
instance Core.ToQuery ImportRestApi where
toQuery :: ImportRestApi -> QueryString
toQuery ImportRestApi' {Maybe Bool
Maybe (HashMap Text Text)
ByteString
body :: ByteString
parameters :: Maybe (HashMap Text Text)
failOnWarnings :: Maybe Bool
$sel:body:ImportRestApi' :: ImportRestApi -> ByteString
$sel:parameters:ImportRestApi' :: ImportRestApi -> Maybe (HashMap Text Text)
$sel:failOnWarnings:ImportRestApi' :: ImportRestApi -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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
),
QueryString
"mode=import"
]