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

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types.CustomerPolicyScopeIdType
import Amazonka.FMS.Types.ResourceTag
import Amazonka.FMS.Types.SecurityServicePolicyData
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An Firewall Manager policy.
--
-- /See:/ 'newPolicy' smart constructor.
data Policy = Policy'
  { -- | The ID of the Firewall Manager policy.
    Policy -> Maybe Text
policyId :: Prelude.Maybe Prelude.Text,
    -- | An array of @ResourceType@ objects. Use this only to specify multiple
    -- resource types. To specify a single resource type, use @ResourceType@.
    Policy -> Maybe [Text]
resourceTypeList :: Prelude.Maybe [Prelude.Text],
    -- | An array of @ResourceTag@ objects.
    Policy -> Maybe [ResourceTag]
resourceTags :: Prelude.Maybe [ResourceTag],
    -- | A unique identifier for each update to the policy. When issuing a
    -- @PutPolicy@ request, the @PolicyUpdateToken@ in the request must match
    -- the @PolicyUpdateToken@ of the current policy version. To get the
    -- @PolicyUpdateToken@ of the current policy version, use a @GetPolicy@
    -- request.
    Policy -> Maybe Text
policyUpdateToken :: 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.
    Policy -> Maybe Bool
deleteUnusedFMManagedResources :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the Amazon Web Services account IDs and Organizations
    -- organizational units (OUs) to exclude from the policy. Specifying an OU
    -- is the equivalent of specifying all accounts in the OU and in any of its
    -- child OUs, including any child OUs and accounts that are added at a
    -- later time.
    --
    -- You can specify inclusions or exclusions, but not both. If you specify
    -- an @IncludeMap@, Firewall Manager applies the policy to all accounts
    -- specified by the @IncludeMap@, and does not evaluate any @ExcludeMap@
    -- specifications. If you do not specify an @IncludeMap@, then Firewall
    -- Manager applies the policy to all accounts except for those specified by
    -- the @ExcludeMap@.
    --
    -- You can specify account IDs, OUs, or a combination:
    --
    -- -   Specify account IDs by setting the key to @ACCOUNT@. For example,
    --     the following is a valid map:
    --     @{“ACCOUNT” : [“accountID1”, “accountID2”]}@.
    --
    -- -   Specify OUs by setting the key to @ORG_UNIT@. For example, the
    --     following is a valid map: @{“ORG_UNIT” : [“ouid111”, “ouid112”]}@.
    --
    -- -   Specify accounts and OUs together in a single map, separated with a
    --     comma. For example, the following is a valid map:
    --     @{“ACCOUNT” : [“accountID1”, “accountID2”], “ORG_UNIT” : [“ouid111”, “ouid112”]}@.
    Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap :: Prelude.Maybe (Prelude.HashMap CustomerPolicyScopeIdType [Prelude.Text]),
    -- | Specifies the Amazon Web Services account IDs and Organizations
    -- organizational units (OUs) to include in the policy. Specifying an OU is
    -- the equivalent of specifying all accounts in the OU and in any of its
    -- child OUs, including any child OUs and accounts that are added at a
    -- later time.
    --
    -- You can specify inclusions or exclusions, but not both. If you specify
    -- an @IncludeMap@, Firewall Manager applies the policy to all accounts
    -- specified by the @IncludeMap@, and does not evaluate any @ExcludeMap@
    -- specifications. If you do not specify an @IncludeMap@, then Firewall
    -- Manager applies the policy to all accounts except for those specified by
    -- the @ExcludeMap@.
    --
    -- You can specify account IDs, OUs, or a combination:
    --
    -- -   Specify account IDs by setting the key to @ACCOUNT@. For example,
    --     the following is a valid map:
    --     @{“ACCOUNT” : [“accountID1”, “accountID2”]}@.
    --
    -- -   Specify OUs by setting the key to @ORG_UNIT@. For example, the
    --     following is a valid map: @{“ORG_UNIT” : [“ouid111”, “ouid112”]}@.
    --
    -- -   Specify accounts and OUs together in a single map, separated with a
    --     comma. For example, the following is a valid map:
    --     @{“ACCOUNT” : [“accountID1”, “accountID2”], “ORG_UNIT” : [“ouid111”, “ouid112”]}@.
    Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap :: Prelude.Maybe (Prelude.HashMap CustomerPolicyScopeIdType [Prelude.Text]),
    -- | The name of the Firewall Manager policy.
    Policy -> Text
policyName :: Prelude.Text,
    -- | Details about the security service that is being used to protect the
    -- resources.
    Policy -> SecurityServicePolicyData
securityServicePolicyData :: SecurityServicePolicyData,
    -- | 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>.
    -- To apply this policy to multiple resource types, specify a resource type
    -- of @ResourceTypeList@ and then specify the resource types in a
    -- @ResourceTypeList@.
    --
    -- For WAF and Shield Advanced, example resource types 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@.
    Policy -> Text
resourceType :: Prelude.Text,
    -- | If set to @True@, resources with the tags that are specified in the
    -- @ResourceTag@ array are not in scope of the policy. If set to @False@,
    -- and the @ResourceTag@ array is not null, only resources with the
    -- specified tags are in scope of the policy.
    Policy -> Bool
excludeResourceTags :: Prelude.Bool,
    -- | Indicates if the policy should be automatically applied to new
    -- resources.
    Policy -> Bool
remediationEnabled :: Prelude.Bool
  }
  deriving (Policy -> Policy -> Bool
(Policy -> Policy -> Bool)
-> (Policy -> Policy -> Bool) -> Eq Policy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Policy -> Policy -> Bool
$c/= :: Policy -> Policy -> Bool
== :: Policy -> Policy -> Bool
$c== :: Policy -> Policy -> Bool
Prelude.Eq, ReadPrec [Policy]
ReadPrec Policy
Int -> ReadS Policy
ReadS [Policy]
(Int -> ReadS Policy)
-> ReadS [Policy]
-> ReadPrec Policy
-> ReadPrec [Policy]
-> Read Policy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Policy]
$creadListPrec :: ReadPrec [Policy]
readPrec :: ReadPrec Policy
$creadPrec :: ReadPrec Policy
readList :: ReadS [Policy]
$creadList :: ReadS [Policy]
readsPrec :: Int -> ReadS Policy
$creadsPrec :: Int -> ReadS Policy
Prelude.Read, Int -> Policy -> ShowS
[Policy] -> ShowS
Policy -> String
(Int -> Policy -> ShowS)
-> (Policy -> String) -> ([Policy] -> ShowS) -> Show Policy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Policy] -> ShowS
$cshowList :: [Policy] -> ShowS
show :: Policy -> String
$cshow :: Policy -> String
showsPrec :: Int -> Policy -> ShowS
$cshowsPrec :: Int -> Policy -> ShowS
Prelude.Show, (forall x. Policy -> Rep Policy x)
-> (forall x. Rep Policy x -> Policy) -> Generic Policy
forall x. Rep Policy x -> Policy
forall x. Policy -> Rep Policy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Policy x -> Policy
$cfrom :: forall x. Policy -> Rep Policy x
Prelude.Generic)

