{-# 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-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)
--
-- Returns the URL of a specified 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.Lens as Lens
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 identifier for the assessment report.
    GetAssessmentReportUrl -> Text
assessmentReportId :: Prelude.Text,
    -- | The identifier for the specified assessment.
    GetAssessmentReportUrl -> Text
assessmentId :: Prelude.Text
  }
  deriving (GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool
(GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool)
-> (GetAssessmentReportUrl -> GetAssessmentReportUrl -> Bool)
-> Eq GetAssessmentReportUrl
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]
(Int -> ReadS GetAssessmentReportUrl)
-> ReadS [GetAssessmentReportUrl]
-> ReadPrec GetAssessmentReportUrl
-> ReadPrec [GetAssessmentReportUrl]
-> Read 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
(Int -> GetAssessmentReportUrl -> ShowS)
-> (GetAssessmentReportUrl -> String)
-> ([GetAssessmentReportUrl] -> ShowS)
-> Show GetAssessmentReportUrl
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. GetAssessmentReportUrl -> Rep GetAssessmentReportUrl x)
-> (forall x.
    Rep GetAssessmentReportUrl x -> GetAssessmentReportUrl)
-> Generic GetAssessmentReportUrl
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 identifier for the assessment report.
--
-- 'assessmentId', 'getAssessmentReportUrl_assessmentId' - The identifier for the specified assessment.
newGetAssessmentReportUrl ::
  -- | 'assessmentReportId'
  Prelude.Text ->
  -- | 'assessmentId'
  Prelude.Text ->
  GetAssessmentReportUrl
newGetAssessmentReportUrl :: Text -> Text -> GetAssessmentReportUrl
newGetAssessmentReportUrl
  Text
pAssessmentReportId_
  Text
pAssessmentId_ =
    GetAssessmentReportUrl' :: Text -> Text -> GetAssessmentReportUrl
GetAssessmentReportUrl'
      { $sel:assessmentReportId:GetAssessmentReportUrl' :: Text
assessmentReportId =
          Text
pAssessmentReportId_,
        $sel:assessmentId:GetAssessmentReportUrl' :: Text
assessmentId = Text
pAssessmentId_
      }

-- | The identifier for the assessment report.
getAssessmentReportUrl_assessmentReportId :: Lens.Lens' GetAssessmentReportUrl Prelude.Text
getAssessmentReportUrl_assessmentReportId :: (Text -> f Text)
-> GetAssessmentReportUrl -> f GetAssessmentReportUrl
getAssessmentReportUrl_assessmentReportId = (GetAssessmentReportUrl -> Text)
-> (GetAssessmentReportUrl -> Text -> GetAssessmentReportUrl)
-> Lens GetAssessmentReportUrl GetAssessmentReportUrl Text Text
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 identifier for the specified assessment.
getAssessmentReportUrl_assessmentId :: Lens.Lens' GetAssessmentReportUrl Prelude.Text
getAssessmentReportUrl_assessmentId :: (Text -> f Text)
-> GetAssessmentReportUrl -> f GetAssessmentReportUrl
getAssessmentReportUrl_assessmentId = (GetAssessmentReportUrl -> Text)
-> (GetAssessmentReportUrl -> Text -> GetAssessmentReportUrl)
-> Lens GetAssessmentReportUrl GetAssessmentReportUrl Text Text
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 :: GetAssessmentReportUrl -> Request GetAssessmentReportUrl
request = Service -> GetAssessmentReportUrl -> Request GetAssessmentReportUrl
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAssessmentReportUrl
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAssessmentReportUrl)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAssessmentReportUrl))
-> Logger
-> Service
-> Proxy GetAssessmentReportUrl
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAssessmentReportUrl)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe URL -> Int -> GetAssessmentReportUrlResponse
GetAssessmentReportUrlResponse'
            (Maybe URL -> Int -> GetAssessmentReportUrlResponse)
-> Either String (Maybe URL)
-> Either String (Int -> GetAssessmentReportUrlResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe URL)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"preSignedUrl")
            Either String (Int -> GetAssessmentReportUrlResponse)
-> Either String Int
-> Either String GetAssessmentReportUrlResponse
forall (f :: * -> *) a b. Applicative f => 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 GetAssessmentReportUrl

instance Prelude.NFData GetAssessmentReportUrl

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

instance Core.ToQuery GetAssessmentReportUrl where
  toQuery :: GetAssessmentReportUrl -> QueryString
toQuery = QueryString -> GetAssessmentReportUrl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetAssessmentReportUrlResponse
 -> GetAssessmentReportUrlResponse -> Bool)
-> (GetAssessmentReportUrlResponse
    -> GetAssessmentReportUrlResponse -> Bool)
-> Eq GetAssessmentReportUrlResponse
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]
(Int -> ReadS GetAssessmentReportUrlResponse)
-> ReadS [GetAssessmentReportUrlResponse]
-> ReadPrec GetAssessmentReportUrlResponse
-> ReadPrec [GetAssessmentReportUrlResponse]
-> Read 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
(Int -> GetAssessmentReportUrlResponse -> ShowS)
-> (GetAssessmentReportUrlResponse -> String)
-> ([GetAssessmentReportUrlResponse] -> ShowS)
-> Show GetAssessmentReportUrlResponse
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.
 GetAssessmentReportUrlResponse
 -> Rep GetAssessmentReportUrlResponse x)
-> (forall x.
    Rep GetAssessmentReportUrlResponse x
    -> GetAssessmentReportUrlResponse)
-> Generic GetAssessmentReportUrlResponse
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' :: Maybe URL -> Int -> GetAssessmentReportUrlResponse
GetAssessmentReportUrlResponse'
    { $sel:preSignedUrl:GetAssessmentReportUrlResponse' :: Maybe URL
preSignedUrl =
        Maybe URL
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 :: (Maybe URL -> f (Maybe URL))
-> GetAssessmentReportUrlResponse
-> f GetAssessmentReportUrlResponse
getAssessmentReportUrlResponse_preSignedUrl = (GetAssessmentReportUrlResponse -> Maybe URL)
-> (GetAssessmentReportUrlResponse
    -> Maybe URL -> GetAssessmentReportUrlResponse)
-> Lens
     GetAssessmentReportUrlResponse
     GetAssessmentReportUrlResponse
     (Maybe URL)
     (Maybe URL)
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 :: (Int -> f Int)
-> GetAssessmentReportUrlResponse
-> f GetAssessmentReportUrlResponse
getAssessmentReportUrlResponse_httpStatus = (GetAssessmentReportUrlResponse -> Int)
-> (GetAssessmentReportUrlResponse
    -> Int -> GetAssessmentReportUrlResponse)
-> Lens
     GetAssessmentReportUrlResponse
     GetAssessmentReportUrlResponse
     Int
     Int
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