{-# 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.AlexaBusiness.PutSkillAuthorization
(
PutSkillAuthorization (..),
newPutSkillAuthorization,
putSkillAuthorization_roomArn,
putSkillAuthorization_authorizationResult,
putSkillAuthorization_skillId,
PutSkillAuthorizationResponse (..),
newPutSkillAuthorizationResponse,
putSkillAuthorizationResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.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 PutSkillAuthorization = PutSkillAuthorization'
{
PutSkillAuthorization -> Maybe Text
roomArn :: Prelude.Maybe Prelude.Text,
PutSkillAuthorization -> Sensitive (HashMap Text Text)
authorizationResult :: Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text),
PutSkillAuthorization -> Text
skillId :: Prelude.Text
}
deriving (PutSkillAuthorization -> PutSkillAuthorization -> Bool
(PutSkillAuthorization -> PutSkillAuthorization -> Bool)
-> (PutSkillAuthorization -> PutSkillAuthorization -> Bool)
-> Eq PutSkillAuthorization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutSkillAuthorization -> PutSkillAuthorization -> Bool
$c/= :: PutSkillAuthorization -> PutSkillAuthorization -> Bool
== :: PutSkillAuthorization -> PutSkillAuthorization -> Bool
$c== :: PutSkillAuthorization -> PutSkillAuthorization -> Bool
Prelude.Eq, Int -> PutSkillAuthorization -> ShowS
[PutSkillAuthorization] -> ShowS
PutSkillAuthorization -> String
(Int -> PutSkillAuthorization -> ShowS)
-> (PutSkillAuthorization -> String)
-> ([PutSkillAuthorization] -> ShowS)
-> Show PutSkillAuthorization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutSkillAuthorization] -> ShowS
$cshowList :: [PutSkillAuthorization] -> ShowS
show :: PutSkillAuthorization -> String
$cshow :: PutSkillAuthorization -> String
showsPrec :: Int -> PutSkillAuthorization -> ShowS
$cshowsPrec :: Int -> PutSkillAuthorization -> ShowS
Prelude.Show, (forall x. PutSkillAuthorization -> Rep PutSkillAuthorization x)
-> (forall x. Rep PutSkillAuthorization x -> PutSkillAuthorization)
-> Generic PutSkillAuthorization
forall x. Rep PutSkillAuthorization x -> PutSkillAuthorization
forall x. PutSkillAuthorization -> Rep PutSkillAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutSkillAuthorization x -> PutSkillAuthorization
$cfrom :: forall x. PutSkillAuthorization -> Rep PutSkillAuthorization x
Prelude.Generic)
newPutSkillAuthorization ::
Prelude.Text ->
PutSkillAuthorization
newPutSkillAuthorization :: Text -> PutSkillAuthorization
newPutSkillAuthorization Text
pSkillId_ =
PutSkillAuthorization' :: Maybe Text
-> Sensitive (HashMap Text Text) -> Text -> PutSkillAuthorization
PutSkillAuthorization'
{ $sel:roomArn:PutSkillAuthorization' :: Maybe Text
roomArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:authorizationResult:PutSkillAuthorization' :: Sensitive (HashMap Text Text)
authorizationResult = Sensitive (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty,
$sel:skillId:PutSkillAuthorization' :: Text
skillId = Text
pSkillId_
}
putSkillAuthorization_roomArn :: Lens.Lens' PutSkillAuthorization (Prelude.Maybe Prelude.Text)
putSkillAuthorization_roomArn :: (Maybe Text -> f (Maybe Text))
-> PutSkillAuthorization -> f PutSkillAuthorization
putSkillAuthorization_roomArn = (PutSkillAuthorization -> Maybe Text)
-> (PutSkillAuthorization -> Maybe Text -> PutSkillAuthorization)
-> Lens
PutSkillAuthorization
PutSkillAuthorization
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSkillAuthorization' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:PutSkillAuthorization' :: PutSkillAuthorization -> Maybe Text
roomArn} -> Maybe Text
roomArn) (\s :: PutSkillAuthorization
s@PutSkillAuthorization' {} Maybe Text
a -> PutSkillAuthorization
s {$sel:roomArn:PutSkillAuthorization' :: Maybe Text
roomArn = Maybe Text
a} :: PutSkillAuthorization)
putSkillAuthorization_authorizationResult :: Lens.Lens' PutSkillAuthorization (Prelude.HashMap Prelude.Text Prelude.Text)
putSkillAuthorization_authorizationResult :: (HashMap Text Text -> f (HashMap Text Text))
-> PutSkillAuthorization -> f PutSkillAuthorization
putSkillAuthorization_authorizationResult = (PutSkillAuthorization -> Sensitive (HashMap Text Text))
-> (PutSkillAuthorization
-> Sensitive (HashMap Text Text) -> PutSkillAuthorization)
-> Lens
PutSkillAuthorization
PutSkillAuthorization
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSkillAuthorization' {Sensitive (HashMap Text Text)
authorizationResult :: Sensitive (HashMap Text Text)
$sel:authorizationResult:PutSkillAuthorization' :: PutSkillAuthorization -> Sensitive (HashMap Text Text)
authorizationResult} -> Sensitive (HashMap Text Text)
authorizationResult) (\s :: PutSkillAuthorization
s@PutSkillAuthorization' {} Sensitive (HashMap Text Text)
a -> PutSkillAuthorization
s {$sel:authorizationResult:PutSkillAuthorization' :: Sensitive (HashMap Text Text)
authorizationResult = Sensitive (HashMap Text Text)
a} :: PutSkillAuthorization) ((Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text)))
-> PutSkillAuthorization -> f PutSkillAuthorization)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text)))
-> (HashMap Text Text -> f (HashMap Text Text))
-> PutSkillAuthorization
-> f PutSkillAuthorization
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text)))
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putSkillAuthorization_skillId :: Lens.Lens' PutSkillAuthorization Prelude.Text
putSkillAuthorization_skillId :: (Text -> f Text)
-> PutSkillAuthorization -> f PutSkillAuthorization
putSkillAuthorization_skillId = (PutSkillAuthorization -> Text)
-> (PutSkillAuthorization -> Text -> PutSkillAuthorization)
-> Lens PutSkillAuthorization PutSkillAuthorization Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSkillAuthorization' {Text
skillId :: Text
$sel:skillId:PutSkillAuthorization' :: PutSkillAuthorization -> Text
skillId} -> Text
skillId) (\s :: PutSkillAuthorization
s@PutSkillAuthorization' {} Text
a -> PutSkillAuthorization
s {$sel:skillId:PutSkillAuthorization' :: Text
skillId = Text
a} :: PutSkillAuthorization)
instance Core.AWSRequest PutSkillAuthorization where
type
AWSResponse PutSkillAuthorization =
PutSkillAuthorizationResponse
request :: PutSkillAuthorization -> Request PutSkillAuthorization
request = Service -> PutSkillAuthorization -> Request PutSkillAuthorization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutSkillAuthorization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSkillAuthorization)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutSkillAuthorization))
-> Logger
-> Service
-> Proxy PutSkillAuthorization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSkillAuthorization)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutSkillAuthorizationResponse
PutSkillAuthorizationResponse'
(Int -> PutSkillAuthorizationResponse)
-> Either String Int -> Either String PutSkillAuthorizationResponse
forall (f :: * -> *) a b. Functor 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 PutSkillAuthorization
instance Prelude.NFData PutSkillAuthorization
instance Core.ToHeaders PutSkillAuthorization where
toHeaders :: PutSkillAuthorization -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutSkillAuthorization -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.PutSkillAuthorization" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutSkillAuthorization where
toJSON :: PutSkillAuthorization -> Value
toJSON PutSkillAuthorization' {Maybe Text
Text
Sensitive (HashMap Text Text)
skillId :: Text
authorizationResult :: Sensitive (HashMap Text Text)
roomArn :: Maybe Text
$sel:skillId:PutSkillAuthorization' :: PutSkillAuthorization -> Text
$sel:authorizationResult:PutSkillAuthorization' :: PutSkillAuthorization -> Sensitive (HashMap Text Text)
$sel:roomArn:PutSkillAuthorization' :: PutSkillAuthorization -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RoomArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roomArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AuthorizationResult" Text -> Sensitive (HashMap Text Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive (HashMap Text Text)
authorizationResult),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SkillId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
skillId)
]
)
instance Core.ToPath PutSkillAuthorization where
toPath :: PutSkillAuthorization -> ByteString
toPath = ByteString -> PutSkillAuthorization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutSkillAuthorization where
toQuery :: PutSkillAuthorization -> QueryString
toQuery = QueryString -> PutSkillAuthorization -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutSkillAuthorizationResponse = PutSkillAuthorizationResponse'
{
PutSkillAuthorizationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool
(PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool)
-> (PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool)
-> Eq PutSkillAuthorizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool
$c/= :: PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool
== :: PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool
$c== :: PutSkillAuthorizationResponse
-> PutSkillAuthorizationResponse -> Bool
Prelude.Eq, ReadPrec [PutSkillAuthorizationResponse]
ReadPrec PutSkillAuthorizationResponse
Int -> ReadS PutSkillAuthorizationResponse
ReadS [PutSkillAuthorizationResponse]
(Int -> ReadS PutSkillAuthorizationResponse)
-> ReadS [PutSkillAuthorizationResponse]
-> ReadPrec PutSkillAuthorizationResponse
-> ReadPrec [PutSkillAuthorizationResponse]
-> Read PutSkillAuthorizationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutSkillAuthorizationResponse]
$creadListPrec :: ReadPrec [PutSkillAuthorizationResponse]
readPrec :: ReadPrec PutSkillAuthorizationResponse
$creadPrec :: ReadPrec PutSkillAuthorizationResponse
readList :: ReadS [PutSkillAuthorizationResponse]
$creadList :: ReadS [PutSkillAuthorizationResponse]
readsPrec :: Int -> ReadS PutSkillAuthorizationResponse
$creadsPrec :: Int -> ReadS PutSkillAuthorizationResponse
Prelude.Read, Int -> PutSkillAuthorizationResponse -> ShowS
[PutSkillAuthorizationResponse] -> ShowS
PutSkillAuthorizationResponse -> String
(Int -> PutSkillAuthorizationResponse -> ShowS)
-> (PutSkillAuthorizationResponse -> String)
-> ([PutSkillAuthorizationResponse] -> ShowS)
-> Show PutSkillAuthorizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutSkillAuthorizationResponse] -> ShowS
$cshowList :: [PutSkillAuthorizationResponse] -> ShowS
show :: PutSkillAuthorizationResponse -> String
$cshow :: PutSkillAuthorizationResponse -> String
showsPrec :: Int -> PutSkillAuthorizationResponse -> ShowS
$cshowsPrec :: Int -> PutSkillAuthorizationResponse -> ShowS
Prelude.Show, (forall x.
PutSkillAuthorizationResponse
-> Rep PutSkillAuthorizationResponse x)
-> (forall x.
Rep PutSkillAuthorizationResponse x
-> PutSkillAuthorizationResponse)
-> Generic PutSkillAuthorizationResponse
forall x.
Rep PutSkillAuthorizationResponse x
-> PutSkillAuthorizationResponse
forall x.
PutSkillAuthorizationResponse
-> Rep PutSkillAuthorizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutSkillAuthorizationResponse x
-> PutSkillAuthorizationResponse
$cfrom :: forall x.
PutSkillAuthorizationResponse
-> Rep PutSkillAuthorizationResponse x
Prelude.Generic)
newPutSkillAuthorizationResponse ::
Prelude.Int ->
PutSkillAuthorizationResponse
newPutSkillAuthorizationResponse :: Int -> PutSkillAuthorizationResponse
newPutSkillAuthorizationResponse Int
pHttpStatus_ =
PutSkillAuthorizationResponse' :: Int -> PutSkillAuthorizationResponse
PutSkillAuthorizationResponse'
{ $sel:httpStatus:PutSkillAuthorizationResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putSkillAuthorizationResponse_httpStatus :: Lens.Lens' PutSkillAuthorizationResponse Prelude.Int
putSkillAuthorizationResponse_httpStatus :: (Int -> f Int)
-> PutSkillAuthorizationResponse -> f PutSkillAuthorizationResponse
putSkillAuthorizationResponse_httpStatus = (PutSkillAuthorizationResponse -> Int)
-> (PutSkillAuthorizationResponse
-> Int -> PutSkillAuthorizationResponse)
-> Lens
PutSkillAuthorizationResponse PutSkillAuthorizationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSkillAuthorizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutSkillAuthorizationResponse' :: PutSkillAuthorizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutSkillAuthorizationResponse
s@PutSkillAuthorizationResponse' {} Int
a -> PutSkillAuthorizationResponse
s {$sel:httpStatus:PutSkillAuthorizationResponse' :: Int
httpStatus = Int
a} :: PutSkillAuthorizationResponse)
instance Prelude.NFData PutSkillAuthorizationResponse