{-# 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.CognitoIdentityProvider.DeleteResourceServer
-- 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 resource server.
module Amazonka.CognitoIdentityProvider.DeleteResourceServer
  ( -- * Creating a Request
    DeleteResourceServer (..),
    newDeleteResourceServer,

    -- * Request Lenses
    deleteResourceServer_userPoolId,
    deleteResourceServer_identifier,

    -- * Destructuring the Response
    DeleteResourceServerResponse (..),
    newDeleteResourceServerResponse,
  )
where

import Amazonka.CognitoIdentityProvider.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:/ 'newDeleteResourceServer' smart constructor.
data DeleteResourceServer = DeleteResourceServer'
  { -- | The user pool ID for the user pool that hosts the resource server.
    DeleteResourceServer -> Text
userPoolId :: Prelude.Text,
    -- | The identifier for the resource server.
    DeleteResourceServer -> Text
identifier :: Prelude.Text
  }
  deriving (DeleteResourceServer -> DeleteResourceServer -> Bool
(DeleteResourceServer -> DeleteResourceServer -> Bool)
-> (DeleteResourceServer -> DeleteResourceServer -> Bool)
-> Eq DeleteResourceServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceServer -> DeleteResourceServer -> Bool
$c/= :: DeleteResourceServer -> DeleteResourceServer -> Bool
== :: DeleteResourceServer -> DeleteResourceServer -> Bool
$c== :: DeleteResourceServer -> DeleteResourceServer -> Bool
Prelude.Eq, ReadPrec [DeleteResourceServer]
ReadPrec DeleteResourceServer
Int -> ReadS DeleteResourceServer
ReadS [DeleteResourceServer]
(Int -> ReadS DeleteResourceServer)
-> ReadS [DeleteResourceServer]
-> ReadPrec DeleteResourceServer
-> ReadPrec [DeleteResourceServer]
-> Read DeleteResourceServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceServer]
$creadListPrec :: ReadPrec [DeleteResourceServer]
readPrec :: ReadPrec DeleteResourceServer
$creadPrec :: ReadPrec DeleteResourceServer
readList :: ReadS [DeleteResourceServer]
$creadList :: ReadS [DeleteResourceServer]
readsPrec :: Int -> ReadS DeleteResourceServer
$creadsPrec :: Int -> ReadS DeleteResourceServer
Prelude.Read, Int -> DeleteResourceServer -> ShowS
[DeleteResourceServer] -> ShowS
DeleteResourceServer -> String
(Int -> DeleteResourceServer -> ShowS)
-> (DeleteResourceServer -> String)
-> ([DeleteResourceServer] -> ShowS)
-> Show DeleteResourceServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceServer] -> ShowS
$cshowList :: [DeleteResourceServer] -> ShowS
show :: DeleteResourceServer -> String
$cshow :: DeleteResourceServer -> String
showsPrec :: Int -> DeleteResourceServer -> ShowS
$cshowsPrec :: Int -> DeleteResourceServer -> ShowS
Prelude.Show, (forall x. DeleteResourceServer -> Rep DeleteResourceServer x)
-> (forall x. Rep DeleteResourceServer x -> DeleteResourceServer)
-> Generic DeleteResourceServer
forall x. Rep DeleteResourceServer x -> DeleteResourceServer
forall x. DeleteResourceServer -> Rep DeleteResourceServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourceServer x -> DeleteResourceServer
$cfrom :: forall x. DeleteResourceServer -> Rep DeleteResourceServer x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourceServer' 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:
--
-- 'userPoolId', 'deleteResourceServer_userPoolId' - The user pool ID for the user pool that hosts the resource server.
--
-- 'identifier', 'deleteResourceServer_identifier' - The identifier for the resource server.
newDeleteResourceServer ::
  -- | 'userPoolId'
  Prelude.Text ->
  -- | 'identifier'
  Prelude.Text ->
  DeleteResourceServer
newDeleteResourceServer :: Text -> Text -> DeleteResourceServer
newDeleteResourceServer Text
pUserPoolId_ Text
pIdentifier_ =
  DeleteResourceServer' :: Text -> Text -> DeleteResourceServer
DeleteResourceServer'
    { $sel:userPoolId:DeleteResourceServer' :: Text
userPoolId = Text
pUserPoolId_,
      $sel:identifier:DeleteResourceServer' :: Text
identifier = Text
pIdentifier_
    }

-- | The user pool ID for the user pool that hosts the resource server.
deleteResourceServer_userPoolId :: Lens.Lens' DeleteResourceServer Prelude.Text
deleteResourceServer_userPoolId :: (Text -> f Text) -> DeleteResourceServer -> f DeleteResourceServer
deleteResourceServer_userPoolId = (DeleteResourceServer -> Text)
-> (DeleteResourceServer -> Text -> DeleteResourceServer)
-> Lens DeleteResourceServer DeleteResourceServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceServer' {Text
userPoolId :: Text
$sel:userPoolId:DeleteResourceServer' :: DeleteResourceServer -> Text
userPoolId} -> Text
userPoolId) (\s :: DeleteResourceServer
s@DeleteResourceServer' {} Text
a -> DeleteResourceServer
s {$sel:userPoolId:DeleteResourceServer' :: Text
userPoolId = Text
a} :: DeleteResourceServer)

-- | The identifier for the resource server.
deleteResourceServer_identifier :: Lens.Lens' DeleteResourceServer Prelude.Text
deleteResourceServer_identifier :: (Text -> f Text) -> DeleteResourceServer -> f DeleteResourceServer
deleteResourceServer_identifier = (DeleteResourceServer -> Text)
-> (DeleteResourceServer -> Text -> DeleteResourceServer)
-> Lens DeleteResourceServer DeleteResourceServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceServer' {Text
identifier :: Text
$sel:identifier:DeleteResourceServer' :: DeleteResourceServer -> Text
identifier} -> Text
identifier) (\s :: DeleteResourceServer
s@DeleteResourceServer' {} Text
a -> DeleteResourceServer
s {$sel:identifier:DeleteResourceServer' :: Text
identifier = Text
a} :: DeleteResourceServer)

instance Core.AWSRequest DeleteResourceServer where
  type
    AWSResponse DeleteResourceServer =
      DeleteResourceServerResponse
  request :: DeleteResourceServer -> Request DeleteResourceServer
request = Service -> DeleteResourceServer -> Request DeleteResourceServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteResourceServer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourceServer)))
response =
    AWSResponse DeleteResourceServer
-> Logger
-> Service
-> Proxy DeleteResourceServer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourceServer)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteResourceServer
DeleteResourceServerResponse
DeleteResourceServerResponse'

instance Prelude.Hashable DeleteResourceServer

instance Prelude.NFData DeleteResourceServer

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

instance Core.ToJSON DeleteResourceServer where
  toJSON :: DeleteResourceServer -> Value
toJSON DeleteResourceServer' {Text
identifier :: Text
userPoolId :: Text
$sel:identifier:DeleteResourceServer' :: DeleteResourceServer -> Text
$sel:userPoolId:DeleteResourceServer' :: DeleteResourceServer -> 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
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identifier)
          ]
      )

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

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

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

-- |
-- Create a value of 'DeleteResourceServerResponse' 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.
newDeleteResourceServerResponse ::
  DeleteResourceServerResponse
newDeleteResourceServerResponse :: DeleteResourceServerResponse
newDeleteResourceServerResponse =
  DeleteResourceServerResponse
DeleteResourceServerResponse'

instance Prelude.NFData DeleteResourceServerResponse