{-# 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.OpenSearch.RemoveTags
-- 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 the specified set of tags from the given domain.
module Amazonka.OpenSearch.RemoveTags
  ( -- * Creating a Request
    RemoveTags (..),
    newRemoveTags,

    -- * Request Lenses
    removeTags_arn,
    removeTags_tagKeys,

    -- * Destructuring the Response
    RemoveTagsResponse (..),
    newRemoveTagsResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Container for the parameters to the @ RemoveTags @ operation. Specify
-- the @ARN@ for the domain from which you want to remove the specified
-- @TagKey@.
--
-- /See:/ 'newRemoveTags' smart constructor.
data RemoveTags = RemoveTags'
  { -- | The @ARN@ of the domain from which you want to delete the specified
    -- tags.
    RemoveTags -> Text
arn :: Prelude.Text,
    -- | The @TagKey@ list you want to remove from the domain.
    RemoveTags -> [Text]
tagKeys :: [Prelude.Text]
  }
  deriving (RemoveTags -> RemoveTags -> Bool
(RemoveTags -> RemoveTags -> Bool)
-> (RemoveTags -> RemoveTags -> Bool) -> Eq RemoveTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTags -> RemoveTags -> Bool
$c/= :: RemoveTags -> RemoveTags -> Bool
== :: RemoveTags -> RemoveTags -> Bool
$c== :: RemoveTags -> RemoveTags -> Bool
Prelude.Eq, ReadPrec [RemoveTags]
ReadPrec RemoveTags
Int -> ReadS RemoveTags
ReadS [RemoveTags]
(Int -> ReadS RemoveTags)
-> ReadS [RemoveTags]
-> ReadPrec RemoveTags
-> ReadPrec [RemoveTags]
-> Read RemoveTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTags]
$creadListPrec :: ReadPrec [RemoveTags]
readPrec :: ReadPrec RemoveTags
$creadPrec :: ReadPrec RemoveTags
readList :: ReadS [RemoveTags]
$creadList :: ReadS [RemoveTags]
readsPrec :: Int -> ReadS RemoveTags
$creadsPrec :: Int -> ReadS RemoveTags
Prelude.Read, Int -> RemoveTags -> ShowS
[RemoveTags] -> ShowS
RemoveTags -> String
(Int -> RemoveTags -> ShowS)
-> (RemoveTags -> String)
-> ([RemoveTags] -> ShowS)
-> Show RemoveTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTags] -> ShowS
$cshowList :: [RemoveTags] -> ShowS
show :: RemoveTags -> String
$cshow :: RemoveTags -> String
showsPrec :: Int -> RemoveTags -> ShowS
$cshowsPrec :: Int -> RemoveTags -> ShowS
Prelude.Show, (forall x. RemoveTags -> Rep RemoveTags x)
-> (forall x. Rep RemoveTags x -> RemoveTags) -> Generic RemoveTags
forall x. Rep RemoveTags x -> RemoveTags
forall x. RemoveTags -> Rep RemoveTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveTags x -> RemoveTags
$cfrom :: forall x. RemoveTags -> Rep RemoveTags x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTags' 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:
--
-- 'arn', 'removeTags_arn' - The @ARN@ of the domain from which you want to delete the specified
-- tags.
--
-- 'tagKeys', 'removeTags_tagKeys' - The @TagKey@ list you want to remove from the domain.
newRemoveTags ::
  -- | 'arn'
  Prelude.Text ->
  RemoveTags
newRemoveTags :: Text -> RemoveTags
newRemoveTags Text
pARN_ =
  RemoveTags' :: Text -> [Text] -> RemoveTags
RemoveTags' {$sel:arn:RemoveTags' :: Text
arn = Text
pARN_, $sel:tagKeys:RemoveTags' :: [Text]
tagKeys = [Text]
forall a. Monoid a => a
Prelude.mempty}

-- | The @ARN@ of the domain from which you want to delete the specified
-- tags.
removeTags_arn :: Lens.Lens' RemoveTags Prelude.Text
removeTags_arn :: (Text -> f Text) -> RemoveTags -> f RemoveTags
removeTags_arn = (RemoveTags -> Text)
-> (RemoveTags -> Text -> RemoveTags)
-> Lens RemoveTags RemoveTags Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTags' {Text
arn :: Text
$sel:arn:RemoveTags' :: RemoveTags -> Text
arn} -> Text
arn) (\s :: RemoveTags
s@RemoveTags' {} Text
a -> RemoveTags
s {$sel:arn:RemoveTags' :: Text
arn = Text
a} :: RemoveTags)

-- | The @TagKey@ list you want to remove from the domain.
removeTags_tagKeys :: Lens.Lens' RemoveTags [Prelude.Text]
removeTags_tagKeys :: ([Text] -> f [Text]) -> RemoveTags -> f RemoveTags
removeTags_tagKeys = (RemoveTags -> [Text])
-> (RemoveTags -> [Text] -> RemoveTags)
-> Lens RemoveTags RemoveTags [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTags' {[Text]
tagKeys :: [Text]
$sel:tagKeys:RemoveTags' :: RemoveTags -> [Text]
tagKeys} -> [Text]
tagKeys) (\s :: RemoveTags
s@RemoveTags' {} [Text]
a -> RemoveTags
s {$sel:tagKeys:RemoveTags' :: [Text]
tagKeys = [Text]
a} :: RemoveTags) (([Text] -> f [Text]) -> RemoveTags -> f RemoveTags)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> RemoveTags
-> f RemoveTags
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable RemoveTags

instance Prelude.NFData RemoveTags

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

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

instance Core.ToPath RemoveTags where
  toPath :: RemoveTags -> ByteString
toPath = ByteString -> RemoveTags -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2021-01-01/tags-removal"

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

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

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

instance Prelude.NFData RemoveTagsResponse