{-# 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.DeleteFolder
-- 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)
--
-- Deletes an empty folder.
module Amazonka.QuickSight.DeleteFolder
  ( -- * Creating a Request
    DeleteFolder (..),
    newDeleteFolder,

    -- * Request Lenses
    deleteFolder_awsAccountId,
    deleteFolder_folderId,

    -- * Destructuring the Response
    DeleteFolderResponse (..),
    newDeleteFolderResponse,

    -- * Response Lenses
    deleteFolderResponse_requestId,
    deleteFolderResponse_arn,
    deleteFolderResponse_folderId,
    deleteFolderResponse_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:/ 'newDeleteFolder' smart constructor.
data DeleteFolder = DeleteFolder'
  { -- | The AWS Account ID for the folder.
    DeleteFolder -> Text
awsAccountId :: Prelude.Text,
    -- | The folder ID.
    DeleteFolder -> Text
folderId :: Prelude.Text
  }
  deriving (DeleteFolder -> DeleteFolder -> Bool
(DeleteFolder -> DeleteFolder -> Bool)
-> (DeleteFolder -> DeleteFolder -> Bool) -> Eq DeleteFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFolder -> DeleteFolder -> Bool
$c/= :: DeleteFolder -> DeleteFolder -> Bool
== :: DeleteFolder -> DeleteFolder -> Bool
$c== :: DeleteFolder -> DeleteFolder -> Bool
Prelude.Eq, ReadPrec [DeleteFolder]
ReadPrec DeleteFolder
Int -> ReadS DeleteFolder
ReadS [DeleteFolder]
(Int -> ReadS DeleteFolder)
-> ReadS [DeleteFolder]
-> ReadPrec DeleteFolder
-> ReadPrec [DeleteFolder]
-> Read DeleteFolder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFolder]
$creadListPrec :: ReadPrec [DeleteFolder]
readPrec :: ReadPrec DeleteFolder
$creadPrec :: ReadPrec DeleteFolder
readList :: ReadS [DeleteFolder]
$creadList :: ReadS [DeleteFolder]
readsPrec :: Int -> ReadS DeleteFolder
$creadsPrec :: Int -> ReadS DeleteFolder
Prelude.Read, Int -> DeleteFolder -> ShowS
[DeleteFolder] -> ShowS
DeleteFolder -> String
(Int -> DeleteFolder -> ShowS)
-> (DeleteFolder -> String)
-> ([DeleteFolder] -> ShowS)
-> Show DeleteFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFolder] -> ShowS
$cshowList :: [DeleteFolder] -> ShowS
show :: DeleteFolder -> String
$cshow :: DeleteFolder -> String
showsPrec :: Int -> DeleteFolder -> ShowS
$cshowsPrec :: Int -> DeleteFolder -> ShowS
Prelude.Show, (forall x. DeleteFolder -> Rep DeleteFolder x)
-> (forall x. Rep DeleteFolder x -> DeleteFolder)
-> Generic DeleteFolder
forall x. Rep DeleteFolder x -> DeleteFolder
forall x. DeleteFolder -> Rep DeleteFolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFolder x -> DeleteFolder
$cfrom :: forall x. DeleteFolder -> Rep DeleteFolder x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFolder' 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', 'deleteFolder_awsAccountId' - The AWS Account ID for the folder.
--
-- 'folderId', 'deleteFolder_folderId' - The folder ID.
newDeleteFolder ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'folderId'
  Prelude.Text ->
  DeleteFolder
newDeleteFolder :: Text -> Text -> DeleteFolder
newDeleteFolder Text
pAwsAccountId_ Text
pFolderId_ =
  DeleteFolder' :: Text -> Text -> DeleteFolder
DeleteFolder'
    { $sel:awsAccountId:DeleteFolder' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:folderId:DeleteFolder' :: Text
folderId = Text
pFolderId_
    }

