{-# 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.ApiGatewayV2.ExportApi
(
ExportApi (..),
newExportApi,
exportApi_exportVersion,
exportApi_stageName,
exportApi_includeExtensions,
exportApi_specification,
exportApi_outputType,
exportApi_apiId,
ExportApiResponse (..),
newExportApiResponse,
exportApiResponse_body,
exportApiResponse_httpStatus,
)
where
import Amazonka.ApiGatewayV2.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 ExportApi = ExportApi'
{
ExportApi -> Maybe Text
exportVersion :: Prelude.Maybe Prelude.Text,
ExportApi -> Maybe Text
stageName :: Prelude.Maybe Prelude.Text,
ExportApi -> Maybe Bool
includeExtensions :: Prelude.Maybe Prelude.Bool,
ExportApi -> Text
specification :: Prelude.Text,
ExportApi -> Text
outputType :: Prelude.Text,
ExportApi -> Text
apiId :: Prelude.Text
}
deriving (ExportApi -> ExportApi -> Bool
(ExportApi -> ExportApi -> Bool)
-> (ExportApi -> ExportApi -> Bool) -> Eq ExportApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportApi -> ExportApi -> Bool
$c/= :: ExportApi -> ExportApi -> Bool
== :: ExportApi -> ExportApi -> Bool
$c== :: ExportApi -> ExportApi -> Bool
Prelude.Eq, ReadPrec [ExportApi]
ReadPrec ExportApi
Int -> ReadS ExportApi
ReadS [ExportApi]
(Int -> ReadS ExportApi)
-> ReadS [ExportApi]
-> ReadPrec ExportApi
-> ReadPrec [ExportApi]
-> Read ExportApi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportApi]
$creadListPrec :: ReadPrec [ExportApi]
readPrec :: ReadPrec ExportApi
$creadPrec :: ReadPrec ExportApi
readList :: ReadS [ExportApi]
$creadList :: ReadS [ExportApi]
readsPrec :: Int -> ReadS ExportApi
$creadsPrec :: Int -> ReadS ExportApi
Prelude.Read, Int -> ExportApi -> ShowS
[ExportApi] -> ShowS
ExportApi -> String
(Int -> ExportApi -> ShowS)
-> (ExportApi -> String)
-> ([ExportApi] -> ShowS)
-> Show ExportApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportApi] -> ShowS
$cshowList :: [ExportApi] -> ShowS
show :: ExportApi -> String
$cshow :: ExportApi -> String
showsPrec :: Int -> ExportApi -> ShowS
$cshowsPrec :: Int -> ExportApi -> ShowS
Prelude.Show, (forall x. ExportApi -> Rep ExportApi x)
-> (forall x. Rep ExportApi x -> ExportApi) -> Generic ExportApi
forall x. Rep ExportApi x -> ExportApi
forall x. ExportApi -> Rep ExportApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportApi x -> ExportApi
$cfrom :: forall x. ExportApi -> Rep ExportApi x
Prelude.Generic)
newExportApi ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ExportApi
newExportApi :: Text -> Text -> Text -> ExportApi
newExportApi Text
pSpecification_ Text
pOutputType_ Text
pApiId_ =
ExportApi' :: Maybe Text
-> Maybe Text -> Maybe Bool -> Text -> Text -> Text -> ExportApi
ExportApi'
{ $sel:exportVersion:ExportApi' :: Maybe Text
exportVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stageName:ExportApi' :: Maybe Text
stageName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:includeExtensions:ExportApi' :: Maybe Bool
includeExtensions = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:specification:ExportApi' :: Text
specification = Text
pSpecification_,
$sel:outputType:ExportApi' :: Text
outputType = Text
pOutputType_,
$sel:apiId:ExportApi' :: Text
apiId = Text
pApiId_
}
exportApi_exportVersion :: Lens.Lens' ExportApi (Prelude.Maybe Prelude.Text)
exportApi_exportVersion :: (Maybe Text -> f (Maybe Text)) -> ExportApi -> f ExportApi
exportApi_exportVersion = (ExportApi -> Maybe Text)
-> (ExportApi -> Maybe Text -> ExportApi)
-> Lens ExportApi ExportApi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApi' {Maybe Text
exportVersion :: Maybe Text
$sel:exportVersion:ExportApi' :: ExportApi -> Maybe Text
exportVersion} -> Maybe Text
exportVersion) (\s :: ExportApi
s@ExportApi' {} Maybe Text
a -> ExportApi
s {$sel:exportVersion:ExportApi' :: Maybe Text
exportVersion = Maybe Text
a} :: ExportApi)
exportApi_stageName :: Lens.Lens' ExportApi (Prelude.Maybe Prelude.Text)
exportApi_stageName :: (Maybe Text -> f (Maybe Text)) -> ExportApi -> f ExportApi
exportApi_stageName = (ExportApi -> Maybe Text)
-> (ExportApi -> Maybe Text -> ExportApi)
-> Lens ExportApi ExportApi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApi' {Maybe Text
stageName :: Maybe Text
$sel:stageName:ExportApi' :: ExportApi -> Maybe Text
stageName} -> Maybe Text
stageName) (\s :: ExportApi
s@ExportApi' {} Maybe Text
a -> ExportApi
s {$sel:stageName:ExportApi' :: Maybe Text
stageName = Maybe Text
a} :: ExportApi)
exportApi_includeExtensions :: Lens.Lens' ExportApi (Prelude.Maybe Prelude.Bool)
exportApi_includeExtensions :: (Maybe Bool -> f (Maybe Bool)) -> ExportApi -> f ExportApi
exportApi_includeExtensions = (ExportApi -> Maybe Bool)
-> (ExportApi -> Maybe Bool -> ExportApi)
-> Lens ExportApi ExportApi (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApi' {Maybe Bool
includeExtensions :: Maybe Bool
$sel:includeExtensions:ExportApi' :: ExportApi -> Maybe Bool
includeExtensions} -> Maybe Bool
includeExtensions) (\s :: ExportApi
s@ExportApi' {} Maybe Bool
a -> ExportApi
s {$sel:includeExtensions:ExportApi' :: Maybe Bool
includeExtensions = Maybe Bool
a} :: ExportApi)
exportApi_specification :: Lens.Lens' ExportApi Prelude.Text
exportApi_specification :: (Text -> f Text) -> ExportApi -> f ExportApi
exportApi_specification = (ExportApi -> Text)
-> (ExportApi -> Text -> ExportApi)
-> Lens ExportApi ExportApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApi' {Text
specification :: Text
$sel:specification:ExportApi' :: ExportApi -> Text
specification} -> Text
specification) (\s :: ExportApi
s@ExportApi' {} Text
a -> ExportApi
s {$sel:specification:ExportApi' :: Text
specification = Text
a} :: ExportApi)
exportApi_outputType :: Lens.Lens' ExportApi Prelude.Text
exportApi_outputType :: (Text -> f Text) -> ExportApi -> f ExportApi
exportApi_outputType = (ExportApi -> Text)
-> (ExportApi -> Text -> ExportApi)
-> Lens ExportApi ExportApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApi' {Text
outputType :: Text
$sel:outputType:ExportApi' :: ExportApi -> Text
outputType} -> Text
outputType) (\s :: ExportApi
s@ExportApi' {} Text
a -> ExportApi
s {$sel:outputType:ExportApi' :: Text
outputType = Text
a} :: ExportApi)
exportApi_apiId :: Lens.Lens' ExportApi Prelude.Text
exportApi_apiId :: (Text -> f Text) -> ExportApi -> f ExportApi
exportApi_apiId = (ExportApi -> Text)
-> (ExportApi -> Text -> ExportApi)
-> Lens ExportApi ExportApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApi' {Text
apiId :: Text
$sel:apiId:ExportApi' :: ExportApi -> Text
apiId} -> Text
apiId) (\s :: ExportApi
s@ExportApi' {} Text
a -> ExportApi
s {$sel:apiId:ExportApi' :: Text
apiId = Text
a} :: ExportApi)
instance Core.AWSRequest ExportApi where
type AWSResponse ExportApi = ExportApiResponse
request :: ExportApi -> Request ExportApi
request = Service -> ExportApi -> Request ExportApi
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ExportApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExportApi)))
response =
(Int
-> ResponseHeaders
-> ByteString
-> Either String (AWSResponse ExportApi))
-> Logger
-> Service
-> Proxy ExportApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExportApi)))
forall (m :: * -> *) a.
MonadResource m =>
(Int
-> ResponseHeaders -> ByteString -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveBytes
( \Int
s ResponseHeaders
h ByteString
x ->
Maybe ByteString -> Int -> ExportApiResponse
ExportApiResponse'
(Maybe ByteString -> Int -> ExportApiResponse)
-> Either String (Maybe ByteString)
-> Either String (Int -> ExportApiResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Maybe ByteString -> Either String (Maybe ByteString)
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (ByteString -> Maybe ByteString
forall a. a -> Maybe a
Prelude.Just (ByteString -> ByteString
Prelude.coerce ByteString
x)))
Either String (Int -> ExportApiResponse)
-> Either String Int -> Either String ExportApiResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ExportApi
instance Prelude.NFData ExportApi
instance Core.ToHeaders ExportApi where
toHeaders :: ExportApi -> ResponseHeaders
toHeaders =
ResponseHeaders -> ExportApi -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath ExportApi where
toPath :: ExportApi -> ByteString
toPath ExportApi' {Maybe Bool
Maybe Text
Text
apiId :: Text
outputType :: Text
specification :: Text
includeExtensions :: Maybe Bool
stageName :: Maybe Text
exportVersion :: Maybe Text
$sel:apiId:ExportApi' :: ExportApi -> Text
$sel:outputType:ExportApi' :: ExportApi -> Text
$sel:specification:ExportApi' :: ExportApi -> Text
$sel:includeExtensions:ExportApi' :: ExportApi -> Maybe Bool
$sel:stageName:ExportApi' :: ExportApi -> Maybe Text
$sel:exportVersion:ExportApi' :: ExportApi -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/apis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId,
ByteString
"/exports/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
specification
]
instance Core.ToQuery ExportApi where
toQuery :: ExportApi -> QueryString
toQuery ExportApi' {Maybe Bool
Maybe Text
Text
apiId :: Text
outputType :: Text
specification :: Text
includeExtensions :: Maybe Bool
stageName :: Maybe Text
exportVersion :: Maybe Text
$sel:apiId:ExportApi' :: ExportApi -> Text
$sel:outputType:ExportApi' :: ExportApi -> Text
$sel:specification:ExportApi' :: ExportApi -> Text
$sel:includeExtensions:ExportApi' :: ExportApi -> Maybe Bool
$sel:stageName:ExportApi' :: ExportApi -> Maybe Text
$sel:exportVersion:ExportApi' :: ExportApi -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"exportVersion" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
exportVersion,
ByteString
"stageName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
stageName,
ByteString
"includeExtensions" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeExtensions,
ByteString
"outputType" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
outputType
]
data ExportApiResponse = ExportApiResponse'
{ ExportApiResponse -> Maybe ByteString
body :: Prelude.Maybe Prelude.ByteString,
ExportApiResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ExportApiResponse -> ExportApiResponse -> Bool
(ExportApiResponse -> ExportApiResponse -> Bool)
-> (ExportApiResponse -> ExportApiResponse -> Bool)
-> Eq ExportApiResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportApiResponse -> ExportApiResponse -> Bool
$c/= :: ExportApiResponse -> ExportApiResponse -> Bool
== :: ExportApiResponse -> ExportApiResponse -> Bool
$c== :: ExportApiResponse -> ExportApiResponse -> Bool
Prelude.Eq, ReadPrec [ExportApiResponse]
ReadPrec ExportApiResponse
Int -> ReadS ExportApiResponse
ReadS [ExportApiResponse]
(Int -> ReadS ExportApiResponse)
-> ReadS [ExportApiResponse]
-> ReadPrec ExportApiResponse
-> ReadPrec [ExportApiResponse]
-> Read ExportApiResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportApiResponse]
$creadListPrec :: ReadPrec [ExportApiResponse]
readPrec :: ReadPrec ExportApiResponse
$creadPrec :: ReadPrec ExportApiResponse
readList :: ReadS [ExportApiResponse]
$creadList :: ReadS [ExportApiResponse]
readsPrec :: Int -> ReadS ExportApiResponse
$creadsPrec :: Int -> ReadS ExportApiResponse
Prelude.Read, Int -> ExportApiResponse -> ShowS
[ExportApiResponse] -> ShowS
ExportApiResponse -> String
(Int -> ExportApiResponse -> ShowS)
-> (ExportApiResponse -> String)
-> ([ExportApiResponse] -> ShowS)
-> Show ExportApiResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportApiResponse] -> ShowS
$cshowList :: [ExportApiResponse] -> ShowS
show :: ExportApiResponse -> String
$cshow :: ExportApiResponse -> String
showsPrec :: Int -> ExportApiResponse -> ShowS
$cshowsPrec :: Int -> ExportApiResponse -> ShowS
Prelude.Show, (forall x. ExportApiResponse -> Rep ExportApiResponse x)
-> (forall x. Rep ExportApiResponse x -> ExportApiResponse)
-> Generic ExportApiResponse
forall x. Rep ExportApiResponse x -> ExportApiResponse
forall x. ExportApiResponse -> Rep ExportApiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportApiResponse x -> ExportApiResponse
$cfrom :: forall x. ExportApiResponse -> Rep ExportApiResponse x
Prelude.Generic)
newExportApiResponse ::
Prelude.Int ->
ExportApiResponse
newExportApiResponse :: Int -> ExportApiResponse
newExportApiResponse Int
pHttpStatus_ =
ExportApiResponse' :: Maybe ByteString -> Int -> ExportApiResponse
ExportApiResponse'
{ $sel:body:ExportApiResponse' :: Maybe ByteString
body = Maybe ByteString
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ExportApiResponse' :: Int
httpStatus = Int
pHttpStatus_
}
exportApiResponse_body :: Lens.Lens' ExportApiResponse (Prelude.Maybe Prelude.ByteString)
exportApiResponse_body :: (Maybe ByteString -> f (Maybe ByteString))
-> ExportApiResponse -> f ExportApiResponse
exportApiResponse_body = (ExportApiResponse -> Maybe ByteString)
-> (ExportApiResponse -> Maybe ByteString -> ExportApiResponse)
-> Lens
ExportApiResponse
ExportApiResponse
(Maybe ByteString)
(Maybe ByteString)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApiResponse' {Maybe ByteString
body :: Maybe ByteString
$sel:body:ExportApiResponse' :: ExportApiResponse -> Maybe ByteString
body} -> Maybe ByteString
body) (\s :: ExportApiResponse
s@ExportApiResponse' {} Maybe ByteString
a -> ExportApiResponse
s {$sel:body:ExportApiResponse' :: Maybe ByteString
body = Maybe ByteString
a} :: ExportApiResponse)
exportApiResponse_httpStatus :: Lens.Lens' ExportApiResponse Prelude.Int
exportApiResponse_httpStatus :: (Int -> f Int) -> ExportApiResponse -> f ExportApiResponse
exportApiResponse_httpStatus = (ExportApiResponse -> Int)
-> (ExportApiResponse -> Int -> ExportApiResponse)
-> Lens ExportApiResponse ExportApiResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportApiResponse' {Int
httpStatus :: Int
$sel:httpStatus:ExportApiResponse' :: ExportApiResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ExportApiResponse
s@ExportApiResponse' {} Int
a -> ExportApiResponse
s {$sel:httpStatus:ExportApiResponse' :: Int
httpStatus = Int
a} :: ExportApiResponse)
instance Prelude.NFData ExportApiResponse