{-# 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.AuditManager.GetAssessmentReportUrl
-- 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 URL of an assessment report in Audit Manager.
module Amazonka.AuditManager.GetAssessmentReportUrl
  ( -- * Creating a Request
    GetAssessmentReportUrl (..),
    newGetAssessmentReportUrl,

    -- * Request Lenses
    getAssessmentReportUrl_assessmentReportId,
    getAssessmentReportUrl_assessmentId,

    -- * Destructuring the Response
    GetAssessmentReportUrlResponse (..),
    newGetAssessmentReportUrlResponse,

    -- * Response Lenses
    getAssessmentReportUrlResponse_preSignedUrl,
    getAssessmentReportUrlResponse_httpStatus,
  )
where

import Amazonka.AuditManager.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:/ 'newGetAssessmentReportUrl' smart constructor.
data GetAssessmentReportUrl = GetAssessmentReportUrl'
  { -- | The unique identifier for the assessment report.
    GetAssessmentReportUrl -> Text
assessmentReportId :: Prelude.Text,
    -- | The unique identifier for the assessment.
    GetAssessmentReportUrl -> Text
assessmentId :: Prelude.Text
  }
  deriving (GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool
$c/= :: GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool
== :: GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool
$c== :: GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool
Prelude.Eq, ReadPrec [GetAssessmentReportUrl]
ReadPrec GetAssessmentReportUrl
Int -> ReadS GetAssessmentReportUrl
ReadS [GetAssessmentReportUrl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAssessmentReportUrl]
$creadListPrec :: ReadPrec [GetAssessmentReportUrl]
readPrec :: ReadPrec GetAssessmentReportUrl
$creadPrec :: ReadPrec GetAssessmentReportUrl
readList :: ReadS [GetAssessmentReportUrl]
$creadList :: ReadS [GetAssessmentReportUrl]
readsPrec :: Int -> ReadS GetAssessmentReportUrl
$creadsPrec :: Int -> ReadS GetAssessmentReportUrl
Prelude.Read, Int -> GetAssessmentReportUrl -> ShowS
[GetAssessmentReportUrl] -> ShowS
GetAssessmentReportUrl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAssessmentReportUrl] -> ShowS
$cshowList :: [GetAssessmentReportUrl] -> ShowS
show :: GetAssessmentReportUrl -> String
$cshow :: GetAssessmentReportUrl -> String
showsPrec :: Int -> GetAssessmentReportUrl -> ShowS
$cshowsPrec :: Int -> GetAssessmentReportUrl -> ShowS
Prelude.Show, forall x. Rep GetAssessmentReportUrl x -> GetAssessmentReportUrl
forall x. GetAssessmentReportUrl -> Rep GetAssessmentReportUrl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAssessmentReportUrl x -> GetAssessmentReportUrl
$cfrom :: forall x. GetAssessmentReportUrl -> Rep GetAssessmentReportUrl x
Prelude.Generic)

-- |
-- Create a value of 'GetAssessmentReportUrl' 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:
--
-- 'assessmentReportId', 'getAssessmentReportUrl_assessmentReportId' - The unique identifier for the assessment report.
--
-- 'assessmentId', 'getAssessmentReportUrl_assessmentId' - The unique identifier for the assessment.
newGetAssessmentReportUrl ::
  -- | 'assessmentReportId'
  Prelude.Text ->
  -- | 'assessmentId'
  Prelude.Text ->
  GetAssessmentReportUrl
newGetAssessmentReportUrl :: Text -> Text -> GetAssessmentReportUrl
newGetAssessmentReportUrl
  Text
pAssessmentReportId_
  Text
pAssessmentId_ =
    GetAssessmentReportUrl'
      { $sel:assessmentReportId:GetAssessmentReportUrl' :: Text
assessmentReportId =
          Text
pAssessmentReportId_,
        $sel:assessmentId:GetAssessmentReportUrl' :: Text
assessmentId = Text
pAssessmentId_
      }

