{-# 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.RefreshSchemas
  ( 
    RefreshSchemas (..),
    newRefreshSchemas,
    
    refreshSchemas_endpointArn,
    refreshSchemas_replicationInstanceArn,
    
    RefreshSchemasResponse (..),
    newRefreshSchemasResponse,
    
    refreshSchemasResponse_refreshSchemasStatus,
    refreshSchemasResponse_httpStatus,
  )
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DMS.Types
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RefreshSchemas = RefreshSchemas'
  { 
    
    RefreshSchemas -> Text
endpointArn :: Prelude.Text,
    
    RefreshSchemas -> Text
replicationInstanceArn :: Prelude.Text
  }
  deriving (RefreshSchemas -> RefreshSchemas -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefreshSchemas -> RefreshSchemas -> Bool
$c/= :: RefreshSchemas -> RefreshSchemas -> Bool
== :: RefreshSchemas -> RefreshSchemas -> Bool
$c== :: RefreshSchemas -> RefreshSchemas -> Bool
Prelude.Eq, ReadPrec [RefreshSchemas]
ReadPrec RefreshSchemas
Int -> ReadS RefreshSchemas
ReadS [RefreshSchemas]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefreshSchemas]
$creadListPrec :: ReadPrec [RefreshSchemas]
readPrec :: ReadPrec RefreshSchemas
$creadPrec :: ReadPrec RefreshSchemas
readList :: ReadS [RefreshSchemas]
$creadList :: ReadS [RefreshSchemas]
readsPrec :: Int -> ReadS RefreshSchemas
$creadsPrec :: Int -> ReadS RefreshSchemas
Prelude.Read, Int -> RefreshSchemas -> ShowS
[RefreshSchemas] -> ShowS
RefreshSchemas -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefreshSchemas] -> ShowS
$cshowList :: [RefreshSchemas] -> ShowS
show :: RefreshSchemas -> String
$cshow :: RefreshSchemas -> String
showsPrec :: Int -> RefreshSchemas -> ShowS
$cshowsPrec :: Int -> RefreshSchemas -> ShowS
Prelude.Show, forall x. Rep RefreshSchemas x -> RefreshSchemas
forall x. RefreshSchemas -> Rep RefreshSchemas x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefreshSchemas x -> RefreshSchemas
$cfrom :: forall x. RefreshSchemas -> Rep RefreshSchemas x
Prelude.Generic)
newRefreshSchemas ::
  
  Prelude.Text ->
  
  Prelude.Text ->
  RefreshSchemas
newRefreshSchemas :: Text -> Text -> RefreshSchemas
newRefreshSchemas
  Text
pEndpointArn_
  Text
pReplicationInstanceArn_ =
    RefreshSchemas'
      { $sel:endpointArn:RefreshSchemas' :: Text
endpointArn = Text
pEndpointArn_,
        $sel:replicationInstanceArn:RefreshSchemas' :: Text
replicationInstanceArn = Text
pReplicationInstanceArn_
      }
refreshSchemas_endpointArn :: Lens.Lens' RefreshSchemas Prelude.Text
refreshSchemas_endpointArn :: Lens' RefreshSchemas Text
refreshSchemas_endpointArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemas' {Text
endpointArn :: Text
$sel:endpointArn:RefreshSchemas' :: RefreshSchemas -> Text
endpointArn} -> Text
endpointArn) (\s :: RefreshSchemas
s@RefreshSchemas' {} Text
a -> RefreshSchemas
s {$sel:endpointArn:RefreshSchemas' :: Text
endpointArn = Text
a} :: RefreshSchemas)
refreshSchemas_replicationInstanceArn :: Lens.Lens' RefreshSchemas Prelude.Text
refreshSchemas_replicationInstanceArn :: Lens' RefreshSchemas Text
refreshSchemas_replicationInstanceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemas' {Text
replicationInstanceArn :: Text
$sel:replicationInstanceArn:RefreshSchemas' :: RefreshSchemas -> Text
replicationInstanceArn} -> Text
replicationInstanceArn) (\s :: RefreshSchemas
s@RefreshSchemas' {} Text
a -> RefreshSchemas
s {$sel:replicationInstanceArn:RefreshSchemas' :: Text
replicationInstanceArn = Text
a} :: RefreshSchemas)
instance Core.AWSRequest RefreshSchemas where
  type
    AWSResponse RefreshSchemas =
      RefreshSchemasResponse
  request :: (Service -> Service) -> RefreshSchemas -> Request RefreshSchemas
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 RefreshSchemas
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RefreshSchemas)))
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 RefreshSchemasStatus -> Int -> RefreshSchemasResponse
RefreshSchemasResponse'
            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
"RefreshSchemasStatus")
            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 RefreshSchemas where
  hashWithSalt :: Int -> RefreshSchemas -> Int
hashWithSalt Int
_salt RefreshSchemas' {Text
replicationInstanceArn :: Text
endpointArn :: Text
$sel:replicationInstanceArn:RefreshSchemas' :: RefreshSchemas -> Text
$sel:endpointArn:RefreshSchemas' :: RefreshSchemas -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
replicationInstanceArn
instance Prelude.NFData RefreshSchemas where
  rnf :: RefreshSchemas -> ()
rnf RefreshSchemas' {Text
replicationInstanceArn :: Text
endpointArn :: Text
$sel:replicationInstanceArn:RefreshSchemas' :: RefreshSchemas -> Text
$sel:endpointArn:RefreshSchemas' :: RefreshSchemas -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
endpointArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
replicationInstanceArn
instance Data.ToHeaders RefreshSchemas where
  toHeaders :: RefreshSchemas -> 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
