{-# 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.ForgetDevice
-- 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)
--
-- Forgets the specified device.
module Amazonka.CognitoIdentityProvider.ForgetDevice
  ( -- * Creating a Request
    ForgetDevice (..),
    newForgetDevice,

    -- * Request Lenses
    forgetDevice_accessToken,
    forgetDevice_deviceKey,

    -- * Destructuring the Response
    ForgetDeviceResponse (..),
    newForgetDeviceResponse,
  )
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

-- | Represents the request to forget the device.
--
-- /See:/ 'newForgetDevice' smart constructor.
data ForgetDevice = ForgetDevice'
  { -- | The access token for the forgotten device request.
    ForgetDevice -> Maybe (Sensitive Text)
accessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The device key.
    ForgetDevice -> Text
deviceKey :: Prelude.Text
  }
  deriving (ForgetDevice -> ForgetDevice -> Bool
(ForgetDevice -> ForgetDevice -> Bool)
-> (ForgetDevice -> ForgetDevice -> Bool) -> Eq ForgetDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForgetDevice -> ForgetDevice -> Bool
$c/= :: ForgetDevice -> ForgetDevice -> Bool
== :: ForgetDevice -> ForgetDevice -> Bool
$c== :: ForgetDevice -> ForgetDevice -> Bool
Prelude.Eq, Int -> ForgetDevice -> ShowS
[ForgetDevice] -> ShowS
ForgetDevice -> String
(Int -> ForgetDevice -> ShowS)
-> (ForgetDevice -> String)
-> ([ForgetDevice] -> ShowS)
-> Show ForgetDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForgetDevice] -> ShowS
$cshowList :: [ForgetDevice] -> ShowS
show :: ForgetDevice -> String
$cshow :: ForgetDevice -> String
showsPrec :: Int -> ForgetDevice -> ShowS
$cshowsPrec :: Int -> ForgetDevice -> ShowS
Prelude.Show, (forall x. ForgetDevice -> Rep ForgetDevice x)
-> (forall x. Rep ForgetDevice x -> ForgetDevice)
-> Generic ForgetDevice
forall x. Rep ForgetDevice x -> ForgetDevice
forall x. ForgetDevice -> Rep ForgetDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForgetDevice x -> ForgetDevice
$cfrom :: forall x. ForgetDevice -> Rep ForgetDevice x
Prelude.Generic)

-- |
-- Create a value of 'ForgetDevice' 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:
--
-- 'accessToken', 'forgetDevice_accessToken' - The access token for the forgotten device request.
--
-- 'deviceKey', 'forgetDevice_deviceKey' - The device key.
newForgetDevice ::
  -- | 'deviceKey'
  Prelude.Text ->
  ForgetDevice
newForgetDevice :: Text -> ForgetDevice
newForgetDevice Text
pDeviceKey_ =
  ForgetDevice' :: Maybe (Sensitive Text) -> Text -> ForgetDevice
ForgetDevice'
    { $sel:accessToken:ForgetDevice' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceKey:ForgetDevice' :: Text
deviceKey = Text
pDeviceKey_
    }

-- | The access token for the forgotten device request.
forgetDevice_accessToken :: Lens.Lens' ForgetDevice (Prelude.Maybe Prelude.Text)
forgetDevice_accessToken :: (Maybe Text -> f (Maybe Text)) -> ForgetDevice -> f ForgetDevice
forgetDevice_accessToken = (ForgetDevice -> Maybe (Sensitive Text))
-> (ForgetDevice -> Maybe (Sensitive Text) -> ForgetDevice)
-> Lens
     ForgetDevice
     ForgetDevice
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForgetDevice' {Maybe (Sensitive Text)
accessToken :: Maybe (Sensitive Text)
$sel:accessToken:ForgetDevice' :: ForgetDevice -> Maybe (Sensitive Text)
accessToken} -> Maybe (Sensitive Text)
accessToken) (\s :: ForgetDevice
s@ForgetDevice' {} Maybe (Sensitive Text)
a -> ForgetDevice
s {$sel:accessToken:ForgetDevice' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
a} :: ForgetDevice) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ForgetDevice -> f ForgetDevice)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ForgetDevice
-> f ForgetDevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The device key.
forgetDevice_deviceKey :: Lens.Lens' ForgetDevice Prelude.Text
forgetDevice_deviceKey :: (Text -> f Text) -> ForgetDevice -> f ForgetDevice
forgetDevice_deviceKey = (ForgetDevice -> Text)
-> (ForgetDevice -> Text -> ForgetDevice)
-> Lens ForgetDevice ForgetDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForgetDevice' {Text
deviceKey :: Text
$sel:deviceKey:ForgetDevice' :: ForgetDevice -> Text
deviceKey} -> Text
deviceKey) (\s :: ForgetDevice
s@ForgetDevice' {} Text
a -> ForgetDevice
s {$sel:deviceKey:ForgetDevice' :: Text
deviceKey = Text
a} :: ForgetDevice)

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

instance Prelude.Hashable ForgetDevice

instance Prelude.NFData ForgetDevice

instance Core.ToHeaders ForgetDevice where
  toHeaders :: ForgetDevice -> [Header]
toHeaders =
    [Header] -> ForgetDevice -> [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.ForgetDevice" ::
                          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 ForgetDevice where
  toJSON :: ForgetDevice -> Value
toJSON ForgetDevice' {Maybe (Sensitive Text)
Text
deviceKey :: Text
accessToken :: Maybe (Sensitive Text)
$sel:deviceKey:ForgetDevice' :: ForgetDevice -> Text
$sel:accessToken:ForgetDevice' :: ForgetDevice -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AccessToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
accessToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceKey)
          ]
      )

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

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

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

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

instance Prelude.NFData ForgetDeviceResponse