{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Chime.TagAttendee
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Applies the specified tags to the specified Amazon Chime SDK attendee.
module Amazonka.Chime.TagAttendee
  ( -- * Creating a Request
    TagAttendee (..),
    newTagAttendee,

    -- * Request Lenses
    tagAttendee_meetingId,
    tagAttendee_attendeeId,
    tagAttendee_tags,

    -- * Destructuring the Response
    TagAttendeeResponse (..),
    newTagAttendeeResponse,
  )
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

-- | /See:/ 'newTagAttendee' smart constructor.
data TagAttendee = TagAttendee'
  { -- | The Amazon Chime SDK meeting ID.
    TagAttendee -> Text
meetingId :: Prelude.Text,
    -- | The Amazon Chime SDK attendee ID.
    TagAttendee -> Text
attendeeId :: Prelude.Text,
    -- | The tag key-value pairs.
    TagAttendee -> NonEmpty Tag
tags :: Prelude.NonEmpty Tag
  }
  deriving (TagAttendee -> TagAttendee -> Bool
(TagAttendee -> TagAttendee -> Bool)
-> (TagAttendee -> TagAttendee -> Bool) -> Eq TagAttendee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagAttendee -> TagAttendee -> Bool
$c/= :: TagAttendee -> TagAttendee -> Bool
== :: TagAttendee -> TagAttendee -> Bool
$c== :: TagAttendee -> TagAttendee -> Bool
Prelude.Eq, Int -> TagAttendee -> ShowS
[TagAttendee] -> ShowS
TagAttendee -> String
(Int -> TagAttendee -> ShowS)
-> (TagAttendee -> String)
-> ([TagAttendee] -> ShowS)
-> Show TagAttendee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagAttendee] -> ShowS
$cshowList :: [TagAttendee] -> ShowS
show :: TagAttendee -> String
$cshow :: TagAttendee -> String
showsPrec :: Int -> TagAttendee -> ShowS
$cshowsPrec :: Int -> TagAttendee -> ShowS
Prelude.Show, (forall x. TagAttendee -> Rep TagAttendee x)
-> (forall x. Rep TagAttendee x -> TagAttendee)
-> Generic TagAttendee
forall x. Rep TagAttendee x -> TagAttendee
forall x. TagAttendee -> Rep TagAttendee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagAttendee x -> TagAttendee
$cfrom :: forall x. TagAttendee -> Rep TagAttendee x
Prelude.Generic)

-- |
-- Create a value of 'TagAttendee' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'meetingId', 'tagAttendee_meetingId' - The Amazon Chime SDK meeting ID.
--
-- 'attendeeId', 'tagAttendee_attendeeId' - The Amazon Chime SDK attendee ID.
--
-- 'tags', 'tagAttendee_tags' - The tag key-value pairs.
newTagAttendee ::
  -- | 'meetingId'
  Prelude.Text ->
  -- | 'attendeeId'
  Prelude.Text ->
  -- | 'tags'
  Prelude.NonEmpty Tag ->
  TagAttendee
newTagAttendee :: Text -> Text -> NonEmpty Tag -> TagAttendee
newTagAttendee Text
pMeetingId_ Text
pAttendeeId_ NonEmpty Tag
pTags_ =
  TagAttendee' :: Text -> Text -> NonEmpty Tag -> TagAttendee
TagAttendee'
    { $sel:meetingId:TagAttendee' :: Text
meetingId = Text
pMeetingId_,
      $sel:attendeeId:TagAttendee' :: Text
attendeeId = Text
pAttendeeId_,
      $sel:tags:TagAttendee' :: NonEmpty Tag
tags = Tagged (NonEmpty Tag) (Identity (NonEmpty Tag))
-> Tagged (NonEmpty Tag) (Identity (NonEmpty Tag))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Tag) (Identity (NonEmpty Tag))
 -> Tagged (NonEmpty Tag) (Identity (NonEmpty Tag)))
-> NonEmpty Tag -> NonEmpty Tag
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Tag
pTags_
    }

