{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DMS.DescribeRefreshSchemasStatus
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the status of the RefreshSchemas operation.
module Amazonka.DMS.DescribeRefreshSchemasStatus
  ( -- * Creating a Request
    DescribeRefreshSchemasStatus (..),
    newDescribeRefreshSchemasStatus,

    -- * Request Lenses
    describeRefreshSchemasStatus_endpointArn,

    -- * Destructuring the Response
    DescribeRefreshSchemasStatusResponse (..),
    newDescribeRefreshSchemasStatusResponse,

    -- * Response Lenses
    describeRefreshSchemasStatusResponse_refreshSchemasStatus,
    describeRefreshSchemasStatusResponse_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

-- |
--
-- /See:/ 'newDescribeRefreshSchemasStatus' smart constructor.
data DescribeRefreshSchemasStatus = DescribeRefreshSchemasStatus'
  { -- | The Amazon Resource Name (ARN) string that uniquely identifies the
    -- endpoint.
    DescribeRefreshSchemasStatus -> Text
endpointArn :: Prelude.Text
  }
  deriving (DescribeRefreshSchemasStatus
-> DescribeRefreshSchemasStatus -> Bool
(DescribeRefreshSchemasStatus
 -> DescribeRefreshSchemasStatus -> Bool)
-> (DescribeRefreshSchemasStatus
    -> DescribeRefreshSchemasStatus -> Bool)
-> Eq DescribeRefreshSchemasStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRefreshSchemasStatus
-> DescribeRefreshSchemasStatus -> Bool
$c/= :: DescribeRefreshSchemasStatus
-> DescribeRefreshSchemasStatus -> Bool
== :: DescribeRefreshSchemasStatus
-> DescribeRefreshSchemasStatus -> Bool
$c== :: DescribeRefreshSchemasStatus
-> DescribeRefreshSchemasStatus -> Bool
Prelude.Eq, ReadPrec [DescribeRefreshSchemasStatus]
ReadPrec DescribeRefreshSchemasStatus
Int -> ReadS DescribeRefreshSchemasStatus
ReadS [DescribeRefreshSchemasStatus]
(Int -> ReadS DescribeRefreshSchemasStatus)
-> ReadS [DescribeRefreshSchemasStatus]
-> ReadPrec DescribeRefreshSchemasStatus
-> ReadPrec [DescribeRefreshSchemasStatus]
-> Read DescribeRefreshSchemasStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRefreshSchemasStatus]
$creadListPrec :: ReadPrec [DescribeRefreshSchemasStatus]
readPrec :: ReadPrec DescribeRefreshSchemasStatus
$creadPrec :: ReadPrec DescribeRefreshSchemasStatus
readList :: ReadS [DescribeRefreshSchemasStatus]
$creadList :: ReadS [DescribeRefreshSchemasStatus]
readsPrec :: Int -> ReadS DescribeRefreshSchemasStatus
$creadsPrec :: Int -> ReadS DescribeRefreshSchemasStatus
Prelude.Read, Int -> DescribeRefreshSchemasStatus -> ShowS
[DescribeRefreshSchemasStatus] -> ShowS
DescribeRefreshSchemasStatus -> String
(Int -> DescribeRefreshSchemasStatus -> ShowS)
-> (DescribeRefreshSchemasStatus -> String)
-> ([DescribeRefreshSchemasStatus] -> ShowS)
-> Show DescribeRefreshSchemasStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRefreshSchemasStatus] -> ShowS
$cshowList :: [DescribeRefreshSchemasStatus] -> ShowS
show :: DescribeRefreshSchemasStatus -> String
$cshow :: DescribeRefreshSchemasStatus -> String
showsPrec :: Int -> DescribeRefreshSchemasStatus -> ShowS
$cshowsPrec :: Int -> DescribeRefreshSchemasStatus -> ShowS
Prelude.Show, (forall x.
 DescribeRefreshSchemasStatus -> Rep DescribeRefreshSchemasStatus x)
-> (forall x.
    Rep DescribeRefreshSchemasStatus x -> DescribeRefreshSchemasStatus)
-> Generic DescribeRefreshSchemasStatus
forall x.
Rep DescribeRefreshSchemasStatus x -> DescribeRefreshSchemasStatus
forall x.
DescribeRefreshSchemasStatus -> Rep DescribeRefreshSchemasStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRefreshSchemasStatus x -> DescribeRefreshSchemasStatus
$cfrom :: forall x.
DescribeRefreshSchemasStatus -> Rep DescribeRefreshSchemasStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRefreshSchemasStatus' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'endpointArn', 'describeRefreshSchemasStatus_endpointArn' - The Amazon Resource Name (ARN) string that uniquely identifies the
-- endpoint.
newDescribeRefreshSchemasStatus ::
  -- | 'endpointArn'
  Prelude.Text ->
  DescribeRefreshSchemasStatus
newDescribeRefreshSchemasStatus :: Text -> DescribeRefreshSchemasStatus
newDescribeRefreshSchemasStatus Text
pEndpointArn_ =
  DescribeRefreshSchemasStatus' :: Text -> DescribeRefreshSchemasStatus
DescribeRefreshSchemasStatus'
    { $sel:endpointArn:DescribeRefreshSchemasStatus' :: Text
endpointArn =
        Text
pEndpointArn_
    }

-- | The Amazon Resource Name (ARN) string that uniquely identifies the
-- endpoint.
describeRefreshSchemasStatus_endpointArn :: Lens.Lens' DescribeRefreshSchemasStatus Prelude.Text
describeRefreshSchemasStatus_endpointArn :: (Text -> f Text)
-> DescribeRefreshSchemasStatus -> f DescribeRefreshSchemasStatus
describeRefreshSchemasStatus_endpointArn = (DescribeRefreshSchemasStatus -> Text)
-> (DescribeRefreshSchemasStatus
    -> Text -> DescribeRefreshSchemasStatus)
-> Lens
     DescribeRefreshSchemasStatus DescribeRefreshSchemasStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRefreshSchemasStatus' {Text
endpointArn :: Text
$sel:endpointArn:DescribeRefreshSchemasStatus' :: DescribeRefreshSchemasStatus -> Text
endpointArn} -> Text
endpointArn) (\s :: DescribeRefreshSchemasStatus
s@DescribeRefreshSchemasStatus' {} Text
a -> DescribeRefreshSchemasStatus
s {$sel:endpointArn:DescribeRefreshSchemasStatus' :: Text
endpointArn = Text
a} :: DescribeRefreshSchemasStatus)

