{-# 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.SSMIncidents.DeleteResponsePlan
-- 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 response plan. Deleting a response plan stops all
-- linked CloudWatch alarms and EventBridge events from creating an
-- incident with this response plan.
module Amazonka.SSMIncidents.DeleteResponsePlan
  ( -- * Creating a Request
    DeleteResponsePlan (..),
    newDeleteResponsePlan,

    -- * Request Lenses
    deleteResponsePlan_arn,

    -- * Destructuring the Response
    DeleteResponsePlanResponse (..),
    newDeleteResponsePlanResponse,

    -- * Response Lenses
    deleteResponsePlanResponse_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.SSMIncidents.Types

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

-- |
-- Create a value of 'DeleteResponsePlan' 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:
--
-- 'arn', 'deleteResponsePlan_arn' - The Amazon Resource Name (ARN) of the response plan.
newDeleteResponsePlan ::
  -- | 'arn'
  Prelude.Text ->
  DeleteResponsePlan
newDeleteResponsePlan :: Text -> DeleteResponsePlan
newDeleteResponsePlan Text
pArn_ =
  DeleteResponsePlan' {$sel:arn:DeleteResponsePlan' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the response plan.
deleteResponsePlan_arn :: Lens.Lens' DeleteResponsePlan Prelude.Text
deleteResponsePlan_arn :: Lens' DeleteResponsePlan Text
deleteResponsePlan_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResponsePlan' {Text
arn :: Text
$sel:arn:DeleteResponsePlan' :: DeleteResponsePlan -> Text
arn} -> Text
arn) (\s :: DeleteResponsePlan
s@DeleteResponsePlan' {} Text
a -> DeleteResponsePlan
s {$sel:arn:DeleteResponsePlan' :: Text
arn = Text
a} :: DeleteResponsePlan)

instance Core.AWSRequest DeleteResponsePlan where
  type
    AWSResponse DeleteResponsePlan =
      DeleteResponsePlanResponse
  request :: (Service -> Service)
-> DeleteResponsePlan -> Request DeleteResponsePlan
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 DeleteResponsePlan
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResponsePlan)))
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 -> DeleteResponsePlanResponse
DeleteResponsePlanResponse'
            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 DeleteResponsePlan where
  hashWithSalt :: Int -> DeleteResponsePlan -> Int
hashWithSalt Int
_salt DeleteResponsePlan' {Text
arn :: Text
$sel:arn:DeleteResponsePlan' :: DeleteResponsePlan -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

instance Data.ToHeaders DeleteResponsePlan where
  toHeaders :: DeleteResponsePlan -> 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.ToJSON DeleteResponsePlan where
  toJSON :: DeleteResponsePlan -> Value
toJSON DeleteResponsePlan' {Text
arn :: Text
$sel:arn:DeleteResponsePlan' :: DeleteResponsePlan -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
      )

instance Data.ToPath DeleteResponsePlan where
  toPath :: DeleteResponsePlan -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/deleteResponsePlan"

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

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

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

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

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