{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 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

-- |
--
-- /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
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]
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
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.
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'
    { $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 :: Lens' DescribeRefreshSchemasStatus Text
describeRefreshSchemasStatus_endpointArn = 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 :: (Service -> Service)
-> DescribeRefreshSchemasStatus
-> Request DescribeRefreshSchemasStatus
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 DescribeRefreshSchemasStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRefreshSchemasStatus)))
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 -> DescribeRefreshSchemasStatusResponse
DescribeRefreshSchemasStatusResponse'
            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
    DescribeRefreshSchemasStatus
  where
  hashWithSalt :: Int -> DescribeRefreshSchemasStatus -> Int
hashWithSalt Int
_salt DescribeRefreshSchemasStatus' {Text
endpointArn :: Text
$sel:endpointArn:DescribeRefreshSchemasStatus' :: DescribeRefreshSchemasStatus -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointArn

instance Prelude.NFData DescribeRefreshSchemasStatus where
  rnf :: DescribeRefreshSchemasStatus -> ()
rnf DescribeRefreshSchemasStatus' {Text
endpointArn :: Text
$sel:endpointArn:DescribeRefreshSchemasStatus' :: DescribeRefreshSchemasStatus -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
endpointArn

instance Data.ToHeaders DescribeRefreshSchemasStatus where
  toHeaders :: DescribeRefreshSchemasStatus -> 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.DescribeRefreshSchemasStatus" ::
                          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 DescribeRefreshSchemasStatus where
  toJSON :: DescribeRefreshSchemasStatus -> Value
toJSON DescribeRefreshSchemasStatus' {Text
endpointArn :: Text
$sel:endpointArn:DescribeRefreshSchemasStatus' :: DescribeRefreshSchemasStatus -> 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)]
      )

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

instance Data.ToQuery DescribeRefreshSchemasStatus where
  toQuery :: DescribeRefreshSchemasStatus -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:refreshSchemasStatus:DescribeRefreshSchemasStatusResponse' :: Maybe RefreshSchemasStatus
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 :: Lens'
  DescribeRefreshSchemasStatusResponse (Maybe RefreshSchemasStatus)
describeRefreshSchemasStatusResponse_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 :: Lens' DescribeRefreshSchemasStatusResponse Int
describeRefreshSchemasStatusResponse_httpStatus = 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
  where
  rnf :: DescribeRefreshSchemasStatusResponse -> ()
rnf DescribeRefreshSchemasStatusResponse' {Int
Maybe RefreshSchemasStatus
httpStatus :: Int
refreshSchemasStatus :: Maybe RefreshSchemasStatus
$sel:httpStatus:DescribeRefreshSchemasStatusResponse' :: DescribeRefreshSchemasStatusResponse -> Int
$sel:refreshSchemasStatus:DescribeRefreshSchemasStatusResponse' :: DescribeRefreshSchemasStatusResponse -> 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