{-# 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.ListAttendeeTags
-- 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)
--
-- Lists the tags applied to an Amazon Chime SDK attendee resource.
module Amazonka.Chime.ListAttendeeTags
  ( -- * Creating a Request
    ListAttendeeTags (..),
    newListAttendeeTags,

    -- * Request Lenses
    listAttendeeTags_meetingId,
    listAttendeeTags_attendeeId,

    -- * Destructuring the Response
    ListAttendeeTagsResponse (..),
    newListAttendeeTagsResponse,

    -- * Response Lenses
    listAttendeeTagsResponse_tags,
    listAttendeeTagsResponse_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

-- | /See:/ 'newListAttendeeTags' smart constructor.
data ListAttendeeTags = ListAttendeeTags'
  { -- | The Amazon Chime SDK meeting ID.
    ListAttendeeTags -> Text
meetingId :: Prelude.Text,
    -- | The Amazon Chime SDK attendee ID.
    ListAttendeeTags -> Text
attendeeId :: Prelude.Text
  }
  deriving (ListAttendeeTags -> ListAttendeeTags -> Bool
(ListAttendeeTags -> ListAttendeeTags -> Bool)
-> (ListAttendeeTags -> ListAttendeeTags -> Bool)
-> Eq ListAttendeeTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttendeeTags -> ListAttendeeTags -> Bool
$c/= :: ListAttendeeTags -> ListAttendeeTags -> Bool
== :: ListAttendeeTags -> ListAttendeeTags -> Bool
$c== :: ListAttendeeTags -> ListAttendeeTags -> Bool
Prelude.Eq, ReadPrec [ListAttendeeTags]
ReadPrec ListAttendeeTags
Int -> ReadS ListAttendeeTags
ReadS [ListAttendeeTags]
(Int -> ReadS ListAttendeeTags)
-> ReadS [ListAttendeeTags]
-> ReadPrec ListAttendeeTags
-> ReadPrec [ListAttendeeTags]
-> Read ListAttendeeTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttendeeTags]
$creadListPrec :: ReadPrec [ListAttendeeTags]
readPrec :: ReadPrec ListAttendeeTags
$creadPrec :: ReadPrec ListAttendeeTags
readList :: ReadS [ListAttendeeTags]
$creadList :: ReadS [ListAttendeeTags]
readsPrec :: Int -> ReadS ListAttendeeTags
$creadsPrec :: Int -> ReadS ListAttendeeTags
Prelude.Read, Int -> ListAttendeeTags -> ShowS
[ListAttendeeTags] -> ShowS
ListAttendeeTags -> String
(Int -> ListAttendeeTags -> ShowS)
-> (ListAttendeeTags -> String)
-> ([ListAttendeeTags] -> ShowS)
-> Show ListAttendeeTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttendeeTags] -> ShowS
$cshowList :: [ListAttendeeTags] -> ShowS
show :: ListAttendeeTags -> String
$cshow :: ListAttendeeTags -> String
showsPrec :: Int -> ListAttendeeTags -> ShowS
$cshowsPrec :: Int -> ListAttendeeTags -> ShowS
Prelude.Show, (forall x. ListAttendeeTags -> Rep ListAttendeeTags x)
-> (forall x. Rep ListAttendeeTags x -> ListAttendeeTags)
-> Generic ListAttendeeTags
forall x. Rep ListAttendeeTags x -> ListAttendeeTags
forall x. ListAttendeeTags -> Rep ListAttendeeTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAttendeeTags x -> ListAttendeeTags
$cfrom :: forall x. ListAttendeeTags -> Rep ListAttendeeTags x
Prelude.Generic)

-- |
-- Create a value of 'ListAttendeeTags' 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', 'listAttendeeTags_meetingId' - The Amazon Chime SDK meeting ID.
--
-- 'attendeeId', 'listAttendeeTags_attendeeId' - The Amazon Chime SDK attendee ID.
newListAttendeeTags ::
  -- | 'meetingId'
  Prelude.Text ->
  -- | 'attendeeId'
  Prelude.Text ->
  ListAttendeeTags
newListAttendeeTags :: Text -> Text -> ListAttendeeTags
newListAttendeeTags Text
pMeetingId_ Text
pAttendeeId_ =
  ListAttendeeTags' :: Text -> Text -> ListAttendeeTags
ListAttendeeTags'
    { $sel:meetingId:ListAttendeeTags' :: Text
meetingId = Text
pMeetingId_,
      $sel:attendeeId:ListAttendeeTags' :: Text
attendeeId = Text
pAttendeeId_
    }

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

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

instance Core.AWSRequest ListAttendeeTags where
  type
    AWSResponse ListAttendeeTags =
      ListAttendeeTagsResponse
  request :: ListAttendeeTags -> Request ListAttendeeTags
request = Service -> ListAttendeeTags -> Request ListAttendeeTags
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAttendeeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAttendeeTags)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAttendeeTags))
-> Logger
-> Service
-> Proxy ListAttendeeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAttendeeTags)))
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 (NonEmpty Tag) -> Int -> ListAttendeeTagsResponse
ListAttendeeTagsResponse'
            (Maybe (NonEmpty Tag) -> Int -> ListAttendeeTagsResponse)
-> Either String (Maybe (NonEmpty Tag))
-> Either String (Int -> ListAttendeeTagsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Tag))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Tags")
            Either String (Int -> ListAttendeeTagsResponse)
-> Either String Int -> Either String ListAttendeeTagsResponse
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 ListAttendeeTags

instance Prelude.NFData ListAttendeeTags

instance Core.ToHeaders ListAttendeeTags where
  toHeaders :: ListAttendeeTags -> ResponseHeaders
toHeaders = ResponseHeaders -> ListAttendeeTags -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ListAttendeeTags where
  toPath :: ListAttendeeTags -> ByteString
toPath ListAttendeeTags' {Text
attendeeId :: Text
meetingId :: Text
$sel:attendeeId:ListAttendeeTags' :: ListAttendeeTags -> Text
$sel:meetingId:ListAttendeeTags' :: ListAttendeeTags -> 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 ListAttendeeTags where
  toQuery :: ListAttendeeTags -> QueryString
toQuery = QueryString -> ListAttendeeTags -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListAttendeeTagsResponse' smart constructor.
data ListAttendeeTagsResponse = ListAttendeeTagsResponse'
  { -- | A list of tag key-value pairs.
    ListAttendeeTagsResponse -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The response's http status code.
    ListAttendeeTagsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool
(ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool)
-> (ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool)
-> Eq ListAttendeeTagsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool
$c/= :: ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool
== :: ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool
$c== :: ListAttendeeTagsResponse -> ListAttendeeTagsResponse -> Bool
Prelude.Eq, Int -> ListAttendeeTagsResponse -> ShowS
[ListAttendeeTagsResponse] -> ShowS
ListAttendeeTagsResponse -> String
(Int -> ListAttendeeTagsResponse -> ShowS)
-> (ListAttendeeTagsResponse -> String)
-> ([ListAttendeeTagsResponse] -> ShowS)
-> Show ListAttendeeTagsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttendeeTagsResponse] -> ShowS
$cshowList :: [ListAttendeeTagsResponse] -> ShowS
show :: ListAttendeeTagsResponse -> String
$cshow :: ListAttendeeTagsResponse -> String
showsPrec :: Int -> ListAttendeeTagsResponse -> ShowS
$cshowsPrec :: Int -> ListAttendeeTagsResponse -> ShowS
Prelude.Show, (forall x.
 ListAttendeeTagsResponse -> Rep ListAttendeeTagsResponse x)
-> (forall x.
    Rep ListAttendeeTagsResponse x -> ListAttendeeTagsResponse)
-> Generic ListAttendeeTagsResponse
forall x.
Rep ListAttendeeTagsResponse x -> ListAttendeeTagsResponse
forall x.
ListAttendeeTagsResponse -> Rep ListAttendeeTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAttendeeTagsResponse x -> ListAttendeeTagsResponse
$cfrom :: forall x.
ListAttendeeTagsResponse -> Rep ListAttendeeTagsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAttendeeTagsResponse' 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:
--
-- 'tags', 'listAttendeeTagsResponse_tags' - A list of tag key-value pairs.
--
-- 'httpStatus', 'listAttendeeTagsResponse_httpStatus' - The response's http status code.
newListAttendeeTagsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttendeeTagsResponse
newListAttendeeTagsResponse :: Int -> ListAttendeeTagsResponse
newListAttendeeTagsResponse Int
pHttpStatus_ =
  ListAttendeeTagsResponse' :: Maybe (NonEmpty Tag) -> Int -> ListAttendeeTagsResponse
ListAttendeeTagsResponse'
    { $sel:tags:ListAttendeeTagsResponse' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAttendeeTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of tag key-value pairs.
listAttendeeTagsResponse_tags :: Lens.Lens' ListAttendeeTagsResponse (Prelude.Maybe (Prelude.NonEmpty Tag))
listAttendeeTagsResponse_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> ListAttendeeTagsResponse -> f ListAttendeeTagsResponse
listAttendeeTagsResponse_tags = (ListAttendeeTagsResponse -> Maybe (NonEmpty Tag))
-> (ListAttendeeTagsResponse
    -> Maybe (NonEmpty Tag) -> ListAttendeeTagsResponse)
-> Lens
     ListAttendeeTagsResponse
     ListAttendeeTagsResponse
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttendeeTagsResponse' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:ListAttendeeTagsResponse' :: ListAttendeeTagsResponse -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: ListAttendeeTagsResponse
s@ListAttendeeTagsResponse' {} Maybe (NonEmpty Tag)
a -> ListAttendeeTagsResponse
s {$sel:tags:ListAttendeeTagsResponse' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: ListAttendeeTagsResponse) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> ListAttendeeTagsResponse -> f ListAttendeeTagsResponse)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> ListAttendeeTagsResponse
-> f ListAttendeeTagsResponse
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

-- | The response's http status code.
listAttendeeTagsResponse_httpStatus :: Lens.Lens' ListAttendeeTagsResponse Prelude.Int
listAttendeeTagsResponse_httpStatus :: (Int -> f Int)
-> ListAttendeeTagsResponse -> f ListAttendeeTagsResponse
listAttendeeTagsResponse_httpStatus = (ListAttendeeTagsResponse -> Int)
-> (ListAttendeeTagsResponse -> Int -> ListAttendeeTagsResponse)
-> Lens ListAttendeeTagsResponse ListAttendeeTagsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttendeeTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAttendeeTagsResponse' :: ListAttendeeTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAttendeeTagsResponse
s@ListAttendeeTagsResponse' {} Int
a -> ListAttendeeTagsResponse
s {$sel:httpStatus:ListAttendeeTagsResponse' :: Int
httpStatus = Int
a} :: ListAttendeeTagsResponse)

instance Prelude.NFData ListAttendeeTagsResponse