{-# 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.Mobile.ExportProject
(
ExportProject (..),
newExportProject,
exportProject_projectId,
ExportProjectResponse (..),
newExportProjectResponse,
exportProjectResponse_shareUrl,
exportProjectResponse_downloadUrl,
exportProjectResponse_snapshotId,
exportProjectResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Mobile.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ExportProject = ExportProject'
{
ExportProject -> Text
projectId :: Prelude.Text
}
deriving (ExportProject -> ExportProject -> Bool
(ExportProject -> ExportProject -> Bool)
-> (ExportProject -> ExportProject -> Bool) -> Eq ExportProject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportProject -> ExportProject -> Bool
$c/= :: ExportProject -> ExportProject -> Bool
== :: ExportProject -> ExportProject -> Bool
$c== :: ExportProject -> ExportProject -> Bool
Prelude.Eq, ReadPrec [ExportProject]
ReadPrec ExportProject
Int -> ReadS ExportProject
ReadS [ExportProject]
(Int -> ReadS ExportProject)
-> ReadS [ExportProject]
-> ReadPrec ExportProject
-> ReadPrec [ExportProject]
-> Read ExportProject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportProject]
$creadListPrec :: ReadPrec [ExportProject]
readPrec :: ReadPrec ExportProject
$creadPrec :: ReadPrec ExportProject
readList :: ReadS [ExportProject]
$creadList :: ReadS [ExportProject]
readsPrec :: Int -> ReadS ExportProject
$creadsPrec :: Int -> ReadS ExportProject
Prelude.Read, Int -> ExportProject -> ShowS
[ExportProject] -> ShowS
ExportProject -> String
(Int -> ExportProject -> ShowS)
-> (ExportProject -> String)
-> ([ExportProject] -> ShowS)
-> Show ExportProject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportProject] -> ShowS
$cshowList :: [ExportProject] -> ShowS
show :: ExportProject -> String
$cshow :: ExportProject -> String
showsPrec :: Int -> ExportProject -> ShowS
$cshowsPrec :: Int -> ExportProject -> ShowS
Prelude.Show, (forall x. ExportProject -> Rep ExportProject x)
-> (forall x. Rep ExportProject x -> ExportProject)
-> Generic ExportProject
forall x. Rep ExportProject x -> ExportProject
forall x. ExportProject -> Rep ExportProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportProject x -> ExportProject
$cfrom :: forall x. ExportProject -> Rep ExportProject x
Prelude.Generic)
newExportProject ::
Prelude.Text ->
ExportProject
newExportProject :: Text -> ExportProject
newExportProject Text
pProjectId_ =
ExportProject' :: Text -> ExportProject
ExportProject' {$sel:projectId:ExportProject' :: Text
projectId = Text
pProjectId_}
exportProject_projectId :: Lens.Lens' ExportProject Prelude.Text
exportProject_projectId :: (Text -> f Text) -> ExportProject -> f ExportProject
exportProject_projectId = (ExportProject -> Text)
-> (ExportProject -> Text -> ExportProject)
-> Lens ExportProject ExportProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportProject' {Text
projectId :: Text
$sel:projectId:ExportProject' :: ExportProject -> Text
projectId} -> Text
projectId) (\s :: ExportProject
s@ExportProject' {} Text
a -> ExportProject
s {$sel:projectId:ExportProject' :: Text
projectId = Text
a} :: ExportProject)
instance Core.AWSRequest ExportProject where
type
AWSResponse ExportProject =
ExportProjectResponse
request :: ExportProject -> Request ExportProject
request = Service -> ExportProject -> Request ExportProject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ExportProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExportProject)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ExportProject))
-> Logger
-> Service
-> Proxy ExportProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExportProject)))
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 ->
Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ExportProjectResponse
ExportProjectResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ExportProjectResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> ExportProjectResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"shareUrl")
Either
String (Maybe Text -> Maybe Text -> Int -> ExportProjectResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ExportProjectResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"downloadUrl")
Either String (Maybe Text -> Int -> ExportProjectResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ExportProjectResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"snapshotId")
Either String (Int -> ExportProjectResponse)
-> Either String Int -> Either String ExportProjectResponse
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 ExportProject
instance Prelude.NFData ExportProject
instance Core.ToHeaders ExportProject where
toHeaders :: ExportProject -> ResponseHeaders
toHeaders =
ResponseHeaders -> ExportProject -> 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.ToJSON ExportProject where
toJSON :: ExportProject -> Value
toJSON = Value -> ExportProject -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath ExportProject where
toPath :: ExportProject -> ByteString
toPath ExportProject' {Text
projectId :: Text
$sel:projectId:ExportProject' :: ExportProject -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/exports/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
projectId]
instance Core.ToQuery ExportProject where
toQuery :: ExportProject -> QueryString
toQuery = QueryString -> ExportProject -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ExportProjectResponse = ExportProjectResponse'
{
ExportProjectResponse -> Maybe Text
shareUrl :: Prelude.Maybe Prelude.Text,
ExportProjectResponse -> Maybe Text
downloadUrl :: Prelude.Maybe Prelude.Text,
ExportProjectResponse -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text,
ExportProjectResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ExportProjectResponse -> ExportProjectResponse -> Bool
(ExportProjectResponse -> ExportProjectResponse -> Bool)
-> (ExportProjectResponse -> ExportProjectResponse -> Bool)
-> Eq ExportProjectResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportProjectResponse -> ExportProjectResponse -> Bool
$c/= :: ExportProjectResponse -> ExportProjectResponse -> Bool
== :: ExportProjectResponse -> ExportProjectResponse -> Bool
$c== :: ExportProjectResponse -> ExportProjectResponse -> Bool
Prelude.Eq, ReadPrec [ExportProjectResponse]
ReadPrec ExportProjectResponse
Int -> ReadS ExportProjectResponse
ReadS [ExportProjectResponse]
(Int -> ReadS ExportProjectResponse)
-> ReadS [ExportProjectResponse]
-> ReadPrec ExportProjectResponse
-> ReadPrec [ExportProjectResponse]
-> Read ExportProjectResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportProjectResponse]
$creadListPrec :: ReadPrec [ExportProjectResponse]
readPrec :: ReadPrec ExportProjectResponse
$creadPrec :: ReadPrec ExportProjectResponse
readList :: ReadS [ExportProjectResponse]
$creadList :: ReadS [ExportProjectResponse]
readsPrec :: Int -> ReadS ExportProjectResponse
$creadsPrec :: Int -> ReadS ExportProjectResponse
Prelude.Read, Int -> ExportProjectResponse -> ShowS
[ExportProjectResponse] -> ShowS
ExportProjectResponse -> String
(Int -> ExportProjectResponse -> ShowS)
-> (ExportProjectResponse -> String)
-> ([ExportProjectResponse] -> ShowS)
-> Show ExportProjectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportProjectResponse] -> ShowS
$cshowList :: [ExportProjectResponse] -> ShowS
show :: ExportProjectResponse -> String
$cshow :: ExportProjectResponse -> String
showsPrec :: Int -> ExportProjectResponse -> ShowS
$cshowsPrec :: Int -> ExportProjectResponse -> ShowS
Prelude.Show, (forall x. ExportProjectResponse -> Rep ExportProjectResponse x)
-> (forall x. Rep ExportProjectResponse x -> ExportProjectResponse)
-> Generic ExportProjectResponse
forall x. Rep ExportProjectResponse x -> ExportProjectResponse
forall x. ExportProjectResponse -> Rep ExportProjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportProjectResponse x -> ExportProjectResponse
$cfrom :: forall x. ExportProjectResponse -> Rep ExportProjectResponse x
Prelude.Generic)
newExportProjectResponse ::
Prelude.Int ->
ExportProjectResponse
newExportProjectResponse :: Int -> ExportProjectResponse
newExportProjectResponse Int
pHttpStatus_ =
ExportProjectResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ExportProjectResponse
ExportProjectResponse'
{ $sel:shareUrl:ExportProjectResponse' :: Maybe Text
shareUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:downloadUrl:ExportProjectResponse' :: Maybe Text
downloadUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:snapshotId:ExportProjectResponse' :: Maybe Text
snapshotId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ExportProjectResponse' :: Int
httpStatus = Int
pHttpStatus_
}
exportProjectResponse_shareUrl :: Lens.Lens' ExportProjectResponse (Prelude.Maybe Prelude.Text)
exportProjectResponse_shareUrl :: (Maybe Text -> f (Maybe Text))
-> ExportProjectResponse -> f ExportProjectResponse
exportProjectResponse_shareUrl = (ExportProjectResponse -> Maybe Text)
-> (ExportProjectResponse -> Maybe Text -> ExportProjectResponse)
-> Lens
ExportProjectResponse
ExportProjectResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportProjectResponse' {Maybe Text
shareUrl :: Maybe Text
$sel:shareUrl:ExportProjectResponse' :: ExportProjectResponse -> Maybe Text
shareUrl} -> Maybe Text
shareUrl) (\s :: ExportProjectResponse
s@ExportProjectResponse' {} Maybe Text
a -> ExportProjectResponse
s {$sel:shareUrl:ExportProjectResponse' :: Maybe Text
shareUrl = Maybe Text
a} :: ExportProjectResponse)
exportProjectResponse_downloadUrl :: Lens.Lens' ExportProjectResponse (Prelude.Maybe Prelude.Text)
exportProjectResponse_downloadUrl :: (Maybe Text -> f (Maybe Text))
-> ExportProjectResponse -> f ExportProjectResponse
exportProjectResponse_downloadUrl = (ExportProjectResponse -> Maybe Text)
-> (ExportProjectResponse -> Maybe Text -> ExportProjectResponse)
-> Lens
ExportProjectResponse
ExportProjectResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportProjectResponse' {Maybe Text
downloadUrl :: Maybe Text
$sel:downloadUrl:ExportProjectResponse' :: ExportProjectResponse -> Maybe Text
downloadUrl} -> Maybe Text
downloadUrl) (\s :: ExportProjectResponse
s@ExportProjectResponse' {} Maybe Text
a -> ExportProjectResponse
s {$sel:downloadUrl:ExportProjectResponse' :: Maybe Text
downloadUrl = Maybe Text
a} :: ExportProjectResponse)
exportProjectResponse_snapshotId :: Lens.Lens' ExportProjectResponse (Prelude.Maybe Prelude.Text)
exportProjectResponse_snapshotId :: (Maybe Text -> f (Maybe Text))
-> ExportProjectResponse -> f ExportProjectResponse
exportProjectResponse_snapshotId = (ExportProjectResponse -> Maybe Text)
-> (ExportProjectResponse -> Maybe Text -> ExportProjectResponse)
-> Lens
ExportProjectResponse
ExportProjectResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportProjectResponse' {Maybe Text
snapshotId :: Maybe Text
$sel:snapshotId:ExportProjectResponse' :: ExportProjectResponse -> Maybe Text
snapshotId} -> Maybe Text
snapshotId) (\s :: ExportProjectResponse
s@ExportProjectResponse' {} Maybe Text
a -> ExportProjectResponse
s {$sel:snapshotId:ExportProjectResponse' :: Maybe Text
snapshotId = Maybe Text
a} :: ExportProjectResponse)
exportProjectResponse_httpStatus :: Lens.Lens' ExportProjectResponse Prelude.Int
exportProjectResponse_httpStatus :: (Int -> f Int) -> ExportProjectResponse -> f ExportProjectResponse
exportProjectResponse_httpStatus = (ExportProjectResponse -> Int)
-> (ExportProjectResponse -> Int -> ExportProjectResponse)
-> Lens ExportProjectResponse ExportProjectResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportProjectResponse' {Int
httpStatus :: Int
$sel:httpStatus:ExportProjectResponse' :: ExportProjectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ExportProjectResponse
s@ExportProjectResponse' {} Int
a -> ExportProjectResponse
s {$sel:httpStatus:ExportProjectResponse' :: Int
httpStatus = Int
a} :: ExportProjectResponse)
instance Prelude.NFData ExportProjectResponse