{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an environment member from a 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $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 :: Lens' DeleteEnvironmentMembership Text
deleteEnvironmentMembership_environmentId = 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 :: Lens' DeleteEnvironmentMembership Text
deleteEnvironmentMembership_userArn = 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 :: (Service -> Service)
-> DeleteEnvironmentMembership
-> Request DeleteEnvironmentMembership
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteEnvironmentMembership
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEnvironmentMembership)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteEnvironmentMembershipResponse
DeleteEnvironmentMembershipResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteEnvironmentMembership where
  hashWithSalt :: Int -> DeleteEnvironmentMembership -> Int
hashWithSalt Int
_salt DeleteEnvironmentMembership' {Text
userArn :: Text
environmentId :: Text
$sel:userArn:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
$sel:environmentId:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userArn

instance Prelude.NFData DeleteEnvironmentMembership where
  rnf :: DeleteEnvironmentMembership -> ()
rnf DeleteEnvironmentMembership' {Text
userArn :: Text
environmentId :: Text
$sel:userArn:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
$sel:environmentId:DeleteEnvironmentMembership' :: DeleteEnvironmentMembership -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
environmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userArn

instance Data.ToHeaders DeleteEnvironmentMembership where
  toHeaders :: DeleteEnvironmentMembership -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSCloud9WorkspaceManagementService.DeleteEnvironmentMembership" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"environmentId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
environmentId),
            forall a. a -> Maybe a
Prelude.Just (Key
"userArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userArn)
          ]
      )

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

instance Data.ToQuery DeleteEnvironmentMembership where
  toQuery :: DeleteEnvironmentMembership -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DeleteEnvironmentMembershipResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteEnvironmentMembershipResponse_httpStatus :: Lens.Lens' DeleteEnvironmentMembershipResponse Prelude.Int
deleteEnvironmentMembershipResponse_httpStatus :: Lens' DeleteEnvironmentMembershipResponse Int
deleteEnvironmentMembershipResponse_httpStatus = 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
  where
  rnf :: DeleteEnvironmentMembershipResponse -> ()
rnf DeleteEnvironmentMembershipResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteEnvironmentMembershipResponse' :: DeleteEnvironmentMembershipResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus