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

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

-- | Details of the Firewall Manager policy.
--
-- /See:/ 'newPolicySummary' smart constructor.
data PolicySummary = PolicySummary'
  { -- | The name of the specified policy.
    PolicySummary -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
    -- | Indicates if the policy should be automatically applied to new
    -- resources.
    PolicySummary -> Maybe Bool
remediationEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The type of resource protected by or in scope of the policy. 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 WAF and Shield Advanced, examples include
    -- @AWS::ElasticLoadBalancingV2::LoadBalancer@ and
    -- @AWS::CloudFront::Distribution@. For a security group common policy,
    -- valid values are @AWS::EC2::NetworkInterface@ and @AWS::EC2::Instance@.
    -- For a security group content audit policy, valid values are
    -- @AWS::EC2::SecurityGroup@, @AWS::EC2::NetworkInterface@, and
    -- @AWS::EC2::Instance@. For a security group usage audit policy, the value
    -- is @AWS::EC2::SecurityGroup@. For an Network Firewall policy or DNS
    -- Firewall policy, the value is @AWS::EC2::VPC@.
    PolicySummary -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The ID of the specified policy.
    PolicySummary -> Maybe Text
policyId :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether Firewall Manager should delete Firewall Manager
    -- managed resources, such as web ACLs and security groups, when they are
    -- not in use by the Firewall Manager policy. By default, Firewall Manager
    -- doesn\'t delete unused Firewall Manager managed resources. This option
    -- is not available for Shield Advanced or WAF Classic policies.
    PolicySummary -> Maybe Bool
deleteUnusedFMManagedResources :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the specified policy.
    PolicySummary -> Maybe Text
policyArn :: Prelude.Maybe Prelude.Text,
    -- | The service that the policy is using to protect the resources. This
    -- specifies the type of policy that is created, either an WAF policy, a
    -- Shield Advanced policy, or a security group policy.
    PolicySummary -> Maybe SecurityServiceType
securityServiceType :: Prelude.Maybe SecurityServiceType
  }
  deriving (PolicySummary -> PolicySummary -> Bool
(PolicySummary -> PolicySummary -> Bool)
-> (PolicySummary -> PolicySummary -> Bool) -> Eq PolicySummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicySummary -> PolicySummary -> Bool
$c/= :: PolicySummary -> PolicySummary -> Bool
== :: PolicySummary -> PolicySummary -> Bool
$c== :: PolicySummary -> PolicySummary -> Bool
Prelude.Eq, ReadPrec [PolicySummary]
ReadPrec PolicySummary
Int -> ReadS PolicySummary
ReadS [PolicySummary]
(Int -> ReadS PolicySummary)
-> ReadS [PolicySummary]
-> ReadPrec PolicySummary
-> ReadPrec [PolicySummary]
-> Read PolicySummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicySummary]
$creadListPrec :: ReadPrec [PolicySummary]
readPrec :: ReadPrec PolicySummary
$creadPrec :: ReadPrec PolicySummary
readList :: ReadS [PolicySummary]
$creadList :: ReadS [PolicySummary]
readsPrec :: Int -> ReadS PolicySummary
$creadsPrec :: Int -> ReadS PolicySummary
Prelude.Read, Int -> PolicySummary -> ShowS
[PolicySummary] -> ShowS
PolicySummary -> String
(Int -> PolicySummary -> ShowS)
-> (PolicySummary -> String)
-> ([PolicySummary] -> ShowS)
-> Show PolicySummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicySummary] -> ShowS
$cshowList :: [PolicySummary] -> ShowS
show :: PolicySummary -> String
$cshow :: PolicySummary -> String
showsPrec :: Int -> PolicySummary -> ShowS
$cshowsPrec :: Int -> PolicySummary -> ShowS
Prelude.Show, (forall x. PolicySummary -> Rep PolicySummary x)
-> (forall x. Rep PolicySummary x -> PolicySummary)
-> Generic PolicySummary
forall x. Rep PolicySummary x -> PolicySummary
forall x. PolicySummary -> Rep PolicySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicySummary x -> PolicySummary
$cfrom :: forall x. PolicySummary -> Rep PolicySummary x
Prelude.Generic)

