{-# 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.QuickSight.DescribeFolder
-- 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)
--
-- Describes a folder.
module Amazonka.QuickSight.DescribeFolder
  ( -- * Creating a Request
    DescribeFolder (..),
    newDescribeFolder,

    -- * Request Lenses
    describeFolder_awsAccountId,
    describeFolder_folderId,

    -- * Destructuring the Response
    DescribeFolderResponse (..),
    newDescribeFolderResponse,

    -- * Response Lenses
    describeFolderResponse_requestId,
    describeFolderResponse_folder,
    describeFolderResponse_status,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeFolder' smart constructor.
data DescribeFolder = DescribeFolder'
  { -- | The AWS account ID.
    DescribeFolder -> Text
awsAccountId :: Prelude.Text,
    -- | The folder ID.
    DescribeFolder -> Text
folderId :: Prelude.Text
  }
  deriving (DescribeFolder -> DescribeFolder -> Bool
(DescribeFolder -> DescribeFolder -> Bool)
-> (DescribeFolder -> DescribeFolder -> Bool) -> Eq DescribeFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFolder -> DescribeFolder -> Bool
$c/= :: DescribeFolder -> DescribeFolder -> Bool
== :: DescribeFolder -> DescribeFolder -> Bool
$c== :: DescribeFolder -> DescribeFolder -> Bool
Prelude.Eq, ReadPrec [DescribeFolder]
ReadPrec DescribeFolder
Int -> ReadS DescribeFolder
ReadS [DescribeFolder]
(Int -> ReadS DescribeFolder)
-> ReadS [DescribeFolder]
-> ReadPrec DescribeFolder
-> ReadPrec [DescribeFolder]
-> Read DescribeFolder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFolder]
$creadListPrec :: ReadPrec [DescribeFolder]
readPrec :: ReadPrec DescribeFolder
$creadPrec :: ReadPrec DescribeFolder
readList :: ReadS [DescribeFolder]
$creadList :: ReadS [DescribeFolder]
readsPrec :: Int -> ReadS DescribeFolder
$creadsPrec :: Int -> ReadS DescribeFolder
Prelude.Read, Int -> DescribeFolder -> ShowS
[DescribeFolder] -> ShowS
DescribeFolder -> String
(Int -> DescribeFolder -> ShowS)
-> (DescribeFolder -> String)
-> ([DescribeFolder] -> ShowS)
-> Show DescribeFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFolder] -> ShowS
$cshowList :: [DescribeFolder] -> ShowS
show :: DescribeFolder -> String
$cshow :: DescribeFolder -> String
showsPrec :: Int -> DescribeFolder -> ShowS
$cshowsPrec :: Int -> DescribeFolder -> ShowS
Prelude.Show, (forall x. DescribeFolder -> Rep DescribeFolder x)
-> (forall x. Rep DescribeFolder x -> DescribeFolder)
-> Generic DescribeFolder
forall x. Rep DescribeFolder x -> DescribeFolder
forall x. DescribeFolder -> Rep DescribeFolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFolder x -> DescribeFolder
$cfrom :: forall x. DescribeFolder -> Rep DescribeFolder x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFolder' 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:
--
-- 'awsAccountId', 'describeFolder_awsAccountId' - The AWS account ID.
--
-- 'folderId', 'describeFolder_folderId' - The folder ID.
newDescribeFolder ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'folderId'
  Prelude.Text ->
  DescribeFolder
newDescribeFolder :: Text -> Text -> DescribeFolder
newDescribeFolder Text
pAwsAccountId_ Text
pFolderId_ =
  DescribeFolder' :: Text -> Text -> DescribeFolder
DescribeFolder'
    { $sel:awsAccountId:DescribeFolder' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:folderId:DescribeFolder' :: Text
folderId = Text
pFolderId_
    }

-- | The AWS account ID.
describeFolder_awsAccountId :: Lens.Lens' DescribeFolder Prelude.Text
describeFolder_awsAccountId :: (Text -> f Text) -> DescribeFolder -> f DescribeFolder
describeFolder_awsAccountId = (DescribeFolder -> Text)
-> (DescribeFolder -> Text -> DescribeFolder)
-> Lens DescribeFolder DescribeFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFolder' {Text
awsAccountId :: Text
$sel:awsAccountId:DescribeFolder' :: DescribeFolder -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DescribeFolder
s@DescribeFolder' {} Text
a -> DescribeFolder
s {$sel:awsAccountId:DescribeFolder' :: Text
awsAccountId = Text
a} :: DescribeFolder)

-- | The folder ID.
describeFolder_folderId :: Lens.Lens' DescribeFolder Prelude.Text
describeFolder_folderId :: (Text -> f Text) -> DescribeFolder -> f DescribeFolder
describeFolder_folderId = (DescribeFolder -> Text)
-> (DescribeFolder -> Text -> DescribeFolder)
-> Lens DescribeFolder DescribeFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFolder' {Text
folderId :: Text
$sel:folderId:DescribeFolder' :: DescribeFolder -> Text
folderId} -> Text
folderId) (\s :: DescribeFolder
s@DescribeFolder' {} Text
a -> DescribeFolder
s {$sel:folderId:DescribeFolder' :: Text
folderId = Text
a} :: DescribeFolder)

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

instance Prelude.NFData DescribeFolder

instance Core.ToHeaders DescribeFolder where
  toHeaders :: DescribeFolder -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeFolder -> 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.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeFolder where
  toPath :: DescribeFolder -> ByteString
toPath DescribeFolder' {Text
folderId :: Text
awsAccountId :: Text
$sel:folderId:DescribeFolder' :: DescribeFolder -> Text
$sel:awsAccountId:DescribeFolder' :: DescribeFolder -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
        ByteString
"/folders/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
folderId
      ]

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

-- | /See:/ 'newDescribeFolderResponse' smart constructor.
data DescribeFolderResponse = DescribeFolderResponse'
  { -- | The request ID.
    DescribeFolderResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | Information about the folder.
    DescribeFolderResponse -> Maybe Folder
folder :: Prelude.Maybe Folder,
    -- | The status. If succeeded, the status is @SC_OK (200)@.
    DescribeFolderResponse -> Int
status :: Prelude.Int
  }
  deriving (DescribeFolderResponse -> DescribeFolderResponse -> Bool
(DescribeFolderResponse -> DescribeFolderResponse -> Bool)
-> (DescribeFolderResponse -> DescribeFolderResponse -> Bool)
-> Eq DescribeFolderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFolderResponse -> DescribeFolderResponse -> Bool
$c/= :: DescribeFolderResponse -> DescribeFolderResponse -> Bool
== :: DescribeFolderResponse -> DescribeFolderResponse -> Bool
$c== :: DescribeFolderResponse -> DescribeFolderResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFolderResponse]
ReadPrec DescribeFolderResponse
Int -> ReadS DescribeFolderResponse
ReadS [DescribeFolderResponse]
(Int -> ReadS DescribeFolderResponse)
-> ReadS [DescribeFolderResponse]
-> ReadPrec DescribeFolderResponse
-> ReadPrec [DescribeFolderResponse]
-> Read DescribeFolderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFolderResponse]
$creadListPrec :: ReadPrec [DescribeFolderResponse]
readPrec :: ReadPrec DescribeFolderResponse
$creadPrec :: ReadPrec DescribeFolderResponse
readList :: ReadS [DescribeFolderResponse]
$creadList :: ReadS [DescribeFolderResponse]
readsPrec :: Int -> ReadS DescribeFolderResponse
$creadsPrec :: Int -> ReadS DescribeFolderResponse
Prelude.Read, Int -> DescribeFolderResponse -> ShowS
[DescribeFolderResponse] -> ShowS
DescribeFolderResponse -> String
(Int -> DescribeFolderResponse -> ShowS)
-> (DescribeFolderResponse -> String)
-> ([DescribeFolderResponse] -> ShowS)
-> Show DescribeFolderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFolderResponse] -> ShowS
$cshowList :: [DescribeFolderResponse] -> ShowS
show :: DescribeFolderResponse -> String
$cshow :: DescribeFolderResponse -> String
showsPrec :: Int -> DescribeFolderResponse -> ShowS
$cshowsPrec :: Int -> DescribeFolderResponse -> ShowS
Prelude.Show, (forall x. DescribeFolderResponse -> Rep DescribeFolderResponse x)
-> (forall x.
    Rep DescribeFolderResponse x -> DescribeFolderResponse)
