{-# 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.ComplianceViolator
-- 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.ComplianceViolator where

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types.ViolationReason
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details of the resource that is not protected by the policy.
--
-- /See:/ 'newComplianceViolator' smart constructor.
data ComplianceViolator = ComplianceViolator'
  { -- | The resource ID.
    ComplianceViolator -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The resource type. This is in the format shown in the
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Amazon Web Services Resource Types Reference>.
    -- For example: @AWS::ElasticLoadBalancingV2::LoadBalancer@,
    -- @AWS::CloudFront::Distribution@, or
    -- @AWS::NetworkFirewall::FirewallPolicy@.
    ComplianceViolator -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The reason that the resource is not protected by the policy.
    ComplianceViolator -> Maybe ViolationReason
violationReason :: Prelude.Maybe ViolationReason
  }
  deriving (ComplianceViolator -> ComplianceViolator -> Bool
(ComplianceViolator -> ComplianceViolator -> Bool)
-> (ComplianceViolator -> ComplianceViolator -> Bool)
-> Eq ComplianceViolator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceViolator -> ComplianceViolator -> Bool
$c/= :: ComplianceViolator -> ComplianceViolator -> Bool
== :: ComplianceViolator -> ComplianceViolator -> Bool
$c== :: ComplianceViolator -> ComplianceViolator -> Bool
Prelude.Eq, ReadPrec [ComplianceViolator]
ReadPrec ComplianceViolator
Int -> ReadS ComplianceViolator
ReadS [ComplianceViolator]
(Int -> ReadS ComplianceViolator)
-> ReadS [ComplianceViolator]
-> ReadPrec ComplianceViolator
-> ReadPrec [ComplianceViolator]
-> Read ComplianceViolator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceViolator]
$creadListPrec :: ReadPrec [ComplianceViolator]
readPrec :: ReadPrec ComplianceViolator
$creadPrec :: ReadPrec ComplianceViolator
readList :: ReadS [ComplianceViolator]
$creadList :: ReadS [ComplianceViolator]
readsPrec :: Int -> ReadS ComplianceViolator
$creadsPrec :: Int -> ReadS ComplianceViolator
Prelude.Read, Int -> ComplianceViolator -> ShowS
[ComplianceViolator] -> ShowS
ComplianceViolator -> String
(Int -> ComplianceViolator -> ShowS)
-> (ComplianceViolator -> String)
-> ([ComplianceViolator] -> ShowS)
-> Show ComplianceViolator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceViolator] -> ShowS
$cshowList :: [ComplianceViolator] -> ShowS
show :: ComplianceViolator -> String
$cshow :: ComplianceViolator -> String
showsPrec :: Int -> ComplianceViolator -> ShowS
$cshowsPrec :: Int -> ComplianceViolator -> ShowS
Prelude.Show, (forall x. ComplianceViolator -> Rep ComplianceViolator x)
-> (forall x. Rep ComplianceViolator x -> ComplianceViolator)
-> Generic ComplianceViolator
forall x. Rep ComplianceViolator x -> ComplianceViolator
forall x. ComplianceViolator -> Rep ComplianceViolator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComplianceViolator x -> ComplianceViolator
$cfrom :: forall x. ComplianceViolator -> Rep ComplianceViolator x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceViolator' 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:
--
-- 'resourceId', 'complianceViolator_resourceId' - The resource ID.
--
-- 'resourceType', 'complianceViolator_resourceType' - The resource type. This is in the format shown in the
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Amazon Web Services Resource Types Reference>.
-- For example: @AWS::ElasticLoadBalancingV2::LoadBalancer@,
-- @AWS::CloudFront::Distribution@, or
-- @AWS::NetworkFirewall::FirewallPolicy@.
--
-- 'violationReason', 'complianceViolator_violationReason' - The reason that the resource is not protected by the policy.
newComplianceViolator ::
  ComplianceViolator
newComplianceViolator :: ComplianceViolator
newComplianceViolator =
  ComplianceViolator' :: Maybe Text
-> Maybe Text -> Maybe ViolationReason -> ComplianceViolator
ComplianceViolator'
    { $sel:resourceId:ComplianceViolator' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ComplianceViolator' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:violationReason:ComplianceViolator' :: Maybe ViolationReason
violationReason = Maybe ViolationReason
forall a. Maybe a
Prelude.Nothing
    }

