{-# 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.Kinesis.RemoveTagsFromStream
-- 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)
--
-- Removes tags from the specified Kinesis data stream. Removed tags are
-- deleted and cannot be recovered after this operation successfully
-- completes.
--
-- If you specify a tag that does not exist, it is ignored.
--
-- RemoveTagsFromStream has a limit of five transactions per second per
-- account.
module Amazonka.Kinesis.RemoveTagsFromStream
  ( -- * Creating a Request
    RemoveTagsFromStream (..),
    newRemoveTagsFromStream,

    -- * Request Lenses
    removeTagsFromStream_streamName,
    removeTagsFromStream_tagKeys,

    -- * Destructuring the Response
    RemoveTagsFromStreamResponse (..),
    newRemoveTagsFromStreamResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Kinesis.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

-- | Represents the input for @RemoveTagsFromStream@.
--
-- /See:/ 'newRemoveTagsFromStream' smart constructor.
data RemoveTagsFromStream = RemoveTagsFromStream'
  { -- | The name of the stream.
    RemoveTagsFromStream -> Text
streamName :: Prelude.Text,
    -- | A list of tag keys. Each corresponding tag is removed from the stream.
    RemoveTagsFromStream -> NonEmpty Text
tagKeys :: Prelude.NonEmpty Prelude.Text
  }
  deriving (RemoveTagsFromStream -> RemoveTagsFromStream -> Bool
(RemoveTagsFromStream -> RemoveTagsFromStream -> Bool)
-> (RemoveTagsFromStream -> RemoveTagsFromStream -> Bool)
-> Eq RemoveTagsFromStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTagsFromStream -> RemoveTagsFromStream -> Bool
$c/= :: RemoveTagsFromStream -> RemoveTagsFromStream -> Bool
== :: RemoveTagsFromStream -> RemoveTagsFromStream -> Bool
$c== :: RemoveTagsFromStream -> RemoveTagsFromStream -> Bool
Prelude.Eq, ReadPrec [RemoveTagsFromStream]
ReadPrec RemoveTagsFromStream
Int -> ReadS RemoveTagsFromStream
ReadS [RemoveTagsFromStream]
(Int -> ReadS RemoveTagsFromStream)
-> ReadS [RemoveTagsFromStream]
-> ReadPrec RemoveTagsFromStream
-> ReadPrec [RemoveTagsFromStream]
-> Read RemoveTagsFromStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTagsFromStream]
$creadListPrec :: ReadPrec [RemoveTagsFromStream]
readPrec :: ReadPrec RemoveTagsFromStream
$creadPrec :: ReadPrec RemoveTagsFromStream
readList :: ReadS [RemoveTagsFromStream]
$creadList :: ReadS [RemoveTagsFromStream]
readsPrec :: Int -> ReadS RemoveTagsFromStream
$creadsPrec :: Int -> ReadS RemoveTagsFromStream
Prelude.Read, Int -> RemoveTagsFromStream -> ShowS
[RemoveTagsFromStream] -> ShowS
RemoveTagsFromStream -> String
(Int -> RemoveTagsFromStream -> ShowS)
-> (RemoveTagsFromStream -> String)
-> ([RemoveTagsFromStream] -> ShowS)
-> Show RemoveTagsFromStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTagsFromStream] -> ShowS
$cshowList :: [RemoveTagsFromStream] -> ShowS
show :: RemoveTagsFromStream -> String
$cshow :: RemoveTagsFromStream -> String
showsPrec :: Int -> RemoveTagsFromStream -> ShowS
$cshowsPrec :: Int -> RemoveTagsFromStream -> ShowS
Prelude.Show, (forall x. RemoveTagsFromStream -> Rep RemoveTagsFromStream x)
-> (forall x. Rep RemoveTagsFromStream x -> RemoveTagsFromStream)
-> Generic RemoveTagsFromStream
forall x. Rep RemoveTagsFromStream x -> RemoveTagsFromStream
forall x. RemoveTagsFromStream -> Rep RemoveTagsFromStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveTagsFromStream x -> RemoveTagsFromStream
$cfrom :: forall x. RemoveTagsFromStream -> Rep RemoveTagsFromStream x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTagsFromStream' 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:
--
-- 'streamName', 'removeTagsFromStream_streamName' - The name of the stream.
--
-- 'tagKeys', 'removeTagsFromStream_tagKeys' - A list of tag keys. Each corresponding tag is removed from the stream.
newRemoveTagsFromStream ::
  -- | 'streamName'
  Prelude.Text ->
  -- | 'tagKeys'
  Prelude.NonEmpty Prelude.Text ->
  RemoveTagsFromStream