instance Core.AWSRequest DescribeRefreshSchemasStatus where
  type
    AWSResponse DescribeRefreshSchemasStatus =
      DescribeRefreshSchemasStatusResponse
  request :: DescribeRefreshSchemasStatus
-> Request DescribeRefreshSchemasStatus
request = Service
-> DescribeRefreshSchemasStatus
-> Request DescribeRefreshSchemasStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeRefreshSchemasStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRefreshSchemasStatus)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeRefreshSchemasStatus))
-> Logger
-> Service
-> Proxy DescribeRefreshSchemasStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRefreshSchemasStatus)))
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 RefreshSchemasStatus
-> Int -> DescribeRefreshSchemasStatusResponse
DescribeRefreshSchemasStatusResponse'
            (Maybe RefreshSchemasStatus
 -> Int -> DescribeRefreshSchemasStatusResponse)
-> Either String (Maybe RefreshSchemasStatus)
-> Either String (Int -> DescribeRefreshSchemasStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RefreshSchemasStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RefreshSchemasStatus")
            Either String (Int -> DescribeRefreshSchemasStatusResponse)
-> Either String Int
-> Either String DescribeRefreshSchemasStatusResponse
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
    DescribeRefreshSchemasStatus

instance Prelude.NFData DescribeRefreshSchemasStatus

instance Core.ToHeaders DescribeRefreshSchemasStatus where
  toHeaders :: DescribeRefreshSchemasStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeRefreshSchemasStatus -> 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.DescribeRefreshSchemasStatus" ::
                          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 DescribeRefreshSchemasStatus where
  toJSON :: DescribeRefreshSchemasStatus -> Value
toJSON DescribeRefreshSchemasStatus' {Text
endpointArn :: Text
$sel:endpointArn:DescribeRefreshSchemasStatus' :: DescribeRefreshSchemasStatus -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointArn)]
      )

instance Core.ToPath DescribeRefreshSchemasStatus where
  toPath :: DescribeRefreshSchemasStatus -> ByteString
