{-# 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.Redshift.DeleteTags
-- 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)
--
-- Deletes tags from a resource. You must provide the ARN of the resource
-- from which you want to delete the tag or tags.
module Amazonka.Redshift.DeleteTags
  ( -- * Creating a Request
    DeleteTags (..),
    newDeleteTags,

    -- * Request Lenses
    deleteTags_resourceName,
    deleteTags_tagKeys,

    -- * Destructuring the Response
    DeleteTagsResponse (..),
    newDeleteTagsResponse,
  )
where

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

-- | Contains the output from the @DeleteTags@ action.
--
-- /See:/ 'newDeleteTags' smart constructor.
data DeleteTags = DeleteTags'
  { -- | The Amazon Resource Name (ARN) from which you want to remove the tag or
    -- tags. For example, @arn:aws:redshift:us-east-2:123456789:cluster:t1@.
    DeleteTags -> Text
resourceName :: Prelude.Text,
    -- | The tag key that you want to delete.
    DeleteTags -> [Text]
tagKeys :: [Prelude.Text]
  }
  deriving (DeleteTags -> DeleteTags -> Bool
(DeleteTags -> DeleteTags -> Bool)
-> (DeleteTags -> DeleteTags -> Bool) -> Eq DeleteTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTags -> DeleteTags -> Bool
$c/= :: DeleteTags -> DeleteTags -> Bool
== :: DeleteTags -> DeleteTags -> Bool
$c== :: DeleteTags -> DeleteTags -> Bool
Prelude.Eq, ReadPrec [DeleteTags]
ReadPrec DeleteTags
Int -> ReadS DeleteTags
ReadS [DeleteTags]
(Int -> ReadS DeleteTags)
-> ReadS [DeleteTags]
-> ReadPrec DeleteTags
-> ReadPrec [DeleteTags]
-> Read DeleteTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTags]
$creadListPrec :: ReadPrec [DeleteTags]
readPrec :: ReadPrec DeleteTags
$creadPrec :: ReadPrec DeleteTags
readList :: ReadS [DeleteTags]
$creadList :: ReadS [DeleteTags]
readsPrec :: Int -> ReadS DeleteTags
$creadsPrec :: Int -> ReadS DeleteTags
Prelude.Read, Int -> DeleteTags -> ShowS
[DeleteTags] -> ShowS
DeleteTags -> String
(Int -> DeleteTags -> ShowS)
-> (DeleteTags -> String)
-> ([DeleteTags] -> ShowS)
-> Show DeleteTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTags] -> ShowS
$cshowList :: [DeleteTags] -> ShowS
show :: DeleteTags -> String
$cshow :: DeleteTags -> String
showsPrec :: Int -> DeleteTags -> ShowS
$cshowsPrec :: Int -> DeleteTags -> ShowS
Prelude.Show, (forall x. DeleteTags -> Rep DeleteTags x)
-> (forall x. Rep DeleteTags x -> DeleteTags) -> Generic DeleteTags
forall x. Rep DeleteTags x -> DeleteTags
forall x. DeleteTags -> Rep DeleteTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTags x -> DeleteTags
$cfrom :: forall x. DeleteTags -> Rep DeleteTags x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTags' 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:
--
-- 'resourceName', 'deleteTags_resourceName' - The Amazon Resource Name (ARN) from which you want to remove the tag or
-- tags. For example, @arn:aws:redshift:us-east-2:123456789:cluster:t1@.
--
-- 'tagKeys', 'deleteTags_tagKeys' - The tag key that you want to delete.
newDeleteTags ::
  -- | 'resourceName'
  Prelude.Text ->
  DeleteTags
newDeleteTags :: Text -> DeleteTags
newDeleteTags Text
pResourceName_ =
  DeleteTags' :: Text -> [Text] -> DeleteTags
DeleteTags'
    { $sel:resourceName:DeleteTags' :: Text
resourceName = Text
pResourceName_,
      $sel:tagKeys:DeleteTags' :: [Text]
tagKeys = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The Amazon Resource Name (ARN) from which you want to remove the tag or
-- tags. For example, @arn:aws:redshift:us-east-2:123456789:cluster:t1@.
deleteTags_resourceName :: Lens.Lens' DeleteTags Prelude.Text
deleteTags_resourceName :: (Text -> f Text) -> DeleteTags -> f DeleteTags
deleteTags_resourceName = (DeleteTags -> Text)
-> (DeleteTags -> Text -> DeleteTags)
-> Lens DeleteTags DeleteTags Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTags' {Text
resourceName :: Text
$sel:resourceName:DeleteTags' :: DeleteTags -> Text
resourceName} -> Text
resourceName) (\s :: DeleteTags
s@DeleteTags' {} Text
a -> DeleteTags
s {$sel:resourceName:DeleteTags' :: Text
resourceName = Text
a} :: DeleteTags)

-- | The tag key that you want to delete.
deleteTags_tagKeys :: Lens.Lens' DeleteTags [Prelude.Text]
deleteTags_tagKeys :: ([Text] -> f [Text]) -> DeleteTags -> f DeleteTags
deleteTags_tagKeys = (DeleteTags -> [Text])
-> (DeleteTags -> [Text] -> DeleteTags)
-> Lens DeleteTags DeleteTags [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTags' {[Text]
tagKeys :: [Text]
$sel:tagKeys:DeleteTags' :: DeleteTags -> [Text]
tagKeys} -> [Text]
tagKeys) (\s :: DeleteTags
s@DeleteTags' {} [Text]
a -> DeleteTags
s {$sel:tagKeys:DeleteTags' :: [Text]
tagKeys = [Text]
a} :: DeleteTags) (([Text] -> f [Text]) -> DeleteTags -> f DeleteTags)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DeleteTags
-> f DeleteTags
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 DeleteTags where
  type AWSResponse DeleteTags = DeleteTagsResponse
  request :: DeleteTags -> Request DeleteTags
request = Service -> DeleteTags -> Request DeleteTags
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTags)))
response = AWSResponse DeleteTags
-> Logger
-> Service
-> Proxy DeleteTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTags)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteTags
DeleteTagsResponse
DeleteTagsResponse'

instance Prelude.Hashable DeleteTags

instance Prelude.NFData DeleteTags

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

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

instance Core.ToQuery DeleteTags where
  toQuery :: DeleteTags -> QueryString
toQuery DeleteTags' {[Text]
Text
tagKeys :: [Text]
resourceName :: Text
$sel:tagKeys:DeleteTags' :: DeleteTags -> [Text]
$sel:resourceName:DeleteTags' :: DeleteTags -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteTags" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"ResourceName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
resourceName,
        ByteString
"TagKeys" ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"TagKey" [Text]
tagKeys
      ]

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

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

instance Prelude.NFData DeleteTagsResponse