{-# 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.GetEvidenceFolder
-- 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 an evidence folder from the specified assessment in Audit
-- Manager.
module Amazonka.AuditManager.GetEvidenceFolder
  ( -- * Creating a Request
    GetEvidenceFolder (..),
    newGetEvidenceFolder,

    -- * Request Lenses
    getEvidenceFolder_assessmentId,
    getEvidenceFolder_controlSetId,
    getEvidenceFolder_evidenceFolderId,

    -- * Destructuring the Response
    GetEvidenceFolderResponse (..),
    newGetEvidenceFolderResponse,

    -- * Response Lenses
    getEvidenceFolderResponse_evidenceFolder,
    getEvidenceFolderResponse_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:/ 'newGetEvidenceFolder' smart constructor.
data GetEvidenceFolder = GetEvidenceFolder'
  { -- | The identifier for the specified assessment.
    GetEvidenceFolder -> Text
assessmentId :: Prelude.Text,
    -- | The identifier for the specified control set.
    GetEvidenceFolder -> Text
controlSetId :: Prelude.Text,
    -- | The identifier for the folder in which the evidence is stored.
    GetEvidenceFolder -> Text
evidenceFolderId :: Prelude.Text
  }
  deriving (GetEvidenceFolder -> GetEvidenceFolder -> Bool
(GetEvidenceFolder -> GetEvidenceFolder -> Bool)
-> (GetEvidenceFolder -> GetEvidenceFolder -> Bool)
-> Eq GetEvidenceFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEvidenceFolder -> GetEvidenceFolder -> Bool
$c/= :: GetEvidenceFolder -> GetEvidenceFolder -> Bool
== :: GetEvidenceFolder -> GetEvidenceFolder -> Bool
$c== :: GetEvidenceFolder -> GetEvidenceFolder -> Bool
Prelude.Eq, ReadPrec [GetEvidenceFolder]
ReadPrec GetEvidenceFolder
Int -> ReadS GetEvidenceFolder
ReadS [GetEvidenceFolder]
(Int -> ReadS GetEvidenceFolder)
-> ReadS [GetEvidenceFolder]
-> ReadPrec GetEvidenceFolder
-> ReadPrec [GetEvidenceFolder]
-> Read GetEvidenceFolder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEvidenceFolder]
$creadListPrec :: ReadPrec [GetEvidenceFolder]
readPrec :: ReadPrec GetEvidenceFolder
$creadPrec :: ReadPrec GetEvidenceFolder
readList :: ReadS [GetEvidenceFolder]
$creadList :: ReadS [GetEvidenceFolder]
readsPrec :: Int -> ReadS GetEvidenceFolder
$creadsPrec :: Int -> ReadS GetEvidenceFolder
Prelude.Read, Int -> GetEvidenceFolder -> ShowS
[GetEvidenceFolder] -> ShowS
GetEvidenceFolder -> String
(Int -> GetEvidenceFolder -> ShowS)
-> (GetEvidenceFolder -> String)
-> ([GetEvidenceFolder] -> ShowS)
-> Show GetEvidenceFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEvidenceFolder] -> ShowS
$cshowList :: [GetEvidenceFolder] -> ShowS
show :: GetEvidenceFolder -> String
$cshow :: GetEvidenceFolder -> String
showsPrec :: Int -> GetEvidenceFolder -> ShowS
$cshowsPrec :: Int -> GetEvidenceFolder -> ShowS
Prelude.Show, (forall x. GetEvidenceFolder -> Rep GetEvidenceFolder x)
-> (forall x. Rep GetEvidenceFolder x -> GetEvidenceFolder)
-> Generic GetEvidenceFolder
forall x. Rep GetEvidenceFolder x -> GetEvidenceFolder
forall x. GetEvidenceFolder -> Rep GetEvidenceFolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEvidenceFolder x -> GetEvidenceFolder
$cfrom :: forall x. GetEvidenceFolder -> Rep GetEvidenceFolder x
Prelude.Generic)

