{-# 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.GetSegmentImportJobs
(
GetSegmentImportJobs (..),
newGetSegmentImportJobs,
getSegmentImportJobs_token,
getSegmentImportJobs_pageSize,
getSegmentImportJobs_segmentId,
getSegmentImportJobs_applicationId,
GetSegmentImportJobsResponse (..),
newGetSegmentImportJobsResponse,
getSegmentImportJobsResponse_httpStatus,
getSegmentImportJobsResponse_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 GetSegmentImportJobs = GetSegmentImportJobs'
{
GetSegmentImportJobs -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
GetSegmentImportJobs -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
GetSegmentImportJobs -> Text
segmentId :: Prelude.Text,
GetSegmentImportJobs -> Text
applicationId :: Prelude.Text
}
deriving (GetSegmentImportJobs -> GetSegmentImportJobs -> Bool
(GetSegmentImportJobs -> GetSegmentImportJobs -> Bool)
-> (GetSegmentImportJobs -> GetSegmentImportJobs -> Bool)
-> Eq GetSegmentImportJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentImportJobs -> GetSegmentImportJobs -> Bool
$c/= :: GetSegmentImportJobs -> GetSegmentImportJobs -> Bool
== :: GetSegmentImportJobs -> GetSegmentImportJobs -> Bool
$c== :: GetSegmentImportJobs -> GetSegmentImportJobs -> Bool
Prelude.Eq, ReadPrec [GetSegmentImportJobs]
ReadPrec GetSegmentImportJobs
Int -> ReadS GetSegmentImportJobs
ReadS [GetSegmentImportJobs]
(Int -> ReadS GetSegmentImportJobs)
-> ReadS [GetSegmentImportJobs]
-> ReadPrec GetSegmentImportJobs
-> ReadPrec [GetSegmentImportJobs]
-> Read GetSegmentImportJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentImportJobs]
$creadListPrec :: ReadPrec [GetSegmentImportJobs]
readPrec :: ReadPrec GetSegmentImportJobs
$creadPrec :: ReadPrec GetSegmentImportJobs
readList :: ReadS [GetSegmentImportJobs]
$creadList :: ReadS [GetSegmentImportJobs]
readsPrec :: Int -> ReadS GetSegmentImportJobs
$creadsPrec :: Int -> ReadS GetSegmentImportJobs
Prelude.Read, Int -> GetSegmentImportJobs -> ShowS
[GetSegmentImportJobs] -> ShowS
GetSegmentImportJobs -> String
(Int -> GetSegmentImportJobs -> ShowS)
-> (GetSegmentImportJobs -> String)
-> ([GetSegmentImportJobs] -> ShowS)
-> Show GetSegmentImportJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentImportJobs] -> ShowS
$cshowList :: [GetSegmentImportJobs] -> ShowS
show :: GetSegmentImportJobs -> String
$cshow :: GetSegmentImportJobs -> String
showsPrec :: Int -> GetSegmentImportJobs -> ShowS
$cshowsPrec :: Int -> GetSegmentImportJobs -> ShowS
Prelude.Show, (forall x. GetSegmentImportJobs -> Rep GetSegmentImportJobs x)
-> (forall x. Rep GetSegmentImportJobs x -> GetSegmentImportJobs)
-> Generic GetSegmentImportJobs
forall x. Rep GetSegmentImportJobs x -> GetSegmentImportJobs
forall x. GetSegmentImportJobs -> Rep GetSegmentImportJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSegmentImportJobs x -> GetSegmentImportJobs
$cfrom :: forall x. GetSegmentImportJobs -> Rep GetSegmentImportJobs x
Prelude.Generic)
newGetSegmentImportJobs ::
Prelude.Text ->
Prelude.Text ->
GetSegmentImportJobs
newGetSegmentImportJobs :: Text -> Text -> GetSegmentImportJobs
newGetSegmentImportJobs Text
pSegmentId_ Text
pApplicationId_ =
GetSegmentImportJobs' :: Maybe Text -> Maybe Text -> Text -> Text -> GetSegmentImportJobs
GetSegmentImportJobs'
{ $sel:token:GetSegmentImportJobs' :: Maybe Text
token = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:GetSegmentImportJobs' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:segmentId:GetSegmentImportJobs' :: Text
segmentId = Text
pSegmentId_,
$sel:applicationId:GetSegmentImportJobs' :: Text
applicationId = Text
pApplicationId_
}
getSegmentImportJobs_token :: Lens.Lens' GetSegmentImportJobs (Prelude.Maybe Prelude.Text)
getSegmentImportJobs_token :: (Maybe Text -> f (Maybe Text))
-> GetSegmentImportJobs -> f GetSegmentImportJobs
getSegmentImportJobs_token = (GetSegmentImportJobs -> Maybe Text)
-> (GetSegmentImportJobs -> Maybe Text -> GetSegmentImportJobs)
-> Lens
GetSegmentImportJobs GetSegmentImportJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentImportJobs' {Maybe Text
token :: Maybe Text
$sel:token:GetSegmentImportJobs' :: GetSegmentImportJobs -> Maybe Text
token} -> Maybe Text
token) (\s :: GetSegmentImportJobs
s@GetSegmentImportJobs' {} Maybe Text
a -> GetSegmentImportJobs
s {$sel:token:GetSegmentImportJobs' :: Maybe Text
token = Maybe Text
a} :: GetSegmentImportJobs)
getSegmentImportJobs_pageSize :: Lens.Lens' GetSegmentImportJobs (Prelude.Maybe Prelude.Text)
getSegmentImportJobs_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetSegmentImportJobs -> f GetSegmentImportJobs
getSegmentImportJobs_pageSize = (GetSegmentImportJobs -> Maybe Text)
-> (GetSegmentImportJobs -> Maybe Text -> GetSegmentImportJobs)
-> Lens
GetSegmentImportJobs GetSegmentImportJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentImportJobs' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetSegmentImportJobs' :: GetSegmentImportJobs -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetSegmentImportJobs
s@GetSegmentImportJobs' {} Maybe Text
a -> GetSegmentImportJobs
s {$sel:pageSize:GetSegmentImportJobs' :: Maybe Text
pageSize = Maybe Text
a} :: GetSegmentImportJobs)
getSegmentImportJobs_segmentId :: Lens.Lens' GetSegmentImportJobs Prelude.Text
getSegmentImportJobs_segmentId :: (Text -> f Text) -> GetSegmentImportJobs -> f GetSegmentImportJobs
getSegmentImportJobs_segmentId = (GetSegmentImportJobs -> Text)
-> (GetSegmentImportJobs -> Text -> GetSegmentImportJobs)
-> Lens GetSegmentImportJobs GetSegmentImportJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentImportJobs' {Text
segmentId :: Text
$sel:segmentId:GetSegmentImportJobs' :: GetSegmentImportJobs -> Text
segmentId} -> Text
segmentId) (\s :: GetSegmentImportJobs
s@GetSegmentImportJobs' {} Text
a -> GetSegmentImportJobs
s {$sel:segmentId:GetSegmentImportJobs' :: Text
segmentId = Text
a} :: GetSegmentImportJobs)
getSegmentImportJobs_applicationId :: Lens.Lens' GetSegmentImportJobs Prelude.Text
getSegmentImportJobs_applicationId :: (Text -> f Text) -> GetSegmentImportJobs -> f GetSegmentImportJobs
getSegmentImportJobs_applicationId = (GetSegmentImportJobs -> Text)
-> (GetSegmentImportJobs -> Text -> GetSegmentImportJobs)
-> Lens GetSegmentImportJobs GetSegmentImportJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentImportJobs' {Text
applicationId :: Text
$sel:applicationId:GetSegmentImportJobs' :: GetSegmentImportJobs -> Text
applicationId} -> Text
applicationId) (\s :: GetSegmentImportJobs
s@GetSegmentImportJobs' {} Text
a -> GetSegmentImportJobs
s {$sel:applicationId:GetSegmentImportJobs' :: Text
applicationId = Text
a} :: GetSegmentImportJobs)
instance Core.AWSRequest GetSegmentImportJobs where
type
AWSResponse GetSegmentImportJobs =
GetSegmentImportJobsResponse
request :: GetSegmentImportJobs -> Request GetSegmentImportJobs
request = Service -> GetSegmentImportJobs -> Request GetSegmentImportJobs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetSegmentImportJobs
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSegmentImportJobs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSegmentImportJobs))
-> Logger
-> Service
-> Proxy GetSegmentImportJobs
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSegmentImportJobs)))
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 -> GetSegmentImportJobsResponse
GetSegmentImportJobsResponse'
(Int -> ImportJobsResponse -> GetSegmentImportJobsResponse)
-> Either String Int
-> Either
String (ImportJobsResponse -> GetSegmentImportJobsResponse)
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 -> GetSegmentImportJobsResponse)
-> Either String ImportJobsResponse
-> Either String GetSegmentImportJobsResponse
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 GetSegmentImportJobs
instance Prelude.NFData GetSegmentImportJobs
instance Core.ToHeaders GetSegmentImportJobs where
toHeaders :: GetSegmentImportJobs -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSegmentImportJobs -> 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 GetSegmentImportJobs where
toPath :: GetSegmentImportJobs -> ByteString
toPath GetSegmentImportJobs' {Maybe Text
Text
applicationId :: Text
segmentId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:applicationId:GetSegmentImportJobs' :: GetSegmentImportJobs -> Text
$sel:segmentId:GetSegmentImportJobs' :: GetSegmentImportJobs -> Text
$sel:pageSize:GetSegmentImportJobs' :: GetSegmentImportJobs -> Maybe Text
$sel:token:GetSegmentImportJobs' :: GetSegmentImportJobs -> 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
"/segments/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
segmentId,
ByteString
"/jobs/import"
]
instance Core.ToQuery GetSegmentImportJobs where
toQuery :: GetSegmentImportJobs -> QueryString
toQuery GetSegmentImportJobs' {Maybe Text
Text
applicationId :: Text
segmentId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:applicationId:GetSegmentImportJobs' :: GetSegmentImportJobs -> Text
$sel:segmentId:GetSegmentImportJobs' :: GetSegmentImportJobs -> Text
$sel:pageSize:GetSegmentImportJobs' :: GetSegmentImportJobs -> Maybe Text
$sel:token:GetSegmentImportJobs' :: GetSegmentImportJobs -> 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 GetSegmentImportJobsResponse = GetSegmentImportJobsResponse'
{
GetSegmentImportJobsResponse -> Int
httpStatus :: Prelude.Int,
GetSegmentImportJobsResponse -> ImportJobsResponse
importJobsResponse :: ImportJobsResponse
}
deriving (GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool
(GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool)
-> (GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool)
-> Eq GetSegmentImportJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool
$c/= :: GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool
== :: GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool
$c== :: GetSegmentImportJobsResponse
-> GetSegmentImportJobsResponse -> Bool
Prelude.Eq, ReadPrec [GetSegmentImportJobsResponse]
ReadPrec GetSegmentImportJobsResponse
Int -> ReadS GetSegmentImportJobsResponse
ReadS [GetSegmentImportJobsResponse]
(Int -> ReadS GetSegmentImportJobsResponse)
-> ReadS [GetSegmentImportJobsResponse]
-> ReadPrec GetSegmentImportJobsResponse
-> ReadPrec [GetSegmentImportJobsResponse]
-> Read GetSegmentImportJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentImportJobsResponse]
$creadListPrec :: ReadPrec [GetSegmentImportJobsResponse]
readPrec :: ReadPrec GetSegmentImportJobsResponse
$creadPrec :: ReadPrec GetSegmentImportJobsResponse
readList :: ReadS [GetSegmentImportJobsResponse]
$creadList :: ReadS [GetSegmentImportJobsResponse]
readsPrec :: Int -> ReadS GetSegmentImportJobsResponse
$creadsPrec :: Int -> ReadS GetSegmentImportJobsResponse
Prelude.Read, Int -> GetSegmentImportJobsResponse -> ShowS
[GetSegmentImportJobsResponse] -> ShowS
GetSegmentImportJobsResponse -> String
(Int -> GetSegmentImportJobsResponse -> ShowS)
-> (GetSegmentImportJobsResponse -> String)
-> ([GetSegmentImportJobsResponse] -> ShowS)
-> Show GetSegmentImportJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentImportJobsResponse] -> ShowS
$cshowList :: [GetSegmentImportJobsResponse] -> ShowS
show :: GetSegmentImportJobsResponse -> String
$cshow :: GetSegmentImportJobsResponse -> String
showsPrec :: Int -> GetSegmentImportJobsResponse -> ShowS
$cshowsPrec :: Int -> GetSegmentImportJobsResponse -> ShowS
Prelude.Show, (forall x.
GetSegmentImportJobsResponse -> Rep GetSegmentImportJobsResponse x)
-> (forall x.
Rep GetSegmentImportJobsResponse x -> GetSegmentImportJobsResponse)
-> Generic GetSegmentImportJobsResponse
forall x.
Rep GetSegmentImportJobsResponse x -> GetSegmentImportJobsResponse
forall x.
GetSegmentImportJobsResponse -> Rep GetSegmentImportJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSegmentImportJobsResponse x -> GetSegmentImportJobsResponse
$cfrom :: forall x.
GetSegmentImportJobsResponse -> Rep GetSegmentImportJobsResponse x
Prelude.Generic)
newGetSegmentImportJobsResponse ::
Prelude.Int ->
ImportJobsResponse ->
GetSegmentImportJobsResponse
newGetSegmentImportJobsResponse :: Int -> ImportJobsResponse -> GetSegmentImportJobsResponse
newGetSegmentImportJobsResponse
Int
pHttpStatus_
ImportJobsResponse
pImportJobsResponse_ =
GetSegmentImportJobsResponse' :: Int -> ImportJobsResponse -> GetSegmentImportJobsResponse
GetSegmentImportJobsResponse'
{ $sel:httpStatus:GetSegmentImportJobsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:importJobsResponse:GetSegmentImportJobsResponse' :: ImportJobsResponse
importJobsResponse = ImportJobsResponse
pImportJobsResponse_
}
getSegmentImportJobsResponse_httpStatus :: Lens.Lens' GetSegmentImportJobsResponse Prelude.Int
getSegmentImportJobsResponse_httpStatus :: (Int -> f Int)
-> GetSegmentImportJobsResponse -> f GetSegmentImportJobsResponse
getSegmentImportJobsResponse_httpStatus = (GetSegmentImportJobsResponse -> Int)
-> (GetSegmentImportJobsResponse
-> Int -> GetSegmentImportJobsResponse)
-> Lens
GetSegmentImportJobsResponse GetSegmentImportJobsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentImportJobsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSegmentImportJobsResponse' :: GetSegmentImportJobsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSegmentImportJobsResponse
s@GetSegmentImportJobsResponse' {} Int
a -> GetSegmentImportJobsResponse
s {$sel:httpStatus:GetSegmentImportJobsResponse' :: Int
httpStatus = Int
a} :: GetSegmentImportJobsResponse)
getSegmentImportJobsResponse_importJobsResponse :: Lens.Lens' GetSegmentImportJobsResponse ImportJobsResponse
getSegmentImportJobsResponse_importJobsResponse :: (ImportJobsResponse -> f ImportJobsResponse)
-> GetSegmentImportJobsResponse -> f GetSegmentImportJobsResponse
getSegmentImportJobsResponse_importJobsResponse = (GetSegmentImportJobsResponse -> ImportJobsResponse)
-> (GetSegmentImportJobsResponse
-> ImportJobsResponse -> GetSegmentImportJobsResponse)
-> Lens
GetSegmentImportJobsResponse
GetSegmentImportJobsResponse
ImportJobsResponse
ImportJobsResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentImportJobsResponse' {ImportJobsResponse
importJobsResponse :: ImportJobsResponse
$sel:importJobsResponse:GetSegmentImportJobsResponse' :: GetSegmentImportJobsResponse -> ImportJobsResponse
importJobsResponse} -> ImportJobsResponse
importJobsResponse) (\s :: GetSegmentImportJobsResponse
s@GetSegmentImportJobsResponse' {} ImportJobsResponse
a -> GetSegmentImportJobsResponse
s {$sel:importJobsResponse:GetSegmentImportJobsResponse' :: ImportJobsResponse
importJobsResponse = ImportJobsResponse
a} :: GetSegmentImportJobsResponse)
instance Prelude.NFData GetSegmentImportJobsResponse