{-# 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.DeleteIdentityProvider
-- 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 identity provider for a user pool.
module Amazonka.CognitoIdentityProvider.DeleteIdentityProvider
  ( -- * Creating a Request
    DeleteIdentityProvider (..),
    newDeleteIdentityProvider,

    -- * Request Lenses
    deleteIdentityProvider_userPoolId,
    deleteIdentityProvider_providerName,

    -- * Destructuring the Response
    DeleteIdentityProviderResponse (..),
    newDeleteIdentityProviderResponse,
  )
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:/ 'newDeleteIdentityProvider' smart constructor.
data DeleteIdentityProvider = DeleteIdentityProvider'
  { -- | The user pool ID.
    DeleteIdentityProvider -> Text
userPoolId :: Prelude.Text,
    -- | The identity provider name.
    DeleteIdentityProvider -> Text
providerName :: Prelude.Text
  }
  deriving (DeleteIdentityProvider -> DeleteIdentityProvider -> Bool
(DeleteIdentityProvider -> DeleteIdentityProvider -> Bool)
-> (DeleteIdentityProvider -> DeleteIdentityProvider -> Bool)
-> Eq DeleteIdentityProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIdentityProvider -> DeleteIdentityProvider -> Bool
$c/= :: DeleteIdentityProvider -> DeleteIdentityProvider -> Bool
== :: DeleteIdentityProvider -> DeleteIdentityProvider -> Bool
$c== :: DeleteIdentityProvider -> DeleteIdentityProvider -> Bool
Prelude.Eq, ReadPrec [DeleteIdentityProvider]
ReadPrec DeleteIdentityProvider
Int -> ReadS DeleteIdentityProvider
ReadS [DeleteIdentityProvider]
(Int -> ReadS DeleteIdentityProvider)
-> ReadS [DeleteIdentityProvider]
-> ReadPrec DeleteIdentityProvider
-> ReadPrec [DeleteIdentityProvider]
-> Read DeleteIdentityProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIdentityProvider]
$creadListPrec :: ReadPrec [DeleteIdentityProvider]
readPrec :: ReadPrec DeleteIdentityProvider
$creadPrec :: ReadPrec DeleteIdentityProvider
readList :: ReadS [DeleteIdentityProvider]
$creadList :: ReadS [DeleteIdentityProvider]
readsPrec :: Int -> ReadS DeleteIdentityProvider
$creadsPrec :: Int -> ReadS DeleteIdentityProvider
Prelude.Read, Int -> DeleteIdentityProvider -> ShowS
[DeleteIdentityProvider] -> ShowS
DeleteIdentityProvider -> String
(Int -> DeleteIdentityProvider -> ShowS)
-> (DeleteIdentityProvider -> String)
-> ([DeleteIdentityProvider] -> ShowS)
-> Show DeleteIdentityProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIdentityProvider] -> ShowS
$cshowList :: [DeleteIdentityProvider] -> ShowS
show :: DeleteIdentityProvider -> String
$cshow :: DeleteIdentityProvider -> String
showsPrec :: Int -> DeleteIdentityProvider -> ShowS
$cshowsPrec :: Int -> DeleteIdentityProvider -> ShowS
Prelude.Show, (forall x. DeleteIdentityProvider -> Rep DeleteIdentityProvider x)
-> (forall x.
    Rep DeleteIdentityProvider x -> DeleteIdentityProvider)
-> Generic DeleteIdentityProvider
forall x. Rep DeleteIdentityProvider x -> DeleteIdentityProvider
forall x. DeleteIdentityProvider -> Rep DeleteIdentityProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIdentityProvider x -> DeleteIdentityProvider
$cfrom :: forall x. DeleteIdentityProvider -> Rep DeleteIdentityProvider x
Prelude.Generic)

-- |
-- Create a value of 'DeleteIdentityProvider' 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', 'deleteIdentityProvider_userPoolId' - The user pool ID.
--
-- 'providerName', 'deleteIdentityProvider_providerName' - The identity provider name.
newDeleteIdentityProvider ::
  -- | 'userPoolId'
  Prelude.Text ->
  -- | 'providerName'
  Prelude.Text ->
  DeleteIdentityProvider
newDeleteIdentityProvider :: Text -> Text -> DeleteIdentityProvider
newDeleteIdentityProvider Text
pUserPoolId_ Text
pProviderName_ =
  DeleteIdentityProvider' :: Text -> Text -> DeleteIdentityProvider
DeleteIdentityProvider'
    { $sel:userPoolId:DeleteIdentityProvider' :: Text
userPoolId = Text
pUserPoolId_,
      $sel:providerName:DeleteIdentityProvider' :: Text
providerName = Text
pProviderName_
    }

-- | The user pool ID.
deleteIdentityProvider_userPoolId :: Lens.Lens' DeleteIdentityProvider Prelude.Text
deleteIdentityProvider_userPoolId :: (Text -> f Text)
-> DeleteIdentityProvider -> f DeleteIdentityProvider
deleteIdentityProvider_userPoolId = (DeleteIdentityProvider -> Text)
-> (DeleteIdentityProvider -> Text -> DeleteIdentityProvider)
-> Lens DeleteIdentityProvider DeleteIdentityProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIdentityProvider' {Text
userPoolId :: Text
$sel:userPoolId:DeleteIdentityProvider' :: DeleteIdentityProvider -> Text
userPoolId} -> Text
userPoolId) (\s :: DeleteIdentityProvider
s@DeleteIdentityProvider' {} Text
a -> DeleteIdentityProvider
s {$sel:userPoolId:DeleteIdentityProvider' :: Text
userPoolId = Text
a} :: DeleteIdentityProvider)

-- | The identity provider name.
deleteIdentityProvider_providerName :: Lens.Lens' DeleteIdentityProvider Prelude.Text
deleteIdentityProvider_providerName :: (Text -> f Text)
-> DeleteIdentityProvider -> f DeleteIdentityProvider
deleteIdentityProvider_providerName = (DeleteIdentityProvider -> Text)
-> (DeleteIdentityProvider -> Text -> DeleteIdentityProvider)
-> Lens DeleteIdentityProvider DeleteIdentityProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIdentityProvider' {Text
providerName :: Text
$sel:providerName:DeleteIdentityProvider' :: DeleteIdentityProvider -> Text
providerName} -> Text
providerName) (\s :: DeleteIdentityProvider
s@DeleteIdentityProvider' {} Text
a -> DeleteIdentityProvider
s {$sel:providerName:DeleteIdentityProvider' :: Text
providerName = Text
a} :: DeleteIdentityProvider)

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

instance Prelude.Hashable DeleteIdentityProvider

instance Prelude.NFData DeleteIdentityProvider

instance Core.ToHeaders DeleteIdentityProvider where
  toHeaders :: DeleteIdentityProvider -> [Header]
toHeaders =
    [Header] -> DeleteIdentityProvider -> [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.DeleteIdentityProvider" ::
                          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 DeleteIdentityProvider where
  toJSON :: DeleteIdentityProvider -> Value
toJSON DeleteIdentityProvider' {Text
providerName :: Text
userPoolId :: Text
$sel:providerName:DeleteIdentityProvider' :: DeleteIdentityProvider -> Text
$sel:userPoolId:DeleteIdentityProvider' :: DeleteIdentityProvider -> 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
"ProviderName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
providerName)
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    DeleteIdentityProviderResponse