{-# 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.GetImportJobs
(
GetImportJobs (..),
newGetImportJobs,
getImportJobs_token,
getImportJobs_pageSize,
getImportJobs_applicationId,
GetImportJobsResponse (..),
newGetImportJobsResponse,
getImportJobsResponse_httpStatus,
getImportJobsResponse_importJobsResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetImportJobs = GetImportJobs'
{
GetImportJobs -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
GetImportJobs -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
GetImportJobs -> Text
applicationId :: Prelude.Text
}
deriving (GetImportJobs -> GetImportJobs -> Bool
(GetImportJobs -> GetImportJobs -> Bool)
-> (GetImportJobs -> GetImportJobs -> Bool) -> Eq GetImportJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImportJobs -> GetImportJobs -> Bool
$c/= :: GetImportJobs -> GetImportJobs -> Bool
== :: GetImportJobs -> GetImportJobs -> Bool
$c== :: GetImportJobs -> GetImportJobs -> Bool
Prelude.Eq, ReadPrec [GetImportJobs]
ReadPrec GetImportJobs
Int -> ReadS GetImportJobs
ReadS [GetImportJobs]
(Int -> ReadS GetImportJobs)
-> ReadS [GetImportJobs]
-> ReadPrec GetImportJobs
-> ReadPrec [GetImportJobs]
-> Read GetImportJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImportJobs]
$creadListPrec :: ReadPrec [GetImportJobs]
readPrec :: ReadPrec GetImportJobs
$creadPrec :: ReadPrec GetImportJobs
readList :: ReadS [GetImportJobs]
$creadList :: ReadS [GetImportJobs]
readsPrec :: Int -> ReadS GetImportJobs
$creadsPrec :: Int -> ReadS GetImportJobs
Prelude.Read, Int -> GetImportJobs -> ShowS
[GetImportJobs] -> ShowS
GetImportJobs -> String
(Int -> GetImportJobs -> ShowS)
-> (GetImportJobs -> String)
-> ([GetImportJobs] -> ShowS)
-> Show GetImportJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImportJobs] -> ShowS
$cshowList :: [GetImportJobs] -> ShowS
show :: GetImportJobs -> String
$cshow :: GetImportJobs -> String
showsPrec :: Int -> GetImportJobs -> ShowS
$cshowsPrec :: Int -> GetImportJobs -> ShowS
Prelude.Show, (forall x. GetImportJobs -> Rep GetImportJobs x)
-> (forall x. Rep GetImportJobs x -> GetImportJobs)
-> Generic GetImportJobs
forall x. Rep GetImportJobs x -> GetImportJobs
forall x. GetImportJobs -> Rep GetImportJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetImportJobs x -> GetImportJobs
$cfrom :: forall x. GetImportJobs -> Rep GetImportJobs x
Prelude.Generic)
newGetImportJobs ::
Prelude.Text ->
GetImportJobs
newGetImportJobs :: Text -> GetImportJobs
newGetImportJobs Text
pApplicationId_ =
GetImportJobs' :: Maybe Text -> Maybe Text -> Text -> GetImportJobs
GetImportJobs'
{ $sel:token:GetImportJobs' :: Maybe Text
token = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:GetImportJobs' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:applicationId:GetImportJobs' :: Text
applicationId = Text
pApplicationId_
}
getImportJobs_token :: Lens.Lens' GetImportJobs (Prelude.Maybe Prelude.Text)
getImportJobs_token :: (Maybe Text -> f (Maybe Text)) -> GetImportJobs -> f GetImportJobs
getImportJobs_token = (GetImportJobs -> Maybe Text)
-> (GetImportJobs -> Maybe Text -> GetImportJobs)
-> Lens GetImportJobs GetImportJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJobs' {Maybe Text
token :: Maybe Text
$sel:token:GetImportJobs' :: GetImportJobs -> Maybe Text
token} -> Maybe Text
token) (\s :: GetImportJobs
s@GetImportJobs' {} Maybe Text
a -> GetImportJobs
s {$sel:token:GetImportJobs' :: Maybe Text
token = Maybe Text
a} :: GetImportJobs)
getImportJobs_pageSize :: Lens.Lens' GetImportJobs (Prelude.Maybe Prelude.Text)
getImportJobs_pageSize :: (Maybe Text -> f (Maybe Text)) -> GetImportJobs -> f GetImportJobs
getImportJobs_pageSize = (GetImportJobs -> Maybe Text)
-> (GetImportJobs -> Maybe Text -> GetImportJobs)
-> Lens GetImportJobs GetImportJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJobs' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetImportJobs' :: GetImportJobs -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetImportJobs
s@GetImportJobs' {} Maybe Text
a -> GetImportJobs
s {$sel:pageSize:GetImportJobs' :: Maybe Text
pageSize = Maybe Text
a} :: GetImportJobs)
getImportJobs_applicationId :: Lens.Lens' GetImportJobs Prelude.Text
getImportJobs_applicationId :: (Text -> f Text) -> GetImportJobs -> f GetImportJobs
getImportJobs_applicationId = (GetImportJobs -> Text)
-> (GetImportJobs -> Text -> GetImportJobs)
-> Lens GetImportJobs GetImportJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJobs' {Text
applicationId :: Text
$sel:applicationId:GetImportJobs' :: GetImportJobs -> Text
applicationId} -> Text
applicationId) (\s :: GetImportJobs
s@GetImportJobs' {} Text
a -> GetImportJobs
s {$sel:applicationId:GetImportJobs' :: Text
applicationId = Text
a} :: GetImportJobs)
instance Core.AWSRequest GetImportJobs where
type
AWSResponse GetImportJobs =
GetImportJobsResponse
request :: GetImportJobs -> Request GetImportJobs
request = Service -> GetImportJobs -> Request GetImportJobs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetImportJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImportJobs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetImportJobs))
-> Logger
-> Service
-> Proxy GetImportJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImportJobs)))
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 ->
Int -> ImportJobsResponse -> GetImportJobsResponse
GetImportJobsResponse'
(Int -> ImportJobsResponse -> GetImportJobsResponse)
-> Either String Int
-> Either String (ImportJobsResponse -> GetImportJobsResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (ImportJobsResponse -> GetImportJobsResponse)
-> Either String ImportJobsResponse
-> Either String GetImportJobsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ImportJobsResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetImportJobs
instance Prelude.NFData GetImportJobs
instance Core.ToHeaders GetImportJobs where
toHeaders :: GetImportJobs -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetImportJobs -> 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 GetImportJobs where
toPath :: GetImportJobs -> ByteString
toPath GetImportJobs' {Maybe Text
Text
applicationId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:applicationId:GetImportJobs' :: GetImportJobs -> Text
$sel:pageSize:GetImportJobs' :: GetImportJobs -> Maybe Text
$sel:token:GetImportJobs' :: GetImportJobs -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/jobs/import"
]
instance Core.ToQuery GetImportJobs where
toQuery :: GetImportJobs -> QueryString
toQuery GetImportJobs' {Maybe Text
Text
applicationId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:applicationId:GetImportJobs' :: GetImportJobs -> Text
$sel:pageSize:GetImportJobs' :: GetImportJobs -> Maybe Text
$sel:token:GetImportJobs' :: GetImportJobs -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
token, ByteString
"page-size" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pageSize]
data GetImportJobsResponse = GetImportJobsResponse'
{
GetImportJobsResponse -> Int
httpStatus :: Prelude.Int,
GetImportJobsResponse -> ImportJobsResponse
importJobsResponse :: ImportJobsResponse
}
deriving (GetImportJobsResponse -> GetImportJobsResponse -> Bool
(GetImportJobsResponse -> GetImportJobsResponse -> Bool)
-> (GetImportJobsResponse -> GetImportJobsResponse -> Bool)
-> Eq GetImportJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImportJobsResponse -> GetImportJobsResponse -> Bool
$c/= :: GetImportJobsResponse -> GetImportJobsResponse -> Bool
== :: GetImportJobsResponse -> GetImportJobsResponse -> Bool
$c== :: GetImportJobsResponse -> GetImportJobsResponse -> Bool
Prelude.Eq, ReadPrec [GetImportJobsResponse]
ReadPrec GetImportJobsResponse
Int -> ReadS GetImportJobsResponse
ReadS [GetImportJobsResponse]
(Int -> ReadS GetImportJobsResponse)
-> ReadS [GetImportJobsResponse]
-> ReadPrec GetImportJobsResponse
-> ReadPrec [GetImportJobsResponse]
-> Read GetImportJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImportJobsResponse]
$creadListPrec :: ReadPrec [GetImportJobsResponse]
readPrec :: ReadPrec GetImportJobsResponse
$creadPrec :: ReadPrec GetImportJobsResponse
readList :: ReadS [GetImportJobsResponse]
$creadList :: ReadS [GetImportJobsResponse]
readsPrec :: Int -> ReadS GetImportJobsResponse
$creadsPrec :: Int -> ReadS GetImportJobsResponse
Prelude.Read, Int -> GetImportJobsResponse -> ShowS
[GetImportJobsResponse] -> ShowS
GetImportJobsResponse -> String
(Int -> GetImportJobsResponse -> ShowS)
-> (GetImportJobsResponse -> String)
-> ([GetImportJobsResponse] -> ShowS)
-> Show GetImportJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImportJobsResponse] -> ShowS
$cshowList :: [GetImportJobsResponse] -> ShowS
show :: GetImportJobsResponse -> String
$cshow :: GetImportJobsResponse -> String
showsPrec :: Int -> GetImportJobsResponse -> ShowS
$cshowsPrec :: Int -> GetImportJobsResponse -> ShowS
Prelude.Show, (forall x. GetImportJobsResponse -> Rep GetImportJobsResponse x)
-> (forall x. Rep GetImportJobsResponse x -> GetImportJobsResponse)
-> Generic GetImportJobsResponse
forall x. Rep GetImportJobsResponse x -> GetImportJobsResponse
forall x. GetImportJobsResponse -> Rep GetImportJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetImportJobsResponse x -> GetImportJobsResponse
$cfrom :: forall x. GetImportJobsResponse -> Rep GetImportJobsResponse x
Prelude.Generic)
newGetImportJobsResponse ::
Prelude.Int ->
ImportJobsResponse ->
GetImportJobsResponse
newGetImportJobsResponse :: Int -> ImportJobsResponse -> GetImportJobsResponse
newGetImportJobsResponse
Int
pHttpStatus_
ImportJobsResponse
pImportJobsResponse_ =
GetImportJobsResponse' :: Int -> ImportJobsResponse -> GetImportJobsResponse
GetImportJobsResponse'
{ $sel:httpStatus:GetImportJobsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:importJobsResponse:GetImportJobsResponse' :: ImportJobsResponse
importJobsResponse = ImportJobsResponse
pImportJobsResponse_
}
getImportJobsResponse_httpStatus :: Lens.Lens' GetImportJobsResponse Prelude.Int
getImportJobsResponse_httpStatus :: (Int -> f Int) -> GetImportJobsResponse -> f GetImportJobsResponse
getImportJobsResponse_httpStatus = (GetImportJobsResponse -> Int)
-> (GetImportJobsResponse -> Int -> GetImportJobsResponse)
-> Lens GetImportJobsResponse GetImportJobsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJobsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetImportJobsResponse' :: GetImportJobsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetImportJobsResponse
s@GetImportJobsResponse' {} Int
a -> GetImportJobsResponse
s {$sel:httpStatus:GetImportJobsResponse' :: Int
httpStatus = Int
a} :: GetImportJobsResponse)
getImportJobsResponse_importJobsResponse :: Lens.Lens' GetImportJobsResponse ImportJobsResponse
getImportJobsResponse_importJobsResponse :: (ImportJobsResponse -> f ImportJobsResponse)
-> GetImportJobsResponse -> f GetImportJobsResponse
getImportJobsResponse_importJobsResponse = (GetImportJobsResponse -> ImportJobsResponse)
-> (GetImportJobsResponse
-> ImportJobsResponse -> GetImportJobsResponse)
-> Lens
GetImportJobsResponse
GetImportJobsResponse
ImportJobsResponse
ImportJobsResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJobsResponse' {ImportJobsResponse
importJobsResponse :: ImportJobsResponse
$sel:importJobsResponse:GetImportJobsResponse' :: GetImportJobsResponse -> ImportJobsResponse
importJobsResponse} -> ImportJobsResponse
importJobsResponse) (\s :: GetImportJobsResponse
s@GetImportJobsResponse' {} ImportJobsResponse
a -> GetImportJobsResponse
s {$sel:importJobsResponse:GetImportJobsResponse' :: ImportJobsResponse
importJobsResponse = ImportJobsResponse
a} :: GetImportJobsResponse)
instance Prelude.NFData GetImportJobsResponse