{-# 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.Shield.Types.Protection where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Protection = Protection'
{
Protection -> Maybe Text
protectionArn :: Prelude.Maybe Prelude.Text,
Protection -> Maybe [Text]
healthCheckIds :: Prelude.Maybe [Prelude.Text],
Protection -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
Protection -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Protection -> Maybe Text
id :: Prelude.Maybe Prelude.Text
}
deriving (Protection -> Protection -> Bool
(Protection -> Protection -> Bool)
-> (Protection -> Protection -> Bool) -> Eq Protection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Protection -> Protection -> Bool
$c/= :: Protection -> Protection -> Bool
== :: Protection -> Protection -> Bool
$c== :: Protection -> Protection -> Bool
Prelude.Eq, ReadPrec [Protection]
ReadPrec Protection
Int -> ReadS Protection
ReadS [Protection]
(Int -> ReadS Protection)
-> ReadS [Protection]
-> ReadPrec Protection
-> ReadPrec [Protection]
-> Read Protection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Protection]
$creadListPrec :: ReadPrec [Protection]
readPrec :: ReadPrec Protection
$creadPrec :: ReadPrec Protection
readList :: ReadS [Protection]
$creadList :: ReadS [Protection]
readsPrec :: Int -> ReadS Protection
$creadsPrec :: Int -> ReadS Protection
Prelude.Read, Int -> Protection -> ShowS
[Protection] -> ShowS
Protection -> String
(Int -> Protection -> ShowS)
-> (Protection -> String)
-> ([Protection] -> ShowS)
-> Show Protection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Protection] -> ShowS
$cshowList :: [Protection] -> ShowS
show :: Protection -> String
$cshow :: Protection -> String
showsPrec :: Int -> Protection -> ShowS
$cshowsPrec :: Int -> Protection -> ShowS
Prelude.Show, (forall x. Protection -> Rep Protection x)
-> (forall x. Rep Protection x -> Protection) -> Generic Protection
forall x. Rep Protection x -> Protection
forall x. Protection -> Rep Protection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Protection x -> Protection
$cfrom :: forall x. Protection -> Rep Protection x
Prelude.Generic)
newProtection ::
Protection
newProtection :: Protection
newProtection =
Protection' :: Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Protection
Protection'
{ $sel:protectionArn:Protection' :: Maybe Text
protectionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:healthCheckIds:Protection' :: Maybe [Text]
healthCheckIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:Protection' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:Protection' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:Protection' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
protection_protectionArn :: Lens.Lens' Protection (Prelude.Maybe Prelude.Text)
protection_protectionArn :: (Maybe Text -> f (Maybe Text)) -> Protection -> f Protection
protection_protectionArn = (Protection -> Maybe Text)
-> (Protection -> Maybe Text -> Protection)
-> Lens Protection Protection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Protection' {Maybe Text
protectionArn :: Maybe Text
$sel:protectionArn:Protection' :: Protection -> Maybe Text
protectionArn} -> Maybe Text
protectionArn) (\s :: Protection
s@Protection' {} Maybe Text
a -> Protection
s {$sel:protectionArn:Protection' :: Maybe Text
protectionArn = Maybe Text
a} :: Protection)
protection_healthCheckIds :: Lens.Lens' Protection (Prelude.Maybe [Prelude.Text])
protection_healthCheckIds :: (Maybe [Text] -> f (Maybe [Text])) -> Protection -> f Protection
protection_healthCheckIds = (Protection -> Maybe [Text])
-> (Protection -> Maybe [Text] -> Protection)
-> Lens Protection Protection (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Protection' {Maybe [Text]
healthCheckIds :: Maybe [Text]
$sel:healthCheckIds:Protection' :: Protection -> Maybe [Text]
healthCheckIds} -> Maybe [Text]
healthCheckIds) (\s :: Protection
s@Protection' {} Maybe [Text]
a -> Protection
s {$sel:healthCheckIds:Protection' :: Maybe [Text]
healthCheckIds = Maybe [Text]
a} :: Protection) ((Maybe [Text] -> f (Maybe [Text])) -> Protection -> f Protection)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Protection
-> f Protection
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
protection_resourceArn :: Lens.Lens' Protection (Prelude.Maybe Prelude.Text)
protection_resourceArn :: (Maybe Text -> f (Maybe Text)) -> Protection -> f Protection
protection_resourceArn = (Protection -> Maybe Text)
-> (Protection -> Maybe Text -> Protection)
-> Lens Protection Protection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Protection' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:Protection' :: Protection -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: Protection
s@Protection' {} Maybe Text
a -> Protection
s {$sel:resourceArn:Protection' :: Maybe Text
resourceArn = Maybe Text
a} :: Protection)
protection_name :: Lens.Lens' Protection (Prelude.Maybe Prelude.Text)
protection_name :: (Maybe Text -> f (Maybe Text)) -> Protection -> f Protection
protection_name = (Protection -> Maybe Text)
-> (Protection -> Maybe Text -> Protection)
-> Lens Protection Protection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Protection' {Maybe Text
name :: Maybe Text
$sel:name:Protection' :: Protection -> Maybe Text
name} -> Maybe Text
name) (\s :: Protection
s@Protection' {} Maybe Text
a -> Protection
s {$sel:name:Protection' :: Maybe Text
name = Maybe Text
a} :: Protection)
protection_id :: Lens.Lens' Protection (Prelude.Maybe Prelude.Text)
protection_id :: (Maybe Text -> f (Maybe Text)) -> Protection -> f Protection
protection_id = (Protection -> Maybe Text)
-> (Protection -> Maybe Text -> Protection)
-> Lens Protection Protection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Protection' {Maybe Text
id :: Maybe Text
$sel:id:Protection' :: Protection -> Maybe Text
id} -> Maybe Text
id) (\s :: Protection
s@Protection' {} Maybe Text
a -> Protection
s {$sel:id:Protection' :: Maybe Text
id = Maybe Text
a} :: Protection)
instance Core.FromJSON Protection where
parseJSON :: Value -> Parser Protection
parseJSON =
String
-> (Object -> Parser Protection) -> Value -> Parser Protection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Protection"
( \Object
x ->
Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Protection
Protection'
(Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Protection)
-> Parser (Maybe Text)
-> Parser
(Maybe [Text]
-> Maybe Text -> Maybe Text -> Maybe Text -> Protection)
forall (f :: * -> *) a b. Functor 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
"ProtectionArn")
Parser
(Maybe [Text]
-> Maybe Text -> Maybe Text -> Maybe Text -> Protection)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Protection)
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
"HealthCheckIds" 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 Text -> Maybe Text -> Maybe Text -> Protection)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Protection)
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
"ResourceArn")
Parser (Maybe Text -> Maybe Text -> Protection)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Protection)
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 -> Protection)
-> Parser (Maybe Text) -> Parser Protection
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
"Id")
)
instance Prelude.Hashable Protection
instance Prelude.NFData Protection