{-# 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.CertificateManagerPCA.UntagCertificateAuthority
-- 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)
--
-- Remove one or more tags from your private CA. A tag consists of a
-- key-value pair. If you do not specify the value portion of the tag when
-- calling this action, the tag will be removed regardless of value. If you
-- specify a value, the tag is removed only if it is associated with the
-- specified value. To add tags to a private CA, use the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_TagCertificateAuthority.html TagCertificateAuthority>.
-- Call the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListTags.html ListTags>
-- action to see what tags are associated with your CA.
module Amazonka.CertificateManagerPCA.UntagCertificateAuthority
  ( -- * Creating a Request
    UntagCertificateAuthority (..),
    newUntagCertificateAuthority,

    -- * Request Lenses
    untagCertificateAuthority_certificateAuthorityArn,
    untagCertificateAuthority_tags,

    -- * Destructuring the Response
    UntagCertificateAuthorityResponse (..),
    newUntagCertificateAuthorityResponse,
  )
where

import Amazonka.CertificateManagerPCA.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:/ 'newUntagCertificateAuthority' smart constructor.
data UntagCertificateAuthority = UntagCertificateAuthority'
  { -- | The Amazon Resource Name (ARN) that was returned when you called
    -- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>.
    -- This must be of the form:
    --
    -- @arn:aws:acm-pca:region:account:certificate-authority\/12345678-1234-1234-1234-123456789012 @
    UntagCertificateAuthority -> Text
certificateAuthorityArn :: Prelude.Text,
    -- | List of tags to be removed from the CA.
    UntagCertificateAuthority -> NonEmpty Tag
tags :: Prelude.NonEmpty Tag
  }
  deriving (UntagCertificateAuthority -> UntagCertificateAuthority -> Bool
(UntagCertificateAuthority -> UntagCertificateAuthority -> Bool)
-> (UntagCertificateAuthority -> UntagCertificateAuthority -> Bool)
-> Eq UntagCertificateAuthority
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagCertificateAuthority -> UntagCertificateAuthority -> Bool
$c/= :: UntagCertificateAuthority -> UntagCertificateAuthority -> Bool
== :: UntagCertificateAuthority -> UntagCertificateAuthority -> Bool
$c== :: UntagCertificateAuthority -> UntagCertificateAuthority -> Bool
Prelude.Eq, ReadPrec [UntagCertificateAuthority]
ReadPrec UntagCertificateAuthority
Int -> ReadS UntagCertificateAuthority
ReadS [UntagCertificateAuthority]
(Int -> ReadS UntagCertificateAuthority)
-> ReadS [UntagCertificateAuthority]
-> ReadPrec UntagCertificateAuthority
-> ReadPrec [UntagCertificateAuthority]
-> Read UntagCertificateAuthority
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagCertificateAuthority]
$creadListPrec :: ReadPrec [UntagCertificateAuthority]
readPrec :: ReadPrec UntagCertificateAuthority
$creadPrec :: ReadPrec UntagCertificateAuthority
readList :: ReadS [UntagCertificateAuthority]
$creadList :: ReadS [UntagCertificateAuthority]
readsPrec :: Int -> ReadS UntagCertificateAuthority
$creadsPrec :: Int -> ReadS UntagCertificateAuthority
Prelude.Read, Int -> UntagCertificateAuthority -> ShowS
[UntagCertificateAuthority] -> ShowS
UntagCertificateAuthority -> String
(Int -> UntagCertificateAuthority -> ShowS)
-> (UntagCertificateAuthority -> String)
-> ([UntagCertificateAuthority] -> ShowS)
-> Show UntagCertificateAuthority
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagCertificateAuthority] -> ShowS
$cshowList :: [UntagCertificateAuthority] -> ShowS
show :: UntagCertificateAuthority -> String
$cshow :: UntagCertificateAuthority -> String
showsPrec :: Int -> UntagCertificateAuthority -> ShowS
$cshowsPrec :: Int -> UntagCertificateAuthority -> ShowS
Prelude.Show, (forall x.
 UntagCertificateAuthority -> Rep UntagCertificateAuthority x)
-> (forall x.
    Rep UntagCertificateAuthority x -> UntagCertificateAuthority)
-> Generic UntagCertificateAuthority
forall x.
Rep UntagCertificateAuthority x -> UntagCertificateAuthority
forall x.
UntagCertificateAuthority -> Rep UntagCertificateAuthority x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UntagCertificateAuthority x -> UntagCertificateAuthority
$cfrom :: forall x.
UntagCertificateAuthority -> Rep UntagCertificateAuthority x
Prelude.Generic)

-- |
-- Create a value of 'UntagCertificateAuthority' 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:
--
-- 'certificateAuthorityArn', 'untagCertificateAuthority_certificateAuthorityArn' - The Amazon Resource Name (ARN) that was returned when you called
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>.
-- This must be of the form:
--
-- @arn:aws:acm-pca:region:account:certificate-authority\/12345678-1234-1234-1234-123456789012 @
--
-- 'tags', 'untagCertificateAuthority_tags' - List of tags to be removed from the CA.
newUntagCertificateAuthority ::
  -- | 'certificateAuthorityArn'
  Prelude.Text ->
  -- | 'tags'
  Prelude.NonEmpty Tag ->
  UntagCertificateAuthority
