{-# 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-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 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.Lens as Lens
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
(DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool)
-> (DisassociateRecoveryPoint -> DisassociateRecoveryPoint -> Bool)
-> Eq DisassociateRecoveryPoint
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]
(Int -> ReadS DisassociateRecoveryPoint)
-> ReadS [DisassociateRecoveryPoint]
-> ReadPrec DisassociateRecoveryPoint
-> ReadPrec [DisassociateRecoveryPoint]
-> Read 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
(Int -> DisassociateRecoveryPoint -> ShowS)
-> (DisassociateRecoveryPoint -> String)
-> ([DisassociateRecoveryPoint] -> ShowS)
-> Show DisassociateRecoveryPoint
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.
 DisassociateRecoveryPoint -> Rep DisassociateRecoveryPoint x)
-> (forall x.
    Rep DisassociateRecoveryPoint x -> DisassociateRecoveryPoint)
-> Generic DisassociateRecoveryPoint
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' :: Text -> Text -> DisassociateRecoveryPoint
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 :: (Text -> f Text)
-> DisassociateRecoveryPoint -> f DisassociateRecoveryPoint
disassociateRecoveryPoint_backupVaultName = (DisassociateRecoveryPoint -> Text)
-> (DisassociateRecoveryPoint -> Text -> DisassociateRecoveryPoint)
-> Lens
     DisassociateRecoveryPoint DisassociateRecoveryPoint Text Text
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 :: (Text -> f Text)
-> DisassociateRecoveryPoint -> f DisassociateRecoveryPoint
disassociateRecoveryPoint_recoveryPointArn = (DisassociateRecoveryPoint -> Text)
-> (DisassociateRecoveryPoint -> Text -> DisassociateRecoveryPoint)
-> Lens
     DisassociateRecoveryPoint DisassociateRecoveryPoint Text Text
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 :: DisassociateRecoveryPoint -> Request DisassociateRecoveryPoint
request = Service
-> DisassociateRecoveryPoint -> Request DisassociateRecoveryPoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateRecoveryPoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateRecoveryPoint)))
response =
    AWSResponse DisassociateRecoveryPoint
-> Logger
-> Service
-> Proxy DisassociateRecoveryPoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateRecoveryPoint)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DisassociateRecoveryPoint
DisassociateRecoveryPointResponse
DisassociateRecoveryPointResponse'

instance Prelude.Hashable DisassociateRecoveryPoint

instance Prelude.NFData DisassociateRecoveryPoint

instance Core.ToHeaders DisassociateRecoveryPoint where
  toHeaders :: DisassociateRecoveryPoint -> [Header]
toHeaders =
    [Header] -> DisassociateRecoveryPoint -> [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.ToJSON DisassociateRecoveryPoint where
  toJSON :: DisassociateRecoveryPoint -> Value
toJSON = Value -> DisassociateRecoveryPoint -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath DisassociateRecoveryPoint where
  toPath :: DisassociateRecoveryPoint -> ByteString
toPath DisassociateRecoveryPoint' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> Text
$sel:backupVaultName:DisassociateRecoveryPoint' :: DisassociateRecoveryPoint -> 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,
        ByteString
"/disassociate"
      ]

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

-- | /See:/ 'newDisassociateRecoveryPointResponse' smart constructor.
data DisassociateRecoveryPointResponse = DisassociateRecoveryPointResponse'
  {
  }
  deriving (DisassociateRecoveryPointResponse
-> DisassociateRecoveryPointResponse -> Bool
(DisassociateRecoveryPointResponse
 -> DisassociateRecoveryPointResponse -> Bool)
-> (DisassociateRecoveryPointResponse
    -> DisassociateRecoveryPointResponse -> Bool)
-> Eq DisassociateRecoveryPointResponse
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]
(Int -> ReadS DisassociateRecoveryPointResponse)
-> ReadS [DisassociateRecoveryPointResponse]
-> ReadPrec DisassociateRecoveryPointResponse
-> ReadPrec [DisassociateRecoveryPointResponse]
-> Read 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
(Int -> DisassociateRecoveryPointResponse -> ShowS)
-> (DisassociateRecoveryPointResponse -> String)
-> ([DisassociateRecoveryPointResponse] -> ShowS)
-> Show DisassociateRecoveryPointResponse
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.
 DisassociateRecoveryPointResponse
 -> Rep DisassociateRecoveryPointResponse x)
-> (forall x.
    Rep DisassociateRecoveryPointResponse x
    -> DisassociateRecoveryPointResponse)
-> Generic DisassociateRecoveryPointResponse
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