{-# 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.DMS.ReloadTables
(
ReloadTables (..),
newReloadTables,
reloadTables_reloadOption,
reloadTables_replicationTaskArn,
reloadTables_tablesToReload,
ReloadTablesResponse (..),
newReloadTablesResponse,
reloadTablesResponse_replicationTaskArn,
reloadTablesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DMS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ReloadTables = ReloadTables'
{
ReloadTables -> Maybe ReloadOptionValue
reloadOption :: Prelude.Maybe ReloadOptionValue,
ReloadTables -> Text
replicationTaskArn :: Prelude.Text,
ReloadTables -> [TableToReload]
tablesToReload :: [TableToReload]
}
deriving (ReloadTables -> ReloadTables -> Bool
(ReloadTables -> ReloadTables -> Bool)
-> (ReloadTables -> ReloadTables -> Bool) -> Eq ReloadTables
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReloadTables -> ReloadTables -> Bool
$c/= :: ReloadTables -> ReloadTables -> Bool
== :: ReloadTables -> ReloadTables -> Bool
$c== :: ReloadTables -> ReloadTables -> Bool
Prelude.Eq, ReadPrec [ReloadTables]
ReadPrec ReloadTables
Int -> ReadS ReloadTables
ReadS [ReloadTables]
(Int -> ReadS ReloadTables)
-> ReadS [ReloadTables]
-> ReadPrec ReloadTables
-> ReadPrec [ReloadTables]
-> Read ReloadTables
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReloadTables]
$creadListPrec :: ReadPrec [ReloadTables]
readPrec :: ReadPrec ReloadTables
$creadPrec :: ReadPrec ReloadTables
readList :: ReadS [ReloadTables]
$creadList :: ReadS [ReloadTables]
readsPrec :: Int -> ReadS ReloadTables
$creadsPrec :: Int -> ReadS ReloadTables
Prelude.Read, Int -> ReloadTables -> ShowS
[ReloadTables] -> ShowS
ReloadTables -> String
(Int -> ReloadTables -> ShowS)
-> (ReloadTables -> String)
-> ([ReloadTables] -> ShowS)
-> Show ReloadTables
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReloadTables] -> ShowS
$cshowList :: [ReloadTables] -> ShowS
show :: ReloadTables -> String
$cshow :: ReloadTables -> String
showsPrec :: Int -> ReloadTables -> ShowS
$cshowsPrec :: Int -> ReloadTables -> ShowS
Prelude.Show, (forall x. ReloadTables -> Rep ReloadTables x)
-> (forall x. Rep ReloadTables x -> ReloadTables)
-> Generic ReloadTables
forall x. Rep ReloadTables x -> ReloadTables
forall x. ReloadTables -> Rep ReloadTables x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReloadTables x -> ReloadTables
$cfrom :: forall x. ReloadTables -> Rep ReloadTables x
Prelude.Generic)
newReloadTables ::
Prelude.Text ->
ReloadTables
newReloadTables :: Text -> ReloadTables
newReloadTables Text
pReplicationTaskArn_ =
ReloadTables' :: Maybe ReloadOptionValue -> Text -> [TableToReload] -> ReloadTables
ReloadTables'
{ $sel:reloadOption:ReloadTables' :: Maybe ReloadOptionValue
reloadOption = Maybe ReloadOptionValue
forall a. Maybe a
Prelude.Nothing,
$sel:replicationTaskArn:ReloadTables' :: Text
replicationTaskArn = Text
pReplicationTaskArn_,
$sel:tablesToReload:ReloadTables' :: [TableToReload]
tablesToReload = [TableToReload]
forall a. Monoid a => a
Prelude.mempty
}
reloadTables_reloadOption :: Lens.Lens' ReloadTables (Prelude.Maybe ReloadOptionValue)
reloadTables_reloadOption :: (Maybe ReloadOptionValue -> f (Maybe ReloadOptionValue))
-> ReloadTables -> f ReloadTables
reloadTables_reloadOption = (ReloadTables -> Maybe ReloadOptionValue)
-> (ReloadTables -> Maybe ReloadOptionValue -> ReloadTables)
-> Lens
ReloadTables
ReloadTables
(Maybe ReloadOptionValue)
(Maybe ReloadOptionValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReloadTables' {Maybe ReloadOptionValue
reloadOption :: Maybe ReloadOptionValue
$sel:reloadOption:ReloadTables' :: ReloadTables -> Maybe ReloadOptionValue
reloadOption} -> Maybe ReloadOptionValue
reloadOption) (\s :: ReloadTables
s@ReloadTables' {} Maybe ReloadOptionValue
a -> ReloadTables
s {$sel:reloadOption:ReloadTables' :: Maybe ReloadOptionValue
reloadOption = Maybe ReloadOptionValue
a} :: ReloadTables)
reloadTables_replicationTaskArn :: Lens.Lens' ReloadTables Prelude.Text
reloadTables_replicationTaskArn :: (Text -> f Text) -> ReloadTables -> f ReloadTables
reloadTables_replicationTaskArn = (ReloadTables -> Text)
-> (ReloadTables -> Text -> ReloadTables)
-> Lens ReloadTables ReloadTables Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReloadTables' {Text
replicationTaskArn :: Text
$sel:replicationTaskArn:ReloadTables' :: ReloadTables -> Text
replicationTaskArn} -> Text
replicationTaskArn) (\s :: ReloadTables
s@ReloadTables' {} Text
a -> ReloadTables
s {$sel:replicationTaskArn:ReloadTables' :: Text
replicationTaskArn = Text
a} :: ReloadTables)
reloadTables_tablesToReload :: Lens.Lens' ReloadTables [TableToReload]
reloadTables_tablesToReload :: ([TableToReload] -> f [TableToReload])
-> ReloadTables -> f ReloadTables
reloadTables_tablesToReload = (ReloadTables -> [TableToReload])
-> (ReloadTables -> [TableToReload] -> ReloadTables)
-> Lens ReloadTables ReloadTables [TableToReload] [TableToReload]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReloadTables' {[TableToReload]
tablesToReload :: [TableToReload]
$sel:tablesToReload:ReloadTables' :: ReloadTables -> [TableToReload]
tablesToReload} -> [TableToReload]
tablesToReload) (\s :: ReloadTables
s@ReloadTables' {} [TableToReload]
a -> ReloadTables
s {$sel:tablesToReload:ReloadTables' :: [TableToReload]
tablesToReload = [TableToReload]
a} :: ReloadTables) (([TableToReload] -> f [TableToReload])
-> ReloadTables -> f ReloadTables)
-> (([TableToReload] -> f [TableToReload])
-> [TableToReload] -> f [TableToReload])
-> ([TableToReload] -> f [TableToReload])
-> ReloadTables
-> f ReloadTables
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TableToReload] -> f [TableToReload])
-> [TableToReload] -> f [TableToReload]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest ReloadTables where
type AWSResponse ReloadTables = ReloadTablesResponse
request :: ReloadTables -> Request ReloadTables
request = Service -> ReloadTables -> Request ReloadTables
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ReloadTables
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ReloadTables)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ReloadTables))
-> Logger
-> Service
-> Proxy ReloadTables
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ReloadTables)))
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 -> Int -> ReloadTablesResponse
ReloadTablesResponse'
(Maybe Text -> Int -> ReloadTablesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ReloadTablesResponse)
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
"ReplicationTaskArn")
Either String (Int -> ReloadTablesResponse)
-> Either String Int -> Either String ReloadTablesResponse
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 ReloadTables
instance Prelude.NFData ReloadTables
instance Core.ToHeaders ReloadTables where
toHeaders :: ReloadTables -> ResponseHeaders
toHeaders =
ResponseHeaders -> ReloadTables -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonDMSv20160101.ReloadTables" ::
Prelude.ByteString
),
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 ReloadTables where
toJSON :: ReloadTables -> Value
toJSON ReloadTables' {[TableToReload]
Maybe ReloadOptionValue
Text
tablesToReload :: [TableToReload]
replicationTaskArn :: Text
reloadOption :: Maybe ReloadOptionValue
$sel:tablesToReload:ReloadTables' :: ReloadTables -> [TableToReload]
$sel:replicationTaskArn:ReloadTables' :: ReloadTables -> Text
$sel:reloadOption:ReloadTables' :: ReloadTables -> Maybe ReloadOptionValue
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ReloadOption" Text -> ReloadOptionValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ReloadOptionValue -> Pair)
-> Maybe ReloadOptionValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReloadOptionValue
reloadOption,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ReplicationTaskArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
replicationTaskArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TablesToReload" Text -> [TableToReload] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [TableToReload]
tablesToReload)
]
)
instance Core.ToPath ReloadTables where
toPath :: ReloadTables -> ByteString
toPath = ByteString -> ReloadTables -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ReloadTables where
toQuery :: ReloadTables -> QueryString
toQuery = QueryString -> ReloadTables -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ReloadTablesResponse = ReloadTablesResponse'
{
ReloadTablesResponse -> Maybe Text
replicationTaskArn :: Prelude.Maybe Prelude.Text,
ReloadTablesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ReloadTablesResponse -> ReloadTablesResponse -> Bool
(ReloadTablesResponse -> ReloadTablesResponse -> Bool)
-> (ReloadTablesResponse -> ReloadTablesResponse -> Bool)
-> Eq ReloadTablesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReloadTablesResponse -> ReloadTablesResponse -> Bool
$c/= :: ReloadTablesResponse -> ReloadTablesResponse -> Bool
== :: ReloadTablesResponse -> ReloadTablesResponse -> Bool
$c== :: ReloadTablesResponse -> ReloadTablesResponse -> Bool
Prelude.Eq, ReadPrec [ReloadTablesResponse]
ReadPrec ReloadTablesResponse
Int -> ReadS ReloadTablesResponse
ReadS [ReloadTablesResponse]
(Int -> ReadS ReloadTablesResponse)
-> ReadS [ReloadTablesResponse]
-> ReadPrec ReloadTablesResponse
-> ReadPrec [ReloadTablesResponse]
-> Read ReloadTablesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReloadTablesResponse]
$creadListPrec :: ReadPrec [ReloadTablesResponse]
readPrec :: ReadPrec ReloadTablesResponse
$creadPrec :: ReadPrec ReloadTablesResponse
readList :: ReadS [ReloadTablesResponse]
$creadList :: ReadS [ReloadTablesResponse]
readsPrec :: Int -> ReadS ReloadTablesResponse
$creadsPrec :: Int -> ReadS ReloadTablesResponse
Prelude.Read, Int -> ReloadTablesResponse -> ShowS
[ReloadTablesResponse] -> ShowS
ReloadTablesResponse -> String
(Int -> ReloadTablesResponse -> ShowS)
-> (ReloadTablesResponse -> String)
-> ([ReloadTablesResponse] -> ShowS)
-> Show ReloadTablesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReloadTablesResponse] -> ShowS
$cshowList :: [ReloadTablesResponse] -> ShowS
show :: ReloadTablesResponse -> String
$cshow :: ReloadTablesResponse -> String
showsPrec :: Int -> ReloadTablesResponse -> ShowS
$cshowsPrec :: Int -> ReloadTablesResponse -> ShowS
Prelude.Show, (forall x. ReloadTablesResponse -> Rep ReloadTablesResponse x)
-> (forall x. Rep ReloadTablesResponse x -> ReloadTablesResponse)
-> Generic ReloadTablesResponse
forall x. Rep ReloadTablesResponse x -> ReloadTablesResponse
forall x. ReloadTablesResponse -> Rep ReloadTablesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReloadTablesResponse x -> ReloadTablesResponse
$cfrom :: forall x. ReloadTablesResponse -> Rep ReloadTablesResponse x
Prelude.Generic)
newReloadTablesResponse ::
Prelude.Int ->
ReloadTablesResponse
newReloadTablesResponse :: Int -> ReloadTablesResponse
newReloadTablesResponse Int
pHttpStatus_ =
ReloadTablesResponse' :: Maybe Text -> Int -> ReloadTablesResponse
ReloadTablesResponse'
{ $sel:replicationTaskArn:ReloadTablesResponse' :: Maybe Text
replicationTaskArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ReloadTablesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
reloadTablesResponse_replicationTaskArn :: Lens.Lens' ReloadTablesResponse (Prelude.Maybe Prelude.Text)
reloadTablesResponse_replicationTaskArn :: (Maybe Text -> f (Maybe Text))
-> ReloadTablesResponse -> f ReloadTablesResponse
reloadTablesResponse_replicationTaskArn = (ReloadTablesResponse -> Maybe Text)
-> (ReloadTablesResponse -> Maybe Text -> ReloadTablesResponse)
-> Lens
ReloadTablesResponse ReloadTablesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReloadTablesResponse' {Maybe Text
replicationTaskArn :: Maybe Text
$sel:replicationTaskArn:ReloadTablesResponse' :: ReloadTablesResponse -> Maybe Text
replicationTaskArn} -> Maybe Text
replicationTaskArn) (\s :: ReloadTablesResponse
s@ReloadTablesResponse' {} Maybe Text
a -> ReloadTablesResponse
s {$sel:replicationTaskArn:ReloadTablesResponse' :: Maybe Text
replicationTaskArn = Maybe Text
a} :: ReloadTablesResponse)
reloadTablesResponse_httpStatus :: Lens.Lens' ReloadTablesResponse Prelude.Int
reloadTablesResponse_httpStatus :: (Int -> f Int) -> ReloadTablesResponse -> f ReloadTablesResponse
reloadTablesResponse_httpStatus = (ReloadTablesResponse -> Int)
-> (ReloadTablesResponse -> Int -> ReloadTablesResponse)
-> Lens ReloadTablesResponse ReloadTablesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReloadTablesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ReloadTablesResponse' :: ReloadTablesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ReloadTablesResponse
s@ReloadTablesResponse' {} Int
a -> ReloadTablesResponse
s {$sel:httpStatus:ReloadTablesResponse' :: Int
httpStatus = Int
a} :: ReloadTablesResponse)
instance Prelude.NFData ReloadTablesResponse