{-# 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.Nimble.DeleteStudioMember
-- 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)
--
-- Delete a user from studio membership.
module Amazonka.Nimble.DeleteStudioMember
  ( -- * Creating a Request
    DeleteStudioMember (..),
    newDeleteStudioMember,

    -- * Request Lenses
    deleteStudioMember_clientToken,
    deleteStudioMember_studioId,
    deleteStudioMember_principalId,

    -- * Destructuring the Response
    DeleteStudioMemberResponse (..),
    newDeleteStudioMemberResponse,

    -- * Response Lenses
    deleteStudioMemberResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteStudioMember' smart constructor.
data DeleteStudioMember = DeleteStudioMember'
  { -- | To make an idempotent API request using one of these actions, specify a
    -- client token in the request. You should not reuse the same client token
    -- for other API requests. If you retry a request that completed
    -- successfully using the same client token and the same parameters, the
    -- retry succeeds without performing any further actions. If you retry a
    -- successful request using the same client token, but one or more of the
    -- parameters are different, the retry fails with a ValidationException
    -- error.
    DeleteStudioMember -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The studio ID.
    DeleteStudioMember -> Text
studioId :: Prelude.Text,
    -- | The principal ID.
    DeleteStudioMember -> Text
principalId :: Prelude.Text
  }
  deriving (DeleteStudioMember -> DeleteStudioMember -> Bool
(DeleteStudioMember -> DeleteStudioMember -> Bool)
-> (DeleteStudioMember -> DeleteStudioMember -> Bool)
-> Eq DeleteStudioMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStudioMember -> DeleteStudioMember -> Bool
$c/= :: DeleteStudioMember -> DeleteStudioMember -> Bool
== :: DeleteStudioMember -> DeleteStudioMember -> Bool
$c== :: DeleteStudioMember -> DeleteStudioMember -> Bool
Prelude.Eq, ReadPrec [DeleteStudioMember]
ReadPrec DeleteStudioMember
Int -> ReadS DeleteStudioMember
ReadS [DeleteStudioMember]
(Int -> ReadS DeleteStudioMember)
-> ReadS [DeleteStudioMember]
-> ReadPrec DeleteStudioMember
-> ReadPrec [DeleteStudioMember]
-> Read DeleteStudioMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStudioMember]
$creadListPrec :: ReadPrec [DeleteStudioMember]
readPrec :: ReadPrec DeleteStudioMember
$creadPrec :: ReadPrec DeleteStudioMember
readList :: ReadS [DeleteStudioMember]
$creadList :: ReadS [DeleteStudioMember]
readsPrec :: Int -> ReadS DeleteStudioMember
$creadsPrec :: Int -> ReadS DeleteStudioMember
Prelude.Read, Int -> DeleteStudioMember -> ShowS
[DeleteStudioMember] -> ShowS
DeleteStudioMember -> String
(Int -> DeleteStudioMember -> ShowS)
-> (DeleteStudioMember -> String)
-> ([DeleteStudioMember] -> ShowS)
-> Show DeleteStudioMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStudioMember] -> ShowS
$cshowList :: [DeleteStudioMember] -> ShowS
show :: DeleteStudioMember -> String
$cshow :: DeleteStudioMember -> String
showsPrec :: Int -> DeleteStudioMember -> ShowS
$cshowsPrec :: Int -> DeleteStudioMember -> ShowS
Prelude.Show, (forall x. DeleteStudioMember -> Rep DeleteStudioMember x)
-> (forall x. Rep DeleteStudioMember x -> DeleteStudioMember)
-> Generic DeleteStudioMember
forall x. Rep DeleteStudioMember x -> DeleteStudioMember
forall x. DeleteStudioMember -> Rep DeleteStudioMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStudioMember x -> DeleteStudioMember
$cfrom :: forall x. DeleteStudioMember -> Rep DeleteStudioMember x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStudioMember' 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:
--
-- 'clientToken', 'deleteStudioMember_clientToken' - To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
--
-- 'studioId', 'deleteStudioMember_studioId' - The studio ID.
--
-- 'principalId', 'deleteStudioMember_principalId' - The principal ID.
newDeleteStudioMember ::
  -- | 'studioId'
  Prelude.Text ->
  -- | 'principalId'
  Prelude.Text ->
  DeleteStudioMember
newDeleteStudioMember :: Text -> Text -> DeleteStudioMember
newDeleteStudioMember Text
pStudioId_ Text
pPrincipalId_ =
  DeleteStudioMember' :: Maybe Text -> Text -> Text -> DeleteStudioMember
DeleteStudioMember'
    { $sel:clientToken:DeleteStudioMember' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:DeleteStudioMember' :: Text
studioId = Text
pStudioId_,
      $sel:principalId:DeleteStudioMember' :: Text
principalId = Text
pPrincipalId_
    }

-- | To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
deleteStudioMember_clientToken :: Lens.Lens' DeleteStudioMember (Prelude.Maybe Prelude.Text)
deleteStudioMember_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteStudioMember -> f DeleteStudioMember
deleteStudioMember_clientToken = (DeleteStudioMember -> Maybe Text)
-> (DeleteStudioMember -> Maybe Text -> DeleteStudioMember)
-> Lens
     DeleteStudioMember DeleteStudioMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioMember' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteStudioMember' :: DeleteStudioMember -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteStudioMember
s@DeleteStudioMember' {} Maybe Text
a -> DeleteStudioMember
s {$sel:clientToken:DeleteStudioMember' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteStudioMember)

-- | The studio ID.
deleteStudioMember_studioId :: Lens.Lens' DeleteStudioMember Prelude.Text
deleteStudioMember_studioId :: (Text -> f Text) -> DeleteStudioMember -> f DeleteStudioMember
deleteStudioMember_studioId = (DeleteStudioMember -> Text)
-> (DeleteStudioMember -> Text -> DeleteStudioMember)
-> Lens DeleteStudioMember DeleteStudioMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioMember' {Text
studioId :: Text
$sel:studioId:DeleteStudioMember' :: DeleteStudioMember -> Text
studioId} -> Text
studioId) (\s :: DeleteStudioMember
s@DeleteStudioMember' {} Text
a -> DeleteStudioMember
s {$sel:studioId:DeleteStudioMember' :: Text
studioId = Text
a} :: DeleteStudioMember)

-- | The principal ID.
deleteStudioMember_principalId :: Lens.Lens' DeleteStudioMember Prelude.Text
deleteStudioMember_principalId :: (Text -> f Text) -> DeleteStudioMember -> f DeleteStudioMember
deleteStudioMember_principalId = (DeleteStudioMember -> Text)
-> (DeleteStudioMember -> Text -> DeleteStudioMember)
-> Lens DeleteStudioMember DeleteStudioMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioMember' {Text
principalId :: Text
$sel:principalId:DeleteStudioMember' :: DeleteStudioMember -> Text
principalId} -> Text
principalId) (\s :: DeleteStudioMember
s@DeleteStudioMember' {} Text
a -> DeleteStudioMember
s {$sel:principalId:DeleteStudioMember' :: Text
principalId = Text
a} :: DeleteStudioMember)

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

instance Prelude.NFData DeleteStudioMember

instance Core.ToHeaders DeleteStudioMember where
  toHeaders :: DeleteStudioMember -> ResponseHeaders
toHeaders DeleteStudioMember' {Maybe Text
Text
principalId :: Text
studioId :: Text
clientToken :: Maybe Text
$sel:principalId:DeleteStudioMember' :: DeleteStudioMember -> Text
$sel:studioId:DeleteStudioMember' :: DeleteStudioMember -> Text
$sel:clientToken:DeleteStudioMember' :: DeleteStudioMember -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amz-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
clientToken,
        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.ToPath DeleteStudioMember where
  toPath :: DeleteStudioMember -> ByteString
toPath DeleteStudioMember' {Maybe Text
Text
principalId :: Text
studioId :: Text
clientToken :: Maybe Text
$sel:principalId:DeleteStudioMember' :: DeleteStudioMember -> Text
$sel:studioId:DeleteStudioMember' :: DeleteStudioMember -> Text
$sel:clientToken:DeleteStudioMember' :: DeleteStudioMember -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-08-01/studios/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioId,
        ByteString
"/membership/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
principalId
      ]

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

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

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

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

instance Prelude.NFData DeleteStudioMemberResponse