{-# 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.SipMediaApplication
-- 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.SipMediaApplication where

import Amazonka.Chime.Types.SipMediaApplicationEndpoint
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of the SIP media application, including name and endpoints.
-- An AWS account can have multiple SIP media applications.
--
-- /See:/ 'newSipMediaApplication' smart constructor.
data SipMediaApplication = SipMediaApplication'
  { -- | The SIP media application updated timestamp, in ISO 8601 format.
    SipMediaApplication -> Maybe POSIX
updatedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The name of the SIP media application.
    SipMediaApplication -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The AWS Region in which the SIP media application is created.
    SipMediaApplication -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
    -- | List of endpoints for SIP media application. Currently, only one
    -- endpoint per SIP media application is permitted.
    SipMediaApplication -> Maybe (NonEmpty SipMediaApplicationEndpoint)
endpoints :: Prelude.Maybe (Prelude.NonEmpty SipMediaApplicationEndpoint),
    -- | The SIP media application creation timestamp, in ISO 8601 format.
    SipMediaApplication -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The SIP media application ID.
    SipMediaApplication -> Maybe Text
sipMediaApplicationId :: Prelude.Maybe Prelude.Text
  }
  deriving (SipMediaApplication -> SipMediaApplication -> Bool
(SipMediaApplication -> SipMediaApplication -> Bool)
-> (SipMediaApplication -> SipMediaApplication -> Bool)
-> Eq SipMediaApplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SipMediaApplication -> SipMediaApplication -> Bool
$c/= :: SipMediaApplication -> SipMediaApplication -> Bool
== :: SipMediaApplication -> SipMediaApplication -> Bool
$c== :: SipMediaApplication -> SipMediaApplication -> Bool
Prelude.Eq, Int -> SipMediaApplication -> ShowS
[SipMediaApplication] -> ShowS
SipMediaApplication -> String
(Int -> SipMediaApplication -> ShowS)
-> (SipMediaApplication -> String)
-> ([SipMediaApplication] -> ShowS)
-> Show SipMediaApplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SipMediaApplication] -> ShowS
$cshowList :: [SipMediaApplication] -> ShowS
show :: SipMediaApplication -> String
$cshow :: SipMediaApplication -> String
showsPrec :: Int -> SipMediaApplication -> ShowS
$cshowsPrec :: Int -> SipMediaApplication -> ShowS
Prelude.Show, (forall x. SipMediaApplication -> Rep SipMediaApplication x)
-> (forall x. Rep SipMediaApplication x -> SipMediaApplication)
-> Generic SipMediaApplication
forall x. Rep SipMediaApplication x -> SipMediaApplication
forall x. SipMediaApplication -> Rep SipMediaApplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SipMediaApplication x -> SipMediaApplication
$cfrom :: forall x. SipMediaApplication -> Rep SipMediaApplication x
Prelude.Generic)

-- |
-- Create a value of 'SipMediaApplication' 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:
--
-- 'updatedTimestamp', 'sipMediaApplication_updatedTimestamp' - The SIP media application updated timestamp, in ISO 8601 format.
--
-- 'name', 'sipMediaApplication_name' - The name of the SIP media application.
--
-- 'awsRegion', 'sipMediaApplication_awsRegion' - The AWS Region in which the SIP media application is created.
--
-- 'endpoints', 'sipMediaApplication_endpoints' - List of endpoints for SIP media application. Currently, only one
-- endpoint per SIP media application is permitted.
--
-- 'createdTimestamp', 'sipMediaApplication_createdTimestamp' - The SIP media application creation timestamp, in ISO 8601 format.
--
-- 'sipMediaApplicationId', 'sipMediaApplication_sipMediaApplicationId' - The SIP media application ID.
newSipMediaApplication ::
  SipMediaApplication
newSipMediaApplication :: SipMediaApplication
newSipMediaApplication =
  SipMediaApplication' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty SipMediaApplicationEndpoint)
-> Maybe POSIX
-> Maybe Text
-> SipMediaApplication
SipMediaApplication'
    { $sel:updatedTimestamp:SipMediaApplication' :: Maybe POSIX
updatedTimestamp =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SipMediaApplication' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsRegion:SipMediaApplication' :: Maybe Text
awsRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpoints:SipMediaApplication' :: Maybe (NonEmpty SipMediaApplicationEndpoint)
endpoints = Maybe (NonEmpty SipMediaApplicationEndpoint)
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:SipMediaApplication' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:sipMediaApplicationId:SipMediaApplication' :: Maybe Text
sipMediaApplicationId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The SIP media application updated timestamp, in ISO 8601 format.
sipMediaApplication_updatedTimestamp :: Lens.Lens' SipMediaApplication (Prelude.Maybe Prelude.UTCTime)
sipMediaApplication_updatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SipMediaApplication -> f SipMediaApplication
sipMediaApplication_updatedTimestamp = (SipMediaApplication -> Maybe POSIX)
-> (SipMediaApplication -> Maybe POSIX -> SipMediaApplication)
-> Lens
     SipMediaApplication SipMediaApplication (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplication' {Maybe POSIX
updatedTimestamp :: Maybe POSIX
$sel:updatedTimestamp:SipMediaApplication' :: SipMediaApplication -> Maybe POSIX
updatedTimestamp} -> Maybe POSIX
updatedTimestamp) (\s :: SipMediaApplication
s@SipMediaApplication' {} Maybe POSIX
a -> SipMediaApplication
s {$sel:updatedTimestamp:SipMediaApplication' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
a} :: SipMediaApplication) ((Maybe POSIX -> f (Maybe POSIX))
 -> SipMediaApplication -> f SipMediaApplication)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SipMediaApplication