-> Generic DescribeFolderResponse
forall x. Rep DescribeFolderResponse x -> DescribeFolderResponse
forall x. DescribeFolderResponse -> Rep DescribeFolderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFolderResponse x -> DescribeFolderResponse
$cfrom :: forall x. DescribeFolderResponse -> Rep DescribeFolderResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFolderResponse' 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:
--
-- 'requestId', 'describeFolderResponse_requestId' - The request ID.
--
-- 'folder', 'describeFolderResponse_folder' - Information about the folder.
--
-- 'status', 'describeFolderResponse_status' - The status. If succeeded, the status is @SC_OK (200)@.
newDescribeFolderResponse ::
  -- | 'status'
  Prelude.Int ->
  DescribeFolderResponse
newDescribeFolderResponse :: Int -> DescribeFolderResponse
newDescribeFolderResponse Int
pStatus_ =
  DescribeFolderResponse' :: Maybe Text -> Maybe Folder -> Int -> DescribeFolderResponse
DescribeFolderResponse'
    { $sel:requestId:DescribeFolderResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:folder:DescribeFolderResponse' :: Maybe Folder
folder = Maybe Folder
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DescribeFolderResponse' :: Int
status = Int
pStatus_
    }

-- | The request ID.
describeFolderResponse_requestId :: Lens.Lens' DescribeFolderResponse (Prelude.Maybe Prelude.Text)
describeFolderResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DescribeFolderResponse -> f DescribeFolderResponse
describeFolderResponse_requestId = (DescribeFolderResponse -> Maybe Text)
-> (DescribeFolderResponse -> Maybe Text -> DescribeFolderResponse)
-> Lens
     DescribeFolderResponse
     DescribeFolderResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFolderResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DescribeFolderResponse' :: DescribeFolderResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DescribeFolderResponse
s@DescribeFolderResponse' {} Maybe Text
a -> DescribeFolderResponse
s {$sel:requestId:DescribeFolderResponse' :: Maybe Text
requestId = Maybe Text
a} :: DescribeFolderResponse)

-- | Information about the folder.
describeFolderResponse_folder :: Lens.Lens' DescribeFolderResponse (Prelude.Maybe Folder)
describeFolderResponse_folder :: (Maybe Folder -> f (Maybe Folder))
-> DescribeFolderResponse -> f DescribeFolderResponse
describeFolderResponse_folder = (DescribeFolderResponse -> Maybe Folder)
-> (DescribeFolderResponse
    -> Maybe Folder -> DescribeFolderResponse)
-> Lens
     DescribeFolderResponse
     DescribeFolderResponse
     (Maybe Folder)
     (Maybe Folder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFolderResponse' {Maybe Folder
folder :: Maybe Folder
$sel:folder:DescribeFolderResponse' :: DescribeFolderResponse -> Maybe Folder
folder} -> Maybe Folder
folder) (\s :: DescribeFolderResponse
s@DescribeFolderResponse' {} Maybe Folder
a -> DescribeFolderResponse
s {$sel:folder:DescribeFolderResponse' :: Maybe Folder
folder = Maybe Folder
a} :: DescribeFolderResponse)

-- | The status. If succeeded, the status is @SC_OK (200)@.
describeFolderResponse_status :: Lens.Lens' DescribeFolderResponse Prelude.Int
describeFolderResponse_status :: (Int -> f Int)
-> DescribeFolderResponse -> f DescribeFolderResponse
describeFolderResponse_status = (DescribeFolderResponse -> Int)
-> (DescribeFolderResponse -> Int -> DescribeFolderResponse)
-> Lens DescribeFolderResponse DescribeFolderResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFolderResponse' {Int
status :: Int
$sel:status:DescribeFolderResponse' :: DescribeFolderResponse -> Int
status} -> Int
status) (\s :: DescribeFolderResponse
s@DescribeFolderResponse' {} Int
a -> DescribeFolderResponse
s {$sel:status:DescribeFolderResponse' :: Int
status = Int
a} :: DescribeFolderResponse)

instance Prelude.NFData DescribeFolderResponse