{-# 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.DeleteIncidentRecord
-- 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)
--
-- Delete an incident record from Incident Manager.
module Amazonka.SSMIncidents.DeleteIncidentRecord
  ( -- * Creating a Request
    DeleteIncidentRecord (..),
    newDeleteIncidentRecord,

    -- * Request Lenses
    deleteIncidentRecord_arn,

    -- * Destructuring the Response
    DeleteIncidentRecordResponse (..),
    newDeleteIncidentRecordResponse,

    -- * Response Lenses
    deleteIncidentRecordResponse_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:/ 'newDeleteIncidentRecord' smart constructor.
data DeleteIncidentRecord = DeleteIncidentRecord'
  { -- | The Amazon Resource Name (ARN) of the incident record you are deleting.
    DeleteIncidentRecord -> Text
arn :: Prelude.Text
  }
  deriving (DeleteIncidentRecord -> DeleteIncidentRecord -> Bool
(DeleteIncidentRecord -> DeleteIncidentRecord -> Bool)
-> (DeleteIncidentRecord -> DeleteIncidentRecord -> Bool)
-> Eq DeleteIncidentRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIncidentRecord -> DeleteIncidentRecord -> Bool
$c/= :: DeleteIncidentRecord -> DeleteIncidentRecord -> Bool
== :: DeleteIncidentRecord -> DeleteIncidentRecord -> Bool
$c== :: DeleteIncidentRecord -> DeleteIncidentRecord -> Bool
Prelude.Eq, ReadPrec [DeleteIncidentRecord]
ReadPrec DeleteIncidentRecord
Int -> ReadS DeleteIncidentRecord
ReadS [DeleteIncidentRecord]
(Int -> ReadS DeleteIncidentRecord)
-> ReadS [DeleteIncidentRecord]
-> ReadPrec DeleteIncidentRecord
-> ReadPrec [DeleteIncidentRecord]
-> Read DeleteIncidentRecord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIncidentRecord]
$creadListPrec :: ReadPrec [DeleteIncidentRecord]
readPrec :: ReadPrec DeleteIncidentRecord
$creadPrec :: ReadPrec DeleteIncidentRecord
readList :: ReadS [DeleteIncidentRecord]
$creadList :: ReadS [DeleteIncidentRecord]
readsPrec :: Int -> ReadS DeleteIncidentRecord
$creadsPrec :: Int -> ReadS DeleteIncidentRecord
Prelude.Read, Int -> DeleteIncidentRecord -> ShowS
[DeleteIncidentRecord] -> ShowS
DeleteIncidentRecord -> String
(Int -> DeleteIncidentRecord -> ShowS)
-> (DeleteIncidentRecord -> String)
-> ([DeleteIncidentRecord] -> ShowS)
-> Show DeleteIncidentRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIncidentRecord] -> ShowS
$cshowList :: [DeleteIncidentRecord] -> ShowS
show :: DeleteIncidentRecord -> String
$cshow :: DeleteIncidentRecord -> String
showsPrec :: Int -> DeleteIncidentRecord -> ShowS
$cshowsPrec :: Int -> DeleteIncidentRecord -> ShowS
Prelude.Show, (forall x. DeleteIncidentRecord -> Rep DeleteIncidentRecord x)
-> (forall x. Rep DeleteIncidentRecord x -> DeleteIncidentRecord)
-> Generic DeleteIncidentRecord
forall x. Rep DeleteIncidentRecord x -> DeleteIncidentRecord
forall x. DeleteIncidentRecord -> Rep DeleteIncidentRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIncidentRecord x -> DeleteIncidentRecord
$cfrom :: forall x. DeleteIncidentRecord -> Rep DeleteIncidentRecord x
Prelude.Generic)

-- |
-- Create a value of 'DeleteIncidentRecord' 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', 'deleteIncidentRecord_arn' - The Amazon Resource Name (ARN) of the incident record you are deleting.
newDeleteIncidentRecord ::
  -- | 'arn'
  Prelude.Text ->
  DeleteIncidentRecord
newDeleteIncidentRecord :: Text -> DeleteIncidentRecord
newDeleteIncidentRecord Text
pArn_ =
  DeleteIncidentRecord' :: Text -> DeleteIncidentRecord
DeleteIncidentRecord' {$sel:arn:DeleteIncidentRecord' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the incident record you are deleting.
deleteIncidentRecord_arn :: Lens.Lens' DeleteIncidentRecord Prelude.Text
deleteIncidentRecord_arn :: (Text -> f Text) -> DeleteIncidentRecord -> f DeleteIncidentRecord
deleteIncidentRecord_arn = (DeleteIncidentRecord -> Text)
-> (DeleteIncidentRecord -> Text -> DeleteIncidentRecord)
-> Lens DeleteIncidentRecord DeleteIncidentRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIncidentRecord' {Text
arn :: Text
$sel:arn:DeleteIncidentRecord' :: DeleteIncidentRecord -> Text
arn} -> Text
arn) (\s :: DeleteIncidentRecord
s@DeleteIncidentRecord' {} Text
a -> DeleteIncidentRecord
s {$sel:arn:DeleteIncidentRecord' :: Text
arn = Text
a} :: DeleteIncidentRecord)

instance Core.AWSRequest DeleteIncidentRecord where
  type
    AWSResponse DeleteIncidentRecord =
      DeleteIncidentRecordResponse
  request :: DeleteIncidentRecord -> Request DeleteIncidentRecord
request = Service -> DeleteIncidentRecord -> Request DeleteIncidentRecord
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteIncidentRecord
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteIncidentRecord)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteIncidentRecord))
-> Logger
-> Service
-> Proxy DeleteIncidentRecord
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteIncidentRecord)))
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 -> DeleteIncidentRecordResponse
DeleteIncidentRecordResponse'
            (Int -> DeleteIncidentRecordResponse)
-> Either String Int -> Either String DeleteIncidentRecordResponse
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 DeleteIncidentRecord

instance Prelude.NFData DeleteIncidentRecord

instance Core.ToHeaders DeleteIncidentRecord where
  toHeaders :: DeleteIncidentRecord -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteIncidentRecord -> 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 DeleteIncidentRecord where
  toJSON :: DeleteIncidentRecord -> Value
toJSON DeleteIncidentRecord' {Text
arn :: Text
$sel:arn:DeleteIncidentRecord' :: DeleteIncidentRecord -> 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 DeleteIncidentRecord where
  toPath :: DeleteIncidentRecord -> ByteString
toPath = ByteString -> DeleteIncidentRecord -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/deleteIncidentRecord"

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

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

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

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

instance Prelude.NFData DeleteIncidentRecordResponse