{-# 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.RegenerateSecurityToken
(
RegenerateSecurityToken (..),
newRegenerateSecurityToken,
regenerateSecurityToken_accountId,
regenerateSecurityToken_botId,
RegenerateSecurityTokenResponse (..),
newRegenerateSecurityTokenResponse,
regenerateSecurityTokenResponse_bot,
regenerateSecurityTokenResponse_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 RegenerateSecurityToken = RegenerateSecurityToken'
{
RegenerateSecurityToken -> Text
accountId :: Prelude.Text,
RegenerateSecurityToken -> Text
botId :: Prelude.Text
}
deriving (RegenerateSecurityToken -> RegenerateSecurityToken -> Bool
(RegenerateSecurityToken -> RegenerateSecurityToken -> Bool)
-> (RegenerateSecurityToken -> RegenerateSecurityToken -> Bool)
-> Eq RegenerateSecurityToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegenerateSecurityToken -> RegenerateSecurityToken -> Bool
$c/= :: RegenerateSecurityToken -> RegenerateSecurityToken -> Bool
== :: RegenerateSecurityToken -> RegenerateSecurityToken -> Bool
$c== :: RegenerateSecurityToken -> RegenerateSecurityToken -> Bool
Prelude.Eq, ReadPrec [RegenerateSecurityToken]
ReadPrec RegenerateSecurityToken
Int -> ReadS RegenerateSecurityToken
ReadS [RegenerateSecurityToken]
(Int -> ReadS RegenerateSecurityToken)
-> ReadS [RegenerateSecurityToken]
-> ReadPrec RegenerateSecurityToken
-> ReadPrec [RegenerateSecurityToken]
-> Read RegenerateSecurityToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegenerateSecurityToken]
$creadListPrec :: ReadPrec [RegenerateSecurityToken]
readPrec :: ReadPrec RegenerateSecurityToken
$creadPrec :: ReadPrec RegenerateSecurityToken
readList :: ReadS [RegenerateSecurityToken]
$creadList :: ReadS [RegenerateSecurityToken]
readsPrec :: Int -> ReadS RegenerateSecurityToken
$creadsPrec :: Int -> ReadS RegenerateSecurityToken
Prelude.Read, Int -> RegenerateSecurityToken -> ShowS
[RegenerateSecurityToken] -> ShowS
RegenerateSecurityToken -> String
(Int -> RegenerateSecurityToken -> ShowS)
-> (RegenerateSecurityToken -> String)
-> ([RegenerateSecurityToken] -> ShowS)
-> Show RegenerateSecurityToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegenerateSecurityToken] -> ShowS
$cshowList :: [RegenerateSecurityToken] -> ShowS
show :: RegenerateSecurityToken -> String
$cshow :: RegenerateSecurityToken -> String
showsPrec :: Int -> RegenerateSecurityToken -> ShowS
$cshowsPrec :: Int -> RegenerateSecurityToken -> ShowS
Prelude.Show, (forall x.
RegenerateSecurityToken -> Rep RegenerateSecurityToken x)
-> (forall x.
Rep RegenerateSecurityToken x -> RegenerateSecurityToken)
-> Generic RegenerateSecurityToken
forall x. Rep RegenerateSecurityToken x -> RegenerateSecurityToken
forall x. RegenerateSecurityToken -> Rep RegenerateSecurityToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegenerateSecurityToken x -> RegenerateSecurityToken
$cfrom :: forall x. RegenerateSecurityToken -> Rep RegenerateSecurityToken x
Prelude.Generic)
newRegenerateSecurityToken ::
Prelude.Text ->
Prelude.Text ->
RegenerateSecurityToken
newRegenerateSecurityToken :: Text -> Text -> RegenerateSecurityToken
newRegenerateSecurityToken Text
pAccountId_ Text
pBotId_ =
RegenerateSecurityToken' :: Text -> Text -> RegenerateSecurityToken
RegenerateSecurityToken'
{ $sel:accountId:RegenerateSecurityToken' :: Text
accountId = Text
pAccountId_,
$sel:botId:RegenerateSecurityToken' :: Text
botId = Text
pBotId_
}
regenerateSecurityToken_accountId :: Lens.Lens' RegenerateSecurityToken Prelude.Text
regenerateSecurityToken_accountId :: (Text -> f Text)
-> RegenerateSecurityToken -> f RegenerateSecurityToken
regenerateSecurityToken_accountId = (RegenerateSecurityToken -> Text)
-> (RegenerateSecurityToken -> Text -> RegenerateSecurityToken)
-> Lens RegenerateSecurityToken RegenerateSecurityToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegenerateSecurityToken' {Text
accountId :: Text
$sel:accountId:RegenerateSecurityToken' :: RegenerateSecurityToken -> Text
accountId} -> Text
accountId) (\s :: RegenerateSecurityToken
s@RegenerateSecurityToken' {} Text
a -> RegenerateSecurityToken
s {$sel:accountId:RegenerateSecurityToken' :: Text
accountId = Text
a} :: RegenerateSecurityToken)
regenerateSecurityToken_botId :: Lens.Lens' RegenerateSecurityToken Prelude.Text
regenerateSecurityToken_botId :: (Text -> f Text)
-> RegenerateSecurityToken -> f RegenerateSecurityToken
regenerateSecurityToken_botId = (RegenerateSecurityToken -> Text)
-> (RegenerateSecurityToken -> Text -> RegenerateSecurityToken)
-> Lens RegenerateSecurityToken RegenerateSecurityToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegenerateSecurityToken' {Text
botId :: Text
$sel:botId:RegenerateSecurityToken' :: RegenerateSecurityToken -> Text
botId} -> Text
botId) (\s :: RegenerateSecurityToken
s@RegenerateSecurityToken' {} Text
a -> RegenerateSecurityToken
s {$sel:botId:RegenerateSecurityToken' :: Text
botId = Text
a} :: RegenerateSecurityToken)
instance Core.AWSRequest RegenerateSecurityToken where
type
AWSResponse RegenerateSecurityToken =
RegenerateSecurityTokenResponse
request :: RegenerateSecurityToken -> Request RegenerateSecurityToken
request = Service
-> RegenerateSecurityToken -> Request RegenerateSecurityToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegenerateSecurityToken
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegenerateSecurityToken)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegenerateSecurityToken))
-> Logger
-> Service
-> Proxy RegenerateSecurityToken
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegenerateSecurityToken)))
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 Bot -> Int -> RegenerateSecurityTokenResponse
RegenerateSecurityTokenResponse'
(Maybe Bot -> Int -> RegenerateSecurityTokenResponse)
-> Either String (Maybe Bot)
-> Either String (Int -> RegenerateSecurityTokenResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bot)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Bot")
Either String (Int -> RegenerateSecurityTokenResponse)
-> Either String Int
-> Either String RegenerateSecurityTokenResponse
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 RegenerateSecurityToken
instance Prelude.NFData RegenerateSecurityToken
instance Core.ToHeaders RegenerateSecurityToken where
toHeaders :: RegenerateSecurityToken -> ResponseHeaders
toHeaders = ResponseHeaders -> RegenerateSecurityToken -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON RegenerateSecurityToken where
toJSON :: RegenerateSecurityToken -> Value
toJSON = Value -> RegenerateSecurityToken -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath RegenerateSecurityToken where
toPath :: RegenerateSecurityToken -> ByteString
toPath RegenerateSecurityToken' {Text
botId :: Text
accountId :: Text
$sel:botId:RegenerateSecurityToken' :: RegenerateSecurityToken -> Text
$sel:accountId:RegenerateSecurityToken' :: RegenerateSecurityToken -> 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
"/bots/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
botId
]
instance Core.ToQuery RegenerateSecurityToken where
toQuery :: RegenerateSecurityToken -> QueryString
toQuery =
QueryString -> RegenerateSecurityToken -> QueryString
forall a b. a -> b -> a
Prelude.const
( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[QueryString
"operation=regenerate-security-token"]
)
data RegenerateSecurityTokenResponse = RegenerateSecurityTokenResponse'
{ RegenerateSecurityTokenResponse -> Maybe Bot
bot :: Prelude.Maybe Bot,
RegenerateSecurityTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool
(RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool)
-> (RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool)
-> Eq RegenerateSecurityTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool
$c/= :: RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool
== :: RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool
$c== :: RegenerateSecurityTokenResponse
-> RegenerateSecurityTokenResponse -> Bool
Prelude.Eq, Int -> RegenerateSecurityTokenResponse -> ShowS
[RegenerateSecurityTokenResponse] -> ShowS
RegenerateSecurityTokenResponse -> String
(Int -> RegenerateSecurityTokenResponse -> ShowS)
-> (RegenerateSecurityTokenResponse -> String)
-> ([RegenerateSecurityTokenResponse] -> ShowS)
-> Show RegenerateSecurityTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegenerateSecurityTokenResponse] -> ShowS
$cshowList :: [RegenerateSecurityTokenResponse] -> ShowS
show :: RegenerateSecurityTokenResponse -> String
$cshow :: RegenerateSecurityTokenResponse -> String
showsPrec :: Int -> RegenerateSecurityTokenResponse -> ShowS
$cshowsPrec :: Int -> RegenerateSecurityTokenResponse -> ShowS
Prelude.Show, (forall x.
RegenerateSecurityTokenResponse
-> Rep RegenerateSecurityTokenResponse x)
-> (forall x.
Rep RegenerateSecurityTokenResponse x
-> RegenerateSecurityTokenResponse)
-> Generic RegenerateSecurityTokenResponse
forall x.
Rep RegenerateSecurityTokenResponse x
-> RegenerateSecurityTokenResponse
forall x.
RegenerateSecurityTokenResponse
-> Rep RegenerateSecurityTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegenerateSecurityTokenResponse x
-> RegenerateSecurityTokenResponse
$cfrom :: forall x.
RegenerateSecurityTokenResponse
-> Rep RegenerateSecurityTokenResponse x
Prelude.Generic)
newRegenerateSecurityTokenResponse ::
Prelude.Int ->
RegenerateSecurityTokenResponse
newRegenerateSecurityTokenResponse :: Int -> RegenerateSecurityTokenResponse
newRegenerateSecurityTokenResponse Int
pHttpStatus_ =
RegenerateSecurityTokenResponse' :: Maybe Bot -> Int -> RegenerateSecurityTokenResponse
RegenerateSecurityTokenResponse'
{ $sel:bot:RegenerateSecurityTokenResponse' :: Maybe Bot
bot =
Maybe Bot
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegenerateSecurityTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
}
regenerateSecurityTokenResponse_bot :: Lens.Lens' RegenerateSecurityTokenResponse (Prelude.Maybe Bot)
regenerateSecurityTokenResponse_bot :: (Maybe Bot -> f (Maybe Bot))
-> RegenerateSecurityTokenResponse
-> f RegenerateSecurityTokenResponse
regenerateSecurityTokenResponse_bot = (RegenerateSecurityTokenResponse -> Maybe Bot)
-> (RegenerateSecurityTokenResponse
-> Maybe Bot -> RegenerateSecurityTokenResponse)
-> Lens
RegenerateSecurityTokenResponse
RegenerateSecurityTokenResponse
(Maybe Bot)
(Maybe Bot)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegenerateSecurityTokenResponse' {Maybe Bot
bot :: Maybe Bot
$sel:bot:RegenerateSecurityTokenResponse' :: RegenerateSecurityTokenResponse -> Maybe Bot
bot} -> Maybe Bot
bot) (\s :: RegenerateSecurityTokenResponse
s@RegenerateSecurityTokenResponse' {} Maybe Bot
a -> RegenerateSecurityTokenResponse
s {$sel:bot:RegenerateSecurityTokenResponse' :: Maybe Bot
bot = Maybe Bot
a} :: RegenerateSecurityTokenResponse)
regenerateSecurityTokenResponse_httpStatus :: Lens.Lens' RegenerateSecurityTokenResponse Prelude.Int
regenerateSecurityTokenResponse_httpStatus :: (Int -> f Int)
-> RegenerateSecurityTokenResponse
-> f RegenerateSecurityTokenResponse
regenerateSecurityTokenResponse_httpStatus = (RegenerateSecurityTokenResponse -> Int)
-> (RegenerateSecurityTokenResponse
-> Int -> RegenerateSecurityTokenResponse)
-> Lens
RegenerateSecurityTokenResponse
RegenerateSecurityTokenResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegenerateSecurityTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegenerateSecurityTokenResponse' :: RegenerateSecurityTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegenerateSecurityTokenResponse
s@RegenerateSecurityTokenResponse' {} Int
a -> RegenerateSecurityTokenResponse
s {$sel:httpStatus:RegenerateSecurityTokenResponse' :: Int
httpStatus = Int
a} :: RegenerateSecurityTokenResponse)
instance
Prelude.NFData
RegenerateSecurityTokenResponse