{-# 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.Backup.DeleteRecoveryPoint
-- 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 the recovery point specified by a recovery point ID.
--
-- If the recovery point ID belongs to a continuous backup, calling this
-- endpoint deletes the existing continuous backup and stops future
-- continuous backup.
module Amazonka.Backup.DeleteRecoveryPoint
  ( -- * Creating a Request
    DeleteRecoveryPoint (..),
    newDeleteRecoveryPoint,

    -- * Request Lenses
    deleteRecoveryPoint_backupVaultName,
    deleteRecoveryPoint_recoveryPointArn,

    -- * Destructuring the Response
    DeleteRecoveryPointResponse (..),
    newDeleteRecoveryPointResponse,
  )
where

import Amazonka.Backup.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:/ 'newDeleteRecoveryPoint' smart constructor.
data DeleteRecoveryPoint = DeleteRecoveryPoint'
  { -- | The name of a logical container where backups are stored. Backup vaults
    -- are identified by names that are unique to the account used to create
    -- them and the Amazon Web Services Region where they are created. They
    -- consist of lowercase letters, numbers, and hyphens.
    DeleteRecoveryPoint -> Text
backupVaultName :: Prelude.Text,
    -- | An Amazon Resource Name (ARN) that uniquely identifies a recovery point;
    -- for example,
    -- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45@.
    DeleteRecoveryPoint -> Text
recoveryPointArn :: Prelude.Text
  }
  deriving (DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool
(DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool)
-> (DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool)
-> Eq DeleteRecoveryPoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool
$c/= :: DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool
== :: DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool
$c== :: DeleteRecoveryPoint -> DeleteRecoveryPoint -> Bool
Prelude.Eq, ReadPrec [DeleteRecoveryPoint]
ReadPrec DeleteRecoveryPoint
Int -> ReadS DeleteRecoveryPoint
ReadS [DeleteRecoveryPoint]
(Int -> ReadS DeleteRecoveryPoint)
-> ReadS [DeleteRecoveryPoint]
-> ReadPrec DeleteRecoveryPoint
-> ReadPrec [DeleteRecoveryPoint]
-> Read DeleteRecoveryPoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRecoveryPoint]
$creadListPrec :: ReadPrec [DeleteRecoveryPoint]
readPrec :: ReadPrec DeleteRecoveryPoint
$creadPrec :: ReadPrec DeleteRecoveryPoint
readList :: ReadS [DeleteRecoveryPoint]
$creadList :: ReadS [DeleteRecoveryPoint]
readsPrec :: Int -> ReadS DeleteRecoveryPoint
$creadsPrec :: Int -> ReadS DeleteRecoveryPoint
Prelude.Read, Int -> DeleteRecoveryPoint -> ShowS
[DeleteRecoveryPoint] -> ShowS
DeleteRecoveryPoint -> String
(Int -> DeleteRecoveryPoint -> ShowS)
-> (DeleteRecoveryPoint -> String)
-> ([DeleteRecoveryPoint] -> ShowS)
-> Show DeleteRecoveryPoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRecoveryPoint] -> ShowS
$cshowList :: [DeleteRecoveryPoint] -> ShowS
show :: DeleteRecoveryPoint -> String
$cshow :: DeleteRecoveryPoint -> String
showsPrec :: Int -> DeleteRecoveryPoint -> ShowS
$cshowsPrec :: Int -> DeleteRecoveryPoint -> ShowS
Prelude.Show, (forall x. DeleteRecoveryPoint -> Rep DeleteRecoveryPoint x)
-> (forall x. Rep DeleteRecoveryPoint x -> DeleteRecoveryPoint)
-> Generic DeleteRecoveryPoint
forall x. Rep DeleteRecoveryPoint x -> DeleteRecoveryPoint
forall x. DeleteRecoveryPoint -> Rep DeleteRecoveryPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRecoveryPoint x -> DeleteRecoveryPoint
$cfrom :: forall x. DeleteRecoveryPoint -> Rep DeleteRecoveryPoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRecoveryPoint' 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:
--
-- 'backupVaultName', 'deleteRecoveryPoint_backupVaultName' - The name of a logical container where backups are stored. Backup vaults
-- are identified by names that are unique to the account used to create
-- them and the Amazon Web Services Region where they are created. They
-- consist of lowercase letters, numbers, and hyphens.
--
-- 'recoveryPointArn', 'deleteRecoveryPoint_recoveryPointArn' - An Amazon Resource Name (ARN) that uniquely identifies a recovery point;
-- for example,
-- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45@.
newDeleteRecoveryPoint ::
  -- | 'backupVaultName'
  Prelude.Text ->
  -- | 'recoveryPointArn'
  Prelude.Text ->
  DeleteRecoveryPoint
