{-# 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.Inspector.Types.Subscription where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types.EventSubscription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Subscription = Subscription'
{
Subscription -> Text
resourceArn :: Prelude.Text,
Subscription -> Text
topicArn :: Prelude.Text,
Subscription -> NonEmpty EventSubscription
eventSubscriptions :: Prelude.NonEmpty EventSubscription
}
deriving (Subscription -> Subscription -> Bool
(Subscription -> Subscription -> Bool)
-> (Subscription -> Subscription -> Bool) -> Eq Subscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Subscription -> Subscription -> Bool
$c/= :: Subscription -> Subscription -> Bool
== :: Subscription -> Subscription -> Bool
$c== :: Subscription -> Subscription -> Bool
Prelude.Eq, ReadPrec [Subscription]
ReadPrec Subscription
Int -> ReadS Subscription
ReadS [Subscription]
(Int -> ReadS Subscription)
-> ReadS [Subscription]
-> ReadPrec Subscription
-> ReadPrec [Subscription]
-> Read Subscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Subscription]
$creadListPrec :: ReadPrec [Subscription]
readPrec :: ReadPrec Subscription
$creadPrec :: ReadPrec Subscription
readList :: ReadS [Subscription]
$creadList :: ReadS [Subscription]
readsPrec :: Int -> ReadS Subscription
$creadsPrec :: Int -> ReadS Subscription
Prelude.Read, Int -> Subscription -> ShowS
[Subscription] -> ShowS
Subscription -> String
(Int -> Subscription -> ShowS)
-> (Subscription -> String)
-> ([Subscription] -> ShowS)
-> Show Subscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Subscription] -> ShowS
$cshowList :: [Subscription] -> ShowS
show :: Subscription -> String
$cshow :: Subscription -> String
showsPrec :: Int -> Subscription -> ShowS
$cshowsPrec :: Int -> Subscription -> ShowS
Prelude.Show, (forall x. Subscription -> Rep Subscription x)
-> (forall x. Rep Subscription x -> Subscription)
-> Generic Subscription
forall x. Rep Subscription x -> Subscription
forall x. Subscription -> Rep Subscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Subscription x -> Subscription
$cfrom :: forall x. Subscription -> Rep Subscription x
Prelude.Generic)
newSubscription ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty EventSubscription ->
Subscription
newSubscription :: Text -> Text -> NonEmpty EventSubscription -> Subscription
newSubscription
Text
pResourceArn_
Text
pTopicArn_
NonEmpty EventSubscription
pEventSubscriptions_ =
Subscription' :: Text -> Text -> NonEmpty EventSubscription -> Subscription
Subscription'
{ $sel:resourceArn:Subscription' :: Text
resourceArn = Text
pResourceArn_,
$sel:topicArn:Subscription' :: Text
topicArn = Text
pTopicArn_,
$sel:eventSubscriptions:Subscription' :: NonEmpty EventSubscription
eventSubscriptions =
Tagged
(NonEmpty EventSubscription)
(Identity (NonEmpty EventSubscription))
-> Tagged
(NonEmpty EventSubscription)
(Identity (NonEmpty EventSubscription))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty EventSubscription)
(Identity (NonEmpty EventSubscription))
-> Tagged
(NonEmpty EventSubscription)
(Identity (NonEmpty EventSubscription)))
-> NonEmpty EventSubscription -> NonEmpty EventSubscription
forall t b. AReview t b -> b -> t
Lens.# NonEmpty EventSubscription
pEventSubscriptions_
}
subscription_resourceArn :: Lens.Lens' Subscription Prelude.Text
subscription_resourceArn :: (Text -> f Text) -> Subscription -> f Subscription
subscription_resourceArn = (Subscription -> Text)
-> (Subscription -> Text -> Subscription)
-> Lens Subscription Subscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Text
resourceArn :: Text
$sel:resourceArn:Subscription' :: Subscription -> Text
resourceArn} -> Text
resourceArn) (\s :: Subscription
s@Subscription' {} Text
a -> Subscription
s {$sel:resourceArn:Subscription' :: Text
resourceArn = Text
a} :: Subscription)
subscription_topicArn :: Lens.Lens' Subscription Prelude.Text
subscription_topicArn :: (Text -> f Text) -> Subscription -> f Subscription
subscription_topicArn = (Subscription -> Text)
-> (Subscription -> Text -> Subscription)
-> Lens Subscription Subscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {Text
topicArn :: Text
$sel:topicArn:Subscription' :: Subscription -> Text
topicArn} -> Text
topicArn) (\s :: Subscription
s@Subscription' {} Text
a -> Subscription
s {$sel:topicArn:Subscription' :: Text
topicArn = Text
a} :: Subscription)
subscription_eventSubscriptions :: Lens.Lens' Subscription (Prelude.NonEmpty EventSubscription)
subscription_eventSubscriptions :: (NonEmpty EventSubscription -> f (NonEmpty EventSubscription))
-> Subscription -> f Subscription
subscription_eventSubscriptions = (Subscription -> NonEmpty EventSubscription)
-> (Subscription -> NonEmpty EventSubscription -> Subscription)
-> Lens
Subscription
Subscription
(NonEmpty EventSubscription)
(NonEmpty EventSubscription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscription' {NonEmpty EventSubscription
eventSubscriptions :: NonEmpty EventSubscription
$sel:eventSubscriptions:Subscription' :: Subscription -> NonEmpty EventSubscription
eventSubscriptions} -> NonEmpty EventSubscription
eventSubscriptions) (\s :: Subscription
s@Subscription' {} NonEmpty EventSubscription
a -> Subscription
s {$sel:eventSubscriptions:Subscription' :: NonEmpty EventSubscription
eventSubscriptions = NonEmpty EventSubscription
a} :: Subscription) ((NonEmpty EventSubscription -> f (NonEmpty EventSubscription))
-> Subscription -> f Subscription)
-> ((NonEmpty EventSubscription -> f (NonEmpty EventSubscription))
-> NonEmpty EventSubscription -> f (NonEmpty EventSubscription))
-> (NonEmpty EventSubscription -> f (NonEmpty EventSubscription))
-> Subscription
-> f Subscription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty EventSubscription -> f (NonEmpty EventSubscription))
-> NonEmpty EventSubscription -> f (NonEmpty EventSubscription)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Subscription where
parseJSON :: Value -> Parser Subscription
parseJSON =
String
-> (Object -> Parser Subscription) -> Value -> Parser Subscription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Subscription"
( \Object
x ->
Text -> Text -> NonEmpty EventSubscription -> Subscription
Subscription'
(Text -> Text -> NonEmpty EventSubscription -> Subscription)
-> Parser Text
-> Parser (Text -> NonEmpty EventSubscription -> Subscription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceArn")
Parser (Text -> NonEmpty EventSubscription -> Subscription)
-> Parser Text
-> Parser (NonEmpty EventSubscription -> Subscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"topicArn")
Parser (NonEmpty EventSubscription -> Subscription)
-> Parser (NonEmpty EventSubscription) -> Parser Subscription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty EventSubscription)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventSubscriptions")
)
instance Prelude.Hashable Subscription
instance Prelude.NFData Subscription