-- |
-- Create a value of 'Policy' 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:
--
-- 'policyId', 'policy_policyId' - The ID of the Firewall Manager policy.
--
-- 'resourceTypeList', 'policy_resourceTypeList' - An array of @ResourceType@ objects. Use this only to specify multiple
-- resource types. To specify a single resource type, use @ResourceType@.
--
-- 'resourceTags', 'policy_resourceTags' - An array of @ResourceTag@ objects.
--
-- 'policyUpdateToken', 'policy_policyUpdateToken' - A unique identifier for each update to the policy. When issuing a
-- @PutPolicy@ request, the @PolicyUpdateToken@ in the request must match
-- the @PolicyUpdateToken@ of the current policy version. To get the
-- @PolicyUpdateToken@ of the current policy version, use a @GetPolicy@
-- request.
--
-- 'deleteUnusedFMManagedResources', 'policy_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.
--
-- 'excludeMap', 'policy_excludeMap' - Specifies the Amazon Web Services account IDs and Organizations
-- organizational units (OUs) to exclude from the policy. Specifying an OU
-- is the equivalent of specifying all accounts in the OU and in any of its
-- child OUs, including any child OUs and accounts that are added at a
-- later time.
--
-- You can specify inclusions or exclusions, but not both. If you specify
-- an @IncludeMap@, Firewall Manager applies the policy to all accounts
-- specified by the @IncludeMap@, and does not evaluate any @ExcludeMap@
-- specifications. If you do not specify an @IncludeMap@, then Firewall
-- Manager applies the policy to all accounts except for those specified by
-- the @ExcludeMap@.
--
-- You can specify account IDs, OUs, or a combination:
--
-- -   Specify account IDs by setting the key to @ACCOUNT@. For example,
--     the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”]}@.
--
-- -   Specify OUs by setting the key to @ORG_UNIT@. For example, the
--     following is a valid map: @{“ORG_UNIT” : [“ouid111”, “ouid112”]}@.
--
-- -   Specify accounts and OUs together in a single map, separated with a
--     comma. For example, the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”], “ORG_UNIT” : [“ouid111”, “ouid112”]}@.
--
-- 'includeMap', 'policy_includeMap' - Specifies the Amazon Web Services account IDs and Organizations
-- organizational units (OUs) to include in the policy. Specifying an OU is
-- the equivalent of specifying all accounts in the OU and in any of its
-- child OUs, including any child OUs and accounts that are added at a
-- later time.
--
-- You can specify inclusions or exclusions, but not both. If you specify
-- an @IncludeMap@, Firewall Manager applies the policy to all accounts
-- specified by the @IncludeMap@, and does not evaluate any @ExcludeMap@
-- specifications. If you do not specify an @IncludeMap@, then Firewall
-- Manager applies the policy to all accounts except for those specified by
-- the @ExcludeMap@.
--
-- You can specify account IDs, OUs, or a combination:
--
-- -   Specify account IDs by setting the key to @ACCOUNT@. For example,
--     the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”]}@.
--
-- -   Specify OUs by setting the key to @ORG_UNIT@. For example, the
--     following is a valid map: @{“ORG_UNIT” : [“ouid111”, “ouid112”]}@.
--
-- -   Specify accounts and OUs together in a single map, separated with a
--     comma. For example, the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”], “ORG_UNIT” : [“ouid111”, “ouid112”]}@.
--
-- 'policyName', 'policy_policyName' - The name of the Firewall Manager policy.
--
-- 'securityServicePolicyData', 'policy_securityServicePolicyData' - Details about the security service that is being used to protect the
-- resources.
--
-- 'resourceType', 'policy_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>.
-- To apply this policy to multiple resource types, specify a resource type
-- of @ResourceTypeList@ and then specify the resource types in a
-- @ResourceTypeList@.
--
-- For WAF and Shield Advanced, example resource types 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@.
--
-- 'excludeResourceTags', 'policy_excludeResourceTags' - If set to @True@, resources with the tags that are specified in the
-- @ResourceTag@ array are not in scope of the policy. If set to @False@,
-- and the @ResourceTag@ array is not null, only resources with the
-- specified tags are in scope of the policy.
--
-- 'remediationEnabled', 'policy_remediationEnabled' - Indicates if the policy should be automatically applied to new
-- resources.
newPolicy ::
  -- | 'policyName'
  Prelude.Text ->
  -- | 'securityServicePolicyData'
  SecurityServicePolicyData ->
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'excludeResourceTags'
  Prelude.Bool ->
  -- | 'remediationEnabled'
  Prelude.Bool ->
  Policy