newRemoveTagsFromStream :: Text -> NonEmpty Text -> RemoveTagsFromStream
newRemoveTagsFromStream Text
pStreamName_ NonEmpty Text
pTagKeys_ =
  RemoveTagsFromStream' :: Text -> NonEmpty Text -> RemoveTagsFromStream
RemoveTagsFromStream'
    { $sel:streamName:RemoveTagsFromStream' :: Text
streamName = Text
pStreamName_,
      $sel:tagKeys:RemoveTagsFromStream' :: NonEmpty Text
tagKeys = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagKeys_
    }

-- | The name of the stream.
removeTagsFromStream_streamName :: Lens.Lens' RemoveTagsFromStream Prelude.Text
removeTagsFromStream_streamName :: (Text -> f Text) -> RemoveTagsFromStream -> f RemoveTagsFromStream
removeTagsFromStream_streamName = (RemoveTagsFromStream -> Text)
-> (RemoveTagsFromStream -> Text -> RemoveTagsFromStream)
-> Lens RemoveTagsFromStream RemoveTagsFromStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTagsFromStream' {Text
streamName :: Text
$sel:streamName:RemoveTagsFromStream' :: RemoveTagsFromStream -> Text
streamName} -> Text
streamName) (\s :: RemoveTagsFromStream
s@RemoveTagsFromStream' {} Text
a -> RemoveTagsFromStream
s {$sel:streamName:RemoveTagsFromStream' :: Text
streamName = Text
a} :: RemoveTagsFromStream)

-- | A list of tag keys. Each corresponding tag is removed from the stream.
removeTagsFromStream_tagKeys :: Lens.Lens' RemoveTagsFromStream (Prelude.NonEmpty Prelude.Text)
removeTagsFromStream_tagKeys :: (NonEmpty Text -> f (NonEmpty Text))
-> RemoveTagsFromStream -> f RemoveTagsFromStream
removeTagsFromStream_tagKeys = (RemoveTagsFromStream -> NonEmpty Text)
-> (RemoveTagsFromStream -> NonEmpty Text -> RemoveTagsFromStream)
-> Lens
     RemoveTagsFromStream
     RemoveTagsFromStream
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTagsFromStream' {NonEmpty Text
tagKeys :: NonEmpty Text
$sel:tagKeys:RemoveTagsFromStream' :: RemoveTagsFromStream -> NonEmpty Text
tagKeys} -> NonEmpty Text
tagKeys) (\s :: RemoveTagsFromStream
s@RemoveTagsFromStream' {} NonEmpty Text
a -> RemoveTagsFromStream
s {$sel:tagKeys:RemoveTagsFromStream' :: NonEmpty Text
tagKeys = NonEmpty Text
a} :: RemoveTagsFromStream) ((NonEmpty Text -> f (NonEmpty Text))
 -> RemoveTagsFromStream -> f RemoveTagsFromStream)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> RemoveTagsFromStream
-> f RemoveTagsFromStream
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest RemoveTagsFromStream where
  type
    AWSResponse RemoveTagsFromStream =
      RemoveTagsFromStreamResponse
  request :: RemoveTagsFromStream -> Request RemoveTagsFromStream
request = Service -> RemoveTagsFromStream -> Request RemoveTagsFromStream
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RemoveTagsFromStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveTagsFromStream)))
response =
    AWSResponse RemoveTagsFromStream
-> Logger
-> Service
-> Proxy RemoveTagsFromStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveTagsFromStream)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse RemoveTagsFromStream
RemoveTagsFromStreamResponse
RemoveTagsFromStreamResponse'

instance Prelude.Hashable RemoveTagsFromStream

instance Prelude.NFData RemoveTagsFromStream

instance Core.ToHeaders RemoveTagsFromStream where
  toHeaders :: RemoveTagsFromStream -> [Header]
toHeaders =
    [Header] -> RemoveTagsFromStream -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"Kinesis_20131202.RemoveTagsFromStream" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON RemoveTagsFromStream where
  toJSON :: RemoveTagsFromStream -> Value
