{-# 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.IoT.SetDefaultAuthorizer
(
SetDefaultAuthorizer (..),
newSetDefaultAuthorizer,
setDefaultAuthorizer_authorizerName,
SetDefaultAuthorizerResponse (..),
newSetDefaultAuthorizerResponse,
setDefaultAuthorizerResponse_authorizerName,
setDefaultAuthorizerResponse_authorizerArn,
setDefaultAuthorizerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
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 SetDefaultAuthorizer = SetDefaultAuthorizer'
{
SetDefaultAuthorizer -> Text
authorizerName :: Prelude.Text
}
deriving (SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool
(SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool)
-> (SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool)
-> Eq SetDefaultAuthorizer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool
$c/= :: SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool
== :: SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool
$c== :: SetDefaultAuthorizer -> SetDefaultAuthorizer -> Bool
Prelude.Eq, ReadPrec [SetDefaultAuthorizer]
ReadPrec SetDefaultAuthorizer
Int -> ReadS SetDefaultAuthorizer
ReadS [SetDefaultAuthorizer]
(Int -> ReadS SetDefaultAuthorizer)
-> ReadS [SetDefaultAuthorizer]
-> ReadPrec SetDefaultAuthorizer
-> ReadPrec [SetDefaultAuthorizer]
-> Read SetDefaultAuthorizer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetDefaultAuthorizer]
$creadListPrec :: ReadPrec [SetDefaultAuthorizer]
readPrec :: ReadPrec SetDefaultAuthorizer
$creadPrec :: ReadPrec SetDefaultAuthorizer
readList :: ReadS [SetDefaultAuthorizer]
$creadList :: ReadS [SetDefaultAuthorizer]
readsPrec :: Int -> ReadS SetDefaultAuthorizer
$creadsPrec :: Int -> ReadS SetDefaultAuthorizer
Prelude.Read, Int -> SetDefaultAuthorizer -> ShowS
[SetDefaultAuthorizer] -> ShowS
SetDefaultAuthorizer -> String
(Int -> SetDefaultAuthorizer -> ShowS)
-> (SetDefaultAuthorizer -> String)
-> ([SetDefaultAuthorizer] -> ShowS)
-> Show SetDefaultAuthorizer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetDefaultAuthorizer] -> ShowS
$cshowList :: [SetDefaultAuthorizer] -> ShowS
show :: SetDefaultAuthorizer -> String
$cshow :: SetDefaultAuthorizer -> String
showsPrec :: Int -> SetDefaultAuthorizer -> ShowS
$cshowsPrec :: Int -> SetDefaultAuthorizer -> ShowS
Prelude.Show, (forall x. SetDefaultAuthorizer -> Rep SetDefaultAuthorizer x)
-> (forall x. Rep SetDefaultAuthorizer x -> SetDefaultAuthorizer)
-> Generic SetDefaultAuthorizer
forall x. Rep SetDefaultAuthorizer x -> SetDefaultAuthorizer
forall x. SetDefaultAuthorizer -> Rep SetDefaultAuthorizer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetDefaultAuthorizer x -> SetDefaultAuthorizer
$cfrom :: forall x. SetDefaultAuthorizer -> Rep SetDefaultAuthorizer x
Prelude.Generic)
newSetDefaultAuthorizer ::
Prelude.Text ->
SetDefaultAuthorizer
newSetDefaultAuthorizer :: Text -> SetDefaultAuthorizer
newSetDefaultAuthorizer Text
pAuthorizerName_ =
SetDefaultAuthorizer' :: Text -> SetDefaultAuthorizer
SetDefaultAuthorizer'
{ $sel:authorizerName:SetDefaultAuthorizer' :: Text
authorizerName =
Text
pAuthorizerName_
}
setDefaultAuthorizer_authorizerName :: Lens.Lens' SetDefaultAuthorizer Prelude.Text
setDefaultAuthorizer_authorizerName :: (Text -> f Text) -> SetDefaultAuthorizer -> f SetDefaultAuthorizer
setDefaultAuthorizer_authorizerName = (SetDefaultAuthorizer -> Text)
-> (SetDefaultAuthorizer -> Text -> SetDefaultAuthorizer)
-> Lens SetDefaultAuthorizer SetDefaultAuthorizer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetDefaultAuthorizer' {Text
authorizerName :: Text
$sel:authorizerName:SetDefaultAuthorizer' :: SetDefaultAuthorizer -> Text
authorizerName} -> Text
authorizerName) (\s :: SetDefaultAuthorizer
s@SetDefaultAuthorizer' {} Text
a -> SetDefaultAuthorizer
s {$sel:authorizerName:SetDefaultAuthorizer' :: Text
authorizerName = Text
a} :: SetDefaultAuthorizer)
instance Core.AWSRequest SetDefaultAuthorizer where
type
AWSResponse SetDefaultAuthorizer =
SetDefaultAuthorizerResponse
request :: SetDefaultAuthorizer -> Request SetDefaultAuthorizer
request = Service -> SetDefaultAuthorizer -> Request SetDefaultAuthorizer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetDefaultAuthorizer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetDefaultAuthorizer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SetDefaultAuthorizer))
-> Logger
-> Service
-> Proxy SetDefaultAuthorizer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetDefaultAuthorizer)))
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 Text -> Maybe Text -> Int -> SetDefaultAuthorizerResponse
SetDefaultAuthorizerResponse'
(Maybe Text -> Maybe Text -> Int -> SetDefaultAuthorizerResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> SetDefaultAuthorizerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"authorizerName")
Either String (Maybe Text -> Int -> SetDefaultAuthorizerResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SetDefaultAuthorizerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"authorizerArn")
Either String (Int -> SetDefaultAuthorizerResponse)
-> Either String Int -> Either String SetDefaultAuthorizerResponse
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 SetDefaultAuthorizer
instance Prelude.NFData SetDefaultAuthorizer
instance Core.ToHeaders SetDefaultAuthorizer where
toHeaders :: SetDefaultAuthorizer -> ResponseHeaders
toHeaders = ResponseHeaders -> SetDefaultAuthorizer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON SetDefaultAuthorizer where
toJSON :: SetDefaultAuthorizer -> Value
toJSON SetDefaultAuthorizer' {Text
authorizerName :: Text
$sel:authorizerName:SetDefaultAuthorizer' :: SetDefaultAuthorizer -> 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
"authorizerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
authorizerName)
]
)
instance Core.ToPath SetDefaultAuthorizer where
toPath :: SetDefaultAuthorizer -> ByteString
toPath = ByteString -> SetDefaultAuthorizer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/default-authorizer"
instance Core.ToQuery SetDefaultAuthorizer where
toQuery :: SetDefaultAuthorizer -> QueryString
toQuery = QueryString -> SetDefaultAuthorizer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetDefaultAuthorizerResponse = SetDefaultAuthorizerResponse'
{
SetDefaultAuthorizerResponse -> Maybe Text
authorizerName :: Prelude.Maybe Prelude.Text,
SetDefaultAuthorizerResponse -> Maybe Text
authorizerArn :: Prelude.Maybe Prelude.Text,
SetDefaultAuthorizerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool
(SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool)
-> (SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool)
-> Eq SetDefaultAuthorizerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool
$c/= :: SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool
== :: SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool
$c== :: SetDefaultAuthorizerResponse
-> SetDefaultAuthorizerResponse -> Bool
Prelude.Eq, ReadPrec [SetDefaultAuthorizerResponse]
ReadPrec SetDefaultAuthorizerResponse
Int -> ReadS SetDefaultAuthorizerResponse
ReadS [SetDefaultAuthorizerResponse]
(Int -> ReadS SetDefaultAuthorizerResponse)
-> ReadS [SetDefaultAuthorizerResponse]
-> ReadPrec SetDefaultAuthorizerResponse
-> ReadPrec [SetDefaultAuthorizerResponse]
-> Read SetDefaultAuthorizerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetDefaultAuthorizerResponse]
$creadListPrec :: ReadPrec [SetDefaultAuthorizerResponse]
readPrec :: ReadPrec SetDefaultAuthorizerResponse
$creadPrec :: ReadPrec SetDefaultAuthorizerResponse
readList :: ReadS [SetDefaultAuthorizerResponse]
$creadList :: ReadS [SetDefaultAuthorizerResponse]
readsPrec :: Int -> ReadS SetDefaultAuthorizerResponse
$creadsPrec :: Int -> ReadS SetDefaultAuthorizerResponse
Prelude.Read, Int -> SetDefaultAuthorizerResponse -> ShowS
[SetDefaultAuthorizerResponse] -> ShowS
SetDefaultAuthorizerResponse -> String
(Int -> SetDefaultAuthorizerResponse -> ShowS)
-> (SetDefaultAuthorizerResponse -> String)
-> ([SetDefaultAuthorizerResponse] -> ShowS)
-> Show SetDefaultAuthorizerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetDefaultAuthorizerResponse] -> ShowS
$cshowList :: [SetDefaultAuthorizerResponse] -> ShowS
show :: SetDefaultAuthorizerResponse -> String
$cshow :: SetDefaultAuthorizerResponse -> String
showsPrec :: Int -> SetDefaultAuthorizerResponse -> ShowS
$cshowsPrec :: Int -> SetDefaultAuthorizerResponse -> ShowS
Prelude.Show, (forall x.
SetDefaultAuthorizerResponse -> Rep SetDefaultAuthorizerResponse x)
-> (forall x.
Rep SetDefaultAuthorizerResponse x -> SetDefaultAuthorizerResponse)
-> Generic SetDefaultAuthorizerResponse
forall x.
Rep SetDefaultAuthorizerResponse x -> SetDefaultAuthorizerResponse
forall x.
SetDefaultAuthorizerResponse -> Rep SetDefaultAuthorizerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetDefaultAuthorizerResponse x -> SetDefaultAuthorizerResponse
$cfrom :: forall x.
SetDefaultAuthorizerResponse -> Rep SetDefaultAuthorizerResponse x
Prelude.Generic)
newSetDefaultAuthorizerResponse ::
Prelude.Int ->
SetDefaultAuthorizerResponse
newSetDefaultAuthorizerResponse :: Int -> SetDefaultAuthorizerResponse
newSetDefaultAuthorizerResponse Int
pHttpStatus_ =
SetDefaultAuthorizerResponse' :: Maybe Text -> Maybe Text -> Int -> SetDefaultAuthorizerResponse
SetDefaultAuthorizerResponse'
{ $sel:authorizerName:SetDefaultAuthorizerResponse' :: Maybe Text
authorizerName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:authorizerArn:SetDefaultAuthorizerResponse' :: Maybe Text
authorizerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SetDefaultAuthorizerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
setDefaultAuthorizerResponse_authorizerName :: Lens.Lens' SetDefaultAuthorizerResponse (Prelude.Maybe Prelude.Text)
setDefaultAuthorizerResponse_authorizerName :: (Maybe Text -> f (Maybe Text))
-> SetDefaultAuthorizerResponse -> f SetDefaultAuthorizerResponse
setDefaultAuthorizerResponse_authorizerName = (SetDefaultAuthorizerResponse -> Maybe Text)
-> (SetDefaultAuthorizerResponse
-> Maybe Text -> SetDefaultAuthorizerResponse)
-> Lens
SetDefaultAuthorizerResponse
SetDefaultAuthorizerResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetDefaultAuthorizerResponse' {Maybe Text
authorizerName :: Maybe Text
$sel:authorizerName:SetDefaultAuthorizerResponse' :: SetDefaultAuthorizerResponse -> Maybe Text
authorizerName} -> Maybe Text
authorizerName) (\s :: SetDefaultAuthorizerResponse
s@SetDefaultAuthorizerResponse' {} Maybe Text
a -> SetDefaultAuthorizerResponse
s {$sel:authorizerName:SetDefaultAuthorizerResponse' :: Maybe Text
authorizerName = Maybe Text
a} :: SetDefaultAuthorizerResponse)
setDefaultAuthorizerResponse_authorizerArn :: Lens.Lens' SetDefaultAuthorizerResponse (Prelude.Maybe Prelude.Text)
setDefaultAuthorizerResponse_authorizerArn :: (Maybe Text -> f (Maybe Text))
-> SetDefaultAuthorizerResponse -> f SetDefaultAuthorizerResponse
setDefaultAuthorizerResponse_authorizerArn = (SetDefaultAuthorizerResponse -> Maybe Text)
-> (SetDefaultAuthorizerResponse
-> Maybe Text -> SetDefaultAuthorizerResponse)
-> Lens
SetDefaultAuthorizerResponse
SetDefaultAuthorizerResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetDefaultAuthorizerResponse' {Maybe Text
authorizerArn :: Maybe Text
$sel:authorizerArn:SetDefaultAuthorizerResponse' :: SetDefaultAuthorizerResponse -> Maybe Text
authorizerArn} -> Maybe Text
authorizerArn) (\s :: SetDefaultAuthorizerResponse
s@SetDefaultAuthorizerResponse' {} Maybe Text
a -> SetDefaultAuthorizerResponse
s {$sel:authorizerArn:SetDefaultAuthorizerResponse' :: Maybe Text
authorizerArn = Maybe Text
a} :: SetDefaultAuthorizerResponse)
setDefaultAuthorizerResponse_httpStatus :: Lens.Lens' SetDefaultAuthorizerResponse Prelude.Int
setDefaultAuthorizerResponse_httpStatus :: (Int -> f Int)
-> SetDefaultAuthorizerResponse -> f SetDefaultAuthorizerResponse
setDefaultAuthorizerResponse_httpStatus = (SetDefaultAuthorizerResponse -> Int)
-> (SetDefaultAuthorizerResponse
-> Int -> SetDefaultAuthorizerResponse)
-> Lens
SetDefaultAuthorizerResponse SetDefaultAuthorizerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetDefaultAuthorizerResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetDefaultAuthorizerResponse' :: SetDefaultAuthorizerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetDefaultAuthorizerResponse
s@SetDefaultAuthorizerResponse' {} Int
a -> SetDefaultAuthorizerResponse
s {$sel:httpStatus:SetDefaultAuthorizerResponse' :: Int
httpStatus = Int
a} :: SetDefaultAuthorizerResponse)
instance Prelude.NFData SetDefaultAuthorizerResponse