{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.ChimeSDKMessaging.Types.MessagingSessionEndpoint
-- 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)
module Amazonka.ChimeSDKMessaging.Types.MessagingSessionEndpoint where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The websocket endpoint used to connect to Amazon Chime SDK messaging.
--
-- /See:/ 'newMessagingSessionEndpoint' smart constructor.
data MessagingSessionEndpoint = MessagingSessionEndpoint'
  { -- | The endpoint to which you establish a websocket connection.
    MessagingSessionEndpoint -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool
(MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool)
-> (MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool)
-> Eq MessagingSessionEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool
$c/= :: MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool
== :: MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool
$c== :: MessagingSessionEndpoint -> MessagingSessionEndpoint -> Bool
Prelude.Eq, ReadPrec [MessagingSessionEndpoint]
ReadPrec MessagingSessionEndpoint
Int -> ReadS MessagingSessionEndpoint
ReadS [MessagingSessionEndpoint]
(Int -> ReadS MessagingSessionEndpoint)
-> ReadS [MessagingSessionEndpoint]
-> ReadPrec MessagingSessionEndpoint
-> ReadPrec [MessagingSessionEndpoint]
-> Read MessagingSessionEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MessagingSessionEndpoint]
$creadListPrec :: ReadPrec [MessagingSessionEndpoint]
readPrec :: ReadPrec MessagingSessionEndpoint
$creadPrec :: ReadPrec MessagingSessionEndpoint
readList :: ReadS [MessagingSessionEndpoint]
$creadList :: ReadS [MessagingSessionEndpoint]
readsPrec :: Int -> ReadS MessagingSessionEndpoint
$creadsPrec :: Int -> ReadS MessagingSessionEndpoint
Prelude.Read, Int -> MessagingSessionEndpoint -> ShowS
[MessagingSessionEndpoint] -> ShowS
MessagingSessionEndpoint -> String
(Int -> MessagingSessionEndpoint -> ShowS)
-> (MessagingSessionEndpoint -> String)
-> ([MessagingSessionEndpoint] -> ShowS)
-> Show MessagingSessionEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessagingSessionEndpoint] -> ShowS
$cshowList :: [MessagingSessionEndpoint] -> ShowS
show :: MessagingSessionEndpoint -> String
$cshow :: MessagingSessionEndpoint -> String
showsPrec :: Int -> MessagingSessionEndpoint -> ShowS
$cshowsPrec :: Int -> MessagingSessionEndpoint -> ShowS
Prelude.Show, (forall x.
 MessagingSessionEndpoint -> Rep MessagingSessionEndpoint x)
-> (forall x.
    Rep MessagingSessionEndpoint x -> MessagingSessionEndpoint)
-> Generic MessagingSessionEndpoint
forall x.
Rep MessagingSessionEndpoint x -> MessagingSessionEndpoint
forall x.
MessagingSessionEndpoint -> Rep MessagingSessionEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MessagingSessionEndpoint x -> MessagingSessionEndpoint
$cfrom :: forall x.
MessagingSessionEndpoint -> Rep MessagingSessionEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'MessagingSessionEndpoint' 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:
--
-- 'url', 'messagingSessionEndpoint_url' - The endpoint to which you establish a websocket connection.
newMessagingSessionEndpoint ::
  MessagingSessionEndpoint
newMessagingSessionEndpoint :: MessagingSessionEndpoint
newMessagingSessionEndpoint =
  MessagingSessionEndpoint' :: Maybe Text -> MessagingSessionEndpoint
MessagingSessionEndpoint' {$sel:url:MessagingSessionEndpoint' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The endpoint to which you establish a websocket connection.
messagingSessionEndpoint_url :: Lens.Lens' MessagingSessionEndpoint (Prelude.Maybe Prelude.Text)
messagingSessionEndpoint_url :: (Maybe Text -> f (Maybe Text))
-> MessagingSessionEndpoint -> f MessagingSessionEndpoint
messagingSessionEndpoint_url = (MessagingSessionEndpoint -> Maybe Text)
-> (MessagingSessionEndpoint
    -> Maybe Text -> MessagingSessionEndpoint)
-> Lens
     MessagingSessionEndpoint
     MessagingSessionEndpoint
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessagingSessionEndpoint' {Maybe Text
url :: Maybe Text
$sel:url:MessagingSessionEndpoint' :: MessagingSessionEndpoint -> Maybe Text
url} -> Maybe Text
url) (\s :: MessagingSessionEndpoint
s@MessagingSessionEndpoint' {} Maybe Text
a -> MessagingSessionEndpoint
s {$sel:url:MessagingSessionEndpoint' :: Maybe Text
url = Maybe Text
a} :: MessagingSessionEndpoint)

instance Core.FromJSON MessagingSessionEndpoint where
  parseJSON :: Value -> Parser MessagingSessionEndpoint
parseJSON =
    String
-> (Object -> Parser MessagingSessionEndpoint)
-> Value
-> Parser MessagingSessionEndpoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MessagingSessionEndpoint"
      ( \Object
x ->
          Maybe Text -> MessagingSessionEndpoint
MessagingSessionEndpoint'
            (Maybe Text -> MessagingSessionEndpoint)
-> Parser (Maybe Text) -> Parser MessagingSessionEndpoint
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Url")
      )

instance Prelude.Hashable MessagingSessionEndpoint

instance Prelude.NFData MessagingSessionEndpoint