amazonka-certificatemanager-2.0: gen/Amazonka/CertificateManager/DeleteCertificate.hs
{-# 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.CertificateManager.DeleteCertificate
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a certificate and its associated private key. If this action
-- succeeds, the certificate no longer appears in the list that can be
-- displayed by calling the ListCertificates action or be retrieved by
-- calling the GetCertificate action. The certificate will not be available
-- for use by Amazon Web Services services integrated with ACM.
--
-- You cannot delete an ACM certificate that is being used by another
-- Amazon Web Services service. To delete a certificate that is in use, the
-- certificate association must first be removed.
module Amazonka.CertificateManager.DeleteCertificate
( -- * Creating a Request
DeleteCertificate (..),
newDeleteCertificate,
-- * Request Lenses
deleteCertificate_certificateArn,
-- * Destructuring the Response
DeleteCertificateResponse (..),
newDeleteCertificateResponse,
)
where
import Amazonka.CertificateManager.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
-- | /See:/ 'newDeleteCertificate' smart constructor.
data DeleteCertificate = DeleteCertificate'
{ -- | String that contains the ARN of the ACM certificate to be deleted. This
-- must be of the form:
--
-- @arn:aws:acm:region:123456789012:certificate\/12345678-1234-1234-1234-123456789012@
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>.
certificateArn :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DeleteCertificate' 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:
--
-- 'certificateArn', 'deleteCertificate_certificateArn' - String that contains the ARN of the ACM certificate to be deleted. This
-- must be of the form:
--
-- @arn:aws:acm:region:123456789012:certificate\/12345678-1234-1234-1234-123456789012@
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>.
newDeleteCertificate ::
-- | 'certificateArn'
Prelude.Text ->
DeleteCertificate
newDeleteCertificate pCertificateArn_ =
DeleteCertificate'
{ certificateArn =
pCertificateArn_
}
-- | String that contains the ARN of the ACM certificate to be deleted. This
-- must be of the form:
--
-- @arn:aws:acm:region:123456789012:certificate\/12345678-1234-1234-1234-123456789012@
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>.
deleteCertificate_certificateArn :: Lens.Lens' DeleteCertificate Prelude.Text
deleteCertificate_certificateArn = Lens.lens (\DeleteCertificate' {certificateArn} -> certificateArn) (\s@DeleteCertificate' {} a -> s {certificateArn = a} :: DeleteCertificate)
instance Core.AWSRequest DeleteCertificate where
type
AWSResponse DeleteCertificate =
DeleteCertificateResponse
request overrides =
Request.postJSON (overrides defaultService)
response =
Response.receiveNull DeleteCertificateResponse'
instance Prelude.Hashable DeleteCertificate where
hashWithSalt _salt DeleteCertificate' {..} =
_salt `Prelude.hashWithSalt` certificateArn
instance Prelude.NFData DeleteCertificate where
rnf DeleteCertificate' {..} =
Prelude.rnf certificateArn
instance Data.ToHeaders DeleteCertificate where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "X-Amz-Target"
Data.=# ( "CertificateManager.DeleteCertificate" ::
Prelude.ByteString
),
"Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DeleteCertificate where
toJSON DeleteCertificate' {..} =
Data.object
( Prelude.catMaybes
[ Prelude.Just
("CertificateArn" Data..= certificateArn)
]
)
instance Data.ToPath DeleteCertificate where
toPath = Prelude.const "/"
instance Data.ToQuery DeleteCertificate where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newDeleteCertificateResponse' smart constructor.
data DeleteCertificateResponse = DeleteCertificateResponse'
{
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DeleteCertificateResponse' 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.
newDeleteCertificateResponse ::
DeleteCertificateResponse
newDeleteCertificateResponse =
DeleteCertificateResponse'
instance Prelude.NFData DeleteCertificateResponse where
rnf _ = ()