newDeleteRecoveryPoint :: Text -> Text -> DeleteRecoveryPoint
newDeleteRecoveryPoint
  Text
pBackupVaultName_
  Text
pRecoveryPointArn_ =
    DeleteRecoveryPoint' :: Text -> Text -> DeleteRecoveryPoint
DeleteRecoveryPoint'
      { $sel:backupVaultName:DeleteRecoveryPoint' :: Text
backupVaultName =
          Text
pBackupVaultName_,
        $sel:recoveryPointArn:DeleteRecoveryPoint' :: Text
recoveryPointArn = Text
pRecoveryPointArn_
      }

-- | The name of a logical container where backups are stored. Backup vaults
-- are identified by names that are unique to the account used to create
-- them and the Amazon Web Services Region where they are created. They
-- consist of lowercase letters, numbers, and hyphens.
deleteRecoveryPoint_backupVaultName :: Lens.Lens' DeleteRecoveryPoint Prelude.Text
deleteRecoveryPoint_backupVaultName :: (Text -> f Text) -> DeleteRecoveryPoint -> f DeleteRecoveryPoint
deleteRecoveryPoint_backupVaultName = (DeleteRecoveryPoint -> Text)
-> (DeleteRecoveryPoint -> Text -> DeleteRecoveryPoint)
-> Lens DeleteRecoveryPoint DeleteRecoveryPoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecoveryPoint' {Text
backupVaultName :: Text
$sel:backupVaultName:DeleteRecoveryPoint' :: DeleteRecoveryPoint -> Text
backupVaultName} -> Text
backupVaultName) (\s :: DeleteRecoveryPoint
s@DeleteRecoveryPoint' {} Text
a -> DeleteRecoveryPoint
s {$sel:backupVaultName:DeleteRecoveryPoint' :: Text
backupVaultName = Text
a} :: DeleteRecoveryPoint)

-- | An Amazon Resource Name (ARN) that uniquely identifies a recovery point;
-- for example,
-- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45@.
deleteRecoveryPoint_recoveryPointArn :: Lens.Lens' DeleteRecoveryPoint Prelude.Text
deleteRecoveryPoint_recoveryPointArn :: (Text -> f Text) -> DeleteRecoveryPoint -> f DeleteRecoveryPoint
deleteRecoveryPoint_recoveryPointArn = (DeleteRecoveryPoint -> Text)
-> (DeleteRecoveryPoint -> Text -> DeleteRecoveryPoint)
-> Lens DeleteRecoveryPoint DeleteRecoveryPoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecoveryPoint' {Text
recoveryPointArn :: Text
$sel:recoveryPointArn:DeleteRecoveryPoint' :: DeleteRecoveryPoint -> Text
recoveryPointArn} -> Text
recoveryPointArn) (\s :: DeleteRecoveryPoint
s@DeleteRecoveryPoint' {} Text
a -> DeleteRecoveryPoint
s {$sel:recoveryPointArn:DeleteRecoveryPoint' :: Text
recoveryPointArn = Text
a} :: DeleteRecoveryPoint)

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

instance Prelude.Hashable DeleteRecoveryPoint

instance Prelude.NFData DeleteRecoveryPoint

instance Core.ToHeaders DeleteRecoveryPoint where
  toHeaders :: DeleteRecoveryPoint -> [Header]
toHeaders =
    [Header] -> DeleteRecoveryPoint -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteRecoveryPoint where
  toPath :: DeleteRecoveryPoint -> ByteString
toPath DeleteRecoveryPoint' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DeleteRecoveryPoint' :: DeleteRecoveryPoint -> Text
$sel:backupVaultName:DeleteRecoveryPoint' :: DeleteRecoveryPoint -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/backup-vaults/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backupVaultName,
        ByteString
"/recovery-points/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
recoveryPointArn
      ]

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

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

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

instance Prelude.NFData DeleteRecoveryPointResponse