{-# 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.Termination where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Termination = Termination'
{
Termination -> Maybe (Sensitive Text)
defaultPhoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
Termination -> Maybe Bool
disabled :: Prelude.Maybe Prelude.Bool,
Termination -> Maybe [Text]
callingRegions :: Prelude.Maybe [Prelude.Text],
Termination -> Maybe Natural
cpsLimit :: Prelude.Maybe Prelude.Natural,
Termination -> Maybe [Text]
cidrAllowedList :: Prelude.Maybe [Prelude.Text]
}
deriving (Termination -> Termination -> Bool
(Termination -> Termination -> Bool)
-> (Termination -> Termination -> Bool) -> Eq Termination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Termination -> Termination -> Bool
$c/= :: Termination -> Termination -> Bool
== :: Termination -> Termination -> Bool
$c== :: Termination -> Termination -> Bool
Prelude.Eq, Int -> Termination -> ShowS
[Termination] -> ShowS
Termination -> String
(Int -> Termination -> ShowS)
-> (Termination -> String)
-> ([Termination] -> ShowS)
-> Show Termination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Termination] -> ShowS
$cshowList :: [Termination] -> ShowS
show :: Termination -> String
$cshow :: Termination -> String
showsPrec :: Int -> Termination -> ShowS
$cshowsPrec :: Int -> Termination -> ShowS
Prelude.Show, (forall x. Termination -> Rep Termination x)
-> (forall x. Rep Termination x -> Termination)
-> Generic Termination
forall x. Rep Termination x -> Termination
forall x. Termination -> Rep Termination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Termination x -> Termination
$cfrom :: forall x. Termination -> Rep Termination x
Prelude.Generic)
newTermination ::
Termination
newTermination :: Termination
newTermination =
Termination' :: Maybe (Sensitive Text)
-> Maybe Bool
-> Maybe [Text]
-> Maybe Natural
-> Maybe [Text]
-> Termination
Termination'
{ $sel:defaultPhoneNumber:Termination' :: Maybe (Sensitive Text)
defaultPhoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:disabled:Termination' :: Maybe Bool
disabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:callingRegions:Termination' :: Maybe [Text]
callingRegions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:cpsLimit:Termination' :: Maybe Natural
cpsLimit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:cidrAllowedList:Termination' :: Maybe [Text]
cidrAllowedList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
termination_defaultPhoneNumber :: Lens.Lens' Termination (Prelude.Maybe Prelude.Text)
termination_defaultPhoneNumber :: (Maybe Text -> f (Maybe Text)) -> Termination -> f Termination
termination_defaultPhoneNumber = (Termination -> Maybe (Sensitive Text))
-> (Termination -> Maybe (Sensitive Text) -> Termination)
-> Lens
Termination
Termination
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Termination' {Maybe (Sensitive Text)
defaultPhoneNumber :: Maybe (Sensitive Text)
$sel:defaultPhoneNumber:Termination' :: Termination -> Maybe (Sensitive Text)
defaultPhoneNumber} -> Maybe (Sensitive Text)
defaultPhoneNumber) (\s :: Termination
s@Termination' {} Maybe (Sensitive Text)
a -> Termination
s {$sel:defaultPhoneNumber:Termination' :: Maybe (Sensitive Text)
defaultPhoneNumber = Maybe (Sensitive Text)
a} :: Termination) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Termination -> f Termination)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Termination
-> f Termination
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
termination_disabled :: Lens.Lens' Termination (Prelude.Maybe Prelude.Bool)
termination_disabled :: (Maybe Bool -> f (Maybe Bool)) -> Termination -> f Termination
termination_disabled = (Termination -> Maybe Bool)
-> (Termination -> Maybe Bool -> Termination)
-> Lens Termination Termination (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Termination' {Maybe Bool
disabled :: Maybe Bool
$sel:disabled:Termination' :: Termination -> Maybe Bool
disabled} -> Maybe Bool
disabled) (\s :: Termination
s@Termination' {} Maybe Bool
a -> Termination
s {$sel:disabled:Termination' :: Maybe Bool
disabled = Maybe Bool
a} :: Termination)
termination_callingRegions :: Lens.Lens' Termination (Prelude.Maybe [Prelude.Text])
termination_callingRegions :: (Maybe [Text] -> f (Maybe [Text])) -> Termination -> f Termination
termination_callingRegions = (Termination -> Maybe [Text])
-> (Termination -> Maybe [Text] -> Termination)
-> Lens Termination Termination (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Termination' {Maybe [Text]
callingRegions :: Maybe [Text]
$sel:callingRegions:Termination' :: Termination -> Maybe [Text]
callingRegions} -> Maybe [Text]
callingRegions) (\s :: Termination
s@Termination' {} Maybe [Text]
a -> Termination
s {$sel:callingRegions:Termination' :: Maybe [Text]
callingRegions = Maybe [Text]
a} :: Termination) ((Maybe [Text] -> f (Maybe [Text]))
-> Termination -> f Termination)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Termination
-> f Termination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
termination_cpsLimit :: Lens.Lens' Termination (Prelude.Maybe Prelude.Natural)
termination_cpsLimit :: (Maybe Natural -> f (Maybe Natural))
-> Termination -> f Termination
termination_cpsLimit = (Termination -> Maybe Natural)
-> (Termination -> Maybe Natural -> Termination)
-> Lens Termination Termination (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Termination' {Maybe Natural
cpsLimit :: Maybe Natural
$sel:cpsLimit:Termination' :: Termination -> Maybe Natural
cpsLimit} -> Maybe Natural
cpsLimit) (\s :: Termination
s@Termination' {} Maybe Natural
a -> Termination
s {$sel:cpsLimit:Termination' :: Maybe Natural
cpsLimit = Maybe Natural
a} :: Termination)
termination_cidrAllowedList :: Lens.Lens' Termination (Prelude.Maybe [Prelude.Text])
termination_cidrAllowedList :: (Maybe [Text] -> f (Maybe [Text])) -> Termination -> f Termination
termination_cidrAllowedList = (Termination -> Maybe [Text])
-> (Termination -> Maybe [Text] -> Termination)
-> Lens Termination Termination (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Termination' {Maybe [Text]
cidrAllowedList :: Maybe [Text]
$sel:cidrAllowedList:Termination' :: Termination -> Maybe [Text]
cidrAllowedList} -> Maybe [Text]
cidrAllowedList) (\s :: Termination
s@Termination' {} Maybe [Text]
a -> Termination
s {$sel:cidrAllowedList:Termination' :: Maybe [Text]
cidrAllowedList = Maybe [Text]
a} :: Termination) ((Maybe [Text] -> f (Maybe [Text]))
-> Termination -> f Termination)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Termination
-> f Termination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Termination where
parseJSON :: Value -> Parser Termination
parseJSON =
String
-> (Object -> Parser Termination) -> Value -> Parser Termination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Termination"
( \Object
x ->
Maybe (Sensitive Text)
-> Maybe Bool
-> Maybe [Text]
-> Maybe Natural
-> Maybe [Text]
-> Termination
Termination'
(Maybe (Sensitive Text)
-> Maybe Bool
-> Maybe [Text]
-> Maybe Natural
-> Maybe [Text]
-> Termination)
-> Parser (Maybe (Sensitive Text))
-> Parser
(Maybe Bool
-> Maybe [Text] -> Maybe Natural -> Maybe [Text] -> Termination)
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
"DefaultPhoneNumber")
Parser
(Maybe Bool
-> Maybe [Text] -> Maybe Natural -> Maybe [Text] -> Termination)
-> Parser (Maybe Bool)
-> Parser
(Maybe [Text] -> Maybe Natural -> Maybe [Text] -> Termination)
forall (f :: * -> *) a b. Applicative f => 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 [Text] -> Maybe Natural -> Maybe [Text] -> Termination)
-> Parser (Maybe [Text])
-> Parser (Maybe Natural -> Maybe [Text] -> Termination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CallingRegions" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Natural -> Maybe [Text] -> Termination)
-> Parser (Maybe Natural) -> Parser (Maybe [Text] -> Termination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CpsLimit")
Parser (Maybe [Text] -> Termination)
-> Parser (Maybe [Text]) -> Parser Termination
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CidrAllowedList"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Termination
instance Prelude.NFData Termination
instance Core.ToJSON Termination where
toJSON :: Termination -> Value
toJSON Termination' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe (Sensitive Text)
cidrAllowedList :: Maybe [Text]
cpsLimit :: Maybe Natural
callingRegions :: Maybe [Text]
disabled :: Maybe Bool
defaultPhoneNumber :: Maybe (Sensitive Text)
$sel:cidrAllowedList:Termination' :: Termination -> Maybe [Text]
$sel:cpsLimit:Termination' :: Termination -> Maybe Natural
$sel:callingRegions:Termination' :: Termination -> Maybe [Text]
$sel:disabled:Termination' :: Termination -> Maybe Bool
$sel:defaultPhoneNumber:Termination' :: Termination -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DefaultPhoneNumber" 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)
defaultPhoneNumber,
(Text
"Disabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disabled,
(Text
"CallingRegions" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
callingRegions,
(Text
"CpsLimit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
cpsLimit,
(Text
"CidrAllowedList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
cidrAllowedList
]
)