-- |
-- Create a value of 'GetEvidenceFolder' 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:
--
-- 'assessmentId', 'getEvidenceFolder_assessmentId' - The identifier for the specified assessment.
--
-- 'controlSetId', 'getEvidenceFolder_controlSetId' - The identifier for the specified control set.
--
-- 'evidenceFolderId', 'getEvidenceFolder_evidenceFolderId' - The identifier for the folder in which the evidence is stored.
newGetEvidenceFolder ::
  -- | 'assessmentId'
  Prelude.Text ->
  -- | 'controlSetId'
  Prelude.Text ->
  -- | 'evidenceFolderId'
  Prelude.Text ->
  GetEvidenceFolder
newGetEvidenceFolder :: Text -> Text -> Text -> GetEvidenceFolder
newGetEvidenceFolder
  Text
pAssessmentId_
  Text
pControlSetId_
  Text
pEvidenceFolderId_ =
    GetEvidenceFolder' :: Text -> Text -> Text -> GetEvidenceFolder
GetEvidenceFolder'
      { $sel:assessmentId:GetEvidenceFolder' :: Text
assessmentId = Text
pAssessmentId_,
        $sel:controlSetId:GetEvidenceFolder' :: Text
controlSetId = Text
pControlSetId_,
        $sel:evidenceFolderId:GetEvidenceFolder' :: Text
evidenceFolderId = Text
pEvidenceFolderId_
      }

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

-- | The identifier for the specified control set.
getEvidenceFolder_controlSetId :: Lens.Lens' GetEvidenceFolder Prelude.Text
getEvidenceFolder_controlSetId :: (Text -> f Text) -> GetEvidenceFolder -> f GetEvidenceFolder
getEvidenceFolder_controlSetId = (GetEvidenceFolder -> Text)
-> (GetEvidenceFolder -> Text -> GetEvidenceFolder)
-> Lens GetEvidenceFolder GetEvidenceFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEvidenceFolder' {Text
controlSetId :: Text
$sel:controlSetId:GetEvidenceFolder' :: GetEvidenceFolder -> Text
controlSetId} -> Text
controlSetId) (\s :: GetEvidenceFolder
s@GetEvidenceFolder' {} Text
a -> GetEvidenceFolder
s {$sel:controlSetId:GetEvidenceFolder' :: Text
controlSetId = Text
a} :: GetEvidenceFolder)

-- | The identifier for the folder in which the evidence is stored.
getEvidenceFolder_evidenceFolderId :: Lens.Lens' GetEvidenceFolder Prelude.Text
getEvidenceFolder_evidenceFolderId :: (Text -> f Text) -> GetEvidenceFolder -> f GetEvidenceFolder
getEvidenceFolder_evidenceFolderId = (GetEvidenceFolder -> Text)
-> (GetEvidenceFolder -> Text -> GetEvidenceFolder)
-> Lens GetEvidenceFolder GetEvidenceFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEvidenceFolder' {Text
evidenceFolderId :: Text
$sel:evidenceFolderId:GetEvidenceFolder' :: GetEvidenceFolder -> Text
evidenceFolderId} -> Text
evidenceFolderId) (\s :: GetEvidenceFolder
s@GetEvidenceFolder' {} Text
a -> GetEvidenceFolder
s {$sel:evidenceFolderId:GetEvidenceFolder' :: Text
evidenceFolderId = Text
a} :: GetEvidenceFolder)

instance Core.AWSRequest GetEvidenceFolder where
  type
    AWSResponse GetEvidenceFolder =
      GetEvidenceFolderResponse
  request :: GetEvidenceFolder -> Request GetEvidenceFolder
request = Service -> GetEvidenceFolder -> Request GetEvidenceFolder
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetEvidenceFolder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetEvidenceFolder)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetEvidenceFolder))
-> Logger
-> Service
-> Proxy GetEvidenceFolder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetEvidenceFolder)))
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 AssessmentEvidenceFolder -> Int -> GetEvidenceFolderResponse
GetEvidenceFolderResponse'
            (Maybe AssessmentEvidenceFolder
 -> Int -> GetEvidenceFolderResponse)
