{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Inspector.Types.Exclusion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector.Types.Exclusion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector.Types.Attribute
import Amazonka.Inspector.Types.Scope
import qualified Amazonka.Prelude as Prelude

-- | Contains information about what was excluded from an assessment run.
--
-- /See:/ 'newExclusion' smart constructor.
data Exclusion = Exclusion'
  { -- | The system-defined attributes for the exclusion.
    Exclusion -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
    -- | The ARN that specifies the exclusion.
    Exclusion -> Text
arn :: Prelude.Text,
    -- | The name of the exclusion.
    Exclusion -> Text
title :: Prelude.Text,
    -- | The description of the exclusion.
    Exclusion -> Text
description :: Prelude.Text,
    -- | The recommendation for the exclusion.
    Exclusion -> Text
recommendation :: Prelude.Text,
    -- | The AWS resources for which the exclusion pertains.
    Exclusion -> NonEmpty Scope
scopes :: Prelude.NonEmpty Scope
  }
  deriving (Exclusion -> Exclusion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Exclusion -> Exclusion -> Bool
$c/= :: Exclusion -> Exclusion -> Bool
== :: Exclusion -> Exclusion -> Bool
$c== :: Exclusion -> Exclusion -> Bool
Prelude.Eq, ReadPrec [Exclusion]
ReadPrec Exclusion
Int -> ReadS Exclusion
ReadS [Exclusion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Exclusion]
$creadListPrec :: ReadPrec [Exclusion]
readPrec :: ReadPrec Exclusion
$creadPrec :: ReadPrec Exclusion
readList :: ReadS [Exclusion]
$creadList :: ReadS [Exclusion]
readsPrec :: Int -> ReadS Exclusion
$creadsPrec :: Int -> ReadS Exclusion
Prelude.Read, Int -> Exclusion -> ShowS
[Exclusion] -> ShowS
Exclusion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Exclusion] -> ShowS
$cshowList :: [Exclusion] -> ShowS
show :: Exclusion -> String
$cshow :: Exclusion -> String
showsPrec :: Int -> Exclusion -> ShowS
$cshowsPrec :: Int -> Exclusion -> ShowS
Prelude.Show, forall x. Rep Exclusion x -> Exclusion
forall x. Exclusion -> Rep Exclusion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Exclusion x -> Exclusion
$cfrom :: forall x. Exclusion -> Rep Exclusion x
Prelude.Generic)

-- |
-- Create a value of 'Exclusion' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'attributes', 'exclusion_attributes' - The system-defined attributes for the exclusion.
--
-- 'arn', 'exclusion_arn' - The ARN that specifies the exclusion.
--
-- 'title', 'exclusion_title' - The name of the exclusion.
--
-- 'description', 'exclusion_description' - The description of the exclusion.
--
-- 'recommendation', 'exclusion_recommendation' - The recommendation for the exclusion.
--
-- 'scopes', 'exclusion_scopes' - The AWS resources for which the exclusion pertains.
newExclusion ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'description'
  Prelude.Text ->
  -- | 'recommendation'
  Prelude.Text ->
  -- | 'scopes'
  Prelude.NonEmpty Scope ->
  Exclusion
newExclusion :: Text -> Text -> Text -> Text -> NonEmpty Scope -> Exclusion
newExclusion
  Text
pArn_
  Text
pTitle_
  Text
pDescription_
  Text
pRecommendation_
  NonEmpty Scope
pScopes_ =
    Exclusion'
      { $sel:attributes:Exclusion' :: Maybe [Attribute]
attributes = forall a. Maybe a
Prelude.Nothing,
        $sel:arn:Exclusion' :: Text
arn = Text
pArn_,
        $sel:title:Exclusion' :: Text
title = Text
pTitle_,
        $sel:description:Exclusion' :: Text
description = Text
pDescription_,
        $sel:recommendation:Exclusion' :: Text
recommendation = Text
pRecommendation_,
        $sel:scopes:Exclusion' :: NonEmpty Scope
scopes = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Scope
pScopes_
      }

-- | The system-defined attributes for the exclusion.
exclusion_attributes :: Lens.Lens' Exclusion (Prelude.Maybe [Attribute])
exclusion_attributes :: Lens' Exclusion (Maybe [Attribute])
exclusion_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Exclusion' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:Exclusion' :: Exclusion -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: Exclusion
s@Exclusion' {} Maybe [Attribute]
a -> Exclusion
s {$sel:attributes:Exclusion' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: Exclusion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN that specifies the exclusion.
exclusion_arn :: Lens.Lens' Exclusion Prelude.Text
exclusion_arn :: Lens' Exclusion Text
exclusion_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Exclusion' {Text
arn :: Text
$sel:arn:Exclusion' :: Exclusion -> Text
arn} -> Text
arn) (\s :: Exclusion
s@Exclusion' {} Text
a -> Exclusion
s {$sel:arn:Exclusion' :: Text
arn = Text
a} :: Exclusion)

-- | The name of the exclusion.
exclusion_title :: Lens.Lens' Exclusion Prelude.Text
exclusion_title :: Lens' Exclusion Text
exclusion_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Exclusion' {Text
title :: Text
$sel:title:Exclusion' :: Exclusion -> Text
title} -> Text
title) (\s :: Exclusion
s@Exclusion' {} Text
a -> Exclusion
s {$sel:title:Exclusion' :: Text
title = Text
a} :: Exclusion)

-- | The description of the exclusion.
exclusion_description :: Lens.Lens' Exclusion Prelude.Text
exclusion_description :: Lens' Exclusion Text
exclusion_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Exclusion' {Text
description :: Text
$sel:description:Exclusion' :: Exclusion -> Text
description} -> Text
description) (\s :: Exclusion
s@Exclusion' {} Text
a -> Exclusion
s {$sel:description:Exclusion' :: Text
description = Text
a} :: Exclusion)

-- | The recommendation for the exclusion.
exclusion_recommendation :: Lens.Lens' Exclusion Prelude.Text
exclusion_recommendation :: Lens' Exclusion Text
exclusion_recommendation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Exclusion' {Text
recommendation :: Text
$sel:recommendation:Exclusion' :: Exclusion -> Text
recommendation} -> Text
recommendation) (\s :: Exclusion
s@Exclusion' {} Text
a -> Exclusion
s {$sel:recommendation:Exclusion' :: Text
recommendation = Text
a} :: Exclusion)

-- | The AWS resources for which the exclusion pertains.
exclusion_scopes :: Lens.Lens' Exclusion (Prelude.NonEmpty Scope)
exclusion_scopes :: Lens' Exclusion (NonEmpty Scope)
exclusion_scopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Exclusion' {NonEmpty Scope
scopes :: NonEmpty Scope
$sel:scopes:Exclusion' :: Exclusion -> NonEmpty Scope
scopes} -> NonEmpty Scope
scopes) (\s :: Exclusion
s@Exclusion' {} NonEmpty Scope
a -> Exclusion
s {$sel:scopes:Exclusion' :: NonEmpty Scope
scopes = NonEmpty Scope
a} :: Exclusion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Exclusion where
  parseJSON :: Value -> Parser Exclusion
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Exclusion"
      ( \Object
x ->
          Maybe [Attribute]
-> Text -> Text -> Text -> Text -> NonEmpty Scope -> Exclusion
Exclusion'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"attributes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"title")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"recommendation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"scopes")
      )

instance Prelude.Hashable Exclusion where
  hashWithSalt :: Int -> Exclusion -> Int
hashWithSalt Int
_salt Exclusion' {Maybe [Attribute]
NonEmpty Scope
Text
scopes :: NonEmpty Scope
recommendation :: Text
description :: Text
title :: Text
arn :: Text
attributes :: Maybe [Attribute]
$sel:scopes:Exclusion' :: Exclusion -> NonEmpty Scope
$sel:recommendation:Exclusion' :: Exclusion -> Text
$sel:description:Exclusion' :: Exclusion -> Text
$sel:title:Exclusion' :: Exclusion -> Text
$sel:arn:Exclusion' :: Exclusion -> Text
$sel:attributes:Exclusion' :: Exclusion -> Maybe [Attribute]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Attribute]
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
recommendation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Scope
scopes

instance Prelude.NFData Exclusion where
  rnf :: Exclusion -> ()
rnf Exclusion' {Maybe [Attribute]
NonEmpty Scope
Text
scopes :: NonEmpty Scope
recommendation :: Text
description :: Text
title :: Text
arn :: Text
attributes :: Maybe [Attribute]
$sel:scopes:Exclusion' :: Exclusion -> NonEmpty Scope
$sel:recommendation:Exclusion' :: Exclusion -> Text
$sel:description:Exclusion' :: Exclusion -> Text
$sel:title:Exclusion' :: Exclusion -> Text
$sel:arn:Exclusion' :: Exclusion -> Text
$sel:attributes:Exclusion' :: Exclusion -> Maybe [Attribute]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Attribute]
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
recommendation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Scope
scopes