-- |
-- Create a value of 'PolicySummary' 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:
--
-- 'policyName', 'policySummary_policyName' - The name of the specified policy.
--
-- 'remediationEnabled', 'policySummary_remediationEnabled' - Indicates if the policy should be automatically applied to new
-- resources.
--
-- 'resourceType', 'policySummary_resourceType' - The type of resource protected by or in scope of the policy. 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 WAF and Shield Advanced, examples include
-- @AWS::ElasticLoadBalancingV2::LoadBalancer@ and
-- @AWS::CloudFront::Distribution@. For a security group common policy,
-- valid values are @AWS::EC2::NetworkInterface@ and @AWS::EC2::Instance@.
-- For a security group content audit policy, valid values are
-- @AWS::EC2::SecurityGroup@, @AWS::EC2::NetworkInterface@, and
-- @AWS::EC2::Instance@. For a security group usage audit policy, the value
-- is @AWS::EC2::SecurityGroup@. For an Network Firewall policy or DNS
-- Firewall policy, the value is @AWS::EC2::VPC@.
--
-- 'policyId', 'policySummary_policyId' - The ID of the specified policy.
--
-- 'deleteUnusedFMManagedResources', 'policySummary_deleteUnusedFMManagedResources' - Indicates whether Firewall Manager should delete Firewall Manager
-- managed resources, such as web ACLs and security groups, when they are
-- not in use by the Firewall Manager policy. By default, Firewall Manager
-- doesn\'t delete unused Firewall Manager managed resources. This option
-- is not available for Shield Advanced or WAF Classic policies.
--
-- 'policyArn', 'policySummary_policyArn' - The Amazon Resource Name (ARN) of the specified policy.
--
-- 'securityServiceType', 'policySummary_securityServiceType' - The service that the policy is using to protect the resources. This
-- specifies the type of policy that is created, either an WAF policy, a
-- Shield Advanced policy, or a security group policy.
newPolicySummary ::
  PolicySummary
newPolicySummary :: PolicySummary
newPolicySummary =
  PolicySummary' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe SecurityServiceType
-> PolicySummary
PolicySummary'
    { $sel:policyName:PolicySummary' :: Maybe Text
policyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:remediationEnabled:PolicySummary' :: Maybe Bool
remediationEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:PolicySummary' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyId:PolicySummary' :: Maybe Text
policyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deleteUnusedFMManagedResources:PolicySummary' :: Maybe Bool
deleteUnusedFMManagedResources = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:policyArn:PolicySummary' :: Maybe Text
policyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:securityServiceType:PolicySummary' :: Maybe SecurityServiceType
securityServiceType = Maybe SecurityServiceType
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the specified policy.
policySummary_policyName :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_policyName :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_policyName = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
policyName :: Maybe Text
$sel:policyName:PolicySummary' :: PolicySummary -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:policyName:PolicySummary' :: Maybe Text
policyName = Maybe Text
a} :: PolicySummary)

-- | Indicates if the policy should be automatically applied to new
-- resources.
policySummary_remediationEnabled :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Bool)
policySummary_remediationEnabled :: (Maybe Bool -> f (Maybe Bool)) -> PolicySummary -> f PolicySummary
policySummary_remediationEnabled = (PolicySummary -> Maybe Bool)
-> (PolicySummary -> Maybe Bool -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Bool
remediationEnabled :: Maybe Bool
$sel:remediationEnabled:PolicySummary' :: PolicySummary -> Maybe Bool
remediationEnabled} -> Maybe Bool
remediationEnabled) (\s :: PolicySummary
s@PolicySummary' {} Maybe Bool
a -> PolicySummary
s {$sel:remediationEnabled:PolicySummary' :: Maybe Bool
remediationEnabled = Maybe Bool
a} :: PolicySummary)

-- | The type of resource protected by or in scope of the policy. 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 WAF and Shield Advanced, examples include
-- @AWS::ElasticLoadBalancingV2::LoadBalancer@ and
-- @AWS::CloudFront::Distribution@. For a security group common policy,
-- valid values are @AWS::EC2::NetworkInterface@ and @AWS::EC2::Instance@.
-- For a security group content audit policy, valid values are
-- @AWS::EC2::SecurityGroup@, @AWS::EC2::NetworkInterface@, and
-- @AWS::EC2::Instance@. For a security group usage audit policy, the value
-- is @AWS::EC2::SecurityGroup@. For an Network Firewall policy or DNS
-- Firewall policy, the value is @AWS::EC2::VPC@.
policySummary_resourceType :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_resourceType :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_resourceType = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:PolicySummary' :: PolicySummary -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:resourceType:PolicySummary' :: Maybe Text
resourceType = Maybe Text
a} :: PolicySummary)

-- | The ID of the specified policy.
policySummary_policyId :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_policyId :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_policyId = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
policyId :: Maybe Text
$sel:policyId:PolicySummary' :: PolicySummary -> Maybe Text
policyId} -> Maybe Text
policyId) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:policyId:PolicySummary' :: Maybe Text
policyId = Maybe Text
a} :: PolicySummary)