-- | The Amazon Chime SDK meeting ID.
tagAttendee_meetingId :: Lens.Lens' TagAttendee Prelude.Text
tagAttendee_meetingId :: (Text -> f Text) -> TagAttendee -> f TagAttendee
tagAttendee_meetingId = (TagAttendee -> Text)
-> (TagAttendee -> Text -> TagAttendee)
-> Lens TagAttendee TagAttendee Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagAttendee' {Text
meetingId :: Text
$sel:meetingId:TagAttendee' :: TagAttendee -> Text
meetingId} -> Text
meetingId) (\s :: TagAttendee
s@TagAttendee' {} Text
a -> TagAttendee
s {$sel:meetingId:TagAttendee' :: Text
meetingId = Text
a} :: TagAttendee)

-- | The Amazon Chime SDK attendee ID.
tagAttendee_attendeeId :: Lens.Lens' TagAttendee Prelude.Text
tagAttendee_attendeeId :: (Text -> f Text) -> TagAttendee -> f TagAttendee
tagAttendee_attendeeId = (TagAttendee -> Text)
-> (TagAttendee -> Text -> TagAttendee)
-> Lens TagAttendee TagAttendee Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagAttendee' {Text
attendeeId :: Text
$sel:attendeeId:TagAttendee' :: TagAttendee -> Text
attendeeId} -> Text
attendeeId) (\s :: TagAttendee
s@TagAttendee' {} Text
a -> TagAttendee
s {$sel:attendeeId:TagAttendee' :: Text
attendeeId = Text
a} :: TagAttendee)

-- | The tag key-value pairs.
tagAttendee_tags :: Lens.Lens' TagAttendee (Prelude.NonEmpty Tag)
tagAttendee_tags :: (NonEmpty Tag -> f (NonEmpty Tag)) -> TagAttendee -> f TagAttendee
tagAttendee_tags = (TagAttendee -> NonEmpty Tag)
-> (TagAttendee -> NonEmpty Tag -> TagAttendee)
-> Lens TagAttendee TagAttendee (NonEmpty Tag) (NonEmpty Tag)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagAttendee' {NonEmpty Tag
tags :: NonEmpty Tag
$sel:tags:TagAttendee' :: TagAttendee -> NonEmpty Tag
tags} -> NonEmpty Tag
tags) (\s :: TagAttendee
s@TagAttendee' {} NonEmpty Tag
a -> TagAttendee
s {$sel:tags:TagAttendee' :: NonEmpty Tag
tags = NonEmpty Tag
a} :: TagAttendee) ((NonEmpty Tag -> f (NonEmpty Tag))
 -> TagAttendee -> f TagAttendee)
-> ((NonEmpty Tag -> f (NonEmpty Tag))
    -> NonEmpty Tag -> f (NonEmpty Tag))
-> (NonEmpty Tag -> f (NonEmpty Tag))
-> TagAttendee
-> f TagAttendee
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Tag -> f (NonEmpty Tag))
-> NonEmpty Tag -> f (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest TagAttendee where
  type AWSResponse TagAttendee = TagAttendeeResponse
  request :: TagAttendee -> Request TagAttendee
request = Service -> TagAttendee -> Request TagAttendee
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy TagAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagAttendee)))
response = AWSResponse TagAttendee
-> Logger
-> Service
-> Proxy TagAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagAttendee)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse TagAttendee
TagAttendeeResponse
TagAttendeeResponse'

instance Prelude.Hashable TagAttendee

instance Prelude.NFData TagAttendee

instance Core.ToHeaders TagAttendee where
  toHeaders :: TagAttendee -> [Header]
toHeaders = [Header] -> TagAttendee -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON TagAttendee where
  toJSON :: TagAttendee -> Value
toJSON TagAttendee' {NonEmpty Tag
Text
tags :: NonEmpty Tag
attendeeId :: Text
meetingId :: Text
$sel:tags:TagAttendee' :: TagAttendee -> NonEmpty Tag
$sel:attendeeId:TagAttendee' :: TagAttendee -> Text
$sel:meetingId:TagAttendee' :: TagAttendee -> 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
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Tag
tags)]
      )

