{-# 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.GetExport
(
GetExport (..),
newGetExport,
getExport_parameters,
getExport_accepts,
getExport_restApiId,
getExport_stageName,
getExport_exportType,
GetExportResponse (..),
newGetExportResponse,
getExportResponse_body,
getExportResponse_contentDisposition,
getExportResponse_contentType,
getExportResponse_httpStatus,
)
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 GetExport = GetExport'
{
GetExport -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetExport -> Maybe Text
accepts :: Prelude.Maybe Prelude.Text,
GetExport -> Text
restApiId :: Prelude.Text,
GetExport -> Text
stageName :: Prelude.Text,
GetExport -> Text
exportType :: Prelude.Text
}
deriving (GetExport -> GetExport -> Bool
(GetExport -> GetExport -> Bool)
-> (GetExport -> GetExport -> Bool) -> Eq GetExport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExport -> GetExport -> Bool
$c/= :: GetExport -> GetExport -> Bool
== :: GetExport -> GetExport -> Bool
$c== :: GetExport -> GetExport -> Bool
Prelude.Eq, ReadPrec [GetExport]
ReadPrec GetExport
Int -> ReadS GetExport
ReadS [GetExport]
(Int -> ReadS GetExport)
-> ReadS [GetExport]
-> ReadPrec GetExport
-> ReadPrec [GetExport]
-> Read GetExport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExport]
$creadListPrec :: ReadPrec [GetExport]
readPrec :: ReadPrec GetExport
$creadPrec :: ReadPrec GetExport
readList :: ReadS [GetExport]
$creadList :: ReadS [GetExport]
readsPrec :: Int -> ReadS GetExport
$creadsPrec :: Int -> ReadS GetExport
Prelude.Read, Int -> GetExport -> ShowS
[GetExport] -> ShowS
GetExport -> String
(Int -> GetExport -> ShowS)
-> (GetExport -> String)
-> ([GetExport] -> ShowS)
-> Show GetExport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExport] -> ShowS
$cshowList :: [GetExport] -> ShowS
show :: GetExport -> String
$cshow :: GetExport -> String
showsPrec :: Int -> GetExport -> ShowS
$cshowsPrec :: Int -> GetExport -> ShowS
Prelude.Show, (forall x. GetExport -> Rep GetExport x)
-> (forall x. Rep GetExport x -> GetExport) -> Generic GetExport
forall x. Rep GetExport x -> GetExport
forall x. GetExport -> Rep GetExport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetExport x -> GetExport
$cfrom :: forall x. GetExport -> Rep GetExport x
Prelude.Generic)
newGetExport ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetExport
newGetExport :: Text -> Text -> Text -> GetExport
newGetExport Text
pRestApiId_ Text
pStageName_ Text
pExportType_ =
GetExport' :: Maybe (HashMap Text Text)
-> Maybe Text -> Text -> Text -> Text -> GetExport
GetExport'
{ $sel:parameters:GetExport' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:accepts:GetExport' :: Maybe Text
accepts = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:GetExport' :: Text
restApiId = Text
pRestApiId_,
$sel:stageName:GetExport' :: Text
stageName = Text
pStageName_,
$sel:exportType:GetExport' :: Text
exportType = Text
pExportType_
}
getExport_parameters :: Lens.Lens' GetExport (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getExport_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetExport -> f GetExport
getExport_parameters = (GetExport -> Maybe (HashMap Text Text))
-> (GetExport -> Maybe (HashMap Text Text) -> GetExport)
-> Lens
GetExport
GetExport
(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 (\GetExport' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:GetExport' :: GetExport -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: GetExport
s@GetExport' {} Maybe (HashMap Text Text)
a -> GetExport
s {$sel:parameters:GetExport' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: GetExport) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetExport -> f GetExport)
-> ((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)))
-> GetExport
-> f GetExport
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
getExport_accepts :: Lens.Lens' GetExport (Prelude.Maybe Prelude.Text)
getExport_accepts :: (Maybe Text -> f (Maybe Text)) -> GetExport -> f GetExport
getExport_accepts = (GetExport -> Maybe Text)
-> (GetExport -> Maybe Text -> GetExport)
-> Lens GetExport GetExport (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExport' {Maybe Text
accepts :: Maybe Text
$sel:accepts:GetExport' :: GetExport -> Maybe Text
accepts} -> Maybe Text
accepts) (\s :: GetExport
s@GetExport' {} Maybe Text
a -> GetExport
s {$sel:accepts:GetExport' :: Maybe Text
accepts = Maybe Text
a} :: GetExport)
getExport_restApiId :: Lens.Lens' GetExport Prelude.Text
getExport_restApiId :: (Text -> f Text) -> GetExport -> f GetExport
getExport_restApiId = (GetExport -> Text)
-> (GetExport -> Text -> GetExport)
-> Lens GetExport GetExport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExport' {Text
restApiId :: Text
$sel:restApiId:GetExport' :: GetExport -> Text
restApiId} -> Text
restApiId) (\s :: GetExport
s@GetExport' {} Text
a -> GetExport
s {$sel:restApiId:GetExport' :: Text
restApiId = Text
a} :: GetExport)
getExport_stageName :: Lens.Lens' GetExport Prelude.Text
getExport_stageName :: (Text -> f Text) -> GetExport -> f GetExport
getExport_stageName = (GetExport -> Text)
-> (GetExport -> Text -> GetExport)
-> Lens GetExport GetExport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExport' {Text
stageName :: Text
$sel:stageName:GetExport' :: GetExport -> Text
stageName} -> Text
stageName) (\s :: GetExport
s@GetExport' {} Text
a -> GetExport
s {$sel:stageName:GetExport' :: Text
stageName = Text
a} :: GetExport)
getExport_exportType :: Lens.Lens' GetExport Prelude.Text
getExport_exportType :: (Text -> f Text) -> GetExport -> f GetExport
getExport_exportType = (GetExport -> Text)
-> (GetExport -> Text -> GetExport)
-> Lens GetExport GetExport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExport' {Text
exportType :: Text
$sel:exportType:GetExport' :: GetExport -> Text
exportType} -> Text
exportType) (\s :: GetExport
s@GetExport' {} Text
a -> GetExport
s {$sel:exportType:GetExport' :: Text
exportType = Text
a} :: GetExport)
instance Core.AWSRequest GetExport where
type AWSResponse GetExport = GetExportResponse
request :: GetExport -> Request GetExport
request = Service -> GetExport -> Request GetExport
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetExport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetExport)))
response =
(Int
-> ResponseHeaders
-> ByteString
-> Either String (AWSResponse GetExport))
-> Logger
-> Service
-> Proxy GetExport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetExport)))
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
-> Maybe Text -> Maybe Text -> Int -> GetExportResponse
GetExportResponse'
(Maybe ByteString
-> Maybe Text -> Maybe Text -> Int -> GetExportResponse)
-> Either String (Maybe ByteString)
-> Either
String (Maybe Text -> Maybe Text -> Int -> GetExportResponse)
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 (Maybe Text -> Maybe Text -> Int -> GetExportResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetExportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"Content-Disposition")
Either String (Maybe Text -> Int -> GetExportResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetExportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"Content-Type")
Either String (Int -> GetExportResponse)
-> Either String Int -> Either String GetExportResponse
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 GetExport
instance Prelude.NFData GetExport
instance Core.ToHeaders GetExport where
toHeaders :: GetExport -> ResponseHeaders
toHeaders GetExport' {Maybe Text
Maybe (HashMap Text Text)
Text
exportType :: Text
stageName :: Text
restApiId :: Text
accepts :: Maybe Text
parameters :: Maybe (HashMap Text Text)
$sel:exportType:GetExport' :: GetExport -> Text
$sel:stageName:GetExport' :: GetExport -> Text
$sel:restApiId:GetExport' :: GetExport -> Text
$sel:accepts:GetExport' :: GetExport -> Maybe Text
$sel:parameters:GetExport' :: GetExport -> Maybe (HashMap Text Text)
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
accepts,
HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
instance Core.ToPath GetExport where
toPath :: GetExport -> ByteString
toPath GetExport' {Maybe Text
Maybe (HashMap Text Text)
Text
exportType :: Text
stageName :: Text
restApiId :: Text
accepts :: Maybe Text
parameters :: Maybe (HashMap Text Text)
$sel:exportType:GetExport' :: GetExport -> Text
$sel:stageName:GetExport' :: GetExport -> Text
$sel:restApiId:GetExport' :: GetExport -> Text
$sel:accepts:GetExport' :: GetExport -> Maybe Text
$sel:parameters:GetExport' :: GetExport -> Maybe (HashMap Text 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
"/stages/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
stageName,
ByteString
"/exports/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
exportType
]
instance Core.ToQuery GetExport where
toQuery :: GetExport -> QueryString
toQuery GetExport' {Maybe Text
Maybe (HashMap Text Text)
Text
exportType :: Text
stageName :: Text
restApiId :: Text
accepts :: Maybe Text
parameters :: Maybe (HashMap Text Text)
$sel:exportType:GetExport' :: GetExport -> Text
$sel:stageName:GetExport' :: GetExport -> Text
$sel:restApiId:GetExport' :: GetExport -> Text
$sel:accepts:GetExport' :: GetExport -> Maybe Text
$sel:parameters:GetExport' :: GetExport -> Maybe (HashMap Text Text)
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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
)
]
data GetExportResponse = GetExportResponse'
{
GetExportResponse -> Maybe ByteString
body :: Prelude.Maybe Prelude.ByteString,
GetExportResponse -> Maybe Text
contentDisposition :: Prelude.Maybe Prelude.Text,
GetExportResponse -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
GetExportResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetExportResponse -> GetExportResponse -> Bool
(GetExportResponse -> GetExportResponse -> Bool)
-> (GetExportResponse -> GetExportResponse -> Bool)
-> Eq GetExportResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExportResponse -> GetExportResponse -> Bool
$c/= :: GetExportResponse -> GetExportResponse -> Bool
== :: GetExportResponse -> GetExportResponse -> Bool
$c== :: GetExportResponse -> GetExportResponse -> Bool
Prelude.Eq, Int -> GetExportResponse -> ShowS
[GetExportResponse] -> ShowS
GetExportResponse -> String
(Int -> GetExportResponse -> ShowS)
-> (GetExportResponse -> String)
-> ([GetExportResponse] -> ShowS)
-> Show GetExportResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExportResponse] -> ShowS
$cshowList :: [GetExportResponse] -> ShowS
show :: GetExportResponse -> String
$cshow :: GetExportResponse -> String
showsPrec :: Int -> GetExportResponse -> ShowS
$cshowsPrec :: Int -> GetExportResponse -> ShowS
Prelude.Show, (forall x. GetExportResponse -> Rep GetExportResponse x)
-> (forall x. Rep GetExportResponse x -> GetExportResponse)
-> Generic GetExportResponse
forall x. Rep GetExportResponse x -> GetExportResponse
forall x. GetExportResponse -> Rep GetExportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetExportResponse x -> GetExportResponse
$cfrom :: forall x. GetExportResponse -> Rep GetExportResponse x
Prelude.Generic)
newGetExportResponse ::
Prelude.Int ->
GetExportResponse
newGetExportResponse :: Int -> GetExportResponse
newGetExportResponse Int
pHttpStatus_ =
GetExportResponse' :: Maybe ByteString
-> Maybe Text -> Maybe Text -> Int -> GetExportResponse
GetExportResponse'
{ $sel:body:GetExportResponse' :: Maybe ByteString
body = Maybe ByteString
forall a. Maybe a
Prelude.Nothing,
$sel:contentDisposition:GetExportResponse' :: Maybe Text
contentDisposition = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contentType:GetExportResponse' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetExportResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getExportResponse_body :: Lens.Lens' GetExportResponse (Prelude.Maybe Prelude.ByteString)
getExportResponse_body :: (Maybe ByteString -> f (Maybe ByteString))
-> GetExportResponse -> f GetExportResponse
getExportResponse_body = (GetExportResponse -> Maybe ByteString)
-> (GetExportResponse -> Maybe ByteString -> GetExportResponse)
-> Lens
GetExportResponse
GetExportResponse
(Maybe ByteString)
(Maybe ByteString)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExportResponse' {Maybe ByteString
body :: Maybe ByteString
$sel:body:GetExportResponse' :: GetExportResponse -> Maybe ByteString
body} -> Maybe ByteString
body) (\s :: GetExportResponse
s@GetExportResponse' {} Maybe ByteString
a -> GetExportResponse
s {$sel:body:GetExportResponse' :: Maybe ByteString
body = Maybe ByteString
a} :: GetExportResponse)
getExportResponse_contentDisposition :: Lens.Lens' GetExportResponse (Prelude.Maybe Prelude.Text)
getExportResponse_contentDisposition :: (Maybe Text -> f (Maybe Text))
-> GetExportResponse -> f GetExportResponse
getExportResponse_contentDisposition = (GetExportResponse -> Maybe Text)
-> (GetExportResponse -> Maybe Text -> GetExportResponse)
-> Lens
GetExportResponse GetExportResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExportResponse' {Maybe Text
contentDisposition :: Maybe Text
$sel:contentDisposition:GetExportResponse' :: GetExportResponse -> Maybe Text
contentDisposition} -> Maybe Text
contentDisposition) (\s :: GetExportResponse
s@GetExportResponse' {} Maybe Text
a -> GetExportResponse
s {$sel:contentDisposition:GetExportResponse' :: Maybe Text
contentDisposition = Maybe Text
a} :: GetExportResponse)
getExportResponse_contentType :: Lens.Lens' GetExportResponse (Prelude.Maybe Prelude.Text)
getExportResponse_contentType :: (Maybe Text -> f (Maybe Text))
-> GetExportResponse -> f GetExportResponse
getExportResponse_contentType = (GetExportResponse -> Maybe Text)
-> (GetExportResponse -> Maybe Text -> GetExportResponse)
-> Lens
GetExportResponse GetExportResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExportResponse' {Maybe Text
contentType :: Maybe Text
$sel:contentType:GetExportResponse' :: GetExportResponse -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: GetExportResponse
s@GetExportResponse' {} Maybe Text
a -> GetExportResponse
s {$sel:contentType:GetExportResponse' :: Maybe Text
contentType = Maybe Text
a} :: GetExportResponse)
getExportResponse_httpStatus :: Lens.Lens' GetExportResponse Prelude.Int
getExportResponse_httpStatus :: (Int -> f Int) -> GetExportResponse -> f GetExportResponse
getExportResponse_httpStatus = (GetExportResponse -> Int)
-> (GetExportResponse -> Int -> GetExportResponse)
-> Lens GetExportResponse GetExportResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExportResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetExportResponse' :: GetExportResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetExportResponse
s@GetExportResponse' {} Int
a -> GetExportResponse
s {$sel:httpStatus:GetExportResponse' :: Int
httpStatus = Int
a} :: GetExportResponse)
instance Prelude.NFData GetExportResponse