{-# 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.Chime.Types.SipMediaApplicationEndpoint
-- 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.Chime.Types.SipMediaApplicationEndpoint where

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

-- | The endpoint assigned to the SIP media application.
--
-- /See:/ 'newSipMediaApplicationEndpoint' smart constructor.
data SipMediaApplicationEndpoint = SipMediaApplicationEndpoint'
  { -- | Valid Amazon Resource Name (ARN) of the Lambda function. The function
    -- must be created in the same AWS Region as the SIP media application.
    SipMediaApplicationEndpoint -> Maybe (Sensitive Text)
lambdaArn :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (SipMediaApplicationEndpoint -> SipMediaApplicationEndpoint -> Bool
(SipMediaApplicationEndpoint
 -> SipMediaApplicationEndpoint -> Bool)
-> (SipMediaApplicationEndpoint
    -> SipMediaApplicationEndpoint -> Bool)
-> Eq SipMediaApplicationEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SipMediaApplicationEndpoint -> SipMediaApplicationEndpoint -> Bool
$c/= :: SipMediaApplicationEndpoint -> SipMediaApplicationEndpoint -> Bool
== :: SipMediaApplicationEndpoint -> SipMediaApplicationEndpoint -> Bool
$c== :: SipMediaApplicationEndpoint -> SipMediaApplicationEndpoint -> Bool
Prelude.Eq, Int -> SipMediaApplicationEndpoint -> ShowS
[SipMediaApplicationEndpoint] -> ShowS
SipMediaApplicationEndpoint -> String
(Int -> SipMediaApplicationEndpoint -> ShowS)
-> (SipMediaApplicationEndpoint -> String)
-> ([SipMediaApplicationEndpoint] -> ShowS)
-> Show SipMediaApplicationEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SipMediaApplicationEndpoint] -> ShowS
$cshowList :: [SipMediaApplicationEndpoint] -> ShowS
show :: SipMediaApplicationEndpoint -> String
$cshow :: SipMediaApplicationEndpoint -> String
showsPrec :: Int -> SipMediaApplicationEndpoint -> ShowS
$cshowsPrec :: Int -> SipMediaApplicationEndpoint -> ShowS
Prelude.Show, (forall x.
 SipMediaApplicationEndpoint -> Rep SipMediaApplicationEndpoint x)
-> (forall x.
    Rep SipMediaApplicationEndpoint x -> SipMediaApplicationEndpoint)
-> Generic SipMediaApplicationEndpoint
forall x.
Rep SipMediaApplicationEndpoint x -> SipMediaApplicationEndpoint
forall x.
SipMediaApplicationEndpoint -> Rep SipMediaApplicationEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SipMediaApplicationEndpoint x -> SipMediaApplicationEndpoint
$cfrom :: forall x.
SipMediaApplicationEndpoint -> Rep SipMediaApplicationEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'SipMediaApplicationEndpoint' 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:
--
-- 'lambdaArn', 'sipMediaApplicationEndpoint_lambdaArn' - Valid Amazon Resource Name (ARN) of the Lambda function. The function
-- must be created in the same AWS Region as the SIP media application.
newSipMediaApplicationEndpoint ::
  SipMediaApplicationEndpoint
newSipMediaApplicationEndpoint :: SipMediaApplicationEndpoint
newSipMediaApplicationEndpoint =
  SipMediaApplicationEndpoint' :: Maybe (Sensitive Text) -> SipMediaApplicationEndpoint
SipMediaApplicationEndpoint'
    { $sel:lambdaArn:SipMediaApplicationEndpoint' :: Maybe (Sensitive Text)
lambdaArn =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Valid Amazon Resource Name (ARN) of the Lambda function. The function
-- must be created in the same AWS Region as the SIP media application.
sipMediaApplicationEndpoint_lambdaArn :: Lens.Lens' SipMediaApplicationEndpoint (Prelude.Maybe Prelude.Text)
sipMediaApplicationEndpoint_lambdaArn :: (Maybe Text -> f (Maybe Text))
-> SipMediaApplicationEndpoint -> f SipMediaApplicationEndpoint
sipMediaApplicationEndpoint_lambdaArn = (SipMediaApplicationEndpoint -> Maybe (Sensitive Text))
-> (SipMediaApplicationEndpoint
    -> Maybe (Sensitive Text) -> SipMediaApplicationEndpoint)
-> Lens
     SipMediaApplicationEndpoint
     SipMediaApplicationEndpoint
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplicationEndpoint' {Maybe (Sensitive Text)
lambdaArn :: Maybe (Sensitive Text)
$sel:lambdaArn:SipMediaApplicationEndpoint' :: SipMediaApplicationEndpoint -> Maybe (Sensitive Text)
lambdaArn} -> Maybe (Sensitive Text)
lambdaArn) (\s :: SipMediaApplicationEndpoint
s@SipMediaApplicationEndpoint' {} Maybe (Sensitive Text)
a -> SipMediaApplicationEndpoint
s {$sel:lambdaArn:SipMediaApplicationEndpoint' :: Maybe (Sensitive Text)
lambdaArn = Maybe (Sensitive Text)
a} :: SipMediaApplicationEndpoint) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> SipMediaApplicationEndpoint -> f SipMediaApplicationEndpoint)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> SipMediaApplicationEndpoint
-> f SipMediaApplicationEndpoint
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

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

instance Prelude.Hashable SipMediaApplicationEndpoint

instance Prelude.NFData SipMediaApplicationEndpoint

instance Core.ToJSON SipMediaApplicationEndpoint where
  toJSON :: SipMediaApplicationEndpoint -> Value
toJSON SipMediaApplicationEndpoint' {Maybe (Sensitive Text)
lambdaArn :: Maybe (Sensitive Text)
$sel:lambdaArn:SipMediaApplicationEndpoint' :: SipMediaApplicationEndpoint -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"LambdaArn" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
lambdaArn]
      )