{-# 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.DeleteGroupMembership
-- 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)
--
-- Removes a user from a group so that the user is no longer a member of
-- the group.
module Amazonka.QuickSight.DeleteGroupMembership
  ( -- * Creating a Request
    DeleteGroupMembership (..),
    newDeleteGroupMembership,

    -- * Request Lenses
    deleteGroupMembership_memberName,
    deleteGroupMembership_groupName,
    deleteGroupMembership_awsAccountId,
    deleteGroupMembership_namespace,

    -- * Destructuring the Response
    DeleteGroupMembershipResponse (..),
    newDeleteGroupMembershipResponse,

    -- * Response Lenses
    deleteGroupMembershipResponse_requestId,
    deleteGroupMembershipResponse_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:/ 'newDeleteGroupMembership' smart constructor.
data DeleteGroupMembership = DeleteGroupMembership'
  { -- | The name of the user that you want to delete from the group membership.
    DeleteGroupMembership -> Text
memberName :: Prelude.Text,
    -- | The name of the group that you want to delete the user from.
    DeleteGroupMembership -> Text
groupName :: Prelude.Text,
    -- | The ID for the Amazon Web Services account that the group is in.
    -- Currently, you use the ID for the Amazon Web Services account that
    -- contains your Amazon QuickSight account.
    DeleteGroupMembership -> Text
awsAccountId :: Prelude.Text,
    -- | The namespace. Currently, you should set this to @default@.
    DeleteGroupMembership -> Text
namespace :: Prelude.Text
  }
  deriving (DeleteGroupMembership -> DeleteGroupMembership -> Bool
(DeleteGroupMembership -> DeleteGroupMembership -> Bool)
-> (DeleteGroupMembership -> DeleteGroupMembership -> Bool)
-> Eq DeleteGroupMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteGroupMembership -> DeleteGroupMembership -> Bool
$c/= :: DeleteGroupMembership -> DeleteGroupMembership -> Bool
== :: DeleteGroupMembership -> DeleteGroupMembership -> Bool
$c== :: DeleteGroupMembership -> DeleteGroupMembership -> Bool
Prelude.Eq, ReadPrec [DeleteGroupMembership]
ReadPrec DeleteGroupMembership
Int -> ReadS DeleteGroupMembership
ReadS [DeleteGroupMembership]
(Int -> ReadS DeleteGroupMembership)
-> ReadS [DeleteGroupMembership]
-> ReadPrec DeleteGroupMembership
-> ReadPrec [DeleteGroupMembership]
-> Read DeleteGroupMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteGroupMembership]
$creadListPrec :: ReadPrec [DeleteGroupMembership]
readPrec :: ReadPrec DeleteGroupMembership
$creadPrec :: ReadPrec DeleteGroupMembership
readList :: ReadS [DeleteGroupMembership]
$creadList :: ReadS [DeleteGroupMembership]
readsPrec :: Int -> ReadS DeleteGroupMembership
$creadsPrec :: Int -> ReadS DeleteGroupMembership
Prelude.Read, Int -> DeleteGroupMembership -> ShowS
[DeleteGroupMembership] -> ShowS
DeleteGroupMembership -> String
(Int -> DeleteGroupMembership -> ShowS)
-> (DeleteGroupMembership -> String)
-> ([DeleteGroupMembership] -> ShowS)
-> Show DeleteGroupMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteGroupMembership] -> ShowS
$cshowList :: [DeleteGroupMembership] -> ShowS
show :: DeleteGroupMembership -> String
$cshow :: DeleteGroupMembership -> String
showsPrec :: Int -> DeleteGroupMembership -> ShowS
$cshowsPrec :: Int -> DeleteGroupMembership -> ShowS
Prelude.Show, (forall x. DeleteGroupMembership -> Rep DeleteGroupMembership x)
-> (forall x. Rep DeleteGroupMembership x -> DeleteGroupMembership)
-> Generic DeleteGroupMembership
forall x. Rep DeleteGroupMembership x -> DeleteGroupMembership
forall x. DeleteGroupMembership -> Rep DeleteGroupMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteGroupMembership x -> DeleteGroupMembership
$cfrom :: forall x. DeleteGroupMembership -> Rep DeleteGroupMembership x
Prelude.Generic)

-- |
-- Create a value of 'DeleteGroupMembership' 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:
--
-- 'memberName', 'deleteGroupMembership_memberName' - The name of the user that you want to delete from the group membership.
--
-- 'groupName', 'deleteGroupMembership_groupName' - The name of the group that you want to delete the user from.
--
-- 'awsAccountId', 'deleteGroupMembership_awsAccountId' - The ID for the Amazon Web Services account that the group is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
--
-- 'namespace', 'deleteGroupMembership_namespace' - The namespace. Currently, you should set this to @default@.
newDeleteGroupMembership ::
  -- | 'memberName'
  Prelude.Text ->
  -- | 'groupName'
  Prelude.Text ->
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'namespace'
  Prelude.Text ->
  DeleteGroupMembership
newDeleteGroupMembership :: Text -> Text -> Text -> Text -> DeleteGroupMembership
newDeleteGroupMembership
  Text
pMemberName_
  Text
pGroupName_
  Text
pAwsAccountId_
  Text
pNamespace_ =
    DeleteGroupMembership' :: Text -> Text -> Text -> Text -> DeleteGroupMembership
DeleteGroupMembership'
      { $sel:memberName:DeleteGroupMembership' :: Text
memberName = Text
pMemberName_,
        $sel:groupName:DeleteGroupMembership' :: Text
groupName = Text
pGroupName_,
        $sel:awsAccountId:DeleteGroupMembership' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:namespace:DeleteGroupMembership' :: Text
namespace = Text
pNamespace_
      }

-- | The name of the user that you want to delete from the group membership.
deleteGroupMembership_memberName :: Lens.Lens' DeleteGroupMembership Prelude.Text
deleteGroupMembership_memberName :: (Text -> f Text)
-> DeleteGroupMembership -> f DeleteGroupMembership
deleteGroupMembership_memberName = (DeleteGroupMembership -> Text)
-> (DeleteGroupMembership -> Text -> DeleteGroupMembership)
-> Lens DeleteGroupMembership DeleteGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupMembership' {Text
memberName :: Text
$sel:memberName:DeleteGroupMembership' :: DeleteGroupMembership -> Text
memberName} -> Text
memberName) (\s :: DeleteGroupMembership
s@DeleteGroupMembership' {} Text
a -> DeleteGroupMembership
s {$sel:memberName:DeleteGroupMembership' :: Text
memberName = Text
a} :: DeleteGroupMembership)

-- | The name of the group that you want to delete the user from.
deleteGroupMembership_groupName :: Lens.Lens' DeleteGroupMembership Prelude.Text
deleteGroupMembership_groupName :: (Text -> f Text)
-> DeleteGroupMembership -> f DeleteGroupMembership
deleteGroupMembership_groupName = (DeleteGroupMembership -> Text)
-> (DeleteGroupMembership -> Text -> DeleteGroupMembership)
-> Lens DeleteGroupMembership DeleteGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupMembership' {Text
groupName :: Text
$sel:groupName:DeleteGroupMembership' :: DeleteGroupMembership -> Text
groupName} -> Text
groupName) (\s :: DeleteGroupMembership
s@DeleteGroupMembership' {} Text
a -> DeleteGroupMembership
s {$sel:groupName:DeleteGroupMembership' :: Text
groupName = Text
a} :: DeleteGroupMembership)

-- | The ID for the Amazon Web Services account that the group is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
deleteGroupMembership_awsAccountId :: Lens.Lens' DeleteGroupMembership Prelude.Text
deleteGroupMembership_awsAccountId :: (Text -> f Text)
-> DeleteGroupMembership -> f DeleteGroupMembership
deleteGroupMembership_awsAccountId = (DeleteGroupMembership -> Text)
-> (DeleteGroupMembership -> Text -> DeleteGroupMembership)
-> Lens DeleteGroupMembership DeleteGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupMembership' {Text
awsAccountId :: Text
$sel:awsAccountId:DeleteGroupMembership' :: DeleteGroupMembership -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DeleteGroupMembership
s@DeleteGroupMembership' {} Text
a -> DeleteGroupMembership
s {$sel:awsAccountId:DeleteGroupMembership' :: Text
awsAccountId = Text
a} :: DeleteGroupMembership)

-- | The namespace. Currently, you should set this to @default@.
deleteGroupMembership_namespace :: Lens.Lens' DeleteGroupMembership Prelude.Text
deleteGroupMembership_namespace :: (Text -> f Text)
-> DeleteGroupMembership -> f DeleteGroupMembership
deleteGroupMembership_namespace = (DeleteGroupMembership -> Text)
-> (DeleteGroupMembership -> Text -> DeleteGroupMembership)
-> Lens DeleteGroupMembership DeleteGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupMembership' {Text
namespace :: Text
$sel:namespace:DeleteGroupMembership' :: DeleteGroupMembership -> Text
namespace} -> Text
namespace) (\s :: DeleteGroupMembership
s@DeleteGroupMembership' {} Text
a -> DeleteGroupMembership
s {$sel:namespace:DeleteGroupMembership' :: Text
namespace = Text
a} :: DeleteGroupMembership)

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

instance Prelude.NFData DeleteGroupMembership

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

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

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

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

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

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

instance Prelude.NFData DeleteGroupMembershipResponse