-- | The resource ID.
complianceViolator_resourceId :: Lens.Lens' ComplianceViolator (Prelude.Maybe Prelude.Text)
complianceViolator_resourceId :: (Maybe Text -> f (Maybe Text))
-> ComplianceViolator -> f ComplianceViolator
complianceViolator_resourceId = (ComplianceViolator -> Maybe Text)
-> (ComplianceViolator -> Maybe Text -> ComplianceViolator)
-> Lens
     ComplianceViolator ComplianceViolator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceViolator' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:ComplianceViolator' :: ComplianceViolator -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: ComplianceViolator
s@ComplianceViolator' {} Maybe Text
a -> ComplianceViolator
s {$sel:resourceId:ComplianceViolator' :: Maybe Text
resourceId = Maybe Text
a} :: ComplianceViolator)

-- | The resource type. This is in the format shown in the
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Amazon Web Services Resource Types Reference>.
-- For example: @AWS::ElasticLoadBalancingV2::LoadBalancer@,
-- @AWS::CloudFront::Distribution@, or
-- @AWS::NetworkFirewall::FirewallPolicy@.
complianceViolator_resourceType :: Lens.Lens' ComplianceViolator (Prelude.Maybe Prelude.Text)
complianceViolator_resourceType :: (Maybe Text -> f (Maybe Text))
-> ComplianceViolator -> f ComplianceViolator
complianceViolator_resourceType = (ComplianceViolator -> Maybe Text)
-> (ComplianceViolator -> Maybe Text -> ComplianceViolator)
-> Lens
     ComplianceViolator ComplianceViolator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceViolator' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ComplianceViolator' :: ComplianceViolator -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ComplianceViolator
s@ComplianceViolator' {} Maybe Text
a -> ComplianceViolator
s {$sel:resourceType:ComplianceViolator' :: Maybe Text
resourceType = Maybe Text
a} :: ComplianceViolator)

-- | The reason that the resource is not protected by the policy.
complianceViolator_violationReason :: Lens.Lens' ComplianceViolator (Prelude.Maybe ViolationReason)
complianceViolator_violationReason :: (Maybe ViolationReason -> f (Maybe ViolationReason))
-> ComplianceViolator -> f ComplianceViolator
complianceViolator_violationReason = (ComplianceViolator -> Maybe ViolationReason)
-> (ComplianceViolator
    -> Maybe ViolationReason -> ComplianceViolator)
-> Lens
     ComplianceViolator
     ComplianceViolator
     (Maybe ViolationReason)
     (Maybe ViolationReason)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceViolator' {Maybe ViolationReason
violationReason :: Maybe ViolationReason
$sel:violationReason:ComplianceViolator' :: ComplianceViolator -> Maybe ViolationReason
violationReason} -> Maybe ViolationReason
violationReason) (\s :: ComplianceViolator
s@ComplianceViolator' {} Maybe ViolationReason
a -> ComplianceViolator
s {$sel:violationReason:ComplianceViolator' :: Maybe ViolationReason
violationReason = Maybe ViolationReason
a} :: ComplianceViolator)

instance Core.FromJSON ComplianceViolator where
  parseJSON :: Value -> Parser ComplianceViolator
parseJSON =
    String
-> (Object -> Parser ComplianceViolator)
-> Value
-> Parser ComplianceViolator
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComplianceViolator"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe ViolationReason -> ComplianceViolator
ComplianceViolator'
            (Maybe Text
 -> Maybe Text -> Maybe ViolationReason -> ComplianceViolator)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe ViolationReason -> ComplianceViolator)
forall (f :: * -> *) a b. Functor 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
"ResourceId")
            Parser (Maybe Text -> Maybe ViolationReason -> ComplianceViolator)
-> Parser (Maybe Text)
-> Parser (Maybe ViolationReason -> ComplianceViolator)
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
"ResourceType")
            Parser (Maybe ViolationReason -> ComplianceViolator)
-> Parser (Maybe ViolationReason) -> Parser ComplianceViolator
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ViolationReason)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ViolationReason")
      )

instance Prelude.Hashable ComplianceViolator

instance Prelude.NFData ComplianceViolator