{-# 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.Backup.DescribeReportJob
-- 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 associated with creating a report as specified by
-- its @ReportJobId@.
module Amazonka.Backup.DescribeReportJob
  ( -- * Creating a Request
    DescribeReportJob (..),
    newDescribeReportJob,

    -- * Request Lenses
    describeReportJob_reportJobId,

    -- * Destructuring the Response
    DescribeReportJobResponse (..),
    newDescribeReportJobResponse,

    -- * Response Lenses
    describeReportJobResponse_reportJob,
    describeReportJobResponse_httpStatus,
  )
where

import Amazonka.Backup.Types
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

-- | /See:/ 'newDescribeReportJob' smart constructor.
data DescribeReportJob = DescribeReportJob'
  { -- | The identifier of the report job. A unique, randomly generated, Unicode,
    -- UTF-8 encoded string that is at most 1,024 bytes long. The report job ID
    -- cannot be edited.
    DescribeReportJob -> Text
reportJobId :: Prelude.Text
  }
  deriving (DescribeReportJob -> DescribeReportJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReportJob -> DescribeReportJob -> Bool
$c/= :: DescribeReportJob -> DescribeReportJob -> Bool
== :: DescribeReportJob -> DescribeReportJob -> Bool
$c== :: DescribeReportJob -> DescribeReportJob -> Bool
Prelude.Eq, ReadPrec [DescribeReportJob]
ReadPrec DescribeReportJob
Int -> ReadS DescribeReportJob
ReadS [DescribeReportJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReportJob]
$creadListPrec :: ReadPrec [DescribeReportJob]
readPrec :: ReadPrec DescribeReportJob
$creadPrec :: ReadPrec DescribeReportJob
readList :: ReadS [DescribeReportJob]
$creadList :: ReadS [DescribeReportJob]
readsPrec :: Int -> ReadS DescribeReportJob
$creadsPrec :: Int -> ReadS DescribeReportJob
Prelude.Read, Int -> DescribeReportJob -> ShowS
[DescribeReportJob] -> ShowS
DescribeReportJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReportJob] -> ShowS
$cshowList :: [DescribeReportJob] -> ShowS
show :: DescribeReportJob -> String
$cshow :: DescribeReportJob -> String
showsPrec :: Int -> DescribeReportJob -> ShowS
$cshowsPrec :: Int -> DescribeReportJob -> ShowS
Prelude.Show, forall x. Rep DescribeReportJob x -> DescribeReportJob
forall x. DescribeReportJob -> Rep DescribeReportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeReportJob x -> DescribeReportJob
$cfrom :: forall x. DescribeReportJob -> Rep DescribeReportJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReportJob' 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:
--
-- 'reportJobId', 'describeReportJob_reportJobId' - The identifier of the report job. A unique, randomly generated, Unicode,
-- UTF-8 encoded string that is at most 1,024 bytes long. The report job ID
-- cannot be edited.
newDescribeReportJob ::
  -- | 'reportJobId'
  Prelude.Text ->
  DescribeReportJob
newDescribeReportJob :: Text -> DescribeReportJob
newDescribeReportJob Text
pReportJobId_ =
  DescribeReportJob' {$sel:reportJobId:DescribeReportJob' :: Text
reportJobId = Text
pReportJobId_}

-- | The identifier of the report job. A unique, randomly generated, Unicode,
-- UTF-8 encoded string that is at most 1,024 bytes long. The report job ID
-- cannot be edited.
describeReportJob_reportJobId :: Lens.Lens' DescribeReportJob Prelude.Text
describeReportJob_reportJobId :: Lens' DescribeReportJob Text
describeReportJob_reportJobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReportJob' {Text
reportJobId :: Text
$sel:reportJobId:DescribeReportJob' :: DescribeReportJob -> Text
reportJobId} -> Text
reportJobId) (\s :: DescribeReportJob
s@DescribeReportJob' {} Text
a -> DescribeReportJob
s {$sel:reportJobId:DescribeReportJob' :: Text
reportJobId = Text
a} :: DescribeReportJob)

instance Core.AWSRequest DescribeReportJob where
  type
    AWSResponse DescribeReportJob =
      DescribeReportJobResponse
  request :: (Service -> Service)
-> DescribeReportJob -> Request DescribeReportJob
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 DescribeReportJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReportJob)))
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 ->
          Maybe ReportJob -> Int -> DescribeReportJobResponse
DescribeReportJobResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ReportJob")
            forall (f :: * -> *) a b. Applicative f => 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 DescribeReportJob where
  hashWithSalt :: Int -> DescribeReportJob -> Int
hashWithSalt Int
_salt DescribeReportJob' {Text
reportJobId :: Text
$sel:reportJobId:DescribeReportJob' :: DescribeReportJob -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
reportJobId

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