toJSON RemoveTagsFromStream' {NonEmpty Text
Text
tagKeys :: NonEmpty Text
streamName :: Text
$sel:tagKeys:RemoveTagsFromStream' :: RemoveTagsFromStream -> NonEmpty Text
$sel:streamName:RemoveTagsFromStream' :: RemoveTagsFromStream -> 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
"StreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
streamName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagKeys" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
tagKeys)
          ]
      )

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

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

-- | /See:/ 'newRemoveTagsFromStreamResponse' smart constructor.
data RemoveTagsFromStreamResponse = RemoveTagsFromStreamResponse'
  {
  }
  deriving (RemoveTagsFromStreamResponse
-> RemoveTagsFromStreamResponse -> Bool
(RemoveTagsFromStreamResponse
 -> RemoveTagsFromStreamResponse -> Bool)
-> (RemoveTagsFromStreamResponse
    -> RemoveTagsFromStreamResponse -> Bool)
-> Eq RemoveTagsFromStreamResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTagsFromStreamResponse
-> RemoveTagsFromStreamResponse -> Bool
$c/= :: RemoveTagsFromStreamResponse
-> RemoveTagsFromStreamResponse -> Bool
== :: RemoveTagsFromStreamResponse
-> RemoveTagsFromStreamResponse -> Bool
$c== :: RemoveTagsFromStreamResponse
-> RemoveTagsFromStreamResponse -> Bool
Prelude.Eq, ReadPrec [RemoveTagsFromStreamResponse]
ReadPrec RemoveTagsFromStreamResponse
Int -> ReadS RemoveTagsFromStreamResponse
ReadS [RemoveTagsFromStreamResponse]
(Int -> ReadS RemoveTagsFromStreamResponse)
-> ReadS [RemoveTagsFromStreamResponse]
-> ReadPrec RemoveTagsFromStreamResponse
-> ReadPrec [RemoveTagsFromStreamResponse]
-> Read RemoveTagsFromStreamResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTagsFromStreamResponse]
$creadListPrec :: ReadPrec [RemoveTagsFromStreamResponse]
readPrec :: ReadPrec RemoveTagsFromStreamResponse
$creadPrec :: ReadPrec RemoveTagsFromStreamResponse
readList :: ReadS [RemoveTagsFromStreamResponse]
$creadList :: ReadS [RemoveTagsFromStreamResponse]
readsPrec :: Int -> ReadS RemoveTagsFromStreamResponse
$creadsPrec :: Int -> ReadS RemoveTagsFromStreamResponse
Prelude.Read, Int -> RemoveTagsFromStreamResponse -> ShowS
[RemoveTagsFromStreamResponse] -> ShowS
RemoveTagsFromStreamResponse -> String
(Int -> RemoveTagsFromStreamResponse -> ShowS)
-> (RemoveTagsFromStreamResponse -> String)
-> ([RemoveTagsFromStreamResponse] -> ShowS)
-> Show RemoveTagsFromStreamResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTagsFromStreamResponse] -> ShowS
$cshowList :: [RemoveTagsFromStreamResponse] -> ShowS
show :: RemoveTagsFromStreamResponse -> String
$cshow :: RemoveTagsFromStreamResponse -> String
showsPrec :: Int -> RemoveTagsFromStreamResponse -> ShowS
$cshowsPrec :: Int -> RemoveTagsFromStreamResponse -> ShowS
Prelude.Show, (forall x.
 RemoveTagsFromStreamResponse -> Rep RemoveTagsFromStreamResponse x)
-> (forall x.
    Rep RemoveTagsFromStreamResponse x -> RemoveTagsFromStreamResponse)
-> Generic RemoveTagsFromStreamResponse
forall x.
Rep RemoveTagsFromStreamResponse x -> RemoveTagsFromStreamResponse
forall x.
RemoveTagsFromStreamResponse -> Rep RemoveTagsFromStreamResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveTagsFromStreamResponse x -> RemoveTagsFromStreamResponse
$cfrom :: forall x.
RemoveTagsFromStreamResponse -> Rep RemoveTagsFromStreamResponse x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTagsFromStreamResponse' 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.
newRemoveTagsFromStreamResponse ::
  RemoveTagsFromStreamResponse
newRemoveTagsFromStreamResponse :: RemoveTagsFromStreamResponse
newRemoveTagsFromStreamResponse =
  RemoveTagsFromStreamResponse
RemoveTagsFromStreamResponse'

instance Prelude.NFData RemoveTagsFromStreamResponse