{-# 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.DeleteNamespace
-- 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 a namespace and the users and groups that are associated with
-- the namespace. This is an asynchronous process. Assets including
-- dashboards, analyses, datasets and data sources are not deleted. To
-- delete these assets, you use the API operations for the relevant asset.
module Amazonka.QuickSight.DeleteNamespace
  ( -- * Creating a Request
    DeleteNamespace (..),
    newDeleteNamespace,

    -- * Request Lenses
    deleteNamespace_awsAccountId,
    deleteNamespace_namespace,

    -- * Destructuring the Response
    DeleteNamespaceResponse (..),
    newDeleteNamespaceResponse,

    -- * Response Lenses
    deleteNamespaceResponse_requestId,
    deleteNamespaceResponse_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:/ 'newDeleteNamespace' smart constructor.
data DeleteNamespace = DeleteNamespace'
  { -- | The ID for the Amazon Web Services account that you want to delete the
    -- Amazon QuickSight namespace from.
    DeleteNamespace -> Text
awsAccountId :: Prelude.Text,
    -- | The namespace that you want to delete.
    DeleteNamespace -> Text
namespace :: Prelude.Text
  }
  deriving (DeleteNamespace -> DeleteNamespace -> Bool
(DeleteNamespace -> DeleteNamespace -> Bool)
-> (DeleteNamespace -> DeleteNamespace -> Bool)
-> Eq DeleteNamespace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNamespace -> DeleteNamespace -> Bool
$c/= :: DeleteNamespace -> DeleteNamespace -> Bool
== :: DeleteNamespace -> DeleteNamespace -> Bool
$c== :: DeleteNamespace -> DeleteNamespace -> Bool
Prelude.Eq, ReadPrec [DeleteNamespace]
ReadPrec DeleteNamespace
Int -> ReadS DeleteNamespace
ReadS [DeleteNamespace]
(Int -> ReadS DeleteNamespace)
-> ReadS [DeleteNamespace]
-> ReadPrec DeleteNamespace
-> ReadPrec [DeleteNamespace]
-> Read DeleteNamespace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNamespace]
$creadListPrec :: ReadPrec [DeleteNamespace]
readPrec :: ReadPrec DeleteNamespace
$creadPrec :: ReadPrec DeleteNamespace
readList :: ReadS [DeleteNamespace]
$creadList :: ReadS [DeleteNamespace]
readsPrec :: Int -> ReadS DeleteNamespace
$creadsPrec :: Int -> ReadS DeleteNamespace
Prelude.Read, Int -> DeleteNamespace -> ShowS
[DeleteNamespace] -> ShowS
DeleteNamespace -> String
(Int -> DeleteNamespace -> ShowS)
-> (DeleteNamespace -> String)
-> ([DeleteNamespace] -> ShowS)
-> Show DeleteNamespace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNamespace] -> ShowS
$cshowList :: [DeleteNamespace] -> ShowS
show :: DeleteNamespace -> String
$cshow :: DeleteNamespace -> String
showsPrec :: Int -> DeleteNamespace -> ShowS
$cshowsPrec :: Int -> DeleteNamespace -> ShowS
Prelude.Show, (forall x. DeleteNamespace -> Rep DeleteNamespace x)
-> (forall x. Rep DeleteNamespace x -> DeleteNamespace)
-> Generic DeleteNamespace
forall x. Rep DeleteNamespace x -> DeleteNamespace
forall x. DeleteNamespace -> Rep DeleteNamespace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteNamespace x -> DeleteNamespace
$cfrom :: forall x. DeleteNamespace -> Rep DeleteNamespace x
Prelude.Generic)

-- |
-- Create a value of 'DeleteNamespace' 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', 'deleteNamespace_awsAccountId' - The ID for the Amazon Web Services account that you want to delete the
-- Amazon QuickSight namespace from.
--
-- 'namespace', 'deleteNamespace_namespace' - The namespace that you want to delete.
newDeleteNamespace ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'namespace'
  Prelude.Text ->
  DeleteNamespace
newDeleteNamespace :: Text -> Text -> DeleteNamespace
newDeleteNamespace Text
pAwsAccountId_ Text
pNamespace_ =
  DeleteNamespace' :: Text -> Text -> DeleteNamespace
DeleteNamespace'
    { $sel:awsAccountId:DeleteNamespace' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:namespace:DeleteNamespace' :: Text
namespace = Text
pNamespace_
    }

-- | The ID for the Amazon Web Services account that you want to delete the
-- Amazon QuickSight namespace from.
deleteNamespace_awsAccountId :: Lens.Lens' DeleteNamespace Prelude.Text
deleteNamespace_awsAccountId :: (Text -> f Text) -> DeleteNamespace -> f DeleteNamespace
deleteNamespace_awsAccountId = (DeleteNamespace -> Text)
-> (DeleteNamespace -> Text -> DeleteNamespace)
-> Lens DeleteNamespace DeleteNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespace' {Text
awsAccountId :: Text
$sel:awsAccountId:DeleteNamespace' :: DeleteNamespace -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DeleteNamespace
s@DeleteNamespace' {} Text
a -> DeleteNamespace
s {$sel:awsAccountId:DeleteNamespace' :: Text
awsAccountId = Text
a} :: DeleteNamespace)

-- | The namespace that you want to delete.
deleteNamespace_namespace :: Lens.Lens' DeleteNamespace Prelude.Text
deleteNamespace_namespace :: (Text -> f Text) -> DeleteNamespace -> f DeleteNamespace
deleteNamespace_namespace = (DeleteNamespace -> Text)
-> (DeleteNamespace -> Text -> DeleteNamespace)
-> Lens DeleteNamespace DeleteNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespace' {Text
namespace :: Text
$sel:namespace:DeleteNamespace' :: DeleteNamespace -> Text
namespace} -> Text
namespace) (\s :: DeleteNamespace
s@DeleteNamespace' {} Text
a -> DeleteNamespace
s {$sel:namespace:DeleteNamespace' :: Text
namespace = Text
a} :: DeleteNamespace)

instance Core.AWSRequest DeleteNamespace where
  type
    AWSResponse DeleteNamespace =
      DeleteNamespaceResponse
  request :: DeleteNamespace -> Request DeleteNamespace
request = Service -> DeleteNamespace -> Request DeleteNamespace
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteNamespace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteNamespace)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteNamespace))
-> Logger
-> Service
-> Proxy DeleteNamespace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteNamespace)))
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 -> Int -> DeleteNamespaceResponse
DeleteNamespaceResponse'
            (Maybe Text -> Int -> DeleteNamespaceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteNamespaceResponse)
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 (Int -> DeleteNamespaceResponse)
-> Either String Int -> Either String DeleteNamespaceResponse
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 DeleteNamespace

instance Prelude.NFData DeleteNamespace

instance Core.ToHeaders DeleteNamespace where
  toHeaders :: DeleteNamespace -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteNamespace -> 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 DeleteNamespace where
  toPath :: DeleteNamespace -> ByteString
toPath DeleteNamespace' {Text
namespace :: Text
awsAccountId :: Text
$sel:namespace:DeleteNamespace' :: DeleteNamespace -> Text
$sel:awsAccountId:DeleteNamespace' :: DeleteNamespace -> 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
"/namespaces/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
namespace
      ]

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