"AmazonDMSv20160101.RefreshSchemas" ::
                          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 RefreshSchemas where
  toJSON :: RefreshSchemas -> Value
toJSON RefreshSchemas' {Text
replicationInstanceArn :: Text
endpointArn :: Text
$sel:replicationInstanceArn:RefreshSchemas' :: RefreshSchemas -> Text
$sel:endpointArn:RefreshSchemas' :: RefreshSchemas -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"EndpointArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointArn),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ReplicationInstanceArn"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
replicationInstanceArn
              )
          ]
      )
instance Data.ToPath RefreshSchemas where
  toPath :: RefreshSchemas -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery RefreshSchemas where
  toQuery :: RefreshSchemas -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data RefreshSchemasResponse = RefreshSchemasResponse'
  { 
    RefreshSchemasResponse -> Maybe RefreshSchemasStatus
refreshSchemasStatus :: Prelude.Maybe RefreshSchemasStatus,
    
    RefreshSchemasResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RefreshSchemasResponse -> RefreshSchemasResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefreshSchemasResponse -> RefreshSchemasResponse -> Bool
$c/= :: RefreshSchemasResponse -> RefreshSchemasResponse -> Bool
== :: RefreshSchemasResponse -> RefreshSchemasResponse -> Bool
$c== :: RefreshSchemasResponse -> RefreshSchemasResponse -> Bool
Prelude.Eq, ReadPrec [RefreshSchemasResponse]
ReadPrec RefreshSchemasResponse
Int -> ReadS RefreshSchemasResponse
ReadS [RefreshSchemasResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefreshSchemasResponse]
$creadListPrec :: ReadPrec [RefreshSchemasResponse]
readPrec :: ReadPrec RefreshSchemasResponse
$creadPrec :: ReadPrec RefreshSchemasResponse
readList :: ReadS [RefreshSchemasResponse]
$creadList :: ReadS [RefreshSchemasResponse]
readsPrec :: Int -> ReadS RefreshSchemasResponse
$creadsPrec :: Int -> ReadS RefreshSchemasResponse
Prelude.Read, Int -> RefreshSchemasResponse -> ShowS
[RefreshSchemasResponse] -> ShowS
RefreshSchemasResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefreshSchemasResponse] -> ShowS
$cshowList :: [RefreshSchemasResponse] -> ShowS
show :: RefreshSchemasResponse -> String
$cshow :: RefreshSchemasResponse -> String
showsPrec :: Int -> RefreshSchemasResponse -> ShowS
$cshowsPrec :: Int -> RefreshSchemasResponse -> ShowS
Prelude.Show, forall x. Rep RefreshSchemasResponse x -> RefreshSchemasResponse
forall x. RefreshSchemasResponse -> Rep RefreshSchemasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefreshSchemasResponse x -> RefreshSchemasResponse
$cfrom :: forall x. RefreshSchemasResponse -> Rep RefreshSchemasResponse x
Prelude.Generic)
newRefreshSchemasResponse ::
  
  Prelude.Int ->
  RefreshSchemasResponse
newRefreshSchemasResponse :: Int -> RefreshSchemasResponse
newRefreshSchemasResponse Int
pHttpStatus_ =
  RefreshSchemasResponse'
    { $sel:refreshSchemasStatus:RefreshSchemasResponse' :: Maybe RefreshSchemasStatus
refreshSchemasStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RefreshSchemasResponse' :: Int
httpStatus = Int
pHttpStatus_
    }
refreshSchemasResponse_refreshSchemasStatus :: Lens.Lens' RefreshSchemasResponse (Prelude.Maybe RefreshSchemasStatus)
refreshSchemasResponse_refreshSchemasStatus :: Lens' RefreshSchemasResponse (Maybe RefreshSchemasStatus)
refreshSchemasResponse_refreshSchemasStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasResponse' {Maybe RefreshSchemasStatus
refreshSchemasStatus :: Maybe RefreshSchemasStatus
$sel:refreshSchemasStatus:RefreshSchemasResponse' :: RefreshSchemasResponse -> Maybe RefreshSchemasStatus
refreshSchemasStatus} -> Maybe RefreshSchemasStatus
refreshSchemasStatus) (\s :: RefreshSchemasResponse
s@RefreshSchemasResponse' {} Maybe RefreshSchemasStatus
a -> RefreshSchemasResponse
s {$sel:refreshSchemasStatus:RefreshSchemasResponse' :: Maybe RefreshSchemasStatus
refreshSchemasStatus = Maybe RefreshSchemasStatus
a} :: RefreshSchemasResponse)
refreshSchemasResponse_httpStatus :: Lens.Lens' RefreshSchemasResponse Prelude.Int
refreshSchemasResponse_httpStatus :: Lens' RefreshSchemasResponse Int
refreshSchemasResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasResponse' {Int
httpStatus :: Int
$sel:httpStatus:RefreshSchemasResponse' :: RefreshSchemasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RefreshSchemasResponse
s@RefreshSchemasResponse' {} Int
a -> RefreshSchemasResponse
s {$sel:httpStatus:RefreshSchemasResponse' :: Int
httpStatus = Int
a} :: RefreshSchemasResponse)
instance Prelude.NFData RefreshSchemasResponse where
  rnf :: RefreshSchemasResponse -> ()
rnf RefreshSchemasResponse' {Int
Maybe RefreshSchemasStatus
httpStatus :: Int
refreshSchemasStatus :: Maybe RefreshSchemasStatus
$sel:httpStatus:RefreshSchemasResponse' :: RefreshSchemasResponse -> Int
$sel:refreshSchemasStatus:RefreshSchemasResponse' :: RefreshSchemasResponse -> Maybe RefreshSchemasStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RefreshSchemasStatus
refreshSchemasStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus