{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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
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. 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'
    { $sel:meetingId:TagAttendee' :: Text
meetingId = Text
pMeetingId_,
      $sel:attendeeId:TagAttendee' :: Text
attendeeId = Text
pAttendeeId_,
      $sel:tags:TagAttendee' :: NonEmpty Tag
tags = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced 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 :: Lens' TagAttendee Text
tagAttendee_meetingId = 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 :: Lens' TagAttendee Text
tagAttendee_attendeeId = 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 :: Lens' TagAttendee (NonEmpty Tag)
tagAttendee_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: (Service -> Service) -> TagAttendee -> Request TagAttendee
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy TagAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagAttendee)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull TagAttendeeResponse
TagAttendeeResponse'

instance Prelude.Hashable TagAttendee where
  hashWithSalt :: Int -> TagAttendee -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meetingId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attendeeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Tag
tags

instance Prelude.NFData TagAttendee where
  rnf :: TagAttendee -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
meetingId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
attendeeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Tag
tags

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

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Tag
tags)]
      )

instance Data.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
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/meetings/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
meetingId,
        ByteString
"/attendees/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
attendeeId,
        ByteString
"/tags"
      ]

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

-- | /See:/ 'newTagAttendeeResponse' smart constructor.
data TagAttendeeResponse = TagAttendeeResponse'
  {
  }
  deriving (TagAttendeeResponse -> TagAttendeeResponse -> Bool
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]
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
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. 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 where
  rnf :: TagAttendeeResponse -> ()
rnf TagAttendeeResponse
_ = ()