{-# 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.Route53RecoveryControlConfig.DeleteSafetyRule
-- 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 safety rule.
--
-- \/>
module Amazonka.Route53RecoveryControlConfig.DeleteSafetyRule
  ( -- * Creating a Request
    DeleteSafetyRule (..),
    newDeleteSafetyRule,

    -- * Request Lenses
    deleteSafetyRule_safetyRuleArn,

    -- * Destructuring the Response
    DeleteSafetyRuleResponse (..),
    newDeleteSafetyRuleResponse,

    -- * Response Lenses
    deleteSafetyRuleResponse_httpStatus,
  )
where

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
import Amazonka.Route53RecoveryControlConfig.Types

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

-- |
-- Create a value of 'DeleteSafetyRule' 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:
--
-- 'safetyRuleArn', 'deleteSafetyRule_safetyRuleArn' - The ARN of the safety rule.
newDeleteSafetyRule ::
  -- | 'safetyRuleArn'
  Prelude.Text ->
  DeleteSafetyRule
newDeleteSafetyRule :: Text -> DeleteSafetyRule
newDeleteSafetyRule Text
pSafetyRuleArn_ =
  DeleteSafetyRule' {$sel:safetyRuleArn:DeleteSafetyRule' :: Text
safetyRuleArn = Text
pSafetyRuleArn_}

-- | The ARN of the safety rule.
deleteSafetyRule_safetyRuleArn :: Lens.Lens' DeleteSafetyRule Prelude.Text
deleteSafetyRule_safetyRuleArn :: Lens' DeleteSafetyRule Text
deleteSafetyRule_safetyRuleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSafetyRule' {Text
safetyRuleArn :: Text
$sel:safetyRuleArn:DeleteSafetyRule' :: DeleteSafetyRule -> Text
safetyRuleArn} -> Text
safetyRuleArn) (\s :: DeleteSafetyRule
s@DeleteSafetyRule' {} Text
a -> DeleteSafetyRule
s {$sel:safetyRuleArn:DeleteSafetyRule' :: Text
safetyRuleArn = Text
a} :: DeleteSafetyRule)

instance Core.AWSRequest DeleteSafetyRule where
  type
    AWSResponse DeleteSafetyRule =
      DeleteSafetyRuleResponse
  request :: (Service -> Service)
-> DeleteSafetyRule -> Request DeleteSafetyRule
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 DeleteSafetyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSafetyRule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteSafetyRuleResponse
DeleteSafetyRuleResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

instance Prelude.NFData DeleteSafetyRule where
  rnf :: DeleteSafetyRule -> ()
rnf DeleteSafetyRule' {Text
safetyRuleArn :: Text
$sel:safetyRuleArn:DeleteSafetyRule' :: DeleteSafetyRule -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
safetyRuleArn

instance Data.ToHeaders DeleteSafetyRule where
  toHeaders :: DeleteSafetyRule -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteSafetyRule where
  toPath :: DeleteSafetyRule -> ByteString
toPath DeleteSafetyRule' {Text
safetyRuleArn :: Text
$sel:safetyRuleArn:DeleteSafetyRule' :: DeleteSafetyRule -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/safetyrule/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
safetyRuleArn]

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

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

-- |
-- Create a value of 'DeleteSafetyRuleResponse' 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:
--
-- 'httpStatus', 'deleteSafetyRuleResponse_httpStatus' - The response's http status code.
newDeleteSafetyRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteSafetyRuleResponse
newDeleteSafetyRuleResponse :: Int -> DeleteSafetyRuleResponse
newDeleteSafetyRuleResponse Int
pHttpStatus_ =
  DeleteSafetyRuleResponse'
    { $sel:httpStatus:DeleteSafetyRuleResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteSafetyRuleResponse_httpStatus :: Lens.Lens' DeleteSafetyRuleResponse Prelude.Int
deleteSafetyRuleResponse_httpStatus :: Lens' DeleteSafetyRuleResponse Int
deleteSafetyRuleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSafetyRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSafetyRuleResponse' :: DeleteSafetyRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteSafetyRuleResponse
s@DeleteSafetyRuleResponse' {} Int
a -> DeleteSafetyRuleResponse
s {$sel:httpStatus:DeleteSafetyRuleResponse' :: Int
httpStatus = Int
a} :: DeleteSafetyRuleResponse)

instance Prelude.NFData DeleteSafetyRuleResponse where
  rnf :: DeleteSafetyRuleResponse -> ()
rnf DeleteSafetyRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSafetyRuleResponse' :: DeleteSafetyRuleResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus