{-# 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 #-}
module Amazonka.Chime.ResetPersonalPIN
(
ResetPersonalPIN (..),
newResetPersonalPIN,
resetPersonalPIN_accountId,
resetPersonalPIN_userId,
ResetPersonalPINResponse (..),
newResetPersonalPINResponse,
resetPersonalPINResponse_user,
resetPersonalPINResponse_httpStatus,
)
where
import Amazonka.Chime.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
data ResetPersonalPIN = ResetPersonalPIN'
{
ResetPersonalPIN -> Text
accountId :: Prelude.Text,
ResetPersonalPIN -> Text
userId :: Prelude.Text
}
deriving (ResetPersonalPIN -> ResetPersonalPIN -> Bool
(ResetPersonalPIN -> ResetPersonalPIN -> Bool)
-> (ResetPersonalPIN -> ResetPersonalPIN -> Bool)
-> Eq ResetPersonalPIN
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetPersonalPIN -> ResetPersonalPIN -> Bool
$c/= :: ResetPersonalPIN -> ResetPersonalPIN -> Bool
== :: ResetPersonalPIN -> ResetPersonalPIN -> Bool
$c== :: ResetPersonalPIN -> ResetPersonalPIN -> Bool
Prelude.Eq, ReadPrec [ResetPersonalPIN]
ReadPrec ResetPersonalPIN
Int -> ReadS ResetPersonalPIN
ReadS [ResetPersonalPIN]
(Int -> ReadS ResetPersonalPIN)
-> ReadS [ResetPersonalPIN]
-> ReadPrec ResetPersonalPIN
-> ReadPrec [ResetPersonalPIN]
-> Read ResetPersonalPIN
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetPersonalPIN]
$creadListPrec :: ReadPrec [ResetPersonalPIN]
readPrec :: ReadPrec ResetPersonalPIN
$creadPrec :: ReadPrec ResetPersonalPIN
readList :: ReadS [ResetPersonalPIN]
$creadList :: ReadS [ResetPersonalPIN]
readsPrec :: Int -> ReadS ResetPersonalPIN
$creadsPrec :: Int -> ReadS ResetPersonalPIN
Prelude.Read, Int -> ResetPersonalPIN -> ShowS
[ResetPersonalPIN] -> ShowS
ResetPersonalPIN -> String
(Int -> ResetPersonalPIN -> ShowS)
-> (ResetPersonalPIN -> String)
-> ([ResetPersonalPIN] -> ShowS)
-> Show ResetPersonalPIN
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetPersonalPIN] -> ShowS
$cshowList :: [ResetPersonalPIN] -> ShowS
show :: ResetPersonalPIN -> String
$cshow :: ResetPersonalPIN -> String
showsPrec :: Int -> ResetPersonalPIN -> ShowS
$cshowsPrec :: Int -> ResetPersonalPIN -> ShowS
Prelude.Show, (forall x. ResetPersonalPIN -> Rep ResetPersonalPIN x)
-> (forall x. Rep ResetPersonalPIN x -> ResetPersonalPIN)
-> Generic ResetPersonalPIN
forall x. Rep ResetPersonalPIN x -> ResetPersonalPIN
forall x. ResetPersonalPIN -> Rep ResetPersonalPIN x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetPersonalPIN x -> ResetPersonalPIN
$cfrom :: forall x. ResetPersonalPIN -> Rep ResetPersonalPIN x
Prelude.Generic)
newResetPersonalPIN ::
Prelude.Text ->
Prelude.Text ->
ResetPersonalPIN
newResetPersonalPIN :: Text -> Text -> ResetPersonalPIN
newResetPersonalPIN Text
pAccountId_ Text
pUserId_ =
ResetPersonalPIN' :: Text -> Text -> ResetPersonalPIN
ResetPersonalPIN'
{ $sel:accountId:ResetPersonalPIN' :: Text
accountId = Text
pAccountId_,
$sel:userId:ResetPersonalPIN' :: Text
userId = Text
pUserId_
}
resetPersonalPIN_accountId :: Lens.Lens' ResetPersonalPIN Prelude.Text
resetPersonalPIN_accountId :: (Text -> f Text) -> ResetPersonalPIN -> f ResetPersonalPIN
resetPersonalPIN_accountId = (ResetPersonalPIN -> Text)
-> (ResetPersonalPIN -> Text -> ResetPersonalPIN)
-> Lens ResetPersonalPIN ResetPersonalPIN Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPersonalPIN' {Text
accountId :: Text
$sel:accountId:ResetPersonalPIN' :: ResetPersonalPIN -> Text
accountId} -> Text
accountId) (\s :: ResetPersonalPIN
s@ResetPersonalPIN' {} Text
a -> ResetPersonalPIN
s {$sel:accountId:ResetPersonalPIN' :: Text
accountId = Text
a} :: ResetPersonalPIN)
resetPersonalPIN_userId :: Lens.Lens' ResetPersonalPIN Prelude.Text
resetPersonalPIN_userId :: (Text -> f Text) -> ResetPersonalPIN -> f ResetPersonalPIN
resetPersonalPIN_userId = (ResetPersonalPIN -> Text)
-> (ResetPersonalPIN -> Text -> ResetPersonalPIN)
-> Lens ResetPersonalPIN ResetPersonalPIN Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPersonalPIN' {Text
userId :: Text
$sel:userId:ResetPersonalPIN' :: ResetPersonalPIN -> Text
userId} -> Text
userId) (\s :: ResetPersonalPIN
s@ResetPersonalPIN' {} Text
a -> ResetPersonalPIN
s {$sel:userId:ResetPersonalPIN' :: Text
userId = Text
a} :: ResetPersonalPIN)
instance Core.AWSRequest ResetPersonalPIN where
type
AWSResponse ResetPersonalPIN =
ResetPersonalPINResponse
request :: ResetPersonalPIN -> Request ResetPersonalPIN
request = Service -> ResetPersonalPIN -> Request ResetPersonalPIN
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResetPersonalPIN
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetPersonalPIN)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ResetPersonalPIN))
-> Logger
-> Service
-> Proxy ResetPersonalPIN
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetPersonalPIN)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe User -> Int -> ResetPersonalPINResponse
ResetPersonalPINResponse'
(Maybe User -> Int -> ResetPersonalPINResponse)
-> Either String (Maybe User)
-> Either String (Int -> ResetPersonalPINResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe User)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"User")
Either String (Int -> ResetPersonalPINResponse)
-> Either String Int -> Either String ResetPersonalPINResponse
forall (f :: * -> *) a b. Applicative f => 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 ResetPersonalPIN
instance Prelude.NFData ResetPersonalPIN
instance Core.ToHeaders ResetPersonalPIN where
toHeaders :: ResetPersonalPIN -> ResponseHeaders
toHeaders = ResponseHeaders -> ResetPersonalPIN -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON ResetPersonalPIN where
toJSON :: ResetPersonalPIN -> Value
toJSON = Value -> ResetPersonalPIN -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath ResetPersonalPIN where
toPath :: ResetPersonalPIN -> ByteString
toPath ResetPersonalPIN' {Text
userId :: Text
accountId :: Text
$sel:userId:ResetPersonalPIN' :: ResetPersonalPIN -> Text
$sel:accountId:ResetPersonalPIN' :: ResetPersonalPIN -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
ByteString
"/users/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userId
]
instance Core.ToQuery ResetPersonalPIN where
toQuery :: ResetPersonalPIN -> QueryString
toQuery =
QueryString -> ResetPersonalPIN -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=reset-personal-pin"])
data ResetPersonalPINResponse = ResetPersonalPINResponse'
{
ResetPersonalPINResponse -> Maybe User
user :: Prelude.Maybe User,
ResetPersonalPINResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool
(ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool)
-> (ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool)
-> Eq ResetPersonalPINResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool
$c/= :: ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool
== :: ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool
$c== :: ResetPersonalPINResponse -> ResetPersonalPINResponse -> Bool
Prelude.Eq, Int -> ResetPersonalPINResponse -> ShowS
[ResetPersonalPINResponse] -> ShowS
ResetPersonalPINResponse -> String
(Int -> ResetPersonalPINResponse -> ShowS)
-> (ResetPersonalPINResponse -> String)
-> ([ResetPersonalPINResponse] -> ShowS)
-> Show ResetPersonalPINResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetPersonalPINResponse] -> ShowS
$cshowList :: [ResetPersonalPINResponse] -> ShowS
show :: ResetPersonalPINResponse -> String
$cshow :: ResetPersonalPINResponse -> String
showsPrec :: Int -> ResetPersonalPINResponse -> ShowS
$cshowsPrec :: Int -> ResetPersonalPINResponse -> ShowS
Prelude.Show, (forall x.
ResetPersonalPINResponse -> Rep ResetPersonalPINResponse x)
-> (forall x.
Rep ResetPersonalPINResponse x -> ResetPersonalPINResponse)
-> Generic ResetPersonalPINResponse
forall x.
Rep ResetPersonalPINResponse x -> ResetPersonalPINResponse
forall x.
ResetPersonalPINResponse -> Rep ResetPersonalPINResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResetPersonalPINResponse x -> ResetPersonalPINResponse
$cfrom :: forall x.
ResetPersonalPINResponse -> Rep ResetPersonalPINResponse x
Prelude.Generic)
newResetPersonalPINResponse ::
Prelude.Int ->
ResetPersonalPINResponse
newResetPersonalPINResponse :: Int -> ResetPersonalPINResponse
newResetPersonalPINResponse Int
pHttpStatus_ =
ResetPersonalPINResponse' :: Maybe User -> Int -> ResetPersonalPINResponse
ResetPersonalPINResponse'
{ $sel:user:ResetPersonalPINResponse' :: Maybe User
user = Maybe User
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResetPersonalPINResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resetPersonalPINResponse_user :: Lens.Lens' ResetPersonalPINResponse (Prelude.Maybe User)
resetPersonalPINResponse_user :: (Maybe User -> f (Maybe User))
-> ResetPersonalPINResponse -> f ResetPersonalPINResponse
resetPersonalPINResponse_user = (ResetPersonalPINResponse -> Maybe User)
-> (ResetPersonalPINResponse
-> Maybe User -> ResetPersonalPINResponse)
-> Lens
ResetPersonalPINResponse
ResetPersonalPINResponse
(Maybe User)
(Maybe User)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPersonalPINResponse' {Maybe User
user :: Maybe User
$sel:user:ResetPersonalPINResponse' :: ResetPersonalPINResponse -> Maybe User
user} -> Maybe User
user) (\s :: ResetPersonalPINResponse
s@ResetPersonalPINResponse' {} Maybe User
a -> ResetPersonalPINResponse
s {$sel:user:ResetPersonalPINResponse' :: Maybe User
user = Maybe User
a} :: ResetPersonalPINResponse)
resetPersonalPINResponse_httpStatus :: Lens.Lens' ResetPersonalPINResponse Prelude.Int
resetPersonalPINResponse_httpStatus :: (Int -> f Int)
-> ResetPersonalPINResponse -> f ResetPersonalPINResponse
resetPersonalPINResponse_httpStatus = (ResetPersonalPINResponse -> Int)
-> (ResetPersonalPINResponse -> Int -> ResetPersonalPINResponse)
-> Lens ResetPersonalPINResponse ResetPersonalPINResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPersonalPINResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResetPersonalPINResponse' :: ResetPersonalPINResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResetPersonalPINResponse
s@ResetPersonalPINResponse' {} Int
a -> ResetPersonalPINResponse
s {$sel:httpStatus:ResetPersonalPINResponse' :: Int
httpStatus = Int
a} :: ResetPersonalPINResponse)
instance Prelude.NFData ResetPersonalPINResponse