{-# 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.CloudFront.UntagResource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Remove tags from a CloudFront resource.
module Amazonka.CloudFront.UntagResource
  ( -- * Creating a Request
    UntagResource (..),
    newUntagResource,

    -- * Request Lenses
    untagResource_resource,
    untagResource_tagKeys,

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

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

-- | The request to remove tags from a CloudFront resource.
--
-- /See:/ 'newUntagResource' smart constructor.
data UntagResource = UntagResource'
  { -- | An ARN of a CloudFront resource.
    UntagResource -> Text
resource :: Prelude.Text,
    -- | A complex type that contains zero or more @Tag@ key elements.
    UntagResource -> TagKeys
tagKeys :: TagKeys
  }
  deriving (UntagResource -> UntagResource -> Bool
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, ReadPrec [UntagResource]
ReadPrec UntagResource
Int -> ReadS UntagResource
ReadS [UntagResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagResource]
$creadListPrec :: ReadPrec [UntagResource]
readPrec :: ReadPrec UntagResource
$creadPrec :: ReadPrec UntagResource
readList :: ReadS [UntagResource]
$creadList :: ReadS [UntagResource]
readsPrec :: Int -> ReadS UntagResource
$creadsPrec :: Int -> ReadS UntagResource
Prelude.Read, Int -> UntagResource -> ShowS
[UntagResource] -> ShowS
UntagResource -> String
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. 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:
--
-- 'resource', 'untagResource_resource' - An ARN of a CloudFront resource.
--
-- 'tagKeys', 'untagResource_tagKeys' - A complex type that contains zero or more @Tag@ key elements.
newUntagResource ::
  -- | 'resource'
  Prelude.Text ->
  -- | 'tagKeys'
  TagKeys ->
  UntagResource
newUntagResource :: Text -> TagKeys -> UntagResource
newUntagResource Text
pResource_ TagKeys
pTagKeys_ =
  UntagResource'
    { $sel:resource:UntagResource' :: Text
resource = Text
pResource_,
      $sel:tagKeys:UntagResource' :: TagKeys
tagKeys = TagKeys
pTagKeys_
    }

-- | An ARN of a CloudFront resource.
untagResource_resource :: Lens.Lens' UntagResource Prelude.Text
untagResource_resource :: Lens' UntagResource Text
untagResource_resource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResource' {Text
resource :: Text
$sel:resource:UntagResource' :: UntagResource -> Text
resource} -> Text
resource) (\s :: UntagResource
s@UntagResource' {} Text
a -> UntagResource
s {$sel:resource:UntagResource' :: Text
resource = Text
a} :: UntagResource)

-- | A complex type that contains zero or more @Tag@ key elements.
untagResource_tagKeys :: Lens.Lens' UntagResource TagKeys
untagResource_tagKeys :: Lens' UntagResource TagKeys
untagResource_tagKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResource' {TagKeys
tagKeys :: TagKeys
$sel:tagKeys:UntagResource' :: UntagResource -> TagKeys
tagKeys} -> TagKeys
tagKeys) (\s :: UntagResource
s@UntagResource' {} TagKeys
a -> UntagResource
s {$sel:tagKeys:UntagResource' :: TagKeys
tagKeys = TagKeys
a} :: UntagResource)

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

instance Prelude.Hashable UntagResource where
  hashWithSalt :: Int -> UntagResource -> Int
hashWithSalt Int
_salt UntagResource' {Text
TagKeys
tagKeys :: TagKeys
resource :: Text
$sel:tagKeys:UntagResource' :: UntagResource -> TagKeys
$sel:resource:UntagResource' :: UntagResource -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TagKeys
tagKeys

instance Prelude.NFData UntagResource where
  rnf :: UntagResource -> ()
rnf UntagResource' {Text
TagKeys
tagKeys :: TagKeys
resource :: Text
$sel:tagKeys:UntagResource' :: UntagResource -> TagKeys
$sel:resource:UntagResource' :: UntagResource -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
resource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TagKeys
tagKeys

instance Data.ToElement UntagResource where
  toElement :: UntagResource -> Element
toElement UntagResource' {Text
TagKeys
tagKeys :: TagKeys
resource :: Text
$sel:tagKeys:UntagResource' :: UntagResource -> TagKeys
$sel:resource:UntagResource' :: UntagResource -> Text
..} =
    forall a. ToXML a => Name -> a -> Element
Data.mkElement
      Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}TagKeys"
      TagKeys
tagKeys

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

instance Data.ToPath UntagResource where
  toPath :: UntagResource -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/tagging"

instance Data.ToQuery UntagResource where
  toQuery :: UntagResource -> QueryString
toQuery UntagResource' {Text
TagKeys
tagKeys :: TagKeys
resource :: Text
$sel:tagKeys:UntagResource' :: UntagResource -> TagKeys
$sel:resource:UntagResource' :: UntagResource -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Resource" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
resource, QueryString
"Operation=Untag"]

-- | /See:/ 'newUntagResourceResponse' smart constructor.
data UntagResourceResponse = UntagResourceResponse'
  {
  }
  deriving (UntagResourceResponse -> UntagResourceResponse -> Bool
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]
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
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. 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 where
  rnf :: UntagResourceResponse -> ()
rnf UntagResourceResponse
_ = ()