-> Either String (Maybe AssessmentEvidenceFolder)
-> Either String (Int -> GetEvidenceFolderResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AssessmentEvidenceFolder)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"evidenceFolder")
            Either String (Int -> GetEvidenceFolderResponse)
-> Either String Int -> Either String GetEvidenceFolderResponse
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 GetEvidenceFolder

instance Prelude.NFData GetEvidenceFolder

instance Core.ToHeaders GetEvidenceFolder where
  toHeaders :: GetEvidenceFolder -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetEvidenceFolder -> 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 GetEvidenceFolder where
  toPath :: GetEvidenceFolder -> ByteString
toPath GetEvidenceFolder' {Text
evidenceFolderId :: Text
controlSetId :: Text
assessmentId :: Text
$sel:evidenceFolderId:GetEvidenceFolder' :: GetEvidenceFolder -> Text
$sel:controlSetId:GetEvidenceFolder' :: GetEvidenceFolder -> Text
$sel:assessmentId:GetEvidenceFolder' :: GetEvidenceFolder -> 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
"/controlSets/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
controlSetId,
        ByteString
"/evidenceFolders/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
evidenceFolderId
      ]

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

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

-- |
-- Create a value of 'GetEvidenceFolderResponse' 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:
--
-- 'evidenceFolder', 'getEvidenceFolderResponse_evidenceFolder' - The folder in which evidence is stored.
--
-- 'httpStatus', 'getEvidenceFolderResponse_httpStatus' - The response's http status code.
newGetEvidenceFolderResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetEvidenceFolderResponse
newGetEvidenceFolderResponse :: Int -> GetEvidenceFolderResponse
newGetEvidenceFolderResponse Int
pHttpStatus_ =
  GetEvidenceFolderResponse' :: Maybe AssessmentEvidenceFolder -> Int -> GetEvidenceFolderResponse
GetEvidenceFolderResponse'
    { $sel:evidenceFolder:GetEvidenceFolderResponse' :: Maybe AssessmentEvidenceFolder
evidenceFolder =
        Maybe AssessmentEvidenceFolder
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetEvidenceFolderResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The folder in which evidence is stored.
getEvidenceFolderResponse_evidenceFolder :: Lens.Lens' GetEvidenceFolderResponse (Prelude.Maybe AssessmentEvidenceFolder)
getEvidenceFolderResponse_evidenceFolder :: (Maybe AssessmentEvidenceFolder
 -> f (Maybe AssessmentEvidenceFolder))
-> GetEvidenceFolderResponse -> f GetEvidenceFolderResponse
getEvidenceFolderResponse_evidenceFolder = (GetEvidenceFolderResponse -> Maybe AssessmentEvidenceFolder)
-> (GetEvidenceFolderResponse
    -> Maybe AssessmentEvidenceFolder -> GetEvidenceFolderResponse)
-> Lens
     GetEvidenceFolderResponse
     GetEvidenceFolderResponse
     (Maybe AssessmentEvidenceFolder)
     (Maybe AssessmentEvidenceFolder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEvidenceFolderResponse' {Maybe AssessmentEvidenceFolder
evidenceFolder :: Maybe AssessmentEvidenceFolder
$sel:evidenceFolder:GetEvidenceFolderResponse' :: GetEvidenceFolderResponse -> Maybe AssessmentEvidenceFolder
evidenceFolder} -> Maybe AssessmentEvidenceFolder
evidenceFolder) (\s :: GetEvidenceFolderResponse
s@GetEvidenceFolderResponse' {} Maybe AssessmentEvidenceFolder
a -> GetEvidenceFolderResponse
s {$sel:evidenceFolder:GetEvidenceFolderResponse' :: Maybe AssessmentEvidenceFolder
evidenceFolder = Maybe AssessmentEvidenceFolder
a} :: GetEvidenceFolderResponse)

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

instance Prelude.NFData GetEvidenceFolderResponse