{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FMS.Types.AwsEc2NetworkInterfaceViolation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
    { $sel:violatingSecurityGroups:AwsEc2NetworkInterfaceViolation' :: Maybe [Text]
violatingSecurityGroups =
        forall a. Maybe a
Prelude.Nothing,
      $sel:violationTarget:AwsEc2NetworkInterfaceViolation' :: Maybe Text
violationTarget = 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 :: Lens' AwsEc2NetworkInterfaceViolation (Maybe [Text])
awsEc2NetworkInterfaceViolation_violatingSecurityGroups = 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) 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 resource ID of the network interface.
awsEc2NetworkInterfaceViolation_violationTarget :: Lens.Lens' AwsEc2NetworkInterfaceViolation (Prelude.Maybe Prelude.Text)
awsEc2NetworkInterfaceViolation_violationTarget :: Lens' AwsEc2NetworkInterfaceViolation (Maybe Text)
awsEc2NetworkInterfaceViolation_violationTarget = 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
  Data.FromJSON
    AwsEc2NetworkInterfaceViolation
  where
  parseJSON :: Value -> Parser AwsEc2NetworkInterfaceViolation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AwsEc2NetworkInterfaceViolation"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> AwsEc2NetworkInterfaceViolation
AwsEc2NetworkInterfaceViolation'
            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
"ViolatingSecurityGroups"
                            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 (Maybe a)
Data..:? Key
"ViolationTarget")
      )

instance
  Prelude.Hashable
    AwsEc2NetworkInterfaceViolation
  where
  hashWithSalt :: Int -> AwsEc2NetworkInterfaceViolation -> Int
hashWithSalt
    Int
_salt
    AwsEc2NetworkInterfaceViolation' {Maybe [Text]
Maybe Text
violationTarget :: Maybe Text
violatingSecurityGroups :: Maybe [Text]
$sel:violationTarget:AwsEc2NetworkInterfaceViolation' :: AwsEc2NetworkInterfaceViolation -> Maybe Text
$sel:violatingSecurityGroups:AwsEc2NetworkInterfaceViolation' :: AwsEc2NetworkInterfaceViolation -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
violatingSecurityGroups
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
violationTarget

instance
  Prelude.NFData
    AwsEc2NetworkInterfaceViolation
  where
  rnf :: AwsEc2NetworkInterfaceViolation -> ()
rnf AwsEc2NetworkInterfaceViolation' {Maybe [Text]
Maybe Text
violationTarget :: Maybe Text
violatingSecurityGroups :: Maybe [Text]
$sel:violationTarget:AwsEc2NetworkInterfaceViolation' :: AwsEc2NetworkInterfaceViolation -> Maybe Text
$sel:violatingSecurityGroups:AwsEc2NetworkInterfaceViolation' :: AwsEc2NetworkInterfaceViolation -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
violatingSecurityGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
violationTarget