toPath = ByteString -> DescribeRefreshSchemasStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeRefreshSchemasStatus where
  toQuery :: DescribeRefreshSchemasStatus -> QueryString
toQuery = QueryString -> DescribeRefreshSchemasStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- |
--
-- /See:/ 'newDescribeRefreshSchemasStatusResponse' smart constructor.
data DescribeRefreshSchemasStatusResponse = DescribeRefreshSchemasStatusResponse'
  { -- | The status of the schema.
    DescribeRefreshSchemasStatusResponse -> Maybe RefreshSchemasStatus
refreshSchemasStatus :: Prelude.Maybe RefreshSchemasStatus,
    -- | The response's http status code.
    DescribeRefreshSchemasStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeRefreshSchemasStatusResponse
-> DescribeRefreshSchemasStatusResponse -> Bool
(DescribeRefreshSchemasStatusResponse
 -> DescribeRefreshSchemasStatusResponse -> Bool)
-> (DescribeRefreshSchemasStatusResponse
    -> DescribeRefreshSchemasStatusResponse -> Bool)
-> Eq DescribeRefreshSchemasStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRefreshSchemasStatusResponse
-> DescribeRefreshSchemasStatusResponse -> Bool
$c/= :: DescribeRefreshSchemasStatusResponse
-> DescribeRefreshSchemasStatusResponse -> Bool
== :: DescribeRefreshSchemasStatusResponse
-> DescribeRefreshSchemasStatusResponse -> Bool
$c== :: DescribeRefreshSchemasStatusResponse
-> DescribeRefreshSchemasStatusResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRefreshSchemasStatusResponse]
ReadPrec DescribeRefreshSchemasStatusResponse
Int -> ReadS DescribeRefreshSchemasStatusResponse
ReadS [DescribeRefreshSchemasStatusResponse]
(Int -> ReadS DescribeRefreshSchemasStatusResponse)
-> ReadS [DescribeRefreshSchemasStatusResponse]
-> ReadPrec DescribeRefreshSchemasStatusResponse
-> ReadPrec [DescribeRefreshSchemasStatusResponse]
-> Read DescribeRefreshSchemasStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRefreshSchemasStatusResponse]
$creadListPrec :: ReadPrec [DescribeRefreshSchemasStatusResponse]
readPrec :: ReadPrec DescribeRefreshSchemasStatusResponse
$creadPrec :: ReadPrec DescribeRefreshSchemasStatusResponse
readList :: ReadS [DescribeRefreshSchemasStatusResponse]
$creadList :: ReadS [DescribeRefreshSchemasStatusResponse]
readsPrec :: Int -> ReadS DescribeRefreshSchemasStatusResponse
$creadsPrec :: Int -> ReadS DescribeRefreshSchemasStatusResponse
Prelude.Read, Int -> DescribeRefreshSchemasStatusResponse -> ShowS
[DescribeRefreshSchemasStatusResponse] -> ShowS
DescribeRefreshSchemasStatusResponse -> String
(Int -> DescribeRefreshSchemasStatusResponse -> ShowS)
-> (DescribeRefreshSchemasStatusResponse -> String)
-> ([DescribeRefreshSchemasStatusResponse] -> ShowS)
-> Show DescribeRefreshSchemasStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRefreshSchemasStatusResponse] -> ShowS
$cshowList :: [DescribeRefreshSchemasStatusResponse] -> ShowS
show :: DescribeRefreshSchemasStatusResponse -> String
$cshow :: DescribeRefreshSchemasStatusResponse -> String
showsPrec :: Int -> DescribeRefreshSchemasStatusResponse -> ShowS
$cshowsPrec :: Int -> DescribeRefreshSchemasStatusResponse -> ShowS
Prelude.Show, (forall x.
 DescribeRefreshSchemasStatusResponse
 -> Rep DescribeRefreshSchemasStatusResponse x)
-> (forall x.
    Rep DescribeRefreshSchemasStatusResponse x
    -> DescribeRefreshSchemasStatusResponse)
