{-# 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.SMS.GetReplicationJobs
(
GetReplicationJobs (..),
newGetReplicationJobs,
getReplicationJobs_maxResults,
getReplicationJobs_nextToken,
getReplicationJobs_replicationJobId,
GetReplicationJobsResponse (..),
newGetReplicationJobsResponse,
getReplicationJobsResponse_nextToken,
getReplicationJobsResponse_replicationJobList,
getReplicationJobsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SMS.Types
data GetReplicationJobs = GetReplicationJobs'
{
GetReplicationJobs -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
GetReplicationJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetReplicationJobs -> Maybe Text
replicationJobId :: Prelude.Maybe Prelude.Text
}
deriving (GetReplicationJobs -> GetReplicationJobs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReplicationJobs -> GetReplicationJobs -> Bool
$c/= :: GetReplicationJobs -> GetReplicationJobs -> Bool
== :: GetReplicationJobs -> GetReplicationJobs -> Bool
$c== :: GetReplicationJobs -> GetReplicationJobs -> Bool
Prelude.Eq, ReadPrec [GetReplicationJobs]
ReadPrec GetReplicationJobs
Int -> ReadS GetReplicationJobs
ReadS [GetReplicationJobs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReplicationJobs]
$creadListPrec :: ReadPrec [GetReplicationJobs]
readPrec :: ReadPrec GetReplicationJobs
$creadPrec :: ReadPrec GetReplicationJobs
readList :: ReadS [GetReplicationJobs]
$creadList :: ReadS [GetReplicationJobs]
readsPrec :: Int -> ReadS GetReplicationJobs
$creadsPrec :: Int -> ReadS GetReplicationJobs
Prelude.Read, Int -> GetReplicationJobs -> ShowS
[GetReplicationJobs] -> ShowS
GetReplicationJobs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReplicationJobs] -> ShowS
$cshowList :: [GetReplicationJobs] -> ShowS
show :: GetReplicationJobs -> String
$cshow :: GetReplicationJobs -> String
showsPrec :: Int -> GetReplicationJobs -> ShowS
$cshowsPrec :: Int -> GetReplicationJobs -> ShowS
Prelude.Show, forall x. Rep GetReplicationJobs x -> GetReplicationJobs
forall x. GetReplicationJobs -> Rep GetReplicationJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetReplicationJobs x -> GetReplicationJobs
$cfrom :: forall x. GetReplicationJobs -> Rep GetReplicationJobs x
Prelude.Generic)
newGetReplicationJobs ::
GetReplicationJobs
newGetReplicationJobs :: GetReplicationJobs
newGetReplicationJobs =
GetReplicationJobs'
{ $sel:maxResults:GetReplicationJobs' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetReplicationJobs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:replicationJobId:GetReplicationJobs' :: Maybe Text
replicationJobId = forall a. Maybe a
Prelude.Nothing
}
getReplicationJobs_maxResults :: Lens.Lens' GetReplicationJobs (Prelude.Maybe Prelude.Int)
getReplicationJobs_maxResults :: Lens' GetReplicationJobs (Maybe Int)
getReplicationJobs_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationJobs' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:GetReplicationJobs' :: GetReplicationJobs -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: GetReplicationJobs
s@GetReplicationJobs' {} Maybe Int
a -> GetReplicationJobs
s {$sel:maxResults:GetReplicationJobs' :: Maybe Int
maxResults = Maybe Int
a} :: GetReplicationJobs)
getReplicationJobs_nextToken :: Lens.Lens' GetReplicationJobs (Prelude.Maybe Prelude.Text)
getReplicationJobs_nextToken :: Lens' GetReplicationJobs (Maybe Text)
getReplicationJobs_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationJobs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetReplicationJobs
s@GetReplicationJobs' {} Maybe Text
a -> GetReplicationJobs
s {$sel:nextToken:GetReplicationJobs' :: Maybe Text
nextToken = Maybe Text
a} :: GetReplicationJobs)
getReplicationJobs_replicationJobId :: Lens.Lens' GetReplicationJobs (Prelude.Maybe Prelude.Text)
getReplicationJobs_replicationJobId :: Lens' GetReplicationJobs (Maybe Text)
getReplicationJobs_replicationJobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationJobs' {Maybe Text
replicationJobId :: Maybe Text
$sel:replicationJobId:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
replicationJobId} -> Maybe Text
replicationJobId) (\s :: GetReplicationJobs
s@GetReplicationJobs' {} Maybe Text
a -> GetReplicationJobs
s {$sel:replicationJobId:GetReplicationJobs' :: Maybe Text
replicationJobId = Maybe Text
a} :: GetReplicationJobs)
instance Core.AWSPager GetReplicationJobs where
page :: GetReplicationJobs
-> AWSResponse GetReplicationJobs -> Maybe GetReplicationJobs
page GetReplicationJobs
rq AWSResponse GetReplicationJobs
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetReplicationJobs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetReplicationJobsResponse (Maybe Text)
getReplicationJobsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetReplicationJobs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetReplicationJobsResponse (Maybe [ReplicationJob])
getReplicationJobsResponse_replicationJobList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetReplicationJobs
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetReplicationJobs (Maybe Text)
getReplicationJobs_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetReplicationJobs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetReplicationJobsResponse (Maybe Text)
getReplicationJobsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetReplicationJobs where
type
AWSResponse GetReplicationJobs =
GetReplicationJobsResponse
request :: (Service -> Service)
-> GetReplicationJobs -> Request GetReplicationJobs
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 GetReplicationJobs
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetReplicationJobs)))
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 ->
Maybe Text
-> Maybe [ReplicationJob] -> Int -> GetReplicationJobsResponse
GetReplicationJobsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"replicationJobList"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetReplicationJobs where
hashWithSalt :: Int -> GetReplicationJobs -> Int
hashWithSalt Int
_salt GetReplicationJobs' {Maybe Int
Maybe Text
replicationJobId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:replicationJobId:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
$sel:nextToken:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
$sel:maxResults:GetReplicationJobs' :: GetReplicationJobs -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
replicationJobId
instance Prelude.NFData GetReplicationJobs where
rnf :: GetReplicationJobs -> ()
rnf GetReplicationJobs' {Maybe Int
Maybe Text
replicationJobId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:replicationJobId:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
$sel:nextToken:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
$sel:maxResults:GetReplicationJobs' :: GetReplicationJobs -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
replicationJobId
instance Data.ToHeaders GetReplicationJobs where
toHeaders :: GetReplicationJobs -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSServerMigrationService_V2016_10_24.GetReplicationJobs" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetReplicationJobs where
toJSON :: GetReplicationJobs -> Value
toJSON GetReplicationJobs' {Maybe Int
Maybe Text
replicationJobId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:replicationJobId:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
$sel:nextToken:GetReplicationJobs' :: GetReplicationJobs -> Maybe Text
$sel:maxResults:GetReplicationJobs' :: GetReplicationJobs -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Key
"replicationJobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
replicationJobId
]
)
instance Data.ToPath GetReplicationJobs where
toPath :: GetReplicationJobs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetReplicationJobs where
toQuery :: GetReplicationJobs -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetReplicationJobsResponse = GetReplicationJobsResponse'
{
GetReplicationJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetReplicationJobsResponse -> Maybe [ReplicationJob]
replicationJobList :: Prelude.Maybe [ReplicationJob],
GetReplicationJobsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetReplicationJobsResponse -> GetReplicationJobsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReplicationJobsResponse -> GetReplicationJobsResponse -> Bool
$c/= :: GetReplicationJobsResponse -> GetReplicationJobsResponse -> Bool
== :: GetReplicationJobsResponse -> GetReplicationJobsResponse -> Bool
$c== :: GetReplicationJobsResponse -> GetReplicationJobsResponse -> Bool
Prelude.Eq, ReadPrec [GetReplicationJobsResponse]
ReadPrec GetReplicationJobsResponse
Int -> ReadS GetReplicationJobsResponse
ReadS [GetReplicationJobsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReplicationJobsResponse]
$creadListPrec :: ReadPrec [GetReplicationJobsResponse]
readPrec :: ReadPrec GetReplicationJobsResponse
$creadPrec :: ReadPrec GetReplicationJobsResponse
readList :: ReadS [GetReplicationJobsResponse]
$creadList :: ReadS [GetReplicationJobsResponse]
readsPrec :: Int -> ReadS GetReplicationJobsResponse
$creadsPrec :: Int -> ReadS GetReplicationJobsResponse
Prelude.Read, Int -> GetReplicationJobsResponse -> ShowS
[GetReplicationJobsResponse] -> ShowS
GetReplicationJobsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReplicationJobsResponse] -> ShowS
$cshowList :: [GetReplicationJobsResponse] -> ShowS
show :: GetReplicationJobsResponse -> String
$cshow :: GetReplicationJobsResponse -> String
showsPrec :: Int -> GetReplicationJobsResponse -> ShowS
$cshowsPrec :: Int -> GetReplicationJobsResponse -> ShowS
Prelude.Show, forall x.
Rep GetReplicationJobsResponse x -> GetReplicationJobsResponse
forall x.
GetReplicationJobsResponse -> Rep GetReplicationJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReplicationJobsResponse x -> GetReplicationJobsResponse
$cfrom :: forall x.
GetReplicationJobsResponse -> Rep GetReplicationJobsResponse x
Prelude.Generic)
newGetReplicationJobsResponse ::
Prelude.Int ->
GetReplicationJobsResponse
newGetReplicationJobsResponse :: Int -> GetReplicationJobsResponse
newGetReplicationJobsResponse Int
pHttpStatus_ =
GetReplicationJobsResponse'
{ $sel:nextToken:GetReplicationJobsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:replicationJobList:GetReplicationJobsResponse' :: Maybe [ReplicationJob]
replicationJobList = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetReplicationJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getReplicationJobsResponse_nextToken :: Lens.Lens' GetReplicationJobsResponse (Prelude.Maybe Prelude.Text)
getReplicationJobsResponse_nextToken :: Lens' GetReplicationJobsResponse (Maybe Text)
getReplicationJobsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetReplicationJobsResponse' :: GetReplicationJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetReplicationJobsResponse
s@GetReplicationJobsResponse' {} Maybe Text
a -> GetReplicationJobsResponse
s {$sel:nextToken:GetReplicationJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetReplicationJobsResponse)
getReplicationJobsResponse_replicationJobList :: Lens.Lens' GetReplicationJobsResponse (Prelude.Maybe [ReplicationJob])
getReplicationJobsResponse_replicationJobList :: Lens' GetReplicationJobsResponse (Maybe [ReplicationJob])
getReplicationJobsResponse_replicationJobList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationJobsResponse' {Maybe [ReplicationJob]
replicationJobList :: Maybe [ReplicationJob]
$sel:replicationJobList:GetReplicationJobsResponse' :: GetReplicationJobsResponse -> Maybe [ReplicationJob]
replicationJobList} -> Maybe [ReplicationJob]
replicationJobList) (\s :: GetReplicationJobsResponse
s@GetReplicationJobsResponse' {} Maybe [ReplicationJob]
a -> GetReplicationJobsResponse
s {$sel:replicationJobList:GetReplicationJobsResponse' :: Maybe [ReplicationJob]
replicationJobList = Maybe [ReplicationJob]
a} :: GetReplicationJobsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getReplicationJobsResponse_httpStatus :: Lens.Lens' GetReplicationJobsResponse Prelude.Int
getReplicationJobsResponse_httpStatus :: Lens' GetReplicationJobsResponse Int
getReplicationJobsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationJobsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetReplicationJobsResponse' :: GetReplicationJobsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetReplicationJobsResponse
s@GetReplicationJobsResponse' {} Int
a -> GetReplicationJobsResponse
s {$sel:httpStatus:GetReplicationJobsResponse' :: Int
httpStatus = Int
a} :: GetReplicationJobsResponse)
instance Prelude.NFData GetReplicationJobsResponse where
rnf :: GetReplicationJobsResponse -> ()
rnf GetReplicationJobsResponse' {Int
Maybe [ReplicationJob]
Maybe Text
httpStatus :: Int
replicationJobList :: Maybe [ReplicationJob]
nextToken :: Maybe Text
$sel:httpStatus:GetReplicationJobsResponse' :: GetReplicationJobsResponse -> Int
$sel:replicationJobList:GetReplicationJobsResponse' :: GetReplicationJobsResponse -> Maybe [ReplicationJob]
$sel:nextToken:GetReplicationJobsResponse' :: GetReplicationJobsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReplicationJob]
replicationJobList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus