{-# 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.Cloud9.DeleteEnvironmentMembership
-- 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 environment member from an Cloud9 development environment.
module Amazonka.Cloud9.DeleteEnvironmentMembership
  ( -- * Creating a Request
    DeleteEnvironmentMembership (..),
    newDeleteEnvironmentMembership,

    -- * Request Lenses
    deleteEnvironmentMembership_environmentId,
    deleteEnvironmentMembership_userArn,

    -- * Destructuring the Response
    DeleteEnvironmentMembershipResponse (..),
    newDeleteEnvironmentMembershipResponse,

    -- * Response Lenses
    deleteEnvironmentMembershipResponse_httpStatus,
  )
where

import Amazonka.Cloud9.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:/ 'newDeleteEnvironmentMembership' smart constructor.
data DeleteEnvironmentMembership = DeleteEnvironmentMembership'
  { -- | The ID of the environment to delete the environment member from.
    DeleteEnvironmentMembership -> Text
environmentId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the environment member to delete from
    -- the environment.
    DeleteEnvironmentMembership -> Text
userArn :: Prelude.Text
  }
  deriving (DeleteEnvironmentMembership -> DeleteEnvironmentMembership -> Bool
(DeleteEnvironmentMembership
 -> DeleteEnvironmentMembership -> Bool)
-> (DeleteEnvironmentMembership
    -> DeleteEnvironmentMembership -> Bool)
-> Eq DeleteEnvironmentMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEnvironmentMembership -> DeleteEnvironmentMembership -> Bool
$c/= :: DeleteEnvironmentMembership -> DeleteEnvironmentMembership -> Bool
== :: DeleteEnvironmentMembership -> DeleteEnvironmentMembership -> Bool
$c== :: DeleteEnvironmentMembership -> DeleteEnvironmentMembership -> Bool
Prelude.Eq, ReadPrec [DeleteEnvironmentMembership]
ReadPrec DeleteEnvironmentMembership
Int -> ReadS DeleteEnvironmentMembership
ReadS [DeleteEnvironmentMembership]
(Int -> ReadS DeleteEnvironmentMembership)
-> ReadS [DeleteEnvironmentMembership]
-> ReadPrec DeleteEnvironmentMembership
-> ReadPrec [DeleteEnvironmentMembership]
-> Read DeleteEnvironmentMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEnvironmentMembership]
$creadListPrec :: ReadPrec [DeleteEnvironmentMembership]
readPrec :: ReadPrec DeleteEnvironmentMembership
$creadPrec :: ReadPrec DeleteEnvironmentMembership
readList :: ReadS [DeleteEnvironmentMembership]
$creadList :: ReadS [DeleteEnvironmentMembership]
readsPrec :: Int -> ReadS DeleteEnvironmentMembership
$creadsPrec :: Int -> ReadS DeleteEnvironmentMembership
Prelude.Read, Int -> DeleteEnvironmentMembership -> ShowS
[DeleteEnvironmentMembership] -> ShowS
DeleteEnvironmentMembership -> String
(Int -> DeleteEnvironmentMembership -> ShowS)
-> (DeleteEnvironmentMembership -> String)
-> ([DeleteEnvironmentMembership] -> ShowS)
-> Show DeleteEnvironmentMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEnvironmentMembership] -> ShowS
$cshowList :: [DeleteEnvironmentMembership] -> ShowS
show :: DeleteEnvironmentMembership -> String
$cshow :: DeleteEnvironmentMembership -> String
showsPrec :: Int -> DeleteEnvironmentMembership -> ShowS
$cshowsPrec :: Int -> DeleteEnvironmentMembership -> ShowS
Prelude.Show, (forall x.
 DeleteEnvironmentMembership -> Rep DeleteEnvironmentMembership x)
-> (forall x.
    Rep DeleteEnvironmentMembership x -> DeleteEnvironmentMembership)
-> Generic DeleteEnvironmentMembership
forall x.
Rep DeleteEnvironmentMembership x -> DeleteEnvironmentMembership
forall x.
DeleteEnvironmentMembership -> Rep DeleteEnvironmentMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEnvironmentMembership x -> DeleteEnvironmentMembership
$cfrom :: forall x.
DeleteEnvironmentMembership -> Rep DeleteEnvironmentMembership x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEnvironmentMembership' 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:
--
-- 'environmentId', 'deleteEnvironmentMembership_environmentId' - The ID of the environment to delete the environment member from.
--
-- 'userArn', 'deleteEnvironmentMembership_userArn' - The Amazon Resource Name (ARN) of the environment member to delete from
-- the environment.
newDeleteEnvironmentMembership ::
  -- | 'environmentId'
  Prelude.Text ->
  -- | 'userArn'
  Prelude.Text ->
  DeleteEnvironmentMembership
newDeleteEnvironmentMembership :: Text -> Text -> DeleteEnvironmentMembership
newDeleteEnvironmentMembership
  Text
pEnvironmentId_
  Text
pUserArn_ =
    DeleteEnvironmentMembership' :: Text -> Text -> DeleteEnvironmentMembership
DeleteEnvironmentMembership'
      { $sel:environmentId:DeleteEnvironmentMembership' :: Text
environmentId =
          Text
pEnvironmentId_,
        $sel:userArn:DeleteEnvironmentMembership' :: Text
userArn = Text
pUserArn_
      }

-- | The ID of the environment to delete the environment member from.
deleteEnvironmentMembership_environmentId :: Lens.Lens' DeleteEnvironmentMembership Prelude.Text
deleteEnvironmentMembership_environmentId :: (Text -> f Text)
-> DeleteEnvironmentMembership -> f DeleteEnvironmentMembership
deleteEnvironmentMembership_environmentId = (DeleteEnvironmentMembership -> Text)
-> (DeleteEnvironmentMembership
    -> Text -> DeleteEnvironmentMembership)
-> Lens
     DeleteEnvironmentMembership DeleteEnvironmentMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEnvironmentMembership' {Text
environmentId :: Text
$sel:environmentId:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
environmentId} -> Text
environmentId) (\s :: DeleteEnvironmentMembership
s@DeleteEnvironmentMembership' {} Text
a -> DeleteEnvironmentMembership
s {$sel:environmentId:DeleteEnvironmentMembership' :: Text
environmentId = Text
a} :: DeleteEnvironmentMembership)

-- | The Amazon Resource Name (ARN) of the environment member to delete from
-- the environment.
deleteEnvironmentMembership_userArn :: Lens.Lens' DeleteEnvironmentMembership Prelude.Text
deleteEnvironmentMembership_userArn :: (Text -> f Text)
-> DeleteEnvironmentMembership -> f DeleteEnvironmentMembership
deleteEnvironmentMembership_userArn = (DeleteEnvironmentMembership -> Text)
-> (DeleteEnvironmentMembership
    -> Text -> DeleteEnvironmentMembership)
-> Lens
     DeleteEnvironmentMembership DeleteEnvironmentMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEnvironmentMembership' {Text
userArn :: Text
$sel:userArn:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
userArn} -> Text
userArn) (\s :: DeleteEnvironmentMembership
s@DeleteEnvironmentMembership' {} Text
a -> DeleteEnvironmentMembership
s {$sel:userArn:DeleteEnvironmentMembership' :: Text
userArn = Text
a} :: DeleteEnvironmentMembership)

instance Core.AWSRequest DeleteEnvironmentMembership where
  type
    AWSResponse DeleteEnvironmentMembership =
      DeleteEnvironmentMembershipResponse
  request :: DeleteEnvironmentMembership -> Request DeleteEnvironmentMembership
request = Service
-> DeleteEnvironmentMembership
-> Request DeleteEnvironmentMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEnvironmentMembership
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEnvironmentMembership)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteEnvironmentMembership))
-> Logger
-> Service
-> Proxy DeleteEnvironmentMembership
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEnvironmentMembership)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteEnvironmentMembershipResponse
DeleteEnvironmentMembershipResponse'
            (Int -> DeleteEnvironmentMembershipResponse)
-> Either String Int
-> Either String DeleteEnvironmentMembershipResponse
forall (f :: * -> *) a b. Functor 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 DeleteEnvironmentMembership

instance Prelude.NFData DeleteEnvironmentMembership

instance Core.ToHeaders DeleteEnvironmentMembership where
  toHeaders :: DeleteEnvironmentMembership -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEnvironmentMembership -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCloud9WorkspaceManagementService.DeleteEnvironmentMembership" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteEnvironmentMembership where
  toJSON :: DeleteEnvironmentMembership -> Value
toJSON DeleteEnvironmentMembership' {Text
userArn :: Text
environmentId :: Text
$sel:userArn:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
$sel:environmentId:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"environmentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
environmentId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"userArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userArn)
          ]
      )

instance Core.ToPath DeleteEnvironmentMembership where
  toPath :: DeleteEnvironmentMembership -> ByteString
toPath = ByteString -> DeleteEnvironmentMembership -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DeleteEnvironmentMembershipResponse' 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:
--
-- 'httpStatus', 'deleteEnvironmentMembershipResponse_httpStatus' - The response's http status code.
newDeleteEnvironmentMembershipResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteEnvironmentMembershipResponse
newDeleteEnvironmentMembershipResponse :: Int -> DeleteEnvironmentMembershipResponse
newDeleteEnvironmentMembershipResponse Int
pHttpStatus_ =
  DeleteEnvironmentMembershipResponse' :: Int -> DeleteEnvironmentMembershipResponse
DeleteEnvironmentMembershipResponse'
    { $sel:httpStatus:DeleteEnvironmentMembershipResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteEnvironmentMembershipResponse