{-# 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.DynamoDB.DisableKinesisStreamingDestination
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops replication from the DynamoDB table to the Kinesis data stream.
-- This is done without deleting either of the resources.
module Amazonka.DynamoDB.DisableKinesisStreamingDestination
  ( -- * Creating a Request
    DisableKinesisStreamingDestination (..),
    newDisableKinesisStreamingDestination,

    -- * Request Lenses
    disableKinesisStreamingDestination_tableName,
    disableKinesisStreamingDestination_streamArn,

    -- * Destructuring the Response
    KinesisStreamingDestinationOutput (..),
    newKinesisStreamingDestinationOutput,

    -- * Response Lenses
    kinesisStreamingDestinationOutput_destinationStatus,
    kinesisStreamingDestinationOutput_streamArn,
    kinesisStreamingDestinationOutput_tableName,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDisableKinesisStreamingDestination' smart constructor.
data DisableKinesisStreamingDestination = DisableKinesisStreamingDestination'
  { -- | The name of the DynamoDB table.
    DisableKinesisStreamingDestination -> Text
tableName :: Prelude.Text,
    -- | The ARN for a Kinesis data stream.
    DisableKinesisStreamingDestination -> Text
streamArn :: Prelude.Text
  }
  deriving (DisableKinesisStreamingDestination
-> DisableKinesisStreamingDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableKinesisStreamingDestination
-> DisableKinesisStreamingDestination -> Bool
$c/= :: DisableKinesisStreamingDestination
-> DisableKinesisStreamingDestination -> Bool
== :: DisableKinesisStreamingDestination
-> DisableKinesisStreamingDestination -> Bool
$c== :: DisableKinesisStreamingDestination
-> DisableKinesisStreamingDestination -> Bool
Prelude.Eq, ReadPrec [DisableKinesisStreamingDestination]
ReadPrec DisableKinesisStreamingDestination
Int -> ReadS DisableKinesisStreamingDestination
ReadS [DisableKinesisStreamingDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableKinesisStreamingDestination]
$creadListPrec :: ReadPrec [DisableKinesisStreamingDestination]
readPrec :: ReadPrec DisableKinesisStreamingDestination
$creadPrec :: ReadPrec DisableKinesisStreamingDestination
readList :: ReadS [DisableKinesisStreamingDestination]
$creadList :: ReadS [DisableKinesisStreamingDestination]
readsPrec :: Int -> ReadS DisableKinesisStreamingDestination
$creadsPrec :: Int -> ReadS DisableKinesisStreamingDestination
Prelude.Read, Int -> DisableKinesisStreamingDestination -> ShowS
[DisableKinesisStreamingDestination] -> ShowS
DisableKinesisStreamingDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableKinesisStreamingDestination] -> ShowS
$cshowList :: [DisableKinesisStreamingDestination] -> ShowS
show :: DisableKinesisStreamingDestination -> String
$cshow :: DisableKinesisStreamingDestination -> String
showsPrec :: Int -> DisableKinesisStreamingDestination -> ShowS
$cshowsPrec :: Int -> DisableKinesisStreamingDestination -> ShowS
Prelude.Show, forall x.
Rep DisableKinesisStreamingDestination x
-> DisableKinesisStreamingDestination
forall x.
DisableKinesisStreamingDestination
-> Rep DisableKinesisStreamingDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableKinesisStreamingDestination x
-> DisableKinesisStreamingDestination
$cfrom :: forall x.
DisableKinesisStreamingDestination
-> Rep DisableKinesisStreamingDestination x
Prelude.Generic)

-- |
-- Create a value of 'DisableKinesisStreamingDestination' 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:
--
-- 'tableName', 'disableKinesisStreamingDestination_tableName' - The name of the DynamoDB table.
--
-- 'streamArn', 'disableKinesisStreamingDestination_streamArn' - The ARN for a Kinesis data stream.
newDisableKinesisStreamingDestination ::
  -- | 'tableName'
  Prelude.Text ->
  -- | 'streamArn'
  Prelude.Text ->
  DisableKinesisStreamingDestination
newDisableKinesisStreamingDestination :: Text -> Text -> DisableKinesisStreamingDestination
newDisableKinesisStreamingDestination
  Text
pTableName_
  Text
pStreamArn_ =
    DisableKinesisStreamingDestination'
      { $sel:tableName:DisableKinesisStreamingDestination' :: Text
tableName =
          Text
pTableName_,
        $sel:streamArn:DisableKinesisStreamingDestination' :: Text
streamArn = Text
pStreamArn_
      }

-- | The name of the DynamoDB table.
disableKinesisStreamingDestination_tableName :: Lens.Lens' DisableKinesisStreamingDestination Prelude.Text
disableKinesisStreamingDestination_tableName :: Lens' DisableKinesisStreamingDestination Text
disableKinesisStreamingDestination_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableKinesisStreamingDestination' {Text
tableName :: Text
$sel:tableName:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
tableName} -> Text
tableName) (\s :: DisableKinesisStreamingDestination
s@DisableKinesisStreamingDestination' {} Text
a -> DisableKinesisStreamingDestination
s {$sel:tableName:DisableKinesisStreamingDestination' :: Text
tableName = Text
a} :: DisableKinesisStreamingDestination)

