{-# 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.Chime.UntagResource
-- 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)
--
-- Untags the specified tags from the specified Amazon Chime SDK meeting
-- resource.
module Amazonka.Chime.UntagResource
  ( -- * Creating a Request
    UntagResource (..),
    newUntagResource,

    -- * Request Lenses
    untagResource_resourceARN,
    untagResource_tagKeys,

    -- * Destructuring the Response
    UntagResourceResponse (..),
    newUntagResourceResponse,
  )
where

import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
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:/ 'newUntagResource' smart constructor.
data UntagResource = UntagResource'
  { -- | The resource ARN.
    UntagResource -> Sensitive Text
resourceARN :: Core.Sensitive Prelude.Text,
    -- | The tag keys.
    UntagResource -> NonEmpty (Sensitive Text)
tagKeys :: Prelude.NonEmpty (Core.Sensitive Prelude.Text)
  }
  deriving (UntagResource -> UntagResource -> Bool
(UntagResource -> UntagResource -> Bool)
-> (UntagResource -> UntagResource -> Bool) -> Eq UntagResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagResource -> UntagResource -> Bool
$c/= :: UntagResource -> UntagResource -> Bool
== :: UntagResource -> UntagResource -> Bool
$c== :: UntagResource -> UntagResource -> Bool
Prelude.Eq, Int -> UntagResource -> ShowS
[UntagResource] -> ShowS
UntagResource -> String
(Int -> UntagResource -> ShowS)
-> (UntagResource -> String)
-> ([UntagResource] -> ShowS)
-> Show UntagResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagResource] -> ShowS
$cshowList :: [UntagResource] -> ShowS
show :: UntagResource -> String
$cshow :: UntagResource -> String
showsPrec :: Int -> UntagResource -> ShowS
$cshowsPrec :: Int -> UntagResource -> ShowS
Prelude.Show, (forall x. UntagResource -> Rep UntagResource x)
-> (forall x. Rep UntagResource x -> UntagResource)
-> Generic UntagResource
forall x. Rep UntagResource x -> UntagResource
forall x. UntagResource -> Rep UntagResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagResource x -> UntagResource
$cfrom :: forall x. UntagResource -> Rep UntagResource x
Prelude.Generic)

-- |
-- Create a value of 'UntagResource' 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:
--
-- 'resourceARN', 'untagResource_resourceARN' - The resource ARN.
--
-- 'tagKeys', 'untagResource_tagKeys' - The tag keys.
newUntagResource ::
  -- | 'resourceARN'
  Prelude.Text ->
  -- | 'tagKeys'
  Prelude.NonEmpty Prelude.Text ->
  UntagResource
newUntagResource :: Text -> NonEmpty Text -> UntagResource
newUntagResource Text
pResourceARN_ NonEmpty Text
pTagKeys_ =
  UntagResource' :: Sensitive Text -> NonEmpty (Sensitive Text) -> UntagResource
UntagResource'
    { $sel:resourceARN:UntagResource' :: Sensitive Text
resourceARN =
        Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pResourceARN_,
      $sel:tagKeys:UntagResource' :: NonEmpty (Sensitive Text)
tagKeys = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged
     (NonEmpty (Sensitive Text)) (Identity (NonEmpty (Sensitive 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 (Sensitive Text)) (Identity (NonEmpty (Sensitive Text))))
-> NonEmpty Text -> NonEmpty (Sensitive Text)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagKeys_
    }

-- | The resource ARN.
untagResource_resourceARN :: Lens.Lens' UntagResource Prelude.Text
untagResource_resourceARN :: (Text -> f Text) -> UntagResource -> f UntagResource
untagResource_resourceARN = (UntagResource -> Sensitive Text)
-> (UntagResource -> Sensitive Text -> UntagResource)
-> Lens
     UntagResource UntagResource (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResource' {Sensitive Text
resourceARN :: Sensitive Text
$sel:resourceARN:UntagResource' :: UntagResource -> Sensitive Text
resourceARN} -> Sensitive Text
resourceARN) (\s :: UntagResource
s@UntagResource' {} Sensitive Text
a -> UntagResource
s {$sel:resourceARN:UntagResource' :: Sensitive Text
resourceARN = Sensitive Text
a} :: UntagResource) ((Sensitive Text -> f (Sensitive Text))
 -> UntagResource -> f UntagResource)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> UntagResource
-> f UntagResource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The tag keys.
untagResource_tagKeys :: Lens.Lens' UntagResource (Prelude.NonEmpty Prelude.Text)
untagResource_tagKeys :: (NonEmpty Text -> f (NonEmpty Text))
-> UntagResource -> f UntagResource
untagResource_tagKeys = (UntagResource -> NonEmpty (Sensitive Text))
-> (UntagResource -> NonEmpty (Sensitive Text) -> UntagResource)
-> Lens
     UntagResource
     UntagResource
     (NonEmpty (Sensitive Text))
     (NonEmpty (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResource' {NonEmpty (Sensitive Text)
tagKeys :: NonEmpty (Sensitive Text)
$sel:tagKeys:UntagResource' :: UntagResource -> NonEmpty (Sensitive Text)
tagKeys} -> NonEmpty (Sensitive Text)
tagKeys) (\s :: UntagResource
s@UntagResource' {} NonEmpty (Sensitive Text)
a -> UntagResource
s {$sel:tagKeys:UntagResource' :: NonEmpty (Sensitive Text)
tagKeys = NonEmpty (Sensitive Text)
a} :: UntagResource) ((NonEmpty (Sensitive Text) -> f (NonEmpty (Sensitive Text)))
 -> UntagResource -> f UntagResource)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty (Sensitive Text) -> f (NonEmpty (Sensitive Text)))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UntagResource
-> f UntagResource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty (Sensitive Text) -> f (NonEmpty (Sensitive Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable UntagResource

instance Prelude.NFData UntagResource

instance Core.ToHeaders UntagResource where
  toHeaders :: UntagResource -> [Header]
toHeaders = [Header] -> UntagResource -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

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

instance Core.ToQuery UntagResource where
  toQuery :: UntagResource -> QueryString
toQuery =
    QueryString -> UntagResource -> QueryString
forall a b. a -> b -> a
Prelude.const
      ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=untag-resource"])

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

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

instance Prelude.NFData UntagResourceResponse