-> Generic DescribeRefreshSchemasStatusResponse
forall x.
Rep DescribeRefreshSchemasStatusResponse x
-> DescribeRefreshSchemasStatusResponse
forall x.
DescribeRefreshSchemasStatusResponse
-> Rep DescribeRefreshSchemasStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRefreshSchemasStatusResponse x
-> DescribeRefreshSchemasStatusResponse
$cfrom :: forall x.
DescribeRefreshSchemasStatusResponse
-> Rep DescribeRefreshSchemasStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRefreshSchemasStatusResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'refreshSchemasStatus', 'describeRefreshSchemasStatusResponse_refreshSchemasStatus' - The status of the schema.
--
-- 'httpStatus', 'describeRefreshSchemasStatusResponse_httpStatus' - The response's http status code.
newDescribeRefreshSchemasStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeRefreshSchemasStatusResponse
newDescribeRefreshSchemasStatusResponse :: Int -> DescribeRefreshSchemasStatusResponse
newDescribeRefreshSchemasStatusResponse Int
pHttpStatus_ =
  DescribeRefreshSchemasStatusResponse' :: Maybe RefreshSchemasStatus
-> Int -> DescribeRefreshSchemasStatusResponse
DescribeRefreshSchemasStatusResponse'
    { $sel:refreshSchemasStatus:DescribeRefreshSchemasStatusResponse' :: Maybe RefreshSchemasStatus
refreshSchemasStatus =
        Maybe RefreshSchemasStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeRefreshSchemasStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the schema.
describeRefreshSchemasStatusResponse_refreshSchemasStatus :: Lens.Lens' DescribeRefreshSchemasStatusResponse (Prelude.Maybe RefreshSchemasStatus)
describeRefreshSchemasStatusResponse_refreshSchemasStatus :: (Maybe RefreshSchemasStatus -> f (Maybe RefreshSchemasStatus))
-> DescribeRefreshSchemasStatusResponse
-> f DescribeRefreshSchemasStatusResponse
describeRefreshSchemasStatusResponse_refreshSchemasStatus = (DescribeRefreshSchemasStatusResponse
 -> Maybe RefreshSchemasStatus)
-> (DescribeRefreshSchemasStatusResponse
    -> Maybe RefreshSchemasStatus
    -> DescribeRefreshSchemasStatusResponse)
-> Lens
     DescribeRefreshSchemasStatusResponse
     DescribeRefreshSchemasStatusResponse
     (Maybe RefreshSchemasStatus)
     (Maybe RefreshSchemasStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRefreshSchemasStatusResponse' {Maybe RefreshSchemasStatus
refreshSchemasStatus :: Maybe RefreshSchemasStatus
$sel:refreshSchemasStatus:DescribeRefreshSchemasStatusResponse' :: DescribeRefreshSchemasStatusResponse -> Maybe RefreshSchemasStatus
refreshSchemasStatus} -> Maybe RefreshSchemasStatus
refreshSchemasStatus) (\s :: DescribeRefreshSchemasStatusResponse
s@DescribeRefreshSchemasStatusResponse' {} Maybe RefreshSchemasStatus
a -> DescribeRefreshSchemasStatusResponse
s {$sel:refreshSchemasStatus:DescribeRefreshSchemasStatusResponse' :: Maybe RefreshSchemasStatus
refreshSchemasStatus = Maybe RefreshSchemasStatus
a} :: DescribeRefreshSchemasStatusResponse)

-- | The response's http status code.
describeRefreshSchemasStatusResponse_httpStatus :: Lens.Lens' DescribeRefreshSchemasStatusResponse Prelude.Int
describeRefreshSchemasStatusResponse_httpStatus :: (Int -> f Int)
-> DescribeRefreshSchemasStatusResponse
-> f DescribeRefreshSchemasStatusResponse
describeRefreshSchemasStatusResponse_httpStatus = (DescribeRefreshSchemasStatusResponse -> Int)
-> (DescribeRefreshSchemasStatusResponse
    -> Int -> DescribeRefreshSchemasStatusResponse)
-> Lens
     DescribeRefreshSchemasStatusResponse
     DescribeRefreshSchemasStatusResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRefreshSchemasStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeRefreshSchemasStatusResponse' :: DescribeRefreshSchemasStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeRefreshSchemasStatusResponse
s@DescribeRefreshSchemasStatusResponse' {} Int
a -> DescribeRefreshSchemasStatusResponse
s {$sel:httpStatus:DescribeRefreshSchemasStatusResponse' :: Int
httpStatus = Int
a} :: DescribeRefreshSchemasStatusResponse)

instance
  Prelude.NFData
    DescribeRefreshSchemasStatusResponse