{-# 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.KinesisVideo.UntagStream
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes one or more tags from a stream. In the request, specify only a
-- tag key or keys; don\'t specify the value. If you specify a tag key that
-- does not exist, it\'s ignored.
--
-- In the request, you must provide the @StreamName@ or @StreamARN@.
module Amazonka.KinesisVideo.UntagStream
  ( -- * Creating a Request
    UntagStream (..),
    newUntagStream,

    -- * Request Lenses
    untagStream_streamARN,
    untagStream_streamName,
    untagStream_tagKeyList,

    -- * Destructuring the Response
    UntagStreamResponse (..),
    newUntagStreamResponse,

    -- * Response Lenses
    untagStreamResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUntagStream' smart constructor.
data UntagStream = UntagStream'
  { -- | The Amazon Resource Name (ARN) of the stream that you want to remove
    -- tags from.
    UntagStream -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the stream that you want to remove tags from.
    UntagStream -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text,
    -- | A list of the keys of the tags that you want to remove.
    UntagStream -> NonEmpty Text
tagKeyList :: Prelude.NonEmpty Prelude.Text
  }
  deriving (UntagStream -> UntagStream -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagStream -> UntagStream -> Bool
$c/= :: UntagStream -> UntagStream -> Bool
== :: UntagStream -> UntagStream -> Bool
$c== :: UntagStream -> UntagStream -> Bool
Prelude.Eq, ReadPrec [UntagStream]
ReadPrec UntagStream
Int -> ReadS UntagStream
ReadS [UntagStream]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagStream]
$creadListPrec :: ReadPrec [UntagStream]
readPrec :: ReadPrec UntagStream
$creadPrec :: ReadPrec UntagStream
readList :: ReadS [UntagStream]
$creadList :: ReadS [UntagStream]
readsPrec :: Int -> ReadS UntagStream
$creadsPrec :: Int -> ReadS UntagStream
Prelude.Read, Int -> UntagStream -> ShowS
[UntagStream] -> ShowS
UntagStream -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagStream] -> ShowS
$cshowList :: [UntagStream] -> ShowS
show :: UntagStream -> String
$cshow :: UntagStream -> String
showsPrec :: Int -> UntagStream -> ShowS
$cshowsPrec :: Int -> UntagStream -> ShowS
Prelude.Show, forall x. Rep UntagStream x -> UntagStream
forall x. UntagStream -> Rep UntagStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagStream x -> UntagStream
$cfrom :: forall x. UntagStream -> Rep UntagStream x
Prelude.Generic)

-- |
-- Create a value of 'UntagStream' 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:
--
-- 'streamARN', 'untagStream_streamARN' - The Amazon Resource Name (ARN) of the stream that you want to remove
-- tags from.
--
-- 'streamName', 'untagStream_streamName' - The name of the stream that you want to remove tags from.
--
-- 'tagKeyList', 'untagStream_tagKeyList' - A list of the keys of the tags that you want to remove.
newUntagStream ::
  -- | 'tagKeyList'
  Prelude.NonEmpty Prelude.Text ->
  UntagStream
newUntagStream :: NonEmpty Text -> UntagStream
newUntagStream NonEmpty Text
pTagKeyList_ =
  UntagStream'
    { $sel:streamARN:UntagStream' :: Maybe Text
streamARN = forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:UntagStream' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing,
      $sel:tagKeyList:UntagStream' :: NonEmpty Text
tagKeyList = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagKeyList_
    }

-- | The Amazon Resource Name (ARN) of the stream that you want to remove
-- tags from.
untagStream_streamARN :: Lens.Lens' UntagStream (Prelude.Maybe Prelude.Text)
untagStream_streamARN :: Lens' UntagStream (Maybe Text)
untagStream_streamARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagStream' {Maybe Text
streamARN :: Maybe Text
$sel:streamARN:UntagStream' :: UntagStream -> Maybe Text
streamARN} -> Maybe Text
streamARN) (\s :: UntagStream
s@UntagStream' {} Maybe Text
a -> UntagStream
s {$sel:streamARN:UntagStream' :: Maybe Text
streamARN = Maybe Text
a} :: UntagStream)

-- | The name of the stream that you want to remove tags from.
untagStream_streamName :: Lens.Lens' UntagStream (Prelude.Maybe Prelude.Text)
untagStream_streamName :: Lens' UntagStream (Maybe Text)
untagStream_streamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagStream' {Maybe Text
streamName :: Maybe Text
$sel:streamName:UntagStream' :: UntagStream -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: UntagStream
s@UntagStream' {} Maybe Text
a -> UntagStream
s {$sel:streamName:UntagStream' :: Maybe Text
streamName = Maybe Text
a} :: UntagStream)

-- | A list of the keys of the tags that you want to remove.
untagStream_tagKeyList :: Lens.Lens' UntagStream (Prelude.NonEmpty Prelude.Text)
untagStream_tagKeyList :: Lens' UntagStream (NonEmpty Text)
untagStream_tagKeyList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagStream' {NonEmpty Text
tagKeyList :: NonEmpty Text
$sel:tagKeyList:UntagStream' :: UntagStream -> NonEmpty Text
tagKeyList} -> NonEmpty Text
tagKeyList) (\s :: UntagStream
s@UntagStream' {} NonEmpty Text
a -> UntagStream
s {$sel:tagKeyList:UntagStream' :: NonEmpty Text
tagKeyList = NonEmpty Text
a} :: UntagStream) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest UntagStream where
  type AWSResponse UntagStream = UntagStreamResponse
  request :: (Service -> Service) -> UntagStream -> Request UntagStream
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 UntagStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagStream)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UntagStreamResponse
UntagStreamResponse'
            forall (f :: * -> *) a b. Functor 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 UntagStream where
  hashWithSalt :: Int -> UntagStream -> Int
hashWithSalt Int
_salt UntagStream' {Maybe Text
NonEmpty Text
tagKeyList :: NonEmpty Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:tagKeyList:UntagStream' :: UntagStream -> NonEmpty Text
$sel:streamName:UntagStream' :: UntagStream -> Maybe Text
$sel:streamARN:UntagStream' :: UntagStream -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
tagKeyList

instance Prelude.NFData UntagStream where
  rnf :: UntagStream -> ()
rnf UntagStream' {Maybe Text
NonEmpty Text
tagKeyList :: NonEmpty Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:tagKeyList:UntagStream' :: UntagStream -> NonEmpty Text
$sel:streamName:UntagStream' :: UntagStream -> Maybe Text
$sel:streamARN:UntagStream' :: UntagStream -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
tagKeyList

instance Data.ToHeaders UntagStream where
  toHeaders :: UntagStream -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON UntagStream where
  toJSON :: UntagStream -> Value
toJSON UntagStream' {Maybe Text
NonEmpty Text
tagKeyList :: NonEmpty Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:tagKeyList:UntagStream' :: UntagStream -> NonEmpty Text
$sel:streamName:UntagStream' :: UntagStream -> Maybe Text
$sel:streamARN:UntagStream' :: UntagStream -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StreamARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamARN,
            (Key
"StreamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamName,
            forall a. a -> Maybe a
Prelude.Just (Key
"TagKeyList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
tagKeyList)
          ]
      )

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

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

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

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

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

instance Prelude.NFData UntagStreamResponse where
  rnf :: UntagStreamResponse -> ()
rnf UntagStreamResponse' {Int
httpStatus :: Int
$sel:httpStatus:UntagStreamResponse' :: UntagStreamResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus