{-# 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.FMS.Types.AwsEc2NetworkInterfaceViolation
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FMS.Types.AwsEc2NetworkInterfaceViolation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Violation detail for network interfaces associated with an EC2 instance.
--
-- /See:/ 'newAwsEc2NetworkInterfaceViolation' smart constructor.
data AwsEc2NetworkInterfaceViolation = AwsEc2NetworkInterfaceViolation'
  { -- | List of security groups that violate the rules specified in the primary
    -- security group of the Firewall Manager policy.
    AwsEc2NetworkInterfaceViolation -> Maybe [Text]
violatingSecurityGroups :: Prelude.Maybe [Prelude.Text],
    -- | The resource ID of the network interface.
    AwsEc2NetworkInterfaceViolation -> Maybe Text
violationTarget :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEc2NetworkInterfaceViolation
-> AwsEc2NetworkInterfaceViolation -> Bool
(AwsEc2NetworkInterfaceViolation
 -> AwsEc2NetworkInterfaceViolation -> Bool)
-> (AwsEc2NetworkInterfaceViolation
    -> AwsEc2NetworkInterfaceViolation -> Bool)
-> Eq AwsEc2NetworkInterfaceViolation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEc2NetworkInterfaceViolation
-> AwsEc2NetworkInterfaceViolation -> Bool
$c/= :: AwsEc2NetworkInterfaceViolation
-> AwsEc2NetworkInterfaceViolation -> Bool
== :: AwsEc2NetworkInterfaceViolation
-> AwsEc2NetworkInterfaceViolation -> Bool
$c== :: AwsEc2NetworkInterfaceViolation
-> AwsEc2NetworkInterfaceViolation -> Bool
Prelude.Eq, ReadPrec [AwsEc2NetworkInterfaceViolation]
ReadPrec AwsEc2NetworkInterfaceViolation
Int -> ReadS AwsEc2NetworkInterfaceViolation
ReadS [AwsEc2NetworkInterfaceViolation]
(Int -> ReadS AwsEc2NetworkInterfaceViolation)
-> ReadS [AwsEc2NetworkInterfaceViolation]
-> ReadPrec AwsEc2NetworkInterfaceViolation
-> ReadPrec [AwsEc2NetworkInterfaceViolation]
-> Read AwsEc2NetworkInterfaceViolation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEc2NetworkInterfaceViolation]
$creadListPrec :: ReadPrec [AwsEc2NetworkInterfaceViolation]
readPrec :: ReadPrec AwsEc2NetworkInterfaceViolation
$creadPrec :: ReadPrec AwsEc2NetworkInterfaceViolation
readList :: ReadS [AwsEc2NetworkInterfaceViolation]
$creadList :: ReadS [AwsEc2NetworkInterfaceViolation]
readsPrec :: Int -> ReadS AwsEc2NetworkInterfaceViolation
$creadsPrec :: Int -> ReadS AwsEc2NetworkInterfaceViolation
Prelude.Read, Int -> AwsEc2NetworkInterfaceViolation -> ShowS
[AwsEc2NetworkInterfaceViolation] -> ShowS
AwsEc2NetworkInterfaceViolation -> String
(Int -> AwsEc2NetworkInterfaceViolation -> ShowS)
-> (AwsEc2NetworkInterfaceViolation -> String)
-> ([AwsEc2NetworkInterfaceViolation] -> ShowS)
-> Show AwsEc2NetworkInterfaceViolation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEc2NetworkInterfaceViolation] -> ShowS
$cshowList :: [AwsEc2NetworkInterfaceViolation] -> ShowS
show :: AwsEc2NetworkInterfaceViolation -> String
$cshow :: AwsEc2NetworkInterfaceViolation -> String
showsPrec :: Int -> AwsEc2NetworkInterfaceViolation -> ShowS
$cshowsPrec :: Int -> AwsEc2NetworkInterfaceViolation -> ShowS
Prelude.Show, (forall x.
 AwsEc2NetworkInterfaceViolation
 -> Rep AwsEc2NetworkInterfaceViolation x)
-> (forall x.
    Rep AwsEc2NetworkInterfaceViolation x
    -> AwsEc2NetworkInterfaceViolation)
-> Generic AwsEc2NetworkInterfaceViolation
forall x.
Rep AwsEc2NetworkInterfaceViolation x
-> AwsEc2NetworkInterfaceViolation
forall x.
AwsEc2NetworkInterfaceViolation
-> Rep AwsEc2NetworkInterfaceViolation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEc2NetworkInterfaceViolation x
-> AwsEc2NetworkInterfaceViolation
$cfrom :: forall x.
AwsEc2NetworkInterfaceViolation
-> Rep AwsEc2NetworkInterfaceViolation x
Prelude.Generic)

-- |
-- Create a value of 'AwsEc2NetworkInterfaceViolation' 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:
--
-- 'violatingSecurityGroups', 'awsEc2NetworkInterfaceViolation_violatingSecurityGroups' - List of security groups that violate the rules specified in the primary
-- security group of the Firewall Manager policy.
--
-- 'violationTarget', 'awsEc2NetworkInterfaceViolation_violationTarget' - The resource ID of the network interface.
newAwsEc2NetworkInterfaceViolation ::
  AwsEc2NetworkInterfaceViolation
newAwsEc2NetworkInterfaceViolation :: AwsEc2NetworkInterfaceViolation
newAwsEc2NetworkInterfaceViolation =
  AwsEc2NetworkInterfaceViolation' :: Maybe [Text] -> Maybe Text -> AwsEc2NetworkInterfaceViolation
AwsEc2NetworkInterfaceViolation'
    { $sel:violatingSecurityGroups:AwsEc2NetworkInterfaceViolation' :: Maybe [Text]
violatingSecurityGroups =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:violationTarget:AwsEc2NetworkInterfaceViolation' :: Maybe Text
violationTarget = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | List of security groups that violate the rules specified in the primary
-- security group of the Firewall Manager policy.
awsEc2NetworkInterfaceViolation_violatingSecurityGroups :: Lens.Lens' AwsEc2NetworkInterfaceViolation (Prelude.Maybe [Prelude.Text])
awsEc2NetworkInterfaceViolation_violatingSecurityGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsEc2NetworkInterfaceViolation
-> f AwsEc2NetworkInterfaceViolation
awsEc2NetworkInterfaceViolation_violatingSecurityGroups = (AwsEc2NetworkInterfaceViolation -> Maybe [Text])
-> (AwsEc2NetworkInterfaceViolation
    -> Maybe [Text] -> AwsEc2NetworkInterfaceViolation)
-> Lens
     AwsEc2NetworkInterfaceViolation
     AwsEc2NetworkInterfaceViolation
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2NetworkInterfaceViolation' {Maybe [Text]
violatingSecurityGroups :: Maybe [Text]
$sel:violatingSecurityGroups:AwsEc2NetworkInterfaceViolation' :: AwsEc2NetworkInterfaceViolation -> Maybe [Text]
violatingSecurityGroups} -> Maybe [Text]
violatingSecurityGroups) (\s :: AwsEc2NetworkInterfaceViolation
s@AwsEc2NetworkInterfaceViolation' {} Maybe [Text]
a -> AwsEc2NetworkInterfaceViolation
s {$sel:violatingSecurityGroups:AwsEc2NetworkInterfaceViolation' :: Maybe [Text]
violatingSecurityGroups = Maybe [Text]
a} :: AwsEc2NetworkInterfaceViolation) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsEc2NetworkInterfaceViolation
 -> f AwsEc2NetworkInterfaceViolation)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsEc2NetworkInterfaceViolation
-> f AwsEc2NetworkInterfaceViolation
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

-- | The resource ID of the network interface.
awsEc2NetworkInterfaceViolation_violationTarget :: Lens.Lens' AwsEc2NetworkInterfaceViolation (Prelude.Maybe Prelude.Text)
awsEc2NetworkInterfaceViolation_violationTarget :: (Maybe Text -> f (Maybe Text))
-> AwsEc2NetworkInterfaceViolation
-> f AwsEc2NetworkInterfaceViolation
awsEc2NetworkInterfaceViolation_violationTarget = (AwsEc2NetworkInterfaceViolation -> Maybe Text)
-> (AwsEc2NetworkInterfaceViolation
    -> Maybe Text -> AwsEc2NetworkInterfaceViolation)
-> Lens
     AwsEc2NetworkInterfaceViolation
     AwsEc2NetworkInterfaceViolation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2NetworkInterfaceViolation' {Maybe Text
violationTarget :: Maybe Text
$sel:violationTarget:AwsEc2NetworkInterfaceViolation' :: AwsEc2NetworkInterfaceViolation -> Maybe Text
violationTarget} -> Maybe Text
violationTarget) (\s :: AwsEc2NetworkInterfaceViolation
s@AwsEc2NetworkInterfaceViolation' {} Maybe Text
a -> AwsEc2NetworkInterfaceViolation
s {$sel:violationTarget:AwsEc2NetworkInterfaceViolation' :: Maybe Text
violationTarget = Maybe Text
a} :: AwsEc2NetworkInterfaceViolation)

instance
  Core.FromJSON
    AwsEc2NetworkInterfaceViolation
  where
  parseJSON :: Value -> Parser AwsEc2NetworkInterfaceViolation
parseJSON =
    String
-> (Object -> Parser AwsEc2NetworkInterfaceViolation)
-> Value
-> Parser AwsEc2NetworkInterfaceViolation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEc2NetworkInterfaceViolation"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> AwsEc2NetworkInterfaceViolation
AwsEc2NetworkInterfaceViolation'
            (Maybe [Text] -> Maybe Text -> AwsEc2NetworkInterfaceViolation)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> AwsEc2NetworkInterfaceViolation)
forall (f :: * -> *) a b. Functor 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
"ViolatingSecurityGroups"
                            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 -> AwsEc2NetworkInterfaceViolation)
-> Parser (Maybe Text) -> Parser AwsEc2NetworkInterfaceViolation
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
"ViolationTarget")
      )

instance
  Prelude.Hashable
    AwsEc2NetworkInterfaceViolation

instance
  Prelude.NFData
    AwsEc2NetworkInterfaceViolation