{-# 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.TagMeeting
-- 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 meeting.
module Amazonka.Chime.TagMeeting
  ( -- * Creating a Request
    TagMeeting (..),
    newTagMeeting,

    -- * Request Lenses
    tagMeeting_meetingId,
    tagMeeting_tags,

    -- * Destructuring the Response
    TagMeetingResponse (..),
    newTagMeetingResponse,
  )
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:/ 'newTagMeeting' smart constructor.
data TagMeeting = TagMeeting'
  { -- | The Amazon Chime SDK meeting ID.
    TagMeeting -> Text
meetingId :: Prelude.Text,
    -- | The tag key-value pairs.
    TagMeeting -> NonEmpty Tag
tags :: Prelude.NonEmpty Tag
  }
  deriving (TagMeeting -> TagMeeting -> Bool
(TagMeeting -> TagMeeting -> Bool)
-> (TagMeeting -> TagMeeting -> Bool) -> Eq TagMeeting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagMeeting -> TagMeeting -> Bool
$c/= :: TagMeeting -> TagMeeting -> Bool
== :: TagMeeting -> TagMeeting -> Bool
$c== :: TagMeeting -> TagMeeting -> Bool
Prelude.Eq, Int -> TagMeeting -> ShowS
[TagMeeting] -> ShowS
TagMeeting -> String
(Int -> TagMeeting -> ShowS)
-> (TagMeeting -> String)
-> ([TagMeeting] -> ShowS)
-> Show TagMeeting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagMeeting] -> ShowS
$cshowList :: [TagMeeting] -> ShowS
show :: TagMeeting -> String
$cshow :: TagMeeting -> String
showsPrec :: Int -> TagMeeting -> ShowS
$cshowsPrec :: Int -> TagMeeting -> ShowS
Prelude.Show, (forall x. TagMeeting -> Rep TagMeeting x)
-> (forall x. Rep TagMeeting x -> TagMeeting) -> Generic TagMeeting
forall x. Rep TagMeeting x -> TagMeeting
forall x. TagMeeting -> Rep TagMeeting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagMeeting x -> TagMeeting
$cfrom :: forall x. TagMeeting -> Rep TagMeeting x
Prelude.Generic)

-- |
-- Create a value of 'TagMeeting' 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', 'tagMeeting_meetingId' - The Amazon Chime SDK meeting ID.
--
-- 'tags', 'tagMeeting_tags' - The tag key-value pairs.
newTagMeeting ::
  -- | 'meetingId'
  Prelude.Text ->
  -- | 'tags'
  Prelude.NonEmpty Tag ->
  TagMeeting
newTagMeeting :: Text -> NonEmpty Tag -> TagMeeting
newTagMeeting Text
pMeetingId_ NonEmpty Tag
pTags_ =
  TagMeeting' :: Text -> NonEmpty Tag -> TagMeeting
TagMeeting'
    { $sel:meetingId:TagMeeting' :: Text
meetingId = Text
pMeetingId_,
      $sel:tags:TagMeeting' :: 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.
tagMeeting_meetingId :: Lens.Lens' TagMeeting Prelude.Text
tagMeeting_meetingId :: (Text -> f Text) -> TagMeeting -> f TagMeeting
tagMeeting_meetingId = (TagMeeting -> Text)
-> (TagMeeting -> Text -> TagMeeting)
-> Lens TagMeeting TagMeeting Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagMeeting' {Text
meetingId :: Text
$sel:meetingId:TagMeeting' :: TagMeeting -> Text
meetingId} -> Text
meetingId) (\s :: TagMeeting
s@TagMeeting' {} Text
a -> TagMeeting
s {$sel:meetingId:TagMeeting' :: Text
meetingId = Text
a} :: TagMeeting)

-- | The tag key-value pairs.
tagMeeting_tags :: Lens.Lens' TagMeeting (Prelude.NonEmpty Tag)
tagMeeting_tags :: (NonEmpty Tag -> f (NonEmpty Tag)) -> TagMeeting -> f TagMeeting
tagMeeting_tags = (TagMeeting -> NonEmpty Tag)
-> (TagMeeting -> NonEmpty Tag -> TagMeeting)
-> Lens TagMeeting TagMeeting (NonEmpty Tag) (NonEmpty Tag)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagMeeting' {NonEmpty Tag
tags :: NonEmpty Tag
$sel:tags:TagMeeting' :: TagMeeting -> NonEmpty Tag
tags} -> NonEmpty Tag
tags) (\s :: TagMeeting
s@TagMeeting' {} NonEmpty Tag
a -> TagMeeting
s {$sel:tags:TagMeeting' :: NonEmpty Tag
tags = NonEmpty Tag
a} :: TagMeeting) ((NonEmpty Tag -> f (NonEmpty Tag)) -> TagMeeting -> f TagMeeting)
-> ((NonEmpty Tag -> f (NonEmpty Tag))
    -> NonEmpty Tag -> f (NonEmpty Tag))
-> (NonEmpty Tag -> f (NonEmpty Tag))
-> TagMeeting
-> f TagMeeting
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 TagMeeting where
  type AWSResponse TagMeeting = TagMeetingResponse
  request :: TagMeeting -> Request TagMeeting
request = Service -> TagMeeting -> Request TagMeeting
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy TagMeeting
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagMeeting)))
response = AWSResponse TagMeeting
-> Logger
-> Service
-> Proxy TagMeeting
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagMeeting)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse TagMeeting
TagMeetingResponse
TagMeetingResponse'

instance Prelude.Hashable TagMeeting

instance Prelude.NFData TagMeeting

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

instance Core.ToJSON TagMeeting where
  toJSON :: TagMeeting -> Value
toJSON TagMeeting' {NonEmpty Tag
Text
tags :: NonEmpty Tag
meetingId :: Text
$sel:tags:TagMeeting' :: TagMeeting -> NonEmpty Tag
$sel:meetingId:TagMeeting' :: TagMeeting -> 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 TagMeeting where
  toPath :: TagMeeting -> ByteString
toPath TagMeeting' {NonEmpty Tag
Text
tags :: NonEmpty Tag
meetingId :: Text
$sel:tags:TagMeeting' :: TagMeeting -> NonEmpty Tag
$sel:meetingId:TagMeeting' :: TagMeeting -> 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
"/tags"]

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

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

-- |
-- Create a value of 'TagMeetingResponse' 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.
newTagMeetingResponse ::
  TagMeetingResponse
newTagMeetingResponse :: TagMeetingResponse
newTagMeetingResponse = TagMeetingResponse
TagMeetingResponse'

instance Prelude.NFData TagMeetingResponse