newUntagCertificateAuthority :: Text -> NonEmpty Tag -> UntagCertificateAuthority
newUntagCertificateAuthority
  Text
pCertificateAuthorityArn_
  NonEmpty Tag
pTags_ =
    UntagCertificateAuthority' :: Text -> NonEmpty Tag -> UntagCertificateAuthority
UntagCertificateAuthority'
      { $sel:certificateAuthorityArn:UntagCertificateAuthority' :: Text
certificateAuthorityArn =
          Text
pCertificateAuthorityArn_,
        $sel:tags:UntagCertificateAuthority' :: NonEmpty Tag
tags = Tagged (NonEmpty Tag) (Identity (NonEmpty Tag))
-> Tagged (NonEmpty Tag) (Identity (NonEmpty Tag))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Tag) (Identity (NonEmpty Tag))
 -> Tagged (NonEmpty Tag) (Identity (NonEmpty Tag)))
-> NonEmpty Tag -> NonEmpty Tag
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Tag
pTags_
      }

-- | The Amazon Resource Name (ARN) that was returned when you called
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>.
-- This must be of the form:
--
-- @arn:aws:acm-pca:region:account:certificate-authority\/12345678-1234-1234-1234-123456789012 @
untagCertificateAuthority_certificateAuthorityArn :: Lens.Lens' UntagCertificateAuthority Prelude.Text
untagCertificateAuthority_certificateAuthorityArn :: (Text -> f Text)
-> UntagCertificateAuthority -> f UntagCertificateAuthority
untagCertificateAuthority_certificateAuthorityArn = (UntagCertificateAuthority -> Text)
-> (UntagCertificateAuthority -> Text -> UntagCertificateAuthority)
-> Lens
     UntagCertificateAuthority UntagCertificateAuthority Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagCertificateAuthority' {Text
certificateAuthorityArn :: Text
$sel:certificateAuthorityArn:UntagCertificateAuthority' :: UntagCertificateAuthority -> Text
certificateAuthorityArn} -> Text
certificateAuthorityArn) (\s :: UntagCertificateAuthority
s@UntagCertificateAuthority' {} Text
a -> UntagCertificateAuthority
s {$sel:certificateAuthorityArn:UntagCertificateAuthority' :: Text
certificateAuthorityArn = Text
a} :: UntagCertificateAuthority)

-- | List of tags to be removed from the CA.
untagCertificateAuthority_tags :: Lens.Lens' UntagCertificateAuthority (Prelude.NonEmpty Tag)
untagCertificateAuthority_tags :: (NonEmpty Tag -> f (NonEmpty Tag))
-> UntagCertificateAuthority -> f UntagCertificateAuthority
untagCertificateAuthority_tags = (UntagCertificateAuthority -> NonEmpty Tag)
-> (UntagCertificateAuthority
    -> NonEmpty Tag -> UntagCertificateAuthority)
-> Lens
     UntagCertificateAuthority
     UntagCertificateAuthority
     (NonEmpty Tag)
     (NonEmpty Tag)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagCertificateAuthority' {NonEmpty Tag
tags :: NonEmpty Tag
$sel:tags:UntagCertificateAuthority' :: UntagCertificateAuthority -> NonEmpty Tag
tags} -> NonEmpty Tag
tags) (\s :: UntagCertificateAuthority
s@UntagCertificateAuthority' {} NonEmpty Tag
a -> UntagCertificateAuthority
s {$sel:tags:UntagCertificateAuthority' :: NonEmpty Tag
tags = NonEmpty Tag
a} :: UntagCertificateAuthority) ((NonEmpty Tag -> f (NonEmpty Tag))
 -> UntagCertificateAuthority -> f UntagCertificateAuthority)
-> ((NonEmpty Tag -> f (NonEmpty Tag))
    -> NonEmpty Tag -> f (NonEmpty Tag))
-> (NonEmpty Tag -> f (NonEmpty Tag))
-> UntagCertificateAuthority
-> f UntagCertificateAuthority
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Tag -> f (NonEmpty Tag))
-> NonEmpty Tag -> f (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable UntagCertificateAuthority

instance Prelude.NFData UntagCertificateAuthority

instance Core.ToHeaders UntagCertificateAuthority where
  toHeaders :: UntagCertificateAuthority -> [Header]
toHeaders =
    [Header] -> UntagCertificateAuthority -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"ACMPrivateCA.UntagCertificateAuthority" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UntagCertificateAuthority where
  toJSON :: UntagCertificateAuthority -> Value
toJSON UntagCertificateAuthority' {NonEmpty Tag
Text
tags :: NonEmpty Tag
certificateAuthorityArn :: Text
$sel:tags:UntagCertificateAuthority' :: UntagCertificateAuthority -> NonEmpty Tag
$sel:certificateAuthorityArn:UntagCertificateAuthority' :: UntagCertificateAuthority -> 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
"CertificateAuthorityArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateAuthorityArn
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Tag
tags)
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    UntagCertificateAuthorityResponse