{-# 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.DisassociateRecoveryPoint
-- 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 the specified continuous backup recovery point from Backup and
-- releases control of that continuous backup to the source service, such
-- as Amazon RDS. The source service will continue to create and retain
-- continuous backups using the lifecycle that you specified in your
-- original backup plan.
--
-- Does not support snapshot backup recovery points.
module Amazonka.Backup.DisassociateRecoveryPoint
  ( -- * Creating a Request
    DisassociateRecoveryPoint (..),
    newDisassociateRecoveryPoint,

    -- * Request Lenses
    disassociateRecoveryPoint_backupVaultName,
    disassociateRecoveryPoint_recoveryPointArn,

    -- * Destructuring the Response
    DisassociateRecoveryPointResponse (..),
    newDisassociateRecoveryPointResponse,
  )
where

import Amazonka.Backup.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:/ 'newDisassociateRecoveryPoint' smart constructor.
data DisassociateRecoveryPoint = DisassociateRecoveryPoint'
  { -- | The unique name of an Backup vault.
    DisassociateRecoveryPoint -> Text
backupVaultName :: Prelude.Text,
    -- | An Amazon Resource Name (ARN) that uniquely identifies an Backup
    -- recovery point.
    DisassociateRecoveryPoint -> Text
recoveryPointArn :: Prelude.Text
  }
  deriving (DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool
$c/= :: DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool
== :: DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool
$c== :: DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool
Prelude.Eq, ReadPrec [DisassociateRecoveryPoint]
ReadPrec DisassociateRecoveryPoint
Int -> ReadS DisassociateRecoveryPoint
ReadS [DisassociateRecoveryPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateRecoveryPoint]
$creadListPrec :: ReadPrec [DisassociateRecoveryPoint]
readPrec :: ReadPrec DisassociateRecoveryPoint
$creadPrec :: ReadPrec DisassociateRecoveryPoint
readList :: ReadS [DisassociateRecoveryPoint]
$creadList :: ReadS [DisassociateRecoveryPoint]
readsPrec :: Int -> ReadS DisassociateRecoveryPoint
$creadsPrec :: Int -> ReadS DisassociateRecoveryPoint
Prelude.Read, Int -> DisassociateRecoveryPoint -> ShowS
[DisassociateRecoveryPoint] -> ShowS
DisassociateRecoveryPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateRecoveryPoint] -> ShowS
$cshowList :: [DisassociateRecoveryPoint] -> ShowS
show :: DisassociateRecoveryPoint -> String
$cshow :: DisassociateRecoveryPoint -> String
showsPrec :: Int -> DisassociateRecoveryPoint -> ShowS
$cshowsPrec :: Int -> DisassociateRecoveryPoint -> ShowS
Prelude.Show, forall x.
Rep DisassociateRecoveryPoint x -> DisassociateRecoveryPoint
forall x.
DisassociateRecoveryPoint -> Rep DisassociateRecoveryPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateRecoveryPoint x -> DisassociateRecoveryPoint
$cfrom :: forall x.
DisassociateRecoveryPoint -> Rep DisassociateRecoveryPoint x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateRecoveryPoint' 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', 'disassociateRecoveryPoint_backupVaultName' - The unique name of an Backup vault.
--
-- 'recoveryPointArn', 'disassociateRecoveryPoint_recoveryPointArn' - An Amazon Resource Name (ARN) that uniquely identifies an Backup
-- recovery point.
newDisassociateRecoveryPoint ::
  -- | 'backupVaultName'
  Prelude.Text ->
  -- | 'recoveryPointArn'
  Prelude.Text ->
  DisassociateRecoveryPoint
newDisassociateRecoveryPoint :: Text -> Text -> DisassociateRecoveryPoint
newDisassociateRecoveryPoint
  Text
pBackupVaultName_
  Text
pRecoveryPointArn_ =
    DisassociateRecoveryPoint'
      { $sel:backupVaultName:DisassociateRecoveryPoint' :: Text
backupVaultName =
          Text
pBackupVaultName_,
        $sel:recoveryPointArn:DisassociateRecoveryPoint' :: Text
recoveryPointArn = Text
pRecoveryPointArn_
      }

-- | The unique name of an Backup vault.
disassociateRecoveryPoint_backupVaultName :: Lens.Lens' DisassociateRecoveryPoint Prelude.Text
disassociateRecoveryPoint_backupVaultName :: Lens' DisassociateRecoveryPoint Text
disassociateRecoveryPoint_backupVaultName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateRecoveryPoint' {Text
backupVaultName :: Text
$sel:backupVaultName:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
backupVaultName} -> Text
backupVaultName) (\s :: DisassociateRecoveryPoint
s@DisassociateRecoveryPoint' {} Text
a -> DisassociateRecoveryPoint
s {$sel:backupVaultName:DisassociateRecoveryPoint' :: Text
backupVaultName = Text
a} :: DisassociateRecoveryPoint)

-- | An Amazon Resource Name (ARN) that uniquely identifies an Backup
-- recovery point.
disassociateRecoveryPoint_recoveryPointArn :: Lens.Lens' DisassociateRecoveryPoint Prelude.Text
disassociateRecoveryPoint_recoveryPointArn :: Lens' DisassociateRecoveryPoint Text
disassociateRecoveryPoint_recoveryPointArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateRecoveryPoint' {Text
recoveryPointArn :: Text
$sel:recoveryPointArn:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
recoveryPointArn} -> Text
recoveryPointArn) (\s :: DisassociateRecoveryPoint
s@DisassociateRecoveryPoint' {} Text
a -> DisassociateRecoveryPoint
s {$sel:recoveryPointArn:DisassociateRecoveryPoint' :: Text
recoveryPointArn = Text
a} :: DisassociateRecoveryPoint)

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

instance Prelude.Hashable DisassociateRecoveryPoint where
  hashWithSalt :: Int -> DisassociateRecoveryPoint -> Int
hashWithSalt Int
_salt DisassociateRecoveryPoint' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
$sel:backupVaultName:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
backupVaultName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
recoveryPointArn

instance Prelude.NFData DisassociateRecoveryPoint where
  rnf :: DisassociateRecoveryPoint -> ()
rnf DisassociateRecoveryPoint' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
$sel:backupVaultName:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
backupVaultName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
recoveryPointArn

instance Data.ToHeaders DisassociateRecoveryPoint where
  toHeaders :: DisassociateRecoveryPoint -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DisassociateRecoveryPoint where
  toJSON :: DisassociateRecoveryPoint -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath DisassociateRecoveryPoint where
  toPath :: DisassociateRecoveryPoint -> ByteString
toPath DisassociateRecoveryPoint' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
$sel:backupVaultName:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/backup-vaults/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
backupVaultName,
        ByteString
"/recovery-points/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
recoveryPointArn,
        ByteString
"/disassociate"
      ]

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

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

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

instance
  Prelude.NFData
    DisassociateRecoveryPointResponse
  where
  rnf :: DisassociateRecoveryPointResponse -> ()
rnf DisassociateRecoveryPointResponse
_ = ()