{-# 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.ExclusionPreview where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types.Attribute
import Amazonka.Inspector.Types.Scope
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ExclusionPreview = ExclusionPreview'
{
ExclusionPreview -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
ExclusionPreview -> Text
title :: Prelude.Text,
ExclusionPreview -> Text
description :: Prelude.Text,
ExclusionPreview -> Text
recommendation :: Prelude.Text,
ExclusionPreview -> NonEmpty Scope
scopes :: Prelude.NonEmpty Scope
}
deriving (ExclusionPreview -> ExclusionPreview -> Bool
(ExclusionPreview -> ExclusionPreview -> Bool)
-> (ExclusionPreview -> ExclusionPreview -> Bool)
-> Eq ExclusionPreview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExclusionPreview -> ExclusionPreview -> Bool
$c/= :: ExclusionPreview -> ExclusionPreview -> Bool
== :: ExclusionPreview -> ExclusionPreview -> Bool
$c== :: ExclusionPreview -> ExclusionPreview -> Bool
Prelude.Eq, ReadPrec [ExclusionPreview]
ReadPrec ExclusionPreview
Int -> ReadS ExclusionPreview
ReadS [ExclusionPreview]
(Int -> ReadS ExclusionPreview)
-> ReadS [ExclusionPreview]
-> ReadPrec ExclusionPreview
-> ReadPrec [ExclusionPreview]
-> Read ExclusionPreview
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExclusionPreview]
$creadListPrec :: ReadPrec [ExclusionPreview]
readPrec :: ReadPrec ExclusionPreview
$creadPrec :: ReadPrec ExclusionPreview
readList :: ReadS [ExclusionPreview]
$creadList :: ReadS [ExclusionPreview]
readsPrec :: Int -> ReadS ExclusionPreview
$creadsPrec :: Int -> ReadS ExclusionPreview
Prelude.Read, Int -> ExclusionPreview -> ShowS
[ExclusionPreview] -> ShowS
ExclusionPreview -> String
(Int -> ExclusionPreview -> ShowS)
-> (ExclusionPreview -> String)
-> ([ExclusionPreview] -> ShowS)
-> Show ExclusionPreview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExclusionPreview] -> ShowS
$cshowList :: [ExclusionPreview] -> ShowS
show :: ExclusionPreview -> String
$cshow :: ExclusionPreview -> String
showsPrec :: Int -> ExclusionPreview -> ShowS
$cshowsPrec :: Int -> ExclusionPreview -> ShowS
Prelude.Show, (forall x. ExclusionPreview -> Rep ExclusionPreview x)
-> (forall x. Rep ExclusionPreview x -> ExclusionPreview)
-> Generic ExclusionPreview
forall x. Rep ExclusionPreview x -> ExclusionPreview
forall x. ExclusionPreview -> Rep ExclusionPreview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExclusionPreview x -> ExclusionPreview
$cfrom :: forall x. ExclusionPreview -> Rep ExclusionPreview x
Prelude.Generic)
newExclusionPreview ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty Scope ->
ExclusionPreview
newExclusionPreview :: Text -> Text -> Text -> NonEmpty Scope -> ExclusionPreview
newExclusionPreview
Text
pTitle_
Text
pDescription_
Text
pRecommendation_
NonEmpty Scope
pScopes_ =
ExclusionPreview' :: Maybe [Attribute]
-> Text -> Text -> Text -> NonEmpty Scope -> ExclusionPreview
ExclusionPreview'
{ $sel:attributes:ExclusionPreview' :: Maybe [Attribute]
attributes = Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
$sel:title:ExclusionPreview' :: Text
title = Text
pTitle_,
$sel:description:ExclusionPreview' :: Text
description = Text
pDescription_,
$sel:recommendation:ExclusionPreview' :: Text
recommendation = Text
pRecommendation_,
$sel:scopes:ExclusionPreview' :: NonEmpty Scope
scopes = Tagged (NonEmpty Scope) (Identity (NonEmpty Scope))
-> Tagged (NonEmpty Scope) (Identity (NonEmpty Scope))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Scope) (Identity (NonEmpty Scope))
-> Tagged (NonEmpty Scope) (Identity (NonEmpty Scope)))
-> NonEmpty Scope -> NonEmpty Scope
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Scope
pScopes_
}
exclusionPreview_attributes :: Lens.Lens' ExclusionPreview (Prelude.Maybe [Attribute])
exclusionPreview_attributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> ExclusionPreview -> f ExclusionPreview
exclusionPreview_attributes = (ExclusionPreview -> Maybe [Attribute])
-> (ExclusionPreview -> Maybe [Attribute] -> ExclusionPreview)
-> Lens
ExclusionPreview
ExclusionPreview
(Maybe [Attribute])
(Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExclusionPreview' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:ExclusionPreview' :: ExclusionPreview -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: ExclusionPreview
s@ExclusionPreview' {} Maybe [Attribute]
a -> ExclusionPreview
s {$sel:attributes:ExclusionPreview' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: ExclusionPreview) ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> ExclusionPreview -> f ExclusionPreview)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> ExclusionPreview
-> f ExclusionPreview
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
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 [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
exclusionPreview_title :: Lens.Lens' ExclusionPreview Prelude.Text
exclusionPreview_title :: (Text -> f Text) -> ExclusionPreview -> f ExclusionPreview
exclusionPreview_title = (ExclusionPreview -> Text)
-> (ExclusionPreview -> Text -> ExclusionPreview)
-> Lens ExclusionPreview ExclusionPreview Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExclusionPreview' {Text
title :: Text
$sel:title:ExclusionPreview' :: ExclusionPreview -> Text
title} -> Text
title) (\s :: ExclusionPreview
s@ExclusionPreview' {} Text
a -> ExclusionPreview
s {$sel:title:ExclusionPreview' :: Text
title = Text
a} :: ExclusionPreview)
exclusionPreview_description :: Lens.Lens' ExclusionPreview Prelude.Text
exclusionPreview_description :: (Text -> f Text) -> ExclusionPreview -> f ExclusionPreview
exclusionPreview_description = (ExclusionPreview -> Text)
-> (ExclusionPreview -> Text -> ExclusionPreview)
-> Lens ExclusionPreview ExclusionPreview Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExclusionPreview' {Text
description :: Text
$sel:description:ExclusionPreview' :: ExclusionPreview -> Text
description} -> Text
description) (\s :: ExclusionPreview
s@ExclusionPreview' {} Text
a -> ExclusionPreview
s {$sel:description:ExclusionPreview' :: Text
description = Text
a} :: ExclusionPreview)
exclusionPreview_recommendation :: Lens.Lens' ExclusionPreview Prelude.Text
exclusionPreview_recommendation :: (Text -> f Text) -> ExclusionPreview -> f ExclusionPreview
exclusionPreview_recommendation = (ExclusionPreview -> Text)
-> (ExclusionPreview -> Text -> ExclusionPreview)
-> Lens ExclusionPreview ExclusionPreview Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExclusionPreview' {Text
recommendation :: Text
$sel:recommendation:ExclusionPreview' :: ExclusionPreview -> Text
recommendation} -> Text
recommendation) (\s :: ExclusionPreview
s@ExclusionPreview' {} Text
a -> ExclusionPreview
s {$sel:recommendation:ExclusionPreview' :: Text
recommendation = Text
a} :: ExclusionPreview)
exclusionPreview_scopes :: Lens.Lens' ExclusionPreview (Prelude.NonEmpty Scope)
exclusionPreview_scopes :: (NonEmpty Scope -> f (NonEmpty Scope))
-> ExclusionPreview -> f ExclusionPreview
exclusionPreview_scopes = (ExclusionPreview -> NonEmpty Scope)
-> (ExclusionPreview -> NonEmpty Scope -> ExclusionPreview)
-> Lens
ExclusionPreview ExclusionPreview (NonEmpty Scope) (NonEmpty Scope)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExclusionPreview' {NonEmpty Scope
scopes :: NonEmpty Scope
$sel:scopes:ExclusionPreview' :: ExclusionPreview -> NonEmpty Scope
scopes} -> NonEmpty Scope
scopes) (\s :: ExclusionPreview
s@ExclusionPreview' {} NonEmpty Scope
a -> ExclusionPreview
s {$sel:scopes:ExclusionPreview' :: NonEmpty Scope
scopes = NonEmpty Scope
a} :: ExclusionPreview) ((NonEmpty Scope -> f (NonEmpty Scope))
-> ExclusionPreview -> f ExclusionPreview)
-> ((NonEmpty Scope -> f (NonEmpty Scope))
-> NonEmpty Scope -> f (NonEmpty Scope))
-> (NonEmpty Scope -> f (NonEmpty Scope))
-> ExclusionPreview
-> f ExclusionPreview
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Scope -> f (NonEmpty Scope))
-> NonEmpty Scope -> f (NonEmpty Scope)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ExclusionPreview where
parseJSON :: Value -> Parser ExclusionPreview
parseJSON =
String
-> (Object -> Parser ExclusionPreview)
-> Value
-> Parser ExclusionPreview
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ExclusionPreview"
( \Object
x ->
Maybe [Attribute]
-> Text -> Text -> Text -> NonEmpty Scope -> ExclusionPreview
ExclusionPreview'
(Maybe [Attribute]
-> Text -> Text -> Text -> NonEmpty Scope -> ExclusionPreview)
-> Parser (Maybe [Attribute])
-> Parser
(Text -> Text -> Text -> NonEmpty Scope -> ExclusionPreview)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Attribute]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributes" Parser (Maybe (Maybe [Attribute]))
-> Maybe [Attribute] -> Parser (Maybe [Attribute])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Attribute]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> Text -> Text -> NonEmpty Scope -> ExclusionPreview)
-> Parser Text
-> Parser (Text -> Text -> NonEmpty Scope -> ExclusionPreview)
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
"title")
Parser (Text -> Text -> NonEmpty Scope -> ExclusionPreview)
-> Parser Text
-> Parser (Text -> NonEmpty Scope -> ExclusionPreview)
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
"description")
Parser (Text -> NonEmpty Scope -> ExclusionPreview)
-> Parser Text -> Parser (NonEmpty Scope -> ExclusionPreview)
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
"recommendation")
Parser (NonEmpty Scope -> ExclusionPreview)
-> Parser (NonEmpty Scope) -> Parser ExclusionPreview
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Scope)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"scopes")
)
instance Prelude.Hashable ExclusionPreview
instance Prelude.NFData ExclusionPreview