-> f SipMediaApplication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the SIP media application.
sipMediaApplication_name :: Lens.Lens' SipMediaApplication (Prelude.Maybe Prelude.Text)
sipMediaApplication_name :: (Maybe Text -> f (Maybe Text))
-> SipMediaApplication -> f SipMediaApplication
sipMediaApplication_name = (SipMediaApplication -> Maybe Text)
-> (SipMediaApplication -> Maybe Text -> SipMediaApplication)
-> Lens
     SipMediaApplication SipMediaApplication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplication' {Maybe Text
name :: Maybe Text
$sel:name:SipMediaApplication' :: SipMediaApplication -> Maybe Text
name} -> Maybe Text
name) (\s :: SipMediaApplication
s@SipMediaApplication' {} Maybe Text
a -> SipMediaApplication
s {$sel:name:SipMediaApplication' :: Maybe Text
name = Maybe Text
a} :: SipMediaApplication)

-- | The AWS Region in which the SIP media application is created.
sipMediaApplication_awsRegion :: Lens.Lens' SipMediaApplication (Prelude.Maybe Prelude.Text)
sipMediaApplication_awsRegion :: (Maybe Text -> f (Maybe Text))
-> SipMediaApplication -> f SipMediaApplication
sipMediaApplication_awsRegion = (SipMediaApplication -> Maybe Text)
-> (SipMediaApplication -> Maybe Text -> SipMediaApplication)
-> Lens
     SipMediaApplication SipMediaApplication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplication' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:SipMediaApplication' :: SipMediaApplication -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: SipMediaApplication
s@SipMediaApplication' {} Maybe Text
a -> SipMediaApplication
s {$sel:awsRegion:SipMediaApplication' :: Maybe Text
awsRegion = Maybe Text
a} :: SipMediaApplication)

-- | List of endpoints for SIP media application. Currently, only one
-- endpoint per SIP media application is permitted.
sipMediaApplication_endpoints :: Lens.Lens' SipMediaApplication (Prelude.Maybe (Prelude.NonEmpty SipMediaApplicationEndpoint))
sipMediaApplication_endpoints :: (Maybe (NonEmpty SipMediaApplicationEndpoint)
 -> f (Maybe (NonEmpty SipMediaApplicationEndpoint)))
-> SipMediaApplication -> f SipMediaApplication
sipMediaApplication_endpoints = (SipMediaApplication
 -> Maybe (NonEmpty SipMediaApplicationEndpoint))
-> (SipMediaApplication
    -> Maybe (NonEmpty SipMediaApplicationEndpoint)
    -> SipMediaApplication)
-> Lens
     SipMediaApplication
     SipMediaApplication
     (Maybe (NonEmpty SipMediaApplicationEndpoint))
     (Maybe (NonEmpty SipMediaApplicationEndpoint))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplication' {Maybe (NonEmpty SipMediaApplicationEndpoint)
endpoints :: Maybe (NonEmpty SipMediaApplicationEndpoint)
$sel:endpoints:SipMediaApplication' :: SipMediaApplication -> Maybe (NonEmpty SipMediaApplicationEndpoint)
endpoints} -> Maybe (NonEmpty SipMediaApplicationEndpoint)
endpoints) (\s :: SipMediaApplication
s@SipMediaApplication' {} Maybe (NonEmpty SipMediaApplicationEndpoint)
a -> SipMediaApplication
s {$sel:endpoints:SipMediaApplication' :: Maybe (NonEmpty SipMediaApplicationEndpoint)
endpoints = Maybe (NonEmpty SipMediaApplicationEndpoint)
a} :: SipMediaApplication) ((Maybe (NonEmpty SipMediaApplicationEndpoint)
  -> f (Maybe (NonEmpty SipMediaApplicationEndpoint)))
 -> SipMediaApplication -> f SipMediaApplication)
-> ((Maybe (NonEmpty SipMediaApplicationEndpoint)
     -> f (Maybe (NonEmpty SipMediaApplicationEndpoint)))
    -> Maybe (NonEmpty SipMediaApplicationEndpoint)
    -> f (Maybe (NonEmpty SipMediaApplicationEndpoint)))
-> (Maybe (NonEmpty SipMediaApplicationEndpoint)
    -> f (Maybe (NonEmpty SipMediaApplicationEndpoint)))
