{-# 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.KinesisVideo.Types.ResourceEndpointListItem
-- 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.KinesisVideo.Types.ResourceEndpointListItem where

import qualified Amazonka.Core as Core
import Amazonka.KinesisVideo.Types.ChannelProtocol
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that describes the endpoint of the signaling channel returned
-- by the @GetSignalingChannelEndpoint@ API.
--
-- /See:/ 'newResourceEndpointListItem' smart constructor.
data ResourceEndpointListItem = ResourceEndpointListItem'
  { -- | The protocol of the signaling channel returned by the
    -- @GetSignalingChannelEndpoint@ API.
    ResourceEndpointListItem -> Maybe ChannelProtocol
protocol :: Prelude.Maybe ChannelProtocol,
    -- | The endpoint of the signaling channel returned by the
    -- @GetSignalingChannelEndpoint@ API.
    ResourceEndpointListItem -> Maybe Text
resourceEndpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceEndpointListItem -> ResourceEndpointListItem -> Bool
(ResourceEndpointListItem -> ResourceEndpointListItem -> Bool)
-> (ResourceEndpointListItem -> ResourceEndpointListItem -> Bool)
-> Eq ResourceEndpointListItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceEndpointListItem -> ResourceEndpointListItem -> Bool
$c/= :: ResourceEndpointListItem -> ResourceEndpointListItem -> Bool
== :: ResourceEndpointListItem -> ResourceEndpointListItem -> Bool
$c== :: ResourceEndpointListItem -> ResourceEndpointListItem -> Bool
Prelude.Eq, ReadPrec [ResourceEndpointListItem]
ReadPrec ResourceEndpointListItem
Int -> ReadS ResourceEndpointListItem
ReadS [ResourceEndpointListItem]
(Int -> ReadS ResourceEndpointListItem)
-> ReadS [ResourceEndpointListItem]
-> ReadPrec ResourceEndpointListItem
-> ReadPrec [ResourceEndpointListItem]
-> Read ResourceEndpointListItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceEndpointListItem]
$creadListPrec :: ReadPrec [ResourceEndpointListItem]
readPrec :: ReadPrec ResourceEndpointListItem
$creadPrec :: ReadPrec ResourceEndpointListItem
readList :: ReadS [ResourceEndpointListItem]
$creadList :: ReadS [ResourceEndpointListItem]
readsPrec :: Int -> ReadS ResourceEndpointListItem
$creadsPrec :: Int -> ReadS ResourceEndpointListItem
Prelude.Read, Int -> ResourceEndpointListItem -> ShowS
[ResourceEndpointListItem] -> ShowS
ResourceEndpointListItem -> String
(Int -> ResourceEndpointListItem -> ShowS)
-> (ResourceEndpointListItem -> String)
-> ([ResourceEndpointListItem] -> ShowS)
-> Show ResourceEndpointListItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceEndpointListItem] -> ShowS
$cshowList :: [ResourceEndpointListItem] -> ShowS
show :: ResourceEndpointListItem -> String
$cshow :: ResourceEndpointListItem -> String
showsPrec :: Int -> ResourceEndpointListItem -> ShowS
$cshowsPrec :: Int -> ResourceEndpointListItem -> ShowS
Prelude.Show, (forall x.
 ResourceEndpointListItem -> Rep ResourceEndpointListItem x)
-> (forall x.
    Rep ResourceEndpointListItem x -> ResourceEndpointListItem)
-> Generic ResourceEndpointListItem
forall x.
Rep ResourceEndpointListItem x -> ResourceEndpointListItem
forall x.
ResourceEndpointListItem -> Rep ResourceEndpointListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResourceEndpointListItem x -> ResourceEndpointListItem
$cfrom :: forall x.
ResourceEndpointListItem -> Rep ResourceEndpointListItem x
Prelude.Generic)

-- |
-- Create a value of 'ResourceEndpointListItem' 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:
--
-- 'protocol', 'resourceEndpointListItem_protocol' - The protocol of the signaling channel returned by the
-- @GetSignalingChannelEndpoint@ API.
--
-- 'resourceEndpoint', 'resourceEndpointListItem_resourceEndpoint' - The endpoint of the signaling channel returned by the
-- @GetSignalingChannelEndpoint@ API.
newResourceEndpointListItem ::
  ResourceEndpointListItem