instance Data.ToHeaders DescribeReportJob where
  toHeaders :: DescribeReportJob -> 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 DescribeReportJob where
  toPath :: DescribeReportJob -> ByteString
toPath DescribeReportJob' {Text
reportJobId :: Text
$sel:reportJobId:DescribeReportJob' :: DescribeReportJob -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/audit/report-jobs/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
reportJobId]

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

-- | /See:/ 'newDescribeReportJobResponse' smart constructor.
data DescribeReportJobResponse = DescribeReportJobResponse'
  { -- | A list of information about a report job, including its completion and
    -- creation times, report destination, unique report job ID, Amazon
    -- Resource Name (ARN), report template, status, and status message.
    DescribeReportJobResponse -> Maybe ReportJob
reportJob :: Prelude.Maybe ReportJob,
    -- | The response's http status code.
    DescribeReportJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReportJobResponse -> DescribeReportJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReportJobResponse -> DescribeReportJobResponse -> Bool
$c/= :: DescribeReportJobResponse -> DescribeReportJobResponse -> Bool
== :: DescribeReportJobResponse -> DescribeReportJobResponse -> Bool
$c== :: DescribeReportJobResponse -> DescribeReportJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReportJobResponse]
ReadPrec DescribeReportJobResponse
Int -> ReadS DescribeReportJobResponse
ReadS [DescribeReportJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReportJobResponse]
$creadListPrec :: ReadPrec [DescribeReportJobResponse]
readPrec :: ReadPrec DescribeReportJobResponse
$creadPrec :: ReadPrec DescribeReportJobResponse
readList :: ReadS [DescribeReportJobResponse]
$creadList :: ReadS [DescribeReportJobResponse]
readsPrec :: Int -> ReadS DescribeReportJobResponse
$creadsPrec :: Int -> ReadS DescribeReportJobResponse
Prelude.Read, Int -> DescribeReportJobResponse -> ShowS
[DescribeReportJobResponse] -> ShowS
DescribeReportJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReportJobResponse] -> ShowS
$cshowList :: [DescribeReportJobResponse] -> ShowS
show :: DescribeReportJobResponse -> String
$cshow :: DescribeReportJobResponse -> String
showsPrec :: Int -> DescribeReportJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeReportJobResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeReportJobResponse x -> DescribeReportJobResponse
forall x.
DescribeReportJobResponse -> Rep DescribeReportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReportJobResponse x -> DescribeReportJobResponse
$cfrom :: forall x.
DescribeReportJobResponse -> Rep DescribeReportJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReportJobResponse' 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:
--
-- 'reportJob', 'describeReportJobResponse_reportJob' - A list of information about a report job, including its completion and
-- creation times, report destination, unique report job ID, Amazon
-- Resource Name (ARN), report template, status, and status message.
--
-- 'httpStatus', 'describeReportJobResponse_httpStatus' - The response's http status code.
newDescribeReportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReportJobResponse
newDescribeReportJobResponse :: Int -> DescribeReportJobResponse
newDescribeReportJobResponse Int
pHttpStatus_ =
  DescribeReportJobResponse'
    { $sel:reportJob:DescribeReportJobResponse' :: Maybe ReportJob
reportJob =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeReportJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of information about a report job, including its completion and
-- creation times, report destination, unique report job ID, Amazon
-- Resource Name (ARN), report template, status, and status message.
describeReportJobResponse_reportJob :: Lens.Lens' DescribeReportJobResponse (Prelude.Maybe ReportJob)
describeReportJobResponse_reportJob :: Lens' DescribeReportJobResponse (Maybe ReportJob)
describeReportJobResponse_reportJob = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReportJobResponse' {Maybe ReportJob
reportJob :: Maybe ReportJob
$sel:reportJob:DescribeReportJobResponse' :: DescribeReportJobResponse -> Maybe ReportJob
reportJob} -> Maybe ReportJob
reportJob) (\s :: DescribeReportJobResponse
s@DescribeReportJobResponse' {} Maybe ReportJob
a -> DescribeReportJobResponse
s {$sel:reportJob:DescribeReportJobResponse' :: Maybe ReportJob
reportJob = Maybe ReportJob
a} :: DescribeReportJobResponse)

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

instance Prelude.NFData DescribeReportJobResponse where
  rnf :: DescribeReportJobResponse -> ()
rnf DescribeReportJobResponse' {Int
Maybe ReportJob
httpStatus :: Int
reportJob :: Maybe ReportJob
$sel:httpStatus:DescribeReportJobResponse' :: DescribeReportJobResponse -> Int
$sel:reportJob:DescribeReportJobResponse' :: DescribeReportJobResponse -> Maybe ReportJob
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReportJob
reportJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus