{-# 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.GetIncidentRecord
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the details for the specified incident record.
module Amazonka.SSMIncidents.GetIncidentRecord
  ( -- * Creating a Request
    GetIncidentRecord (..),
    newGetIncidentRecord,

    -- * Request Lenses
    getIncidentRecord_arn,

    -- * Destructuring the Response
    GetIncidentRecordResponse (..),
    newGetIncidentRecordResponse,

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

-- |
-- Create a value of 'GetIncidentRecord' 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', 'getIncidentRecord_arn' - The Amazon Resource Name (ARN) of the incident record.
newGetIncidentRecord ::
  -- | 'arn'
  Prelude.Text ->
  GetIncidentRecord
newGetIncidentRecord :: Text -> GetIncidentRecord
newGetIncidentRecord Text
pArn_ =
  GetIncidentRecord' {$sel:arn:GetIncidentRecord' :: Text
arn = Text
pArn_}

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

instance Core.AWSRequest GetIncidentRecord where
  type
    AWSResponse GetIncidentRecord =
      GetIncidentRecordResponse
  request :: (Service -> Service)
-> GetIncidentRecord -> Request GetIncidentRecord
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetIncidentRecord
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIncidentRecord)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> IncidentRecord -> GetIncidentRecordResponse
GetIncidentRecordResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"incidentRecord")
      )

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

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

instance Data.ToHeaders GetIncidentRecord where
  toHeaders :: GetIncidentRecord -> 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 GetIncidentRecord where
  toPath :: GetIncidentRecord -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/getIncidentRecord"

instance Data.ToQuery GetIncidentRecord where
  toQuery :: GetIncidentRecord -> QueryString
toQuery GetIncidentRecord' {Text
arn :: Text
$sel:arn:GetIncidentRecord' :: GetIncidentRecord -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"arn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
arn]

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

-- |
-- Create a value of 'GetIncidentRecordResponse' 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', 'getIncidentRecordResponse_httpStatus' - The response's http status code.
--
-- 'incidentRecord', 'getIncidentRecordResponse_incidentRecord' - Details the structure of the incident record.
newGetIncidentRecordResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'incidentRecord'
  IncidentRecord ->
  GetIncidentRecordResponse
newGetIncidentRecordResponse :: Int -> IncidentRecord -> GetIncidentRecordResponse
newGetIncidentRecordResponse
  Int
pHttpStatus_
  IncidentRecord
pIncidentRecord_ =
    GetIncidentRecordResponse'
      { $sel:httpStatus:GetIncidentRecordResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:incidentRecord:GetIncidentRecordResponse' :: IncidentRecord
incidentRecord = IncidentRecord
pIncidentRecord_
      }

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

-- | Details the structure of the incident record.
getIncidentRecordResponse_incidentRecord :: Lens.Lens' GetIncidentRecordResponse IncidentRecord
getIncidentRecordResponse_incidentRecord :: Lens' GetIncidentRecordResponse IncidentRecord
getIncidentRecordResponse_incidentRecord = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIncidentRecordResponse' {IncidentRecord
incidentRecord :: IncidentRecord
$sel:incidentRecord:GetIncidentRecordResponse' :: GetIncidentRecordResponse -> IncidentRecord
incidentRecord} -> IncidentRecord
incidentRecord) (\s :: GetIncidentRecordResponse
s@GetIncidentRecordResponse' {} IncidentRecord
a -> GetIncidentRecordResponse
s {$sel:incidentRecord:GetIncidentRecordResponse' :: IncidentRecord
incidentRecord = IncidentRecord
a} :: GetIncidentRecordResponse)

instance Prelude.NFData GetIncidentRecordResponse where
  rnf :: GetIncidentRecordResponse -> ()
rnf GetIncidentRecordResponse' {Int
IncidentRecord
incidentRecord :: IncidentRecord
httpStatus :: Int
$sel:incidentRecord:GetIncidentRecordResponse' :: GetIncidentRecordResponse -> IncidentRecord
$sel:httpStatus:GetIncidentRecordResponse' :: GetIncidentRecordResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf IncidentRecord
incidentRecord