-> SipMediaApplication
-> f SipMediaApplication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty SipMediaApplicationEndpoint)
  (NonEmpty SipMediaApplicationEndpoint)
  (NonEmpty SipMediaApplicationEndpoint)
  (NonEmpty SipMediaApplicationEndpoint)
-> Iso
     (Maybe (NonEmpty SipMediaApplicationEndpoint))
     (Maybe (NonEmpty SipMediaApplicationEndpoint))
     (Maybe (NonEmpty SipMediaApplicationEndpoint))
     (Maybe (NonEmpty SipMediaApplicationEndpoint))
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 SipMediaApplicationEndpoint)
  (NonEmpty SipMediaApplicationEndpoint)
  (NonEmpty SipMediaApplicationEndpoint)
  (NonEmpty SipMediaApplicationEndpoint)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The SIP media application creation timestamp, in ISO 8601 format.
sipMediaApplication_createdTimestamp :: Lens.Lens' SipMediaApplication (Prelude.Maybe Prelude.UTCTime)
sipMediaApplication_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SipMediaApplication -> f SipMediaApplication
sipMediaApplication_createdTimestamp = (SipMediaApplication -> Maybe POSIX)
-> (SipMediaApplication -> Maybe POSIX -> SipMediaApplication)
-> Lens
     SipMediaApplication SipMediaApplication (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplication' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:SipMediaApplication' :: SipMediaApplication -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: SipMediaApplication
s@SipMediaApplication' {} Maybe POSIX
a -> SipMediaApplication
s {$sel:createdTimestamp:SipMediaApplication' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: SipMediaApplication) ((Maybe POSIX -> f (Maybe POSIX))
 -> SipMediaApplication -> f SipMediaApplication)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SipMediaApplication
-> f SipMediaApplication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The SIP media application ID.
sipMediaApplication_sipMediaApplicationId :: Lens.Lens' SipMediaApplication (Prelude.Maybe Prelude.Text)
sipMediaApplication_sipMediaApplicationId :: (Maybe Text -> f (Maybe Text))
-> SipMediaApplication -> f SipMediaApplication
sipMediaApplication_sipMediaApplicationId = (SipMediaApplication -> Maybe Text)
-> (SipMediaApplication -> Maybe Text -> SipMediaApplication)
-> Lens
     SipMediaApplication SipMediaApplication (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipMediaApplication' {Maybe Text
sipMediaApplicationId :: Maybe Text
$sel:sipMediaApplicationId:SipMediaApplication' :: SipMediaApplication -> Maybe Text
sipMediaApplicationId} -> Maybe Text
sipMediaApplicationId) (\s :: SipMediaApplication
s@SipMediaApplication' {} Maybe Text
a -> SipMediaApplication
s {$sel:sipMediaApplicationId:SipMediaApplication' :: Maybe Text
sipMediaApplicationId = Maybe Text
a} :: SipMediaApplication)

instance Core.FromJSON SipMediaApplication where
  parseJSON :: Value -> Parser SipMediaApplication
parseJSON =
    String
-> (Object -> Parser SipMediaApplication)
-> Value
-> Parser SipMediaApplication
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SipMediaApplication"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty SipMediaApplicationEndpoint)
-> Maybe POSIX
-> Maybe Text
-> SipMediaApplication
SipMediaApplication'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty SipMediaApplicationEndpoint)
 -> Maybe POSIX
 -> Maybe Text
 -> SipMediaApplication)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty SipMediaApplicationEndpoint)
      -> Maybe POSIX
      -> Maybe Text
      -> SipMediaApplication)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedTimestamp")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty SipMediaApplicationEndpoint)
   -> Maybe POSIX
   -> Maybe Text
   -> SipMediaApplication)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty SipMediaApplicationEndpoint)
      -> Maybe POSIX
      -> Maybe Text
      -> SipMediaApplication)
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
"Name")
            Parser
  (Maybe Text
   -> Maybe (NonEmpty SipMediaApplicationEndpoint)
   -> Maybe POSIX
   -> Maybe Text
   -> SipMediaApplication)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty SipMediaApplicationEndpoint)
      -> Maybe POSIX -> Maybe Text -> SipMediaApplication)
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
"AwsRegion")
            Parser
  (Maybe (NonEmpty SipMediaApplicationEndpoint)
   -> Maybe POSIX -> Maybe Text -> SipMediaApplication)
-> Parser (Maybe (NonEmpty SipMediaApplicationEndpoint))
-> Parser (Maybe POSIX -> Maybe Text -> SipMediaApplication)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty SipMediaApplicationEndpoint))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Endpoints")
            Parser (Maybe POSIX -> Maybe Text -> SipMediaApplication)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> SipMediaApplication)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTimestamp")
            Parser (Maybe Text -> SipMediaApplication)
-> Parser (Maybe Text) -> Parser SipMediaApplication
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
"SipMediaApplicationId")
      )

instance Prelude.Hashable SipMediaApplication

instance Prelude.NFData SipMediaApplication