{-# 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.Firehose.UntagDeliveryStream
-- 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 delivery stream. Removed tags are
-- deleted, and you can\'t recover them after this operation successfully
-- completes.
--
-- If you specify a tag that doesn\'t exist, the operation ignores it.
--
-- This operation has a limit of five transactions per second per account.
module Amazonka.Firehose.UntagDeliveryStream
  ( -- * Creating a Request
    UntagDeliveryStream (..),
    newUntagDeliveryStream,

    -- * Request Lenses
    untagDeliveryStream_deliveryStreamName,
    untagDeliveryStream_tagKeys,

    -- * Destructuring the Response
    UntagDeliveryStreamResponse (..),
    newUntagDeliveryStreamResponse,

    -- * Response Lenses
    untagDeliveryStreamResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Firehose.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:/ 'newUntagDeliveryStream' smart constructor.
data UntagDeliveryStream = UntagDeliveryStream'
  { -- | The name of the delivery stream.
    UntagDeliveryStream -> Text
deliveryStreamName :: Prelude.Text,
    -- | A list of tag keys. Each corresponding tag is removed from the delivery
    -- stream.
    UntagDeliveryStream -> NonEmpty Text
tagKeys :: Prelude.NonEmpty Prelude.Text
  }
  deriving (UntagDeliveryStream -> UntagDeliveryStream -> Bool
(UntagDeliveryStream -> UntagDeliveryStream -> Bool)
-> (UntagDeliveryStream -> UntagDeliveryStream -> Bool)
-> Eq UntagDeliveryStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagDeliveryStream -> UntagDeliveryStream -> Bool
$c/= :: UntagDeliveryStream -> UntagDeliveryStream -> Bool
== :: UntagDeliveryStream -> UntagDeliveryStream -> Bool
$c== :: UntagDeliveryStream -> UntagDeliveryStream -> Bool
Prelude.Eq, ReadPrec [UntagDeliveryStream]
ReadPrec UntagDeliveryStream
Int -> ReadS UntagDeliveryStream
ReadS [UntagDeliveryStream]
(Int -> ReadS UntagDeliveryStream)
-> ReadS [UntagDeliveryStream]
-> ReadPrec UntagDeliveryStream
-> ReadPrec [UntagDeliveryStream]
-> Read UntagDeliveryStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagDeliveryStream]
$creadListPrec :: ReadPrec [UntagDeliveryStream]
readPrec :: ReadPrec UntagDeliveryStream
$creadPrec :: ReadPrec UntagDeliveryStream
readList :: ReadS [UntagDeliveryStream]
$creadList :: ReadS [UntagDeliveryStream]
readsPrec :: Int -> ReadS UntagDeliveryStream
$creadsPrec :: Int -> ReadS UntagDeliveryStream
Prelude.Read, Int -> UntagDeliveryStream -> ShowS
[UntagDeliveryStream] -> ShowS
UntagDeliveryStream -> String
(Int -> UntagDeliveryStream -> ShowS)
-> (UntagDeliveryStream -> String)
-> ([UntagDeliveryStream] -> ShowS)
-> Show UntagDeliveryStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagDeliveryStream] -> ShowS
$cshowList :: [UntagDeliveryStream] -> ShowS
show :: UntagDeliveryStream -> String
$cshow :: UntagDeliveryStream -> String
showsPrec :: Int -> UntagDeliveryStream -> ShowS
$cshowsPrec :: Int -> UntagDeliveryStream -> ShowS
Prelude.Show, (forall x. UntagDeliveryStream -> Rep UntagDeliveryStream x)
-> (forall x. Rep UntagDeliveryStream x -> UntagDeliveryStream)
-> Generic UntagDeliveryStream
forall x. Rep UntagDeliveryStream x -> UntagDeliveryStream
forall x. UntagDeliveryStream -> Rep UntagDeliveryStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagDeliveryStream x -> UntagDeliveryStream
$cfrom :: forall x. UntagDeliveryStream -> Rep UntagDeliveryStream x
Prelude.Generic)

-- |
-- Create a value of 'UntagDeliveryStream' 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:
--
-- 'deliveryStreamName', 'untagDeliveryStream_deliveryStreamName' - The name of the delivery stream.
--
-- 'tagKeys', 'untagDeliveryStream_tagKeys' - A list of tag keys. Each corresponding tag is removed from the delivery
-- stream.
newUntagDeliveryStream ::
  -- | 'deliveryStreamName'
  Prelude.Text ->
  -- | 'tagKeys'
  Prelude.NonEmpty Prelude.Text ->
  UntagDeliveryStream
newUntagDeliveryStream :: Text -> NonEmpty Text -> UntagDeliveryStream
newUntagDeliveryStream Text
pDeliveryStreamName_ NonEmpty Text
pTagKeys_ =
  UntagDeliveryStream' :: Text -> NonEmpty Text -> UntagDeliveryStream