-- | /See:/ 'newDeleteNamespaceResponse' smart constructor.
data DeleteNamespaceResponse = DeleteNamespaceResponse'
  { -- | The Amazon Web Services request ID for this operation.
    DeleteNamespaceResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    DeleteNamespaceResponse -> Int
status :: Prelude.Int
  }
  deriving (DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
(DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool)
-> (DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool)
-> Eq DeleteNamespaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
$c/= :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
== :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
$c== :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteNamespaceResponse]
ReadPrec DeleteNamespaceResponse
Int -> ReadS DeleteNamespaceResponse
ReadS [DeleteNamespaceResponse]
(Int -> ReadS DeleteNamespaceResponse)
-> ReadS [DeleteNamespaceResponse]
-> ReadPrec DeleteNamespaceResponse
-> ReadPrec [DeleteNamespaceResponse]
-> Read DeleteNamespaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNamespaceResponse]
$creadListPrec :: ReadPrec [DeleteNamespaceResponse]
readPrec :: ReadPrec DeleteNamespaceResponse
$creadPrec :: ReadPrec DeleteNamespaceResponse
readList :: ReadS [DeleteNamespaceResponse]
$creadList :: ReadS [DeleteNamespaceResponse]
readsPrec :: Int -> ReadS DeleteNamespaceResponse
$creadsPrec :: Int -> ReadS DeleteNamespaceResponse
Prelude.Read, Int -> DeleteNamespaceResponse -> ShowS
[DeleteNamespaceResponse] -> ShowS
DeleteNamespaceResponse -> String
(Int -> DeleteNamespaceResponse -> ShowS)
-> (DeleteNamespaceResponse -> String)
-> ([DeleteNamespaceResponse] -> ShowS)
-> Show DeleteNamespaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNamespaceResponse] -> ShowS
$cshowList :: [DeleteNamespaceResponse] -> ShowS
show :: DeleteNamespaceResponse -> String
$cshow :: DeleteNamespaceResponse -> String
showsPrec :: Int -> DeleteNamespaceResponse -> ShowS
$cshowsPrec :: Int -> DeleteNamespaceResponse -> ShowS
Prelude.Show, (forall x.
 DeleteNamespaceResponse -> Rep DeleteNamespaceResponse x)
-> (forall x.
    Rep DeleteNamespaceResponse x -> DeleteNamespaceResponse)
-> Generic DeleteNamespaceResponse
forall x. Rep DeleteNamespaceResponse x -> DeleteNamespaceResponse
forall x. DeleteNamespaceResponse -> Rep DeleteNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteNamespaceResponse x -> DeleteNamespaceResponse
$cfrom :: forall x. DeleteNamespaceResponse -> Rep DeleteNamespaceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteNamespaceResponse' 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', 'deleteNamespaceResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'status', 'deleteNamespaceResponse_status' - The HTTP status of the request.
newDeleteNamespaceResponse ::
  -- | 'status'
  Prelude.Int ->
  DeleteNamespaceResponse
newDeleteNamespaceResponse :: Int -> DeleteNamespaceResponse
newDeleteNamespaceResponse Int
pStatus_ =
  DeleteNamespaceResponse' :: Maybe Text -> Int -> DeleteNamespaceResponse
DeleteNamespaceResponse'
    { $sel:requestId:DeleteNamespaceResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DeleteNamespaceResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
deleteNamespaceResponse_requestId :: Lens.Lens' DeleteNamespaceResponse (Prelude.Maybe Prelude.Text)
deleteNamespaceResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DeleteNamespaceResponse -> f DeleteNamespaceResponse
deleteNamespaceResponse_requestId = (DeleteNamespaceResponse -> Maybe Text)
-> (DeleteNamespaceResponse
    -> Maybe Text -> DeleteNamespaceResponse)
-> Lens
     DeleteNamespaceResponse
     DeleteNamespaceResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespaceResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DeleteNamespaceResponse' :: DeleteNamespaceResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DeleteNamespaceResponse
s@DeleteNamespaceResponse' {} Maybe Text
a -> DeleteNamespaceResponse
s {$sel:requestId:DeleteNamespaceResponse' :: Maybe Text
requestId = Maybe Text
a} :: DeleteNamespaceResponse)

-- | The HTTP status of the request.
deleteNamespaceResponse_status :: Lens.Lens' DeleteNamespaceResponse Prelude.Int
deleteNamespaceResponse_status :: (Int -> f Int)
-> DeleteNamespaceResponse -> f DeleteNamespaceResponse
deleteNamespaceResponse_status = (DeleteNamespaceResponse -> Int)
-> (DeleteNamespaceResponse -> Int -> DeleteNamespaceResponse)
-> Lens DeleteNamespaceResponse DeleteNamespaceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespaceResponse' {Int
status :: Int
$sel:status:DeleteNamespaceResponse' :: DeleteNamespaceResponse -> Int
status} -> Int
status) (\s :: DeleteNamespaceResponse
s@DeleteNamespaceResponse' {} Int
a -> DeleteNamespaceResponse
s {$sel:status:DeleteNamespaceResponse' :: Int
status = Int
a} :: DeleteNamespaceResponse)

instance Prelude.NFData DeleteNamespaceResponse