newPolicy :: Text -> SecurityServicePolicyData -> Text -> Bool -> Bool -> Policy
newPolicy
  Text
pPolicyName_
  SecurityServicePolicyData
pSecurityServicePolicyData_
  Text
pResourceType_
  Bool
pExcludeResourceTags_
  Bool
pRemediationEnabled_ =
    Policy' :: Maybe Text
-> Maybe [Text]
-> Maybe [ResourceTag]
-> Maybe Text
-> Maybe Bool
-> Maybe (HashMap CustomerPolicyScopeIdType [Text])
-> Maybe (HashMap CustomerPolicyScopeIdType [Text])
-> Text
-> SecurityServicePolicyData
-> Text
-> Bool
-> Bool
-> Policy
Policy'
      { $sel:policyId:Policy' :: Maybe Text
policyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceTypeList:Policy' :: Maybe [Text]
resourceTypeList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceTags:Policy' :: Maybe [ResourceTag]
resourceTags = Maybe [ResourceTag]
forall a. Maybe a
Prelude.Nothing,
        $sel:policyUpdateToken:Policy' :: Maybe Text
policyUpdateToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:deleteUnusedFMManagedResources:Policy' :: Maybe Bool
deleteUnusedFMManagedResources = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:excludeMap:Policy' :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap = Maybe (HashMap CustomerPolicyScopeIdType [Text])
forall a. Maybe a
Prelude.Nothing,
        $sel:includeMap:Policy' :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap = Maybe (HashMap CustomerPolicyScopeIdType [Text])
forall a. Maybe a
Prelude.Nothing,
        $sel:policyName:Policy' :: Text
policyName = Text
pPolicyName_,
        $sel:securityServicePolicyData:Policy' :: SecurityServicePolicyData
securityServicePolicyData =
          SecurityServicePolicyData
pSecurityServicePolicyData_,
        $sel:resourceType:Policy' :: Text
resourceType = Text
pResourceType_,
        $sel:excludeResourceTags:Policy' :: Bool
excludeResourceTags = Bool
pExcludeResourceTags_,
        $sel:remediationEnabled:Policy' :: Bool
remediationEnabled = Bool
pRemediationEnabled_
      }

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

-- | An array of @ResourceType@ objects. Use this only to specify multiple
-- resource types. To specify a single resource type, use @ResourceType@.
policy_resourceTypeList :: Lens.Lens' Policy (Prelude.Maybe [Prelude.Text])
policy_resourceTypeList :: (Maybe [Text] -> f (Maybe [Text])) -> Policy -> f Policy
policy_resourceTypeList = (Policy -> Maybe [Text])
-> (Policy -> Maybe [Text] -> Policy)
-> Lens Policy Policy (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe [Text]
resourceTypeList :: Maybe [Text]
$sel:resourceTypeList:Policy' :: Policy -> Maybe [Text]
resourceTypeList} -> Maybe [Text]
resourceTypeList) (\s :: Policy
s@Policy' {} Maybe [Text]
a -> Policy
s {$sel:resourceTypeList:Policy' :: Maybe [Text]
resourceTypeList = Maybe [Text]
a} :: Policy) ((Maybe [Text] -> f (Maybe [Text])) -> Policy -> f Policy)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Policy
-> f Policy
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

-- | An array of @ResourceTag@ objects.
policy_resourceTags :: Lens.Lens' Policy (Prelude.Maybe [ResourceTag])
policy_resourceTags :: (Maybe [ResourceTag] -> f (Maybe [ResourceTag]))
-> Policy -> f Policy
policy_resourceTags = (Policy -> Maybe [ResourceTag])
-> (Policy -> Maybe [ResourceTag] -> Policy)
-> Lens Policy Policy (Maybe [ResourceTag]) (Maybe [ResourceTag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe [ResourceTag]
resourceTags :: Maybe [ResourceTag]
$sel:resourceTags:Policy' :: Policy -> Maybe [ResourceTag]
resourceTags} -> Maybe [ResourceTag]
resourceTags) (\s :: Policy
s@Policy' {} Maybe [ResourceTag]
a -> Policy
s {$sel:resourceTags:Policy' :: Maybe [ResourceTag]
resourceTags = Maybe [ResourceTag]
a} :: Policy) ((Maybe [ResourceTag] -> f (Maybe [ResourceTag]))
 -> Policy -> f Policy)
-> ((Maybe [ResourceTag] -> f (Maybe [ResourceTag]))
    -> Maybe [ResourceTag] -> f (Maybe [ResourceTag]))
-> (Maybe [ResourceTag] -> f (Maybe [ResourceTag]))
-> Policy
-> f Policy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ResourceTag] [ResourceTag] [ResourceTag] [ResourceTag]
-> Iso
     (Maybe [ResourceTag])
     (Maybe [ResourceTag])
     (Maybe [ResourceTag])
     (Maybe [ResourceTag])
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 [ResourceTag] [ResourceTag] [ResourceTag] [ResourceTag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique identifier for each update to the policy. When issuing a
-- @PutPolicy@ request, the @PolicyUpdateToken@ in the request must match
-- the @PolicyUpdateToken@ of the current policy version. To get the
-- @PolicyUpdateToken@ of the current policy version, use a @GetPolicy@
-- request.
policy_policyUpdateToken :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_policyUpdateToken :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_policyUpdateToken = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
policyUpdateToken :: Maybe Text
$sel:policyUpdateToken:Policy' :: Policy -> Maybe Text
policyUpdateToken} -> Maybe Text
policyUpdateToken) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:policyUpdateToken:Policy' :: Maybe Text
policyUpdateToken = Maybe Text
a} :: Policy)

