{-# 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.CreateAttendee
(
CreateAttendee (..),
newCreateAttendee,
createAttendee_tags,
createAttendee_meetingId,
createAttendee_externalUserId,
CreateAttendeeResponse (..),
newCreateAttendeeResponse,
createAttendeeResponse_attendee,
createAttendeeResponse_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 CreateAttendee = CreateAttendee'
{
CreateAttendee -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
CreateAttendee -> Text
meetingId :: Prelude.Text,
CreateAttendee -> Sensitive Text
externalUserId :: Core.Sensitive Prelude.Text
}
deriving (CreateAttendee -> CreateAttendee -> Bool
(CreateAttendee -> CreateAttendee -> Bool)
-> (CreateAttendee -> CreateAttendee -> Bool) -> Eq CreateAttendee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAttendee -> CreateAttendee -> Bool
$c/= :: CreateAttendee -> CreateAttendee -> Bool
== :: CreateAttendee -> CreateAttendee -> Bool
$c== :: CreateAttendee -> CreateAttendee -> Bool
Prelude.Eq, Int -> CreateAttendee -> ShowS
[CreateAttendee] -> ShowS
CreateAttendee -> String
(Int -> CreateAttendee -> ShowS)
-> (CreateAttendee -> String)
-> ([CreateAttendee] -> ShowS)
-> Show CreateAttendee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAttendee] -> ShowS
$cshowList :: [CreateAttendee] -> ShowS
show :: CreateAttendee -> String
$cshow :: CreateAttendee -> String
showsPrec :: Int -> CreateAttendee -> ShowS
$cshowsPrec :: Int -> CreateAttendee -> ShowS
Prelude.Show, (forall x. CreateAttendee -> Rep CreateAttendee x)
-> (forall x. Rep CreateAttendee x -> CreateAttendee)
-> Generic CreateAttendee
forall x. Rep CreateAttendee x -> CreateAttendee
forall x. CreateAttendee -> Rep CreateAttendee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAttendee x -> CreateAttendee
$cfrom :: forall x. CreateAttendee -> Rep CreateAttendee x
Prelude.Generic)
newCreateAttendee ::
Prelude.Text ->
Prelude.Text ->
CreateAttendee
newCreateAttendee :: Text -> Text -> CreateAttendee
newCreateAttendee Text
pMeetingId_ Text
pExternalUserId_ =
CreateAttendee' :: Maybe (NonEmpty Tag) -> Text -> Sensitive Text -> CreateAttendee
CreateAttendee'
{ $sel:tags:CreateAttendee' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
$sel:meetingId:CreateAttendee' :: Text
meetingId = Text
pMeetingId_,
$sel:externalUserId:CreateAttendee' :: Sensitive Text
externalUserId =
Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pExternalUserId_
}
createAttendee_tags :: Lens.Lens' CreateAttendee (Prelude.Maybe (Prelude.NonEmpty Tag))
createAttendee_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAttendee -> f CreateAttendee
createAttendee_tags = (CreateAttendee -> Maybe (NonEmpty Tag))
-> (CreateAttendee -> Maybe (NonEmpty Tag) -> CreateAttendee)
-> Lens
CreateAttendee
CreateAttendee
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendee' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateAttendee' :: CreateAttendee -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateAttendee
s@CreateAttendee' {} Maybe (NonEmpty Tag)
a -> CreateAttendee
s {$sel:tags:CreateAttendee' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateAttendee) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAttendee -> f CreateAttendee)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAttendee
-> f CreateAttendee
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
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 (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAttendee_meetingId :: Lens.Lens' CreateAttendee Prelude.Text
createAttendee_meetingId :: (Text -> f Text) -> CreateAttendee -> f CreateAttendee
createAttendee_meetingId = (CreateAttendee -> Text)
-> (CreateAttendee -> Text -> CreateAttendee)
-> Lens CreateAttendee CreateAttendee Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendee' {Text
meetingId :: Text
$sel:meetingId:CreateAttendee' :: CreateAttendee -> Text
meetingId} -> Text
meetingId) (\s :: CreateAttendee
s@CreateAttendee' {} Text
a -> CreateAttendee
s {$sel:meetingId:CreateAttendee' :: Text
meetingId = Text
a} :: CreateAttendee)
createAttendee_externalUserId :: Lens.Lens' CreateAttendee Prelude.Text
createAttendee_externalUserId :: (Text -> f Text) -> CreateAttendee -> f CreateAttendee
createAttendee_externalUserId = (CreateAttendee -> Sensitive Text)
-> (CreateAttendee -> Sensitive Text -> CreateAttendee)
-> Lens
CreateAttendee CreateAttendee (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendee' {Sensitive Text
externalUserId :: Sensitive Text
$sel:externalUserId:CreateAttendee' :: CreateAttendee -> Sensitive Text
externalUserId} -> Sensitive Text
externalUserId) (\s :: CreateAttendee
s@CreateAttendee' {} Sensitive Text
a -> CreateAttendee
s {$sel:externalUserId:CreateAttendee' :: Sensitive Text
externalUserId = Sensitive Text
a} :: CreateAttendee) ((Sensitive Text -> f (Sensitive Text))
-> CreateAttendee -> f CreateAttendee)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateAttendee
-> f CreateAttendee
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest CreateAttendee where
type
AWSResponse CreateAttendee =
CreateAttendeeResponse
request :: CreateAttendee -> Request CreateAttendee
request = Service -> CreateAttendee -> Request CreateAttendee
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAttendee)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAttendee))
-> Logger
-> Service
-> Proxy CreateAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAttendee)))
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 Attendee -> Int -> CreateAttendeeResponse
CreateAttendeeResponse'
(Maybe Attendee -> Int -> CreateAttendeeResponse)
-> Either String (Maybe Attendee)
-> Either String (Int -> CreateAttendeeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Attendee)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Attendee")
Either String (Int -> CreateAttendeeResponse)
-> Either String Int -> Either String CreateAttendeeResponse
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 CreateAttendee
instance Prelude.NFData CreateAttendee
instance Core.ToHeaders CreateAttendee where
toHeaders :: CreateAttendee -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateAttendee -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateAttendee where
toJSON :: CreateAttendee -> Value
toJSON CreateAttendee' {Maybe (NonEmpty Tag)
Text
Sensitive Text
externalUserId :: Sensitive Text
meetingId :: Text
tags :: Maybe (NonEmpty Tag)
$sel:externalUserId:CreateAttendee' :: CreateAttendee -> Sensitive Text
$sel:meetingId:CreateAttendee' :: CreateAttendee -> Text
$sel:tags:CreateAttendee' :: CreateAttendee -> Maybe (NonEmpty Tag)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ExternalUserId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
externalUserId)
]
)
instance Core.ToPath CreateAttendee where
toPath :: CreateAttendee -> ByteString
toPath CreateAttendee' {Maybe (NonEmpty Tag)
Text
Sensitive Text
externalUserId :: Sensitive Text
meetingId :: Text
tags :: Maybe (NonEmpty Tag)
$sel:externalUserId:CreateAttendee' :: CreateAttendee -> Sensitive Text
$sel:meetingId:CreateAttendee' :: CreateAttendee -> Text
$sel:tags:CreateAttendee' :: CreateAttendee -> Maybe (NonEmpty Tag)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/meetings/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
meetingId, ByteString
"/attendees"]
instance Core.ToQuery CreateAttendee where
toQuery :: CreateAttendee -> QueryString
toQuery = QueryString -> CreateAttendee -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAttendeeResponse = CreateAttendeeResponse'
{
CreateAttendeeResponse -> Maybe Attendee
attendee :: Prelude.Maybe Attendee,
CreateAttendeeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateAttendeeResponse -> CreateAttendeeResponse -> Bool
(CreateAttendeeResponse -> CreateAttendeeResponse -> Bool)
-> (CreateAttendeeResponse -> CreateAttendeeResponse -> Bool)
-> Eq CreateAttendeeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAttendeeResponse -> CreateAttendeeResponse -> Bool
$c/= :: CreateAttendeeResponse -> CreateAttendeeResponse -> Bool
== :: CreateAttendeeResponse -> CreateAttendeeResponse -> Bool
$c== :: CreateAttendeeResponse -> CreateAttendeeResponse -> Bool
Prelude.Eq, Int -> CreateAttendeeResponse -> ShowS
[CreateAttendeeResponse] -> ShowS
CreateAttendeeResponse -> String
(Int -> CreateAttendeeResponse -> ShowS)
-> (CreateAttendeeResponse -> String)
-> ([CreateAttendeeResponse] -> ShowS)
-> Show CreateAttendeeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAttendeeResponse] -> ShowS
$cshowList :: [CreateAttendeeResponse] -> ShowS
show :: CreateAttendeeResponse -> String
$cshow :: CreateAttendeeResponse -> String
showsPrec :: Int -> CreateAttendeeResponse -> ShowS
$cshowsPrec :: Int -> CreateAttendeeResponse -> ShowS
Prelude.Show, (forall x. CreateAttendeeResponse -> Rep CreateAttendeeResponse x)
-> (forall x.
Rep CreateAttendeeResponse x -> CreateAttendeeResponse)
-> Generic CreateAttendeeResponse
forall x. Rep CreateAttendeeResponse x -> CreateAttendeeResponse
forall x. CreateAttendeeResponse -> Rep CreateAttendeeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAttendeeResponse x -> CreateAttendeeResponse
$cfrom :: forall x. CreateAttendeeResponse -> Rep CreateAttendeeResponse x
Prelude.Generic)
newCreateAttendeeResponse ::
Prelude.Int ->
CreateAttendeeResponse
newCreateAttendeeResponse :: Int -> CreateAttendeeResponse
newCreateAttendeeResponse Int
pHttpStatus_ =
CreateAttendeeResponse' :: Maybe Attendee -> Int -> CreateAttendeeResponse
CreateAttendeeResponse'
{ $sel:attendee:CreateAttendeeResponse' :: Maybe Attendee
attendee = Maybe Attendee
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateAttendeeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createAttendeeResponse_attendee :: Lens.Lens' CreateAttendeeResponse (Prelude.Maybe Attendee)
createAttendeeResponse_attendee :: (Maybe Attendee -> f (Maybe Attendee))
-> CreateAttendeeResponse -> f CreateAttendeeResponse
createAttendeeResponse_attendee = (CreateAttendeeResponse -> Maybe Attendee)
-> (CreateAttendeeResponse
-> Maybe Attendee -> CreateAttendeeResponse)
-> Lens
CreateAttendeeResponse
CreateAttendeeResponse
(Maybe Attendee)
(Maybe Attendee)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeResponse' {Maybe Attendee
attendee :: Maybe Attendee
$sel:attendee:CreateAttendeeResponse' :: CreateAttendeeResponse -> Maybe Attendee
attendee} -> Maybe Attendee
attendee) (\s :: CreateAttendeeResponse
s@CreateAttendeeResponse' {} Maybe Attendee
a -> CreateAttendeeResponse
s {$sel:attendee:CreateAttendeeResponse' :: Maybe Attendee
attendee = Maybe Attendee
a} :: CreateAttendeeResponse)
createAttendeeResponse_httpStatus :: Lens.Lens' CreateAttendeeResponse Prelude.Int
createAttendeeResponse_httpStatus :: (Int -> f Int)
-> CreateAttendeeResponse -> f CreateAttendeeResponse
createAttendeeResponse_httpStatus = (CreateAttendeeResponse -> Int)
-> (CreateAttendeeResponse -> Int -> CreateAttendeeResponse)
-> Lens CreateAttendeeResponse CreateAttendeeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAttendeeResponse' :: CreateAttendeeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAttendeeResponse
s@CreateAttendeeResponse' {} Int
a -> CreateAttendeeResponse
s {$sel:httpStatus:CreateAttendeeResponse' :: Int
httpStatus = Int
a} :: CreateAttendeeResponse)
instance Prelude.NFData CreateAttendeeResponse