{-# 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.Pinpoint.CreateExportJob
(
CreateExportJob (..),
newCreateExportJob,
createExportJob_applicationId,
createExportJob_exportJobRequest,
CreateExportJobResponse (..),
newCreateExportJobResponse,
createExportJobResponse_httpStatus,
createExportJobResponse_exportJobResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateExportJob = CreateExportJob'
{
CreateExportJob -> Text
applicationId :: Prelude.Text,
CreateExportJob -> ExportJobRequest
exportJobRequest :: ExportJobRequest
}
deriving (CreateExportJob -> CreateExportJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateExportJob -> CreateExportJob -> Bool
$c/= :: CreateExportJob -> CreateExportJob -> Bool
== :: CreateExportJob -> CreateExportJob -> Bool
$c== :: CreateExportJob -> CreateExportJob -> Bool
Prelude.Eq, ReadPrec [CreateExportJob]
ReadPrec CreateExportJob
Int -> ReadS CreateExportJob
ReadS [CreateExportJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateExportJob]
$creadListPrec :: ReadPrec [CreateExportJob]
readPrec :: ReadPrec CreateExportJob
$creadPrec :: ReadPrec CreateExportJob
readList :: ReadS [CreateExportJob]
$creadList :: ReadS [CreateExportJob]
readsPrec :: Int -> ReadS CreateExportJob
$creadsPrec :: Int -> ReadS CreateExportJob
Prelude.Read, Int -> CreateExportJob -> ShowS
[CreateExportJob] -> ShowS
CreateExportJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateExportJob] -> ShowS
$cshowList :: [CreateExportJob] -> ShowS
show :: CreateExportJob -> String
$cshow :: CreateExportJob -> String
showsPrec :: Int -> CreateExportJob -> ShowS
$cshowsPrec :: Int -> CreateExportJob -> ShowS
Prelude.Show, forall x. Rep CreateExportJob x -> CreateExportJob
forall x. CreateExportJob -> Rep CreateExportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateExportJob x -> CreateExportJob
$cfrom :: forall x. CreateExportJob -> Rep CreateExportJob x
Prelude.Generic)
newCreateExportJob ::
Prelude.Text ->
ExportJobRequest ->
CreateExportJob
newCreateExportJob :: Text -> ExportJobRequest -> CreateExportJob
newCreateExportJob Text
pApplicationId_ ExportJobRequest
pExportJobRequest_ =
CreateExportJob'
{ $sel:applicationId:CreateExportJob' :: Text
applicationId = Text
pApplicationId_,
$sel:exportJobRequest:CreateExportJob' :: ExportJobRequest
exportJobRequest = ExportJobRequest
pExportJobRequest_
}
createExportJob_applicationId :: Lens.Lens' CreateExportJob Prelude.Text
createExportJob_applicationId :: Lens' CreateExportJob Text
createExportJob_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExportJob' {Text
applicationId :: Text
$sel:applicationId:CreateExportJob' :: CreateExportJob -> Text
applicationId} -> Text
applicationId) (\s :: CreateExportJob
s@CreateExportJob' {} Text
a -> CreateExportJob
s {$sel:applicationId:CreateExportJob' :: Text
applicationId = Text
a} :: CreateExportJob)
createExportJob_exportJobRequest :: Lens.Lens' CreateExportJob ExportJobRequest
createExportJob_exportJobRequest :: Lens' CreateExportJob ExportJobRequest
createExportJob_exportJobRequest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExportJob' {ExportJobRequest
exportJobRequest :: ExportJobRequest
$sel:exportJobRequest:CreateExportJob' :: CreateExportJob -> ExportJobRequest
exportJobRequest} -> ExportJobRequest
exportJobRequest) (\s :: CreateExportJob
s@CreateExportJob' {} ExportJobRequest
a -> CreateExportJob
s {$sel:exportJobRequest:CreateExportJob' :: ExportJobRequest
exportJobRequest = ExportJobRequest
a} :: CreateExportJob)
instance Core.AWSRequest CreateExportJob where
type
AWSResponse CreateExportJob =
CreateExportJobResponse
request :: (Service -> Service) -> CreateExportJob -> Request CreateExportJob
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateExportJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateExportJob)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> ExportJobResponse -> CreateExportJobResponse
CreateExportJobResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
)
instance Prelude.Hashable CreateExportJob where
hashWithSalt :: Int -> CreateExportJob -> Int
hashWithSalt Int
_salt CreateExportJob' {Text
ExportJobRequest
exportJobRequest :: ExportJobRequest
applicationId :: Text
$sel:exportJobRequest:CreateExportJob' :: CreateExportJob -> ExportJobRequest
$sel:applicationId:CreateExportJob' :: CreateExportJob -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ExportJobRequest
exportJobRequest
instance Prelude.NFData CreateExportJob where
rnf :: CreateExportJob -> ()
rnf CreateExportJob' {Text
ExportJobRequest
exportJobRequest :: ExportJobRequest
applicationId :: Text
$sel:exportJobRequest:CreateExportJob' :: CreateExportJob -> ExportJobRequest
$sel:applicationId:CreateExportJob' :: CreateExportJob -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ExportJobRequest
exportJobRequest
instance Data.ToHeaders CreateExportJob where
toHeaders :: CreateExportJob -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateExportJob where
toJSON :: CreateExportJob -> Value
toJSON CreateExportJob' {Text
ExportJobRequest
exportJobRequest :: ExportJobRequest
applicationId :: Text
$sel:exportJobRequest:CreateExportJob' :: CreateExportJob -> ExportJobRequest
$sel:applicationId:CreateExportJob' :: CreateExportJob -> Text
..} =
forall a. ToJSON a => a -> Value
Data.toJSON ExportJobRequest
exportJobRequest
instance Data.ToPath CreateExportJob where
toPath :: CreateExportJob -> ByteString
toPath CreateExportJob' {Text
ExportJobRequest
exportJobRequest :: ExportJobRequest
applicationId :: Text
$sel:exportJobRequest:CreateExportJob' :: CreateExportJob -> ExportJobRequest
$sel:applicationId:CreateExportJob' :: CreateExportJob -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
ByteString
"/jobs/export"
]
instance Data.ToQuery CreateExportJob where
toQuery :: CreateExportJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateExportJobResponse = CreateExportJobResponse'
{
CreateExportJobResponse -> Int
httpStatus :: Prelude.Int,
CreateExportJobResponse -> ExportJobResponse
exportJobResponse :: ExportJobResponse
}
deriving (CreateExportJobResponse -> CreateExportJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateExportJobResponse -> CreateExportJobResponse -> Bool
$c/= :: CreateExportJobResponse -> CreateExportJobResponse -> Bool
== :: CreateExportJobResponse -> CreateExportJobResponse -> Bool
$c== :: CreateExportJobResponse -> CreateExportJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateExportJobResponse]
ReadPrec CreateExportJobResponse
Int -> ReadS CreateExportJobResponse
ReadS [CreateExportJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateExportJobResponse]
$creadListPrec :: ReadPrec [CreateExportJobResponse]
readPrec :: ReadPrec CreateExportJobResponse
$creadPrec :: ReadPrec CreateExportJobResponse
readList :: ReadS [CreateExportJobResponse]
$creadList :: ReadS [CreateExportJobResponse]
readsPrec :: Int -> ReadS CreateExportJobResponse
$creadsPrec :: Int -> ReadS CreateExportJobResponse
Prelude.Read, Int -> CreateExportJobResponse -> ShowS
[CreateExportJobResponse] -> ShowS
CreateExportJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateExportJobResponse] -> ShowS
$cshowList :: [CreateExportJobResponse] -> ShowS
show :: CreateExportJobResponse -> String
$cshow :: CreateExportJobResponse -> String
showsPrec :: Int -> CreateExportJobResponse -> ShowS
$cshowsPrec :: Int -> CreateExportJobResponse -> ShowS
Prelude.Show, forall x. Rep CreateExportJobResponse x -> CreateExportJobResponse
forall x. CreateExportJobResponse -> Rep CreateExportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateExportJobResponse x -> CreateExportJobResponse
$cfrom :: forall x. CreateExportJobResponse -> Rep CreateExportJobResponse x
Prelude.Generic)
newCreateExportJobResponse ::
Prelude.Int ->
ExportJobResponse ->
CreateExportJobResponse
newCreateExportJobResponse :: Int -> ExportJobResponse -> CreateExportJobResponse
newCreateExportJobResponse
Int
pHttpStatus_
ExportJobResponse
pExportJobResponse_ =
CreateExportJobResponse'
{ $sel:httpStatus:CreateExportJobResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:exportJobResponse:CreateExportJobResponse' :: ExportJobResponse
exportJobResponse = ExportJobResponse
pExportJobResponse_
}
createExportJobResponse_httpStatus :: Lens.Lens' CreateExportJobResponse Prelude.Int
createExportJobResponse_httpStatus :: Lens' CreateExportJobResponse Int
createExportJobResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExportJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateExportJobResponse' :: CreateExportJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateExportJobResponse
s@CreateExportJobResponse' {} Int
a -> CreateExportJobResponse
s {$sel:httpStatus:CreateExportJobResponse' :: Int
httpStatus = Int
a} :: CreateExportJobResponse)
createExportJobResponse_exportJobResponse :: Lens.Lens' CreateExportJobResponse ExportJobResponse
createExportJobResponse_exportJobResponse :: Lens' CreateExportJobResponse ExportJobResponse
createExportJobResponse_exportJobResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateExportJobResponse' {ExportJobResponse
exportJobResponse :: ExportJobResponse
$sel:exportJobResponse:CreateExportJobResponse' :: CreateExportJobResponse -> ExportJobResponse
exportJobResponse} -> ExportJobResponse
exportJobResponse) (\s :: CreateExportJobResponse
s@CreateExportJobResponse' {} ExportJobResponse
a -> CreateExportJobResponse
s {$sel:exportJobResponse:CreateExportJobResponse' :: ExportJobResponse
exportJobResponse = ExportJobResponse
a} :: CreateExportJobResponse)
instance Prelude.NFData CreateExportJobResponse where
rnf :: CreateExportJobResponse -> ()
rnf CreateExportJobResponse' {Int
ExportJobResponse
exportJobResponse :: ExportJobResponse
httpStatus :: Int
$sel:exportJobResponse:CreateExportJobResponse' :: CreateExportJobResponse -> ExportJobResponse
$sel:httpStatus:CreateExportJobResponse' :: CreateExportJobResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ExportJobResponse
exportJobResponse