-- | 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.
policy_deleteUnusedFMManagedResources :: Lens.Lens' Policy (Prelude.Maybe Prelude.Bool)
policy_deleteUnusedFMManagedResources :: (Maybe Bool -> f (Maybe Bool)) -> Policy -> f Policy
policy_deleteUnusedFMManagedResources = (Policy -> Maybe Bool)
-> (Policy -> Maybe Bool -> Policy)
-> Lens Policy Policy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Bool
deleteUnusedFMManagedResources :: Maybe Bool
$sel:deleteUnusedFMManagedResources:Policy' :: Policy -> Maybe Bool
deleteUnusedFMManagedResources} -> Maybe Bool
deleteUnusedFMManagedResources) (\s :: Policy
s@Policy' {} Maybe Bool
a -> Policy
s {$sel:deleteUnusedFMManagedResources:Policy' :: Maybe Bool
deleteUnusedFMManagedResources = Maybe Bool
a} :: Policy)

-- | Specifies the Amazon Web Services account IDs and Organizations
-- organizational units (OUs) to exclude from the policy. Specifying an OU
-- is the equivalent of specifying all accounts in the OU and in any of its
-- child OUs, including any child OUs and accounts that are added at a
-- later time.
--
-- You can specify inclusions or exclusions, but not both. If you specify
-- an @IncludeMap@, Firewall Manager applies the policy to all accounts
-- specified by the @IncludeMap@, and does not evaluate any @ExcludeMap@
-- specifications. If you do not specify an @IncludeMap@, then Firewall
-- Manager applies the policy to all accounts except for those specified by
-- the @ExcludeMap@.
--
-- You can specify account IDs, OUs, or a combination:
--
-- -   Specify account IDs by setting the key to @ACCOUNT@. For example,
--     the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”]}@.
--
-- -   Specify OUs by setting the key to @ORG_UNIT@. For example, the
--     following is a valid map: @{“ORG_UNIT” : [“ouid111”, “ouid112”]}@.
--
-- -   Specify accounts and OUs together in a single map, separated with a
--     comma. For example, the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”], “ORG_UNIT” : [“ouid111”, “ouid112”]}@.
policy_excludeMap :: Lens.Lens' Policy (Prelude.Maybe (Prelude.HashMap CustomerPolicyScopeIdType [Prelude.Text]))
policy_excludeMap :: (Maybe (HashMap CustomerPolicyScopeIdType [Text])
 -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> Policy -> f Policy
policy_excludeMap = (Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text]))
-> (Policy
    -> Maybe (HashMap CustomerPolicyScopeIdType [Text]) -> Policy)
-> Lens
     Policy
     Policy
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
$sel:excludeMap:Policy' :: Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap} -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap) (\s :: Policy
s@Policy' {} Maybe (HashMap CustomerPolicyScopeIdType [Text])
a -> Policy
s {$sel:excludeMap:Policy' :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap = Maybe (HashMap CustomerPolicyScopeIdType [Text])
a} :: Policy) ((Maybe (HashMap CustomerPolicyScopeIdType [Text])
  -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
 -> Policy -> f Policy)
-> ((Maybe (HashMap CustomerPolicyScopeIdType [Text])
     -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
    -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
    -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> (Maybe (HashMap CustomerPolicyScopeIdType [Text])
    -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> Policy
-> f Policy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
-> Iso
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [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
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the Amazon Web Services account IDs and Organizations
-- organizational units (OUs) to include in the policy. Specifying an OU is
-- the equivalent of specifying all accounts in the OU and in any of its
-- child OUs, including any child OUs and accounts that are added at a
-- later time.
--
-- You can specify inclusions or exclusions, but not both. If you specify
-- an @IncludeMap@, Firewall Manager applies the policy to all accounts
-- specified by the @IncludeMap@, and does not evaluate any @ExcludeMap@
-- specifications. If you do not specify an @IncludeMap@, then Firewall
-- Manager applies the policy to all accounts except for those specified by
-- the @ExcludeMap@.
--
-- You can specify account IDs, OUs, or a combination:
--
-- -   Specify account IDs by setting the key to @ACCOUNT@. For example,
--     the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”]}@.
--
-- -   Specify OUs by setting the key to @ORG_UNIT@. For example, the
--     following is a valid map: @{“ORG_UNIT” : [“ouid111”, “ouid112”]}@.
--
-- -   Specify accounts and OUs together in a single map, separated with a
--     comma. For example, the following is a valid map:
--     @{“ACCOUNT” : [“accountID1”, “accountID2”], “ORG_UNIT” : [“ouid111”, “ouid112”]}@.
policy_includeMap :: Lens.Lens' Policy (Prelude.Maybe (Prelude.HashMap CustomerPolicyScopeIdType [Prelude.Text]))
policy_includeMap :: (Maybe (HashMap CustomerPolicyScopeIdType [Text])
 -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> Policy -> f Policy
policy_includeMap = (Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text]))
-> (Policy
    -> Maybe (HashMap CustomerPolicyScopeIdType [Text]) -> Policy)
-> Lens
     Policy
     Policy
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
$sel:includeMap:Policy' :: Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap} -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap) (\s :: Policy
s@Policy' {} Maybe (HashMap CustomerPolicyScopeIdType [Text])
a -> Policy
s {$sel:includeMap:Policy' :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap = Maybe (HashMap CustomerPolicyScopeIdType [Text])
a} :: Policy) ((Maybe (HashMap CustomerPolicyScopeIdType [Text])
  -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
 -> Policy -> f Policy)
-> ((Maybe (HashMap CustomerPolicyScopeIdType [Text])
     -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
    -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
    -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> (Maybe (HashMap CustomerPolicyScopeIdType [Text])
    -> f (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> Policy
-> f Policy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
-> Iso
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
     (Maybe (HashMap CustomerPolicyScopeIdType [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
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
  (HashMap CustomerPolicyScopeIdType [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the Firewall Manager policy.
policy_policyName :: Lens.Lens' Policy Prelude.Text
policy_policyName :: (Text -> f Text) -> Policy -> f Policy
policy_policyName = (Policy -> Text)
-> (Policy -> Text -> Policy) -> Lens Policy Policy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Text
policyName :: Text
$sel:policyName:Policy' :: Policy -> Text
policyName} -> Text
policyName) (\s :: Policy
s@Policy' {} Text
a -> Policy
s {$sel:policyName:Policy' :: Text
policyName = Text
a} :: Policy)

-- | Details about the security service that is being used to protect the
-- resources.
policy_securityServicePolicyData :: Lens.Lens' Policy SecurityServicePolicyData
policy_securityServicePolicyData :: (SecurityServicePolicyData -> f SecurityServicePolicyData)
-> Policy -> f Policy
policy_securityServicePolicyData = (Policy -> SecurityServicePolicyData)
-> (Policy -> SecurityServicePolicyData -> Policy)
-> Lens
     Policy Policy SecurityServicePolicyData SecurityServicePolicyData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {SecurityServicePolicyData
securityServicePolicyData :: SecurityServicePolicyData
$sel:securityServicePolicyData:Policy' :: Policy -> SecurityServicePolicyData
securityServicePolicyData} -> SecurityServicePolicyData
securityServicePolicyData) (\s :: Policy
s@Policy' {} SecurityServicePolicyData
a -> Policy
s {$sel:securityServicePolicyData:Policy' :: SecurityServicePolicyData
securityServicePolicyData = SecurityServicePolicyData
a} :: Policy)

-- | 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>.
-- To apply this policy to multiple resource types, specify a resource type
-- of @ResourceTypeList@ and then specify the resource types in a
-- @ResourceTypeList@.
--
-- For WAF and Shield Advanced, example resource types 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@.
policy_resourceType :: Lens.Lens' Policy Prelude.Text
policy_resourceType :: (Text -> f Text) -> Policy -> f Policy
policy_resourceType = (Policy -> Text)
-> (Policy -> Text -> Policy) -> Lens Policy Policy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Text
resourceType :: Text
$sel:resourceType:Policy' :: Policy -> Text
resourceType} -> Text
resourceType) (\s :: Policy
s@Policy' {} Text
a -> Policy
s {$sel:resourceType:Policy' :: Text
resourceType = Text
a} :: Policy)

-- | If set to @True@, resources with the tags that are specified in the
-- @ResourceTag@ array are not in scope of the policy. If set to @False@,
-- and the @ResourceTag@ array is not null, only resources with the
-- specified tags are in scope of the policy.
policy_excludeResourceTags :: Lens.Lens' Policy Prelude.Bool
policy_excludeResourceTags :: (Bool -> f Bool) -> Policy -> f Policy
policy_excludeResourceTags = (Policy -> Bool)
-> (Policy -> Bool -> Policy) -> Lens Policy Policy Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Bool
excludeResourceTags :: Bool
$sel:excludeResourceTags:Policy' :: Policy -> Bool
excludeResourceTags} -> Bool
excludeResourceTags) (\s :: Policy
s@Policy' {} Bool
a -> Policy
s {$sel:excludeResourceTags:Policy' :: Bool
excludeResourceTags = Bool
a} :: Policy)

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

instance Core.FromJSON Policy where
  parseJSON :: Value -> Parser Policy
parseJSON =
    String -> (Object -> Parser Policy) -> Value -> Parser Policy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Policy"
      ( \Object
x ->
          Maybe Text
-> Maybe [Text]
-> Maybe [ResourceTag]
-> Maybe Text
-> Maybe Bool
-> Maybe (HashMap CustomerPolicyScopeIdType [Text])
-> Maybe (HashMap CustomerPolicyScopeIdType [Text])
-> Text
-> SecurityServicePolicyData
-> Text
-> Bool
-> Bool
-> Policy
Policy'
            (Maybe Text
 -> Maybe [Text]
 -> Maybe [ResourceTag]
 -> Maybe Text
 -> Maybe Bool
 -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
 -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
 -> Text
 -> SecurityServicePolicyData
 -> Text
 -> Bool
 -> Bool
 -> Policy)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe [ResourceTag]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Text
      -> SecurityServicePolicyData
      -> Text
      -> Bool
      -> Bool
      -> Policy)
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
"PolicyId")
            Parser
  (Maybe [Text]
   -> Maybe [ResourceTag]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Text
   -> SecurityServicePolicyData
   -> Text
   -> Bool
   -> Bool
   -> Policy)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [ResourceTag]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Text
      -> SecurityServicePolicyData
      -> Text
      -> Bool
      -> Bool
      -> Policy)
forall (f :: * -> *) a b. Applicative f => 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
"ResourceTypeList"
                            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 [ResourceTag]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Text
   -> SecurityServicePolicyData
   -> Text
   -> Bool
   -> Bool
   -> Policy)
-> Parser (Maybe [ResourceTag])
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Text
      -> SecurityServicePolicyData
      -> Text
      -> Bool
      -> Bool
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [ResourceTag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceTags" Parser (Maybe (Maybe [ResourceTag]))
-> Maybe [ResourceTag] -> Parser (Maybe [ResourceTag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ResourceTag]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Text
   -> SecurityServicePolicyData
   -> Text
   -> Bool
   -> Bool
   -> Policy)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Text
      -> SecurityServicePolicyData
      -> Text
      -> Bool
      -> Bool
      -> Policy)
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
"PolicyUpdateToken")
            Parser
  (Maybe Bool
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Text
   -> SecurityServicePolicyData
   -> Text
   -> Bool
   -> Bool
   -> Policy)
-> Parser (Maybe Bool)
-> Parser
     (Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Text
      -> SecurityServicePolicyData
      -> Text
      -> Bool
      -> Bool
      -> Policy)
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 (HashMap CustomerPolicyScopeIdType [Text])
   -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Text
   -> SecurityServicePolicyData
   -> Text
   -> Bool
   -> Bool
   -> Policy)
-> Parser (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
-> Parser
     (Maybe (HashMap CustomerPolicyScopeIdType [Text])
      -> Text
      -> SecurityServicePolicyData
      -> Text
      -> Bool
      -> Bool
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser
     (Maybe (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExcludeMap" Parser (Maybe (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> Maybe (HashMap CustomerPolicyScopeIdType [Text])
-> Parser (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap CustomerPolicyScopeIdType [Text])
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe (HashMap CustomerPolicyScopeIdType [Text])
   -> Text
   -> SecurityServicePolicyData
   -> Text
   -> Bool
   -> Bool
   -> Policy)
-> Parser (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
-> Parser
     (Text
      -> SecurityServicePolicyData -> Text -> Bool -> Bool -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser
     (Maybe (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IncludeMap" Parser (Maybe (Maybe (HashMap CustomerPolicyScopeIdType [Text])))
-> Maybe (HashMap CustomerPolicyScopeIdType [Text])
-> Parser (Maybe (HashMap CustomerPolicyScopeIdType [Text]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap CustomerPolicyScopeIdType [Text])
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Text
   -> SecurityServicePolicyData -> Text -> Bool -> Bool -> Policy)
-> Parser Text
-> Parser
     (SecurityServicePolicyData -> Text -> Bool -> Bool -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PolicyName")
            Parser
  (SecurityServicePolicyData -> Text -> Bool -> Bool -> Policy)
-> Parser SecurityServicePolicyData
-> Parser (Text -> Bool -> Bool -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SecurityServicePolicyData
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SecurityServicePolicyData")
            Parser (Text -> Bool -> Bool -> Policy)
-> Parser Text -> Parser (Bool -> Bool -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceType")
            Parser (Bool -> Bool -> Policy)
-> Parser Bool -> Parser (Bool -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ExcludeResourceTags")
            Parser (Bool -> Policy) -> Parser Bool -> Parser Policy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RemediationEnabled")
      )

instance Prelude.Hashable Policy

instance Prelude.NFData Policy

instance Core.ToJSON Policy where
  toJSON :: Policy -> Value
toJSON Policy' {Bool
Maybe Bool
Maybe [Text]
Maybe [ResourceTag]
Maybe Text
Maybe (HashMap CustomerPolicyScopeIdType [Text])
Text
SecurityServicePolicyData
remediationEnabled :: Bool
excludeResourceTags :: Bool
resourceType :: Text
securityServicePolicyData :: SecurityServicePolicyData
policyName :: Text
includeMap :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap :: Maybe (HashMap CustomerPolicyScopeIdType [Text])
deleteUnusedFMManagedResources :: Maybe Bool
policyUpdateToken :: Maybe Text
resourceTags :: Maybe [ResourceTag]
resourceTypeList :: Maybe [Text]
policyId :: Maybe Text
$sel:remediationEnabled:Policy' :: Policy -> Bool
$sel:excludeResourceTags:Policy' :: Policy -> Bool
$sel:resourceType:Policy' :: Policy -> Text
$sel:securityServicePolicyData:Policy' :: Policy -> SecurityServicePolicyData
$sel:policyName:Policy' :: Policy -> Text
$sel:includeMap:Policy' :: Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
$sel:excludeMap:Policy' :: Policy -> Maybe (HashMap CustomerPolicyScopeIdType [Text])
$sel:deleteUnusedFMManagedResources:Policy' :: Policy -> Maybe Bool
$sel:policyUpdateToken:Policy' :: Policy -> Maybe Text
$sel:resourceTags:Policy' :: Policy -> Maybe [ResourceTag]
$sel:resourceTypeList:Policy' :: Policy -> Maybe [Text]
$sel:policyId:Policy' :: Policy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PolicyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyId,
            (Text
"ResourceTypeList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
resourceTypeList,
            (Text
"ResourceTags" Text -> [ResourceTag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ResourceTag] -> Pair) -> Maybe [ResourceTag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ResourceTag]
resourceTags,
            (Text
"PolicyUpdateToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyUpdateToken,
            (Text
"DeleteUnusedFMManagedResources" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
deleteUnusedFMManagedResources,
            (Text
"ExcludeMap" Text -> HashMap CustomerPolicyScopeIdType [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap CustomerPolicyScopeIdType [Text] -> Pair)
-> Maybe (HashMap CustomerPolicyScopeIdType [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap CustomerPolicyScopeIdType [Text])
excludeMap,
            (Text
"IncludeMap" Text -> HashMap CustomerPolicyScopeIdType [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap CustomerPolicyScopeIdType [Text] -> Pair)
-> Maybe (HashMap CustomerPolicyScopeIdType [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap CustomerPolicyScopeIdType [Text])
includeMap,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PolicyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"SecurityServicePolicyData"
                  Text -> SecurityServicePolicyData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SecurityServicePolicyData
securityServicePolicyData
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ExcludeResourceTags" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
excludeResourceTags),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RemediationEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
remediationEnabled)
          ]
      )