{-# 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.DisassociateRecoveryPointFromParent
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This action to a specific child (nested) recovery point removes the
-- relationship between the specified recovery point and its parent
-- (composite) recovery point.
module Amazonka.Backup.DisassociateRecoveryPointFromParent
  ( -- * Creating a Request
    DisassociateRecoveryPointFromParent (..),
    newDisassociateRecoveryPointFromParent,

    -- * Request Lenses
    disassociateRecoveryPointFromParent_backupVaultName,
    disassociateRecoveryPointFromParent_recoveryPointArn,

    -- * Destructuring the Response
    DisassociateRecoveryPointFromParentResponse (..),
    newDisassociateRecoveryPointFromParentResponse,
  )
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:/ 'newDisassociateRecoveryPointFromParent' smart constructor.
data DisassociateRecoveryPointFromParent = DisassociateRecoveryPointFromParent'
  { -- | This is the name of a logical container where the child (nested)
    -- recovery point is 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.
    DisassociateRecoveryPointFromParent -> Text
backupVaultName :: Prelude.Text,
    -- | This is the Amazon Resource Name (ARN) that uniquely identifies the
    -- child (nested) recovery point; for example,
    -- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45.@
    DisassociateRecoveryPointFromParent -> Text
recoveryPointArn :: Prelude.Text
  }
  deriving (DisassociateRecoveryPointFromParent
-> DisassociateRecoveryPointFromParent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateRecoveryPointFromParent
-> DisassociateRecoveryPointFromParent -> Bool
$c/= :: DisassociateRecoveryPointFromParent
-> DisassociateRecoveryPointFromParent -> Bool
== :: DisassociateRecoveryPointFromParent
-> DisassociateRecoveryPointFromParent -> Bool
$c== :: DisassociateRecoveryPointFromParent
-> DisassociateRecoveryPointFromParent -> Bool
Prelude.Eq, ReadPrec [DisassociateRecoveryPointFromParent]
ReadPrec DisassociateRecoveryPointFromParent
Int -> ReadS DisassociateRecoveryPointFromParent
ReadS [DisassociateRecoveryPointFromParent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateRecoveryPointFromParent]
$creadListPrec :: ReadPrec [DisassociateRecoveryPointFromParent]
readPrec :: ReadPrec DisassociateRecoveryPointFromParent
$creadPrec :: ReadPrec DisassociateRecoveryPointFromParent
readList :: ReadS [DisassociateRecoveryPointFromParent]
$creadList :: ReadS [DisassociateRecoveryPointFromParent]
readsPrec :: Int -> ReadS DisassociateRecoveryPointFromParent
$creadsPrec :: Int -> ReadS DisassociateRecoveryPointFromParent
Prelude.Read, Int -> DisassociateRecoveryPointFromParent -> ShowS
[DisassociateRecoveryPointFromParent] -> ShowS
DisassociateRecoveryPointFromParent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateRecoveryPointFromParent] -> ShowS
$cshowList :: [DisassociateRecoveryPointFromParent] -> ShowS
show :: DisassociateRecoveryPointFromParent -> String
$cshow :: DisassociateRecoveryPointFromParent -> String
showsPrec :: Int -> DisassociateRecoveryPointFromParent -> ShowS
$cshowsPrec :: Int -> DisassociateRecoveryPointFromParent -> ShowS
Prelude.Show, forall x.
Rep DisassociateRecoveryPointFromParent x
-> DisassociateRecoveryPointFromParent
forall x.
DisassociateRecoveryPointFromParent
-> Rep DisassociateRecoveryPointFromParent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateRecoveryPointFromParent x
-> DisassociateRecoveryPointFromParent
$cfrom :: forall x.
DisassociateRecoveryPointFromParent
-> Rep DisassociateRecoveryPointFromParent x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateRecoveryPointFromParent' 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', 'disassociateRecoveryPointFromParent_backupVaultName' - This is the name of a logical container where the child (nested)
-- recovery point is 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', 'disassociateRecoveryPointFromParent_recoveryPointArn' - This is the Amazon Resource Name (ARN) that uniquely identifies the
-- child (nested) recovery point; for example,
-- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45.@
newDisassociateRecoveryPointFromParent ::
  -- | 'backupVaultName'
  Prelude.Text ->
  -- | 'recoveryPointArn'
  Prelude.Text ->
  DisassociateRecoveryPointFromParent
newDisassociateRecoveryPointFromParent :: Text -> Text -> DisassociateRecoveryPointFromParent
newDisassociateRecoveryPointFromParent
  Text
pBackupVaultName_
  Text
pRecoveryPointArn_ =
    DisassociateRecoveryPointFromParent'
      { $sel:backupVaultName:DisassociateRecoveryPointFromParent' :: Text
backupVaultName =
          Text
pBackupVaultName_,
        $sel:recoveryPointArn:DisassociateRecoveryPointFromParent' :: Text
recoveryPointArn = Text
pRecoveryPointArn_
      }

-- | This is the name of a logical container where the child (nested)
-- recovery point is 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.
disassociateRecoveryPointFromParent_backupVaultName :: Lens.Lens' DisassociateRecoveryPointFromParent Prelude.Text
disassociateRecoveryPointFromParent_backupVaultName :: Lens' DisassociateRecoveryPointFromParent Text
disassociateRecoveryPointFromParent_backupVaultName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateRecoveryPointFromParent' {Text
backupVaultName :: Text
$sel:backupVaultName:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> Text
backupVaultName} -> Text
backupVaultName) (\s :: DisassociateRecoveryPointFromParent
s@DisassociateRecoveryPointFromParent' {} Text
a -> DisassociateRecoveryPointFromParent
s {$sel:backupVaultName:DisassociateRecoveryPointFromParent' :: Text
backupVaultName = Text
a} :: DisassociateRecoveryPointFromParent)

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

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

instance
  Prelude.Hashable
    DisassociateRecoveryPointFromParent
  where
  hashWithSalt :: Int -> DisassociateRecoveryPointFromParent -> Int
hashWithSalt
    Int
_salt
    DisassociateRecoveryPointFromParent' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> Text
$sel:backupVaultName:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> 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
    DisassociateRecoveryPointFromParent
  where
  rnf :: DisassociateRecoveryPointFromParent -> ()
rnf DisassociateRecoveryPointFromParent' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> Text
$sel:backupVaultName:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> 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
    DisassociateRecoveryPointFromParent
  where
  toHeaders :: DisassociateRecoveryPointFromParent -> [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.ToPath
    DisassociateRecoveryPointFromParent
  where
  toPath :: DisassociateRecoveryPointFromParent -> ByteString
toPath DisassociateRecoveryPointFromParent' {Text
recoveryPointArn :: Text
backupVaultName :: Text
$sel:recoveryPointArn:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> Text
$sel:backupVaultName:DisassociateRecoveryPointFromParent' :: DisassociateRecoveryPointFromParent -> 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
"/parentAssociation"
      ]

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

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

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

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