instance Core.ToPath TagAttendee where
  toPath :: TagAttendee -> ByteString
toPath TagAttendee' {NonEmpty Tag
Text
tags :: NonEmpty Tag
attendeeId :: Text
meetingId :: Text
$sel:tags:TagAttendee' :: TagAttendee -> NonEmpty Tag
$sel:attendeeId:TagAttendee' :: TagAttendee -> Text
$sel:meetingId:TagAttendee' :: TagAttendee -> Text
..} =
    [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/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
attendeeId,
        ByteString
"/tags"
      ]

instance Core.ToQuery TagAttendee where
  toQuery :: TagAttendee -> QueryString
toQuery =
    QueryString -> TagAttendee -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=add"])

-- | /See:/ 'newTagAttendeeResponse' smart constructor.
data TagAttendeeResponse = TagAttendeeResponse'
  {
  }
  deriving (TagAttendeeResponse -> TagAttendeeResponse -> Bool
(TagAttendeeResponse -> TagAttendeeResponse -> Bool)
-> (TagAttendeeResponse -> TagAttendeeResponse -> Bool)
-> Eq TagAttendeeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagAttendeeResponse -> TagAttendeeResponse -> Bool
$c/= :: TagAttendeeResponse -> TagAttendeeResponse -> Bool
== :: TagAttendeeResponse -> TagAttendeeResponse -> Bool
$c== :: TagAttendeeResponse -> TagAttendeeResponse -> Bool
Prelude.Eq, ReadPrec [TagAttendeeResponse]
ReadPrec TagAttendeeResponse
Int -> ReadS TagAttendeeResponse
ReadS [TagAttendeeResponse]
(Int -> ReadS TagAttendeeResponse)
-> ReadS [TagAttendeeResponse]
-> ReadPrec TagAttendeeResponse
-> ReadPrec [TagAttendeeResponse]
-> Read TagAttendeeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagAttendeeResponse]
$creadListPrec :: ReadPrec [TagAttendeeResponse]
readPrec :: ReadPrec TagAttendeeResponse
$creadPrec :: ReadPrec TagAttendeeResponse
readList :: ReadS [TagAttendeeResponse]
$creadList :: ReadS [TagAttendeeResponse]
readsPrec :: Int -> ReadS TagAttendeeResponse
$creadsPrec :: Int -> ReadS TagAttendeeResponse
Prelude.Read, Int -> TagAttendeeResponse -> ShowS
[TagAttendeeResponse] -> ShowS
TagAttendeeResponse -> String
(Int -> TagAttendeeResponse -> ShowS)
-> (TagAttendeeResponse -> String)
-> ([TagAttendeeResponse] -> ShowS)
-> Show TagAttendeeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagAttendeeResponse] -> ShowS
$cshowList :: [TagAttendeeResponse] -> ShowS
show :: TagAttendeeResponse -> String
$cshow :: TagAttendeeResponse -> String
showsPrec :: Int -> TagAttendeeResponse -> ShowS
$cshowsPrec :: Int -> TagAttendeeResponse -> ShowS
Prelude.Show, (forall x. TagAttendeeResponse -> Rep TagAttendeeResponse x)
-> (forall x. Rep TagAttendeeResponse x -> TagAttendeeResponse)
-> Generic TagAttendeeResponse
forall x. Rep TagAttendeeResponse x -> TagAttendeeResponse
forall x. TagAttendeeResponse -> Rep TagAttendeeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagAttendeeResponse x -> TagAttendeeResponse
$cfrom :: forall x. TagAttendeeResponse -> Rep TagAttendeeResponse x
Prelude.Generic)

-- |
-- Create a value of 'TagAttendeeResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newTagAttendeeResponse ::
  TagAttendeeResponse
newTagAttendeeResponse :: TagAttendeeResponse
newTagAttendeeResponse = TagAttendeeResponse
TagAttendeeResponse'

instance Prelude.NFData TagAttendeeResponse