-- | The unique identifier for the assessment report.
getAssessmentReportUrl_assessmentReportId :: Lens.Lens' GetAssessmentReportUrl Prelude.Text
getAssessmentReportUrl_assessmentReportId :: Lens' GetAssessmentReportUrl Text
getAssessmentReportUrl_assessmentReportId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReportUrl' {Text
assessmentReportId :: Text
$sel:assessmentReportId:GetAssessmentReportUrl' :: GetAssessmentReportUrl -> Text
assessmentReportId} -> Text
assessmentReportId) (\s :: GetAssessmentReportUrl
s@GetAssessmentReportUrl' {} Text
a -> GetAssessmentReportUrl
s {$sel:assessmentReportId:GetAssessmentReportUrl' :: Text
assessmentReportId = Text
a} :: GetAssessmentReportUrl)

-- | The unique identifier for the assessment.
getAssessmentReportUrl_assessmentId :: Lens.Lens' GetAssessmentReportUrl Prelude.Text
getAssessmentReportUrl_assessmentId :: Lens' GetAssessmentReportUrl Text
getAssessmentReportUrl_assessmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReportUrl' {Text
assessmentId :: Text
$sel:assessmentId:GetAssessmentReportUrl' :: GetAssessmentReportUrl -> Text
assessmentId} -> Text
assessmentId) (\s :: GetAssessmentReportUrl
s@GetAssessmentReportUrl' {} Text
a -> GetAssessmentReportUrl
s {$sel:assessmentId:GetAssessmentReportUrl' :: Text
assessmentId = Text
a} :: GetAssessmentReportUrl)

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

instance Prelude.NFData GetAssessmentReportUrl where
  rnf :: GetAssessmentReportUrl -> ()
rnf GetAssessmentReportUrl' {Text
assessmentId :: Text
assessmentReportId :: Text
$sel:assessmentId:GetAssessmentReportUrl' :: GetAssessmentReportUrl -> Text
$sel:assessmentReportId:GetAssessmentReportUrl' :: GetAssessmentReportUrl -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
assessmentReportId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
assessmentId

instance Data.ToHeaders GetAssessmentReportUrl where
  toHeaders :: GetAssessmentReportUrl -> 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 GetAssessmentReportUrl where
  toPath :: GetAssessmentReportUrl -> ByteString
toPath GetAssessmentReportUrl' {Text
assessmentId :: Text
assessmentReportId :: Text
$sel:assessmentId:GetAssessmentReportUrl' :: GetAssessmentReportUrl -> Text
$sel:assessmentReportId:GetAssessmentReportUrl' :: GetAssessmentReportUrl -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/assessments/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
assessmentId,
        ByteString
"/reports/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
assessmentReportId,
        ByteString
"/url"
      ]

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

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

-- |
-- Create a value of 'GetAssessmentReportUrlResponse' 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:
--
-- 'preSignedUrl', 'getAssessmentReportUrlResponse_preSignedUrl' - Undocumented member.
--
-- 'httpStatus', 'getAssessmentReportUrlResponse_httpStatus' - The response's http status code.
newGetAssessmentReportUrlResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAssessmentReportUrlResponse
newGetAssessmentReportUrlResponse :: Int -> GetAssessmentReportUrlResponse
newGetAssessmentReportUrlResponse Int
pHttpStatus_ =
  GetAssessmentReportUrlResponse'
    { $sel:preSignedUrl:GetAssessmentReportUrlResponse' :: Maybe URL
preSignedUrl =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAssessmentReportUrlResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
getAssessmentReportUrlResponse_preSignedUrl :: Lens.Lens' GetAssessmentReportUrlResponse (Prelude.Maybe URL)
getAssessmentReportUrlResponse_preSignedUrl :: Lens' GetAssessmentReportUrlResponse (Maybe URL)
getAssessmentReportUrlResponse_preSignedUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReportUrlResponse' {Maybe URL
preSignedUrl :: Maybe URL
$sel:preSignedUrl:GetAssessmentReportUrlResponse' :: GetAssessmentReportUrlResponse -> Maybe URL
preSignedUrl} -> Maybe URL
preSignedUrl) (\s :: GetAssessmentReportUrlResponse
s@GetAssessmentReportUrlResponse' {} Maybe URL
a -> GetAssessmentReportUrlResponse
s {$sel:preSignedUrl:GetAssessmentReportUrlResponse' :: Maybe URL
preSignedUrl = Maybe URL
a} :: GetAssessmentReportUrlResponse)

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

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