-- | The ARN for a Kinesis data stream.
disableKinesisStreamingDestination_streamArn :: Lens.Lens' DisableKinesisStreamingDestination Prelude.Text
disableKinesisStreamingDestination_streamArn :: Lens' DisableKinesisStreamingDestination Text
disableKinesisStreamingDestination_streamArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableKinesisStreamingDestination' {Text
streamArn :: Text
$sel:streamArn:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
streamArn} -> Text
streamArn) (\s :: DisableKinesisStreamingDestination
s@DisableKinesisStreamingDestination' {} Text
a -> DisableKinesisStreamingDestination
s {$sel:streamArn:DisableKinesisStreamingDestination' :: Text
streamArn = Text
a} :: DisableKinesisStreamingDestination)

instance
  Core.AWSRequest
    DisableKinesisStreamingDestination
  where
  type
    AWSResponse DisableKinesisStreamingDestination =
      KinesisStreamingDestinationOutput
  request :: (Service -> Service)
-> DisableKinesisStreamingDestination
-> Request DisableKinesisStreamingDestination
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 DisableKinesisStreamingDestination
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisableKinesisStreamingDestination)))
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 -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

instance
  Prelude.Hashable
    DisableKinesisStreamingDestination
  where
  hashWithSalt :: Int -> DisableKinesisStreamingDestination -> Int
hashWithSalt
    Int
_salt
    DisableKinesisStreamingDestination' {Text
streamArn :: Text
tableName :: Text
$sel:streamArn:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
$sel:tableName:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
streamArn

instance
  Prelude.NFData
    DisableKinesisStreamingDestination
  where
  rnf :: DisableKinesisStreamingDestination -> ()
rnf DisableKinesisStreamingDestination' {Text
streamArn :: Text
tableName :: Text
$sel:streamArn:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
$sel:tableName:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
streamArn

instance
  Data.ToHeaders
    DisableKinesisStreamingDestination
  where
  toHeaders :: DisableKinesisStreamingDestination -> 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
"DynamoDB_20120810.DisableKinesisStreamingDestination" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    DisableKinesisStreamingDestination
  where
  toJSON :: DisableKinesisStreamingDestination -> Value
toJSON DisableKinesisStreamingDestination' {Text
streamArn :: Text
tableName :: Text
$sel:streamArn:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
$sel:tableName:DisableKinesisStreamingDestination' :: DisableKinesisStreamingDestination -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
            forall a. a -> Maybe a
Prelude.Just (Key
"StreamArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
streamArn)
          ]
      )

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

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