-- | Indicates whether Firewall Manager should delete Firewall Manager
-- managed resources, such as web ACLs and security groups, when they are
-- not in use by the Firewall Manager policy. By default, Firewall Manager
-- doesn\'t delete unused Firewall Manager managed resources. This option
-- is not available for Shield Advanced or WAF Classic policies.
policySummary_deleteUnusedFMManagedResources :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Bool)
policySummary_deleteUnusedFMManagedResources :: (Maybe Bool -> f (Maybe Bool)) -> PolicySummary -> f PolicySummary
policySummary_deleteUnusedFMManagedResources = (PolicySummary -> Maybe Bool)
-> (PolicySummary -> Maybe Bool -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Bool
deleteUnusedFMManagedResources :: Maybe Bool
$sel:deleteUnusedFMManagedResources:PolicySummary' :: PolicySummary -> Maybe Bool
deleteUnusedFMManagedResources} -> Maybe Bool
deleteUnusedFMManagedResources) (\s :: PolicySummary
s@PolicySummary' {} Maybe Bool
a -> PolicySummary
s {$sel:deleteUnusedFMManagedResources:PolicySummary' :: Maybe Bool
deleteUnusedFMManagedResources = Maybe Bool
a} :: PolicySummary)

-- | The Amazon Resource Name (ARN) of the specified policy.
policySummary_policyArn :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_policyArn :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_policyArn = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
policyArn :: Maybe Text
$sel:policyArn:PolicySummary' :: PolicySummary -> Maybe Text
policyArn} -> Maybe Text
policyArn) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:policyArn:PolicySummary' :: Maybe Text
policyArn = Maybe Text
a} :: PolicySummary)

-- | The service that the policy is using to protect the resources. This
-- specifies the type of policy that is created, either an WAF policy, a
-- Shield Advanced policy, or a security group policy.
policySummary_securityServiceType :: Lens.Lens' PolicySummary (Prelude.Maybe SecurityServiceType)
policySummary_securityServiceType :: (Maybe SecurityServiceType -> f (Maybe SecurityServiceType))
-> PolicySummary -> f PolicySummary
policySummary_securityServiceType = (PolicySummary -> Maybe SecurityServiceType)
-> (PolicySummary -> Maybe SecurityServiceType -> PolicySummary)
-> Lens
     PolicySummary
     PolicySummary
     (Maybe SecurityServiceType)
     (Maybe SecurityServiceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe SecurityServiceType
securityServiceType :: Maybe SecurityServiceType
$sel:securityServiceType:PolicySummary' :: PolicySummary -> Maybe SecurityServiceType
securityServiceType} -> Maybe SecurityServiceType
securityServiceType) (\s :: PolicySummary
s@PolicySummary' {} Maybe SecurityServiceType
a -> PolicySummary
s {$sel:securityServiceType:PolicySummary' :: Maybe SecurityServiceType
securityServiceType = Maybe SecurityServiceType
a} :: PolicySummary)

instance Core.FromJSON PolicySummary where
  parseJSON :: Value -> Parser PolicySummary
parseJSON =
    String
-> (Object -> Parser PolicySummary)
-> Value
-> Parser PolicySummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PolicySummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe SecurityServiceType
-> PolicySummary
PolicySummary'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe SecurityServiceType
 -> PolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe SecurityServiceType
      -> PolicySummary)
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
"PolicyName")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe SecurityServiceType
   -> PolicySummary)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe SecurityServiceType
      -> PolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RemediationEnabled")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe SecurityServiceType
   -> PolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe SecurityServiceType
      -> PolicySummary)
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 Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe SecurityServiceType
   -> PolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text -> Maybe SecurityServiceType -> PolicySummary)
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
"PolicyId")
            Parser
  (Maybe Bool
   -> Maybe Text -> Maybe SecurityServiceType -> PolicySummary)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> Maybe SecurityServiceType -> PolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeleteUnusedFMManagedResources")
            Parser (Maybe Text -> Maybe SecurityServiceType -> PolicySummary)
-> Parser (Maybe Text)
-> Parser (Maybe SecurityServiceType -> PolicySummary)
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
"PolicyArn")
            Parser (Maybe SecurityServiceType -> PolicySummary)
-> Parser (Maybe SecurityServiceType) -> Parser PolicySummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SecurityServiceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecurityServiceType")
      )

instance Prelude.Hashable PolicySummary

instance Prelude.NFData PolicySummary