{-# 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-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 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 Amazonka.KinesisVideo.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:/ '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
(UntagStream -> UntagStream -> Bool)
-> (UntagStream -> UntagStream -> Bool) -> Eq UntagStream
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]
(Int -> ReadS UntagStream)
-> ReadS [UntagStream]
-> ReadPrec UntagStream
-> ReadPrec [UntagStream]
-> Read 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
(Int -> UntagStream -> ShowS)
-> (UntagStream -> String)
-> ([UntagStream] -> ShowS)
-> Show UntagStream
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. UntagStream -> Rep UntagStream x)
-> (forall x. Rep UntagStream x -> UntagStream)
-> Generic UntagStream
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' :: Maybe Text -> Maybe Text -> NonEmpty Text -> UntagStream
UntagStream'
    { $sel:streamARN:UntagStream' :: Maybe Text
streamARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:UntagStream' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tagKeyList:UntagStream' :: NonEmpty Text
tagKeyList = 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
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 :: (Maybe Text -> f (Maybe Text)) -> UntagStream -> f UntagStream
untagStream_streamARN = (UntagStream -> Maybe Text)
-> (UntagStream -> Maybe Text -> UntagStream)
-> Lens UntagStream UntagStream (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> UntagStream -> f UntagStream
untagStream_streamName = (UntagStream -> Maybe Text)
-> (UntagStream -> Maybe Text -> UntagStream)
-> Lens UntagStream UntagStream (Maybe Text) (Maybe Text)
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 :: (NonEmpty Text -> f (NonEmpty Text))
-> UntagStream -> f UntagStream
untagStream_tagKeyList = (UntagStream -> NonEmpty Text)
-> (UntagStream -> NonEmpty Text -> UntagStream)
-> Lens UntagStream UntagStream (NonEmpty Text) (NonEmpty Text)
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) ((NonEmpty Text -> f (NonEmpty Text))
 -> UntagStream -> f UntagStream)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UntagStream
-> f UntagStream
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 UntagStream where
  type AWSResponse UntagStream = UntagStreamResponse
  request :: UntagStream -> Request UntagStream
request = Service -> UntagStream -> Request UntagStream
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UntagStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagStream)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UntagStream))
-> Logger
-> Service
-> Proxy UntagStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagStream)))
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 -> UntagStreamResponse
UntagStreamResponse'
            (Int -> UntagStreamResponse)
-> Either String Int -> Either String UntagStreamResponse
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 UntagStream

instance Prelude.NFData UntagStream

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"StreamARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamARN,
            (Text
"StreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagKeyList" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
tagKeyList)
          ]
      )

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

instance Core.ToQuery UntagStream where
  toQuery :: UntagStream -> QueryString
toQuery = QueryString -> UntagStream -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UntagStreamResponse -> UntagStreamResponse -> Bool)
-> (UntagStreamResponse -> UntagStreamResponse -> Bool)
-> Eq UntagStreamResponse
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]
(Int -> ReadS UntagStreamResponse)
-> ReadS [UntagStreamResponse]
-> ReadPrec UntagStreamResponse
-> ReadPrec [UntagStreamResponse]
-> Read 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
(Int -> UntagStreamResponse -> ShowS)
-> (UntagStreamResponse -> String)
-> ([UntagStreamResponse] -> ShowS)
-> Show UntagStreamResponse
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. UntagStreamResponse -> Rep UntagStreamResponse x)
-> (forall x. Rep UntagStreamResponse x -> UntagStreamResponse)
-> Generic UntagStreamResponse
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' :: Int -> UntagStreamResponse
UntagStreamResponse' {$sel:httpStatus:UntagStreamResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
untagStreamResponse_httpStatus :: Lens.Lens' UntagStreamResponse Prelude.Int
untagStreamResponse_httpStatus :: (Int -> f Int) -> UntagStreamResponse -> f UntagStreamResponse
untagStreamResponse_httpStatus = (UntagStreamResponse -> Int)
-> (UntagStreamResponse -> Int -> UntagStreamResponse)
-> Lens UntagStreamResponse UntagStreamResponse Int Int
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