UntagDeliveryStream'
    { $sel:deliveryStreamName:UntagDeliveryStream' :: Text
deliveryStreamName =
        Text
pDeliveryStreamName_,
      $sel:tagKeys:UntagDeliveryStream' :: 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 delivery stream.
untagDeliveryStream_deliveryStreamName :: Lens.Lens' UntagDeliveryStream Prelude.Text
untagDeliveryStream_deliveryStreamName :: (Text -> f Text) -> UntagDeliveryStream -> f UntagDeliveryStream
untagDeliveryStream_deliveryStreamName = (UntagDeliveryStream -> Text)
-> (UntagDeliveryStream -> Text -> UntagDeliveryStream)
-> Lens UntagDeliveryStream UntagDeliveryStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagDeliveryStream' {Text
deliveryStreamName :: Text
$sel:deliveryStreamName:UntagDeliveryStream' :: UntagDeliveryStream -> Text
deliveryStreamName} -> Text
deliveryStreamName) (\s :: UntagDeliveryStream
s@UntagDeliveryStream' {} Text
a -> UntagDeliveryStream
s {$sel:deliveryStreamName:UntagDeliveryStream' :: Text
deliveryStreamName = Text
a} :: UntagDeliveryStream)

-- | A list of tag keys. Each corresponding tag is removed from the delivery
-- stream.
untagDeliveryStream_tagKeys :: Lens.Lens' UntagDeliveryStream (Prelude.NonEmpty Prelude.Text)
untagDeliveryStream_tagKeys :: (NonEmpty Text -> f (NonEmpty Text))
-> UntagDeliveryStream -> f UntagDeliveryStream
untagDeliveryStream_tagKeys = (UntagDeliveryStream -> NonEmpty Text)
-> (UntagDeliveryStream -> NonEmpty Text -> UntagDeliveryStream)
-> Lens
     UntagDeliveryStream
     UntagDeliveryStream
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagDeliveryStream' {NonEmpty Text
tagKeys :: NonEmpty Text
$sel:tagKeys:UntagDeliveryStream' :: UntagDeliveryStream -> NonEmpty Text
tagKeys} -> NonEmpty Text
tagKeys) (\s :: UntagDeliveryStream
s@UntagDeliveryStream' {} NonEmpty Text
a -> UntagDeliveryStream
s {$sel:tagKeys:UntagDeliveryStream' :: NonEmpty Text
tagKeys = NonEmpty Text
a} :: UntagDeliveryStream) ((NonEmpty Text -> f (NonEmpty Text))
 -> UntagDeliveryStream -> f UntagDeliveryStream)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UntagDeliveryStream
-> f UntagDeliveryStream
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 UntagDeliveryStream where
  type
    AWSResponse UntagDeliveryStream =
      UntagDeliveryStreamResponse
  request :: UntagDeliveryStream -> Request UntagDeliveryStream
request = Service -> UntagDeliveryStream -> Request UntagDeliveryStream
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UntagDeliveryStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UntagDeliveryStream)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UntagDeliveryStream))
-> Logger
-> Service
-> Proxy UntagDeliveryStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UntagDeliveryStream)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UntagDeliveryStreamResponse
UntagDeliveryStreamResponse'
            (Int -> UntagDeliveryStreamResponse)
-> Either String Int -> Either String UntagDeliveryStreamResponse
forall (f :: * -> *) a b. Functor 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 UntagDeliveryStream

instance Prelude.NFData UntagDeliveryStream

instance Core.ToHeaders UntagDeliveryStream where
  toHeaders :: UntagDeliveryStream -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UntagDeliveryStream -> 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
"Firehose_20150804.UntagDeliveryStream" ::
                          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 UntagDeliveryStream where
  toJSON :: UntagDeliveryStream -> Value
toJSON UntagDeliveryStream' {NonEmpty Text
Text
tagKeys :: NonEmpty Text
deliveryStreamName :: Text
$sel:tagKeys:UntagDeliveryStream' :: UntagDeliveryStream -> NonEmpty Text
$sel:deliveryStreamName:UntagDeliveryStream' :: UntagDeliveryStream -> 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
"DeliveryStreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deliveryStreamName),
            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 UntagDeliveryStream where
  toPath :: UntagDeliveryStream -> ByteString
toPath = ByteString -> UntagDeliveryStream -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'UntagDeliveryStreamResponse' 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:
--
-- 'httpStatus', 'untagDeliveryStreamResponse_httpStatus' - The response's http status code.
newUntagDeliveryStreamResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UntagDeliveryStreamResponse
newUntagDeliveryStreamResponse :: Int -> UntagDeliveryStreamResponse
newUntagDeliveryStreamResponse Int
pHttpStatus_ =
  UntagDeliveryStreamResponse' :: Int -> UntagDeliveryStreamResponse
UntagDeliveryStreamResponse'
    { $sel:httpStatus:UntagDeliveryStreamResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UntagDeliveryStreamResponse