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

instance Prelude.NFData DeleteResponsePlan

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

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

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

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