newResourceEndpointListItem :: ResourceEndpointListItem
newResourceEndpointListItem =
  ResourceEndpointListItem' :: Maybe ChannelProtocol -> Maybe Text -> ResourceEndpointListItem
ResourceEndpointListItem'
    { $sel:protocol:ResourceEndpointListItem' :: Maybe ChannelProtocol
protocol =
        Maybe ChannelProtocol
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceEndpoint:ResourceEndpointListItem' :: Maybe Text
resourceEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The protocol of the signaling channel returned by the
-- @GetSignalingChannelEndpoint@ API.
resourceEndpointListItem_protocol :: Lens.Lens' ResourceEndpointListItem (Prelude.Maybe ChannelProtocol)
resourceEndpointListItem_protocol :: (Maybe ChannelProtocol -> f (Maybe ChannelProtocol))
-> ResourceEndpointListItem -> f ResourceEndpointListItem
resourceEndpointListItem_protocol = (ResourceEndpointListItem -> Maybe ChannelProtocol)
-> (ResourceEndpointListItem
    -> Maybe ChannelProtocol -> ResourceEndpointListItem)
-> Lens
     ResourceEndpointListItem
     ResourceEndpointListItem
     (Maybe ChannelProtocol)
     (Maybe ChannelProtocol)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceEndpointListItem' {Maybe ChannelProtocol
protocol :: Maybe ChannelProtocol
$sel:protocol:ResourceEndpointListItem' :: ResourceEndpointListItem -> Maybe ChannelProtocol
protocol} -> Maybe ChannelProtocol
protocol) (\s :: ResourceEndpointListItem
s@ResourceEndpointListItem' {} Maybe ChannelProtocol
a -> ResourceEndpointListItem
s {$sel:protocol:ResourceEndpointListItem' :: Maybe ChannelProtocol
protocol = Maybe ChannelProtocol
a} :: ResourceEndpointListItem)

-- | The endpoint of the signaling channel returned by the
-- @GetSignalingChannelEndpoint@ API.
resourceEndpointListItem_resourceEndpoint :: Lens.Lens' ResourceEndpointListItem (Prelude.Maybe Prelude.Text)
resourceEndpointListItem_resourceEndpoint :: (Maybe Text -> f (Maybe Text))
-> ResourceEndpointListItem -> f ResourceEndpointListItem
resourceEndpointListItem_resourceEndpoint = (ResourceEndpointListItem -> Maybe Text)
-> (ResourceEndpointListItem
    -> Maybe Text -> ResourceEndpointListItem)
-> Lens
     ResourceEndpointListItem
     ResourceEndpointListItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceEndpointListItem' {Maybe Text
resourceEndpoint :: Maybe Text
$sel:resourceEndpoint:ResourceEndpointListItem' :: ResourceEndpointListItem -> Maybe Text
resourceEndpoint} -> Maybe Text
resourceEndpoint) (\s :: ResourceEndpointListItem
s@ResourceEndpointListItem' {} Maybe Text
a -> ResourceEndpointListItem
s {$sel:resourceEndpoint:ResourceEndpointListItem' :: Maybe Text
resourceEndpoint = Maybe Text
a} :: ResourceEndpointListItem)

instance Core.FromJSON ResourceEndpointListItem where
  parseJSON :: Value -> Parser ResourceEndpointListItem
parseJSON =
    String
-> (Object -> Parser ResourceEndpointListItem)
-> Value
-> Parser ResourceEndpointListItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceEndpointListItem"
      ( \Object
x ->
          Maybe ChannelProtocol -> Maybe Text -> ResourceEndpointListItem
ResourceEndpointListItem'
            (Maybe ChannelProtocol -> Maybe Text -> ResourceEndpointListItem)
-> Parser (Maybe ChannelProtocol)
-> Parser (Maybe Text -> ResourceEndpointListItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ChannelProtocol)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Protocol")
            Parser (Maybe Text -> ResourceEndpointListItem)
-> Parser (Maybe Text) -> Parser ResourceEndpointListItem
forall (f :: * -> *) a b. Applicative f => 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
"ResourceEndpoint")
      )

instance Prelude.Hashable ResourceEndpointListItem

instance Prelude.NFData ResourceEndpointListItem