{-# 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-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 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.Lens as Lens
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 request body that you include when you update a safety rule.
    DeleteSafetyRule -> Text
safetyRuleArn :: Prelude.Text
  }
  deriving (DeleteSafetyRule -> DeleteSafetyRule -> Bool
(DeleteSafetyRule -> DeleteSafetyRule -> Bool)
-> (DeleteSafetyRule -> DeleteSafetyRule -> Bool)
-> Eq DeleteSafetyRule
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]
(Int -> ReadS DeleteSafetyRule)
-> ReadS [DeleteSafetyRule]
-> ReadPrec DeleteSafetyRule
-> ReadPrec [DeleteSafetyRule]
-> Read 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
(Int -> DeleteSafetyRule -> ShowS)
-> (DeleteSafetyRule -> String)
-> ([DeleteSafetyRule] -> ShowS)
-> Show DeleteSafetyRule
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. DeleteSafetyRule -> Rep DeleteSafetyRule x)
-> (forall x. Rep DeleteSafetyRule x -> DeleteSafetyRule)
-> Generic DeleteSafetyRule
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 request body that you include when you update a safety rule.
newDeleteSafetyRule ::
  -- | 'safetyRuleArn'
  Prelude.Text ->
  DeleteSafetyRule
newDeleteSafetyRule :: Text -> DeleteSafetyRule
newDeleteSafetyRule Text
pSafetyRuleArn_ =
  DeleteSafetyRule' :: Text -> DeleteSafetyRule
DeleteSafetyRule' {$sel:safetyRuleArn:DeleteSafetyRule' :: Text
safetyRuleArn = Text
pSafetyRuleArn_}

-- | The request body that you include when you update a safety rule.
deleteSafetyRule_safetyRuleArn :: Lens.Lens' DeleteSafetyRule Prelude.Text
deleteSafetyRule_safetyRuleArn :: (Text -> f Text) -> DeleteSafetyRule -> f DeleteSafetyRule
deleteSafetyRule_safetyRuleArn = (DeleteSafetyRule -> Text)
-> (DeleteSafetyRule -> Text -> DeleteSafetyRule)
-> Lens DeleteSafetyRule DeleteSafetyRule Text Text
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 :: DeleteSafetyRule -> Request DeleteSafetyRule
request = Service -> DeleteSafetyRule -> Request DeleteSafetyRule
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSafetyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSafetyRule)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteSafetyRule))
-> Logger
-> Service
-> Proxy DeleteSafetyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSafetyRule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteSafetyRuleResponse
DeleteSafetyRuleResponse'
            (Int -> DeleteSafetyRuleResponse)
-> Either String Int -> Either String DeleteSafetyRuleResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteSafetyRule

instance Prelude.NFData DeleteSafetyRule

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

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

instance Core.ToQuery DeleteSafetyRule where
  toQuery :: DeleteSafetyRule -> QueryString
toQuery = QueryString -> DeleteSafetyRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteSafetyRuleResponse -> DeleteSafetyRuleResponse -> Bool)
-> (DeleteSafetyRuleResponse -> DeleteSafetyRuleResponse -> Bool)
-> Eq DeleteSafetyRuleResponse
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]
(Int -> ReadS DeleteSafetyRuleResponse)
-> ReadS [DeleteSafetyRuleResponse]
-> ReadPrec DeleteSafetyRuleResponse
-> ReadPrec [DeleteSafetyRuleResponse]
-> Read 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
(Int -> DeleteSafetyRuleResponse -> ShowS)
-> (DeleteSafetyRuleResponse -> String)
-> ([DeleteSafetyRuleResponse] -> ShowS)
-> Show DeleteSafetyRuleResponse
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.
 DeleteSafetyRuleResponse -> Rep DeleteSafetyRuleResponse x)
-> (forall x.
    Rep DeleteSafetyRuleResponse x -> DeleteSafetyRuleResponse)
-> Generic DeleteSafetyRuleResponse
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' :: Int -> DeleteSafetyRuleResponse
DeleteSafetyRuleResponse'
    { $sel:httpStatus:DeleteSafetyRuleResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteSafetyRuleResponse_httpStatus :: Lens.Lens' DeleteSafetyRuleResponse Prelude.Int
deleteSafetyRuleResponse_httpStatus :: (Int -> f Int)
-> DeleteSafetyRuleResponse -> f DeleteSafetyRuleResponse
deleteSafetyRuleResponse_httpStatus = (DeleteSafetyRuleResponse -> Int)
-> (DeleteSafetyRuleResponse -> Int -> DeleteSafetyRuleResponse)
-> Lens DeleteSafetyRuleResponse DeleteSafetyRuleResponse Int Int
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