-- | The AWS Account ID for the folder.
deleteFolder_awsAccountId :: Lens.Lens' DeleteFolder Prelude.Text
deleteFolder_awsAccountId :: (Text -> f Text) -> DeleteFolder -> f DeleteFolder
deleteFolder_awsAccountId = (DeleteFolder -> Text)
-> (DeleteFolder -> Text -> DeleteFolder)
-> Lens DeleteFolder DeleteFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFolder' {Text
awsAccountId :: Text
$sel:awsAccountId:DeleteFolder' :: DeleteFolder -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DeleteFolder
s@DeleteFolder' {} Text
a -> DeleteFolder
s {$sel:awsAccountId:DeleteFolder' :: Text
awsAccountId = Text
a} :: DeleteFolder)

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

instance Core.AWSRequest DeleteFolder where
  type AWSResponse DeleteFolder = DeleteFolderResponse
  request :: DeleteFolder -> Request DeleteFolder
request = Service -> DeleteFolder -> Request DeleteFolder
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFolder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFolder)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteFolder))
-> Logger
-> Service
-> Proxy DeleteFolder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFolder)))
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 Text -> Maybe Text -> Int -> DeleteFolderResponse
DeleteFolderResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> DeleteFolderResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> DeleteFolderResponse)
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 Text -> Maybe Text -> Int -> DeleteFolderResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeleteFolderResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Arn")
            Either String (Maybe Text -> Int -> DeleteFolderResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteFolderResponse)
forall (f :: * -> *) a b. Applicative f => 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
"FolderId")
            Either String (Int -> DeleteFolderResponse)
-> Either String Int -> Either String DeleteFolderResponse
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 DeleteFolder

instance Prelude.NFData DeleteFolder

instance Core.ToHeaders DeleteFolder where
  toHeaders :: DeleteFolder -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteFolder -> 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 DeleteFolder where
  toPath :: DeleteFolder -> ByteString
toPath DeleteFolder' {Text
folderId :: Text
awsAccountId :: Text
$sel:folderId:DeleteFolder' :: DeleteFolder -> Text
$sel:awsAccountId:DeleteFolder' :: DeleteFolder -> 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 DeleteFolder where
  toQuery :: DeleteFolder -> QueryString
toQuery = QueryString -> DeleteFolder -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'DeleteFolderResponse' 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', 'deleteFolderResponse_requestId' - The request ID.
--
-- 'arn', 'deleteFolderResponse_arn' - The Amazon Resource Name of the deleted folder.
--
-- 'folderId', 'deleteFolderResponse_folderId' - The folder ID.
--
-- 'status', 'deleteFolderResponse_status' - The status of deleting the folder. If succeeded, the status is
-- @SC_OK (200)@.
newDeleteFolderResponse ::
  -- | 'status'
  Prelude.Int ->
  DeleteFolderResponse
newDeleteFolderResponse :: Int -> DeleteFolderResponse
newDeleteFolderResponse Int
pStatus_ =
  DeleteFolderResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DeleteFolderResponse
DeleteFolderResponse'
    { $sel:requestId:DeleteFolderResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DeleteFolderResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:folderId:DeleteFolderResponse' :: Maybe Text
folderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DeleteFolderResponse' :: Int
status = Int
pStatus_
    }

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

-- | The Amazon Resource Name of the deleted folder.
deleteFolderResponse_arn :: Lens.Lens' DeleteFolderResponse (Prelude.Maybe Prelude.Text)
deleteFolderResponse_arn :: (Maybe Text -> f (Maybe Text))
-> DeleteFolderResponse -> f DeleteFolderResponse
deleteFolderResponse_arn = (DeleteFolderResponse -> Maybe Text)
-> (DeleteFolderResponse -> Maybe Text -> DeleteFolderResponse)
-> Lens
     DeleteFolderResponse DeleteFolderResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFolderResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DeleteFolderResponse' :: DeleteFolderResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeleteFolderResponse
s@DeleteFolderResponse' {} Maybe Text
a -> DeleteFolderResponse
s {$sel:arn:DeleteFolderResponse' :: Maybe Text
arn = Maybe Text
a} :: DeleteFolderResponse)

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

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

instance Prelude.NFData DeleteFolderResponse