{-# 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 #-}
module Amazonka.Chime.Types.SipRule where
import Amazonka.Chime.Types.SipRuleTargetApplication
import Amazonka.Chime.Types.SipRuleTriggerType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SipRule = SipRule'
{
SipRule -> Maybe Bool
disabled :: Prelude.Maybe Prelude.Bool,
SipRule -> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications :: Prelude.Maybe (Prelude.NonEmpty SipRuleTargetApplication),
SipRule -> Maybe SipRuleTriggerType
triggerType :: Prelude.Maybe SipRuleTriggerType,
SipRule -> Maybe POSIX
updatedTimestamp :: Prelude.Maybe Core.POSIX,
SipRule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
SipRule -> Maybe Text
triggerValue :: Prelude.Maybe Prelude.Text,
SipRule -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX,
SipRule -> Maybe Text
sipRuleId :: Prelude.Maybe Prelude.Text
}
deriving (SipRule -> SipRule -> Bool
(SipRule -> SipRule -> Bool)
-> (SipRule -> SipRule -> Bool) -> Eq SipRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SipRule -> SipRule -> Bool
$c/= :: SipRule -> SipRule -> Bool
== :: SipRule -> SipRule -> Bool
$c== :: SipRule -> SipRule -> Bool
Prelude.Eq, ReadPrec [SipRule]
ReadPrec SipRule
Int -> ReadS SipRule
ReadS [SipRule]
(Int -> ReadS SipRule)
-> ReadS [SipRule]
-> ReadPrec SipRule
-> ReadPrec [SipRule]
-> Read SipRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SipRule]
$creadListPrec :: ReadPrec [SipRule]
readPrec :: ReadPrec SipRule
$creadPrec :: ReadPrec SipRule
readList :: ReadS [SipRule]
$creadList :: ReadS [SipRule]
readsPrec :: Int -> ReadS SipRule
$creadsPrec :: Int -> ReadS SipRule
Prelude.Read, Int -> SipRule -> ShowS
[SipRule] -> ShowS
SipRule -> String
(Int -> SipRule -> ShowS)
-> (SipRule -> String) -> ([SipRule] -> ShowS) -> Show SipRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SipRule] -> ShowS
$cshowList :: [SipRule] -> ShowS
show :: SipRule -> String
$cshow :: SipRule -> String
showsPrec :: Int -> SipRule -> ShowS
$cshowsPrec :: Int -> SipRule -> ShowS
Prelude.Show, (forall x. SipRule -> Rep SipRule x)
-> (forall x. Rep SipRule x -> SipRule) -> Generic SipRule
forall x. Rep SipRule x -> SipRule
forall x. SipRule -> Rep SipRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SipRule x -> SipRule
$cfrom :: forall x. SipRule -> Rep SipRule x
Prelude.Generic)
newSipRule ::
SipRule
newSipRule :: SipRule
newSipRule =
SipRule' :: Maybe Bool
-> Maybe (NonEmpty SipRuleTargetApplication)
-> Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule
SipRule'
{ $sel:disabled:SipRule' :: Maybe Bool
disabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:targetApplications:SipRule' :: Maybe (NonEmpty SipRuleTargetApplication)
targetApplications = Maybe (NonEmpty SipRuleTargetApplication)
forall a. Maybe a
Prelude.Nothing,
$sel:triggerType:SipRule' :: Maybe SipRuleTriggerType
triggerType = Maybe SipRuleTriggerType
forall a. Maybe a
Prelude.Nothing,
$sel:updatedTimestamp:SipRule' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:name:SipRule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:triggerValue:SipRule' :: Maybe Text
triggerValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createdTimestamp:SipRule' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:sipRuleId:SipRule' :: Maybe Text
sipRuleId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
sipRule_disabled :: Lens.Lens' SipRule (Prelude.Maybe Prelude.Bool)
sipRule_disabled :: (Maybe Bool -> f (Maybe Bool)) -> SipRule -> f SipRule
sipRule_disabled = (SipRule -> Maybe Bool)
-> (SipRule -> Maybe Bool -> SipRule)
-> Lens SipRule SipRule (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe Bool
disabled :: Maybe Bool
$sel:disabled:SipRule' :: SipRule -> Maybe Bool
disabled} -> Maybe Bool
disabled) (\s :: SipRule
s@SipRule' {} Maybe Bool
a -> SipRule
s {$sel:disabled:SipRule' :: Maybe Bool
disabled = Maybe Bool
a} :: SipRule)
sipRule_targetApplications :: Lens.Lens' SipRule (Prelude.Maybe (Prelude.NonEmpty SipRuleTargetApplication))
sipRule_targetApplications :: (Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> SipRule -> f SipRule
sipRule_targetApplications = (SipRule -> Maybe (NonEmpty SipRuleTargetApplication))
-> (SipRule
-> Maybe (NonEmpty SipRuleTargetApplication) -> SipRule)
-> Lens
SipRule
SipRule
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe (NonEmpty SipRuleTargetApplication)
targetApplications :: Maybe (NonEmpty SipRuleTargetApplication)
$sel:targetApplications:SipRule' :: SipRule -> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications} -> Maybe (NonEmpty SipRuleTargetApplication)
targetApplications) (\s :: SipRule
s@SipRule' {} Maybe (NonEmpty SipRuleTargetApplication)
a -> SipRule
s {$sel:targetApplications:SipRule' :: Maybe (NonEmpty SipRuleTargetApplication)
targetApplications = Maybe (NonEmpty SipRuleTargetApplication)
a} :: SipRule) ((Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> SipRule -> f SipRule)
-> ((Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> (Maybe (NonEmpty SipRuleTargetApplication)
-> f (Maybe (NonEmpty SipRuleTargetApplication)))
-> SipRule
-> f SipRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
-> Iso
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
(Maybe (NonEmpty SipRuleTargetApplication))
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 SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
(NonEmpty SipRuleTargetApplication)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
sipRule_triggerType :: Lens.Lens' SipRule (Prelude.Maybe SipRuleTriggerType)
sipRule_triggerType :: (Maybe SipRuleTriggerType -> f (Maybe SipRuleTriggerType))
-> SipRule -> f SipRule
sipRule_triggerType = (SipRule -> Maybe SipRuleTriggerType)
-> (SipRule -> Maybe SipRuleTriggerType -> SipRule)
-> Lens
SipRule
SipRule
(Maybe SipRuleTriggerType)
(Maybe SipRuleTriggerType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe SipRuleTriggerType
triggerType :: Maybe SipRuleTriggerType
$sel:triggerType:SipRule' :: SipRule -> Maybe SipRuleTriggerType
triggerType} -> Maybe SipRuleTriggerType
triggerType) (\s :: SipRule
s@SipRule' {} Maybe SipRuleTriggerType
a -> SipRule
s {$sel:triggerType:SipRule' :: Maybe SipRuleTriggerType
triggerType = Maybe SipRuleTriggerType
a} :: SipRule)
sipRule_updatedTimestamp :: Lens.Lens' SipRule (Prelude.Maybe Prelude.UTCTime)
sipRule_updatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> SipRule -> f SipRule
sipRule_updatedTimestamp = (SipRule -> Maybe POSIX)
-> (SipRule -> Maybe POSIX -> SipRule)
-> Lens SipRule SipRule (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe POSIX
updatedTimestamp :: Maybe POSIX
$sel:updatedTimestamp:SipRule' :: SipRule -> Maybe POSIX
updatedTimestamp} -> Maybe POSIX
updatedTimestamp) (\s :: SipRule
s@SipRule' {} Maybe POSIX
a -> SipRule
s {$sel:updatedTimestamp:SipRule' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
a} :: SipRule) ((Maybe POSIX -> f (Maybe POSIX)) -> SipRule -> f SipRule)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SipRule
-> f SipRule
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
sipRule_name :: Lens.Lens' SipRule (Prelude.Maybe Prelude.Text)
sipRule_name :: (Maybe Text -> f (Maybe Text)) -> SipRule -> f SipRule
sipRule_name = (SipRule -> Maybe Text)
-> (SipRule -> Maybe Text -> SipRule)
-> Lens SipRule SipRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe Text
name :: Maybe Text
$sel:name:SipRule' :: SipRule -> Maybe Text
name} -> Maybe Text
name) (\s :: SipRule
s@SipRule' {} Maybe Text
a -> SipRule
s {$sel:name:SipRule' :: Maybe Text
name = Maybe Text
a} :: SipRule)
sipRule_triggerValue :: Lens.Lens' SipRule (Prelude.Maybe Prelude.Text)
sipRule_triggerValue :: (Maybe Text -> f (Maybe Text)) -> SipRule -> f SipRule
sipRule_triggerValue = (SipRule -> Maybe Text)
-> (SipRule -> Maybe Text -> SipRule)
-> Lens SipRule SipRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe Text
triggerValue :: Maybe Text
$sel:triggerValue:SipRule' :: SipRule -> Maybe Text
triggerValue} -> Maybe Text
triggerValue) (\s :: SipRule
s@SipRule' {} Maybe Text
a -> SipRule
s {$sel:triggerValue:SipRule' :: Maybe Text
triggerValue = Maybe Text
a} :: SipRule)
sipRule_createdTimestamp :: Lens.Lens' SipRule (Prelude.Maybe Prelude.UTCTime)
sipRule_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> SipRule -> f SipRule
sipRule_createdTimestamp = (SipRule -> Maybe POSIX)
-> (SipRule -> Maybe POSIX -> SipRule)
-> Lens SipRule SipRule (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:SipRule' :: SipRule -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: SipRule
s@SipRule' {} Maybe POSIX
a -> SipRule
s {$sel:createdTimestamp:SipRule' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: SipRule) ((Maybe POSIX -> f (Maybe POSIX)) -> SipRule -> f SipRule)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SipRule
-> f SipRule
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
sipRule_sipRuleId :: Lens.Lens' SipRule (Prelude.Maybe Prelude.Text)
sipRule_sipRuleId :: (Maybe Text -> f (Maybe Text)) -> SipRule -> f SipRule
sipRule_sipRuleId = (SipRule -> Maybe Text)
-> (SipRule -> Maybe Text -> SipRule)
-> Lens SipRule SipRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SipRule' {Maybe Text
sipRuleId :: Maybe Text
$sel:sipRuleId:SipRule' :: SipRule -> Maybe Text
sipRuleId} -> Maybe Text
sipRuleId) (\s :: SipRule
s@SipRule' {} Maybe Text
a -> SipRule
s {$sel:sipRuleId:SipRule' :: Maybe Text
sipRuleId = Maybe Text
a} :: SipRule)
instance Core.FromJSON SipRule where
parseJSON :: Value -> Parser SipRule
parseJSON =
String -> (Object -> Parser SipRule) -> Value -> Parser SipRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SipRule"
( \Object
x ->
Maybe Bool
-> Maybe (NonEmpty SipRuleTargetApplication)
-> Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule
SipRule'
(Maybe Bool
-> Maybe (NonEmpty SipRuleTargetApplication)
-> Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
-> Parser (Maybe Bool)
-> Parser
(Maybe (NonEmpty SipRuleTargetApplication)
-> Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Disabled")
Parser
(Maybe (NonEmpty SipRuleTargetApplication)
-> Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
-> Parser (Maybe (NonEmpty SipRuleTargetApplication))
-> Parser
(Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty SipRuleTargetApplication))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetApplications")
Parser
(Maybe SipRuleTriggerType
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
-> Parser (Maybe SipRuleTriggerType)
-> Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SipRuleTriggerType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TriggerType")
Parser
(Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> SipRule)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text -> Maybe Text -> Maybe POSIX -> Maybe Text -> SipRule)
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
"UpdatedTimestamp")
Parser
(Maybe Text -> Maybe Text -> Maybe POSIX -> Maybe Text -> SipRule)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> SipRule)
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 POSIX -> Maybe Text -> SipRule)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> SipRule)
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
"TriggerValue")
Parser (Maybe POSIX -> Maybe Text -> SipRule)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> SipRule)
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 -> SipRule)
-> Parser (Maybe Text) -> Parser SipRule
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
"SipRuleId")
)
instance Prelude.Hashable SipRule
instance Prelude.NFData SipRule