{-# 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.DLM.Types.PolicyDetails
-- 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.DLM.Types.PolicyDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DLM.Types.Action
import Amazonka.DLM.Types.EventSource
import Amazonka.DLM.Types.Parameters
import Amazonka.DLM.Types.PolicyTypeValues
import Amazonka.DLM.Types.ResourceLocationValues
import Amazonka.DLM.Types.ResourceTypeValues
import Amazonka.DLM.Types.Schedule
import Amazonka.DLM.Types.Tag
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | __[All policy types]__ Specifies the configuration of a lifecycle
-- policy.
--
-- /See:/ 'newPolicyDetails' smart constructor.
data PolicyDetails = PolicyDetails'
  { -- | __[Event-based policies only]__ The actions to be performed when the
    -- event-based policy is activated. You can specify only one action per
    -- policy.
    PolicyDetails -> Maybe (NonEmpty Action)
actions :: Prelude.Maybe (Prelude.NonEmpty Action),
    -- | __[Event-based policies only]__ The event that activates the event-based
    -- policy.
    PolicyDetails -> Maybe EventSource
eventSource :: Prelude.Maybe EventSource,
    -- | __[Snapshot and AMI policies only]__ A set of optional parameters for
    -- snapshot and AMI lifecycle policies.
    --
    -- If you are modifying a policy that was created or previously modified
    -- using the Amazon Data Lifecycle Manager console, then you must include
    -- this parameter and specify either the default values or the new values
    -- that you require. You can\'t omit this parameter or set its values to
    -- null.
    PolicyDetails -> Maybe Parameters
parameters :: Prelude.Maybe Parameters,
    -- | __[All policy types]__ The valid target resource types and actions a
    -- policy can manage. Specify @EBS_SNAPSHOT_MANAGEMENT@ to create a
    -- lifecycle policy that manages the lifecycle of Amazon EBS snapshots.
    -- Specify @IMAGE_MANAGEMENT@ to create a lifecycle policy that manages the
    -- lifecycle of EBS-backed AMIs. Specify @EVENT_BASED_POLICY @ to create an
    -- event-based policy that performs specific actions when a defined event
    -- occurs in your Amazon Web Services account.
    --
    -- The default is @EBS_SNAPSHOT_MANAGEMENT@.
    PolicyDetails -> Maybe PolicyTypeValues
policyType :: Prelude.Maybe PolicyTypeValues,
    -- | __[Snapshot and AMI policies only]__ The location of the resources to
    -- backup. If the source resources are located in an Amazon Web Services
    -- Region, specify @CLOUD@. If the source resources are located on an
    -- Outpost in your account, specify @OUTPOST@.
    --
    -- If you specify @OUTPOST@, Amazon Data Lifecycle Manager backs up all
    -- resources of the specified type with matching target tags across all of
    -- the Outposts in your account.
    PolicyDetails -> Maybe (NonEmpty ResourceLocationValues)
resourceLocations :: Prelude.Maybe (Prelude.NonEmpty ResourceLocationValues),
    -- | __[Snapshot policies only]__ The target resource type for snapshot and
    -- AMI lifecycle policies. Use @VOLUME @to create snapshots of individual
    -- volumes or use @INSTANCE@ to create multi-volume snapshots from the
    -- volumes for an instance.
    PolicyDetails -> Maybe (NonEmpty ResourceTypeValues)
resourceTypes :: Prelude.Maybe (Prelude.NonEmpty ResourceTypeValues),
    -- | __[Snapshot and AMI policies only]__ The schedules of policy-defined
    -- actions for snapshot and AMI lifecycle policies. A policy can have up to
    -- four schedules—one mandatory schedule and up to three optional
    -- schedules.
    PolicyDetails -> Maybe (NonEmpty Schedule)
schedules :: Prelude.Maybe (Prelude.NonEmpty Schedule),
    -- | __[Snapshot and AMI policies only]__ The single tag that identifies
    -- targeted resources for this policy.
    PolicyDetails -> Maybe (NonEmpty Tag)
targetTags :: Prelude.Maybe (Prelude.NonEmpty Tag)
  }
  deriving (PolicyDetails -> PolicyDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyDetails -> PolicyDetails -> Bool
$c/= :: PolicyDetails -> PolicyDetails -> Bool
== :: PolicyDetails -> PolicyDetails -> Bool
$c== :: PolicyDetails -> PolicyDetails -> Bool
Prelude.Eq, ReadPrec [PolicyDetails]
ReadPrec PolicyDetails
Int -> ReadS PolicyDetails
ReadS [PolicyDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyDetails]
$creadListPrec :: ReadPrec [PolicyDetails]
readPrec :: ReadPrec PolicyDetails
$creadPrec :: ReadPrec PolicyDetails
readList :: ReadS [PolicyDetails]
$creadList :: ReadS [PolicyDetails]
readsPrec :: Int -> ReadS PolicyDetails
$creadsPrec :: Int -> ReadS PolicyDetails
Prelude.Read, Int -> PolicyDetails -> ShowS
[PolicyDetails] -> ShowS
PolicyDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyDetails] -> ShowS
$cshowList :: [PolicyDetails] -> ShowS
show :: PolicyDetails -> String
$cshow :: PolicyDetails -> String
showsPrec :: Int -> PolicyDetails -> ShowS
$cshowsPrec :: Int -> PolicyDetails -> ShowS
Prelude.Show, forall x. Rep PolicyDetails x -> PolicyDetails
forall x. PolicyDetails -> Rep PolicyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyDetails x -> PolicyDetails
$cfrom :: forall x. PolicyDetails -> Rep PolicyDetails x
Prelude.Generic)

-- |
-- Create a value of 'PolicyDetails' 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:
--
-- 'actions', 'policyDetails_actions' - __[Event-based policies only]__ The actions to be performed when the
-- event-based policy is activated. You can specify only one action per
-- policy.
--
-- 'eventSource', 'policyDetails_eventSource' - __[Event-based policies only]__ The event that activates the event-based
-- policy.
--
-- 'parameters', 'policyDetails_parameters' - __[Snapshot and AMI policies only]__ A set of optional parameters for
-- snapshot and AMI lifecycle policies.
--
-- If you are modifying a policy that was created or previously modified
-- using the Amazon Data Lifecycle Manager console, then you must include
-- this parameter and specify either the default values or the new values
-- that you require. You can\'t omit this parameter or set its values to
-- null.
--
-- 'policyType', 'policyDetails_policyType' - __[All policy types]__ The valid target resource types and actions a
-- policy can manage. Specify @EBS_SNAPSHOT_MANAGEMENT@ to create a
-- lifecycle policy that manages the lifecycle of Amazon EBS snapshots.
-- Specify @IMAGE_MANAGEMENT@ to create a lifecycle policy that manages the
-- lifecycle of EBS-backed AMIs. Specify @EVENT_BASED_POLICY @ to create an
-- event-based policy that performs specific actions when a defined event
-- occurs in your Amazon Web Services account.
--
-- The default is @EBS_SNAPSHOT_MANAGEMENT@.
--
-- 'resourceLocations', 'policyDetails_resourceLocations' - __[Snapshot and AMI policies only]__ The location of the resources to
-- backup. If the source resources are located in an Amazon Web Services
-- Region, specify @CLOUD@. If the source resources are located on an
-- Outpost in your account, specify @OUTPOST@.
--
-- If you specify @OUTPOST@, Amazon Data Lifecycle Manager backs up all
-- resources of the specified type with matching target tags across all of
-- the Outposts in your account.
--
-- 'resourceTypes', 'policyDetails_resourceTypes' - __[Snapshot policies only]__ The target resource type for snapshot and
-- AMI lifecycle policies. Use @VOLUME @to create snapshots of individual
-- volumes or use @INSTANCE@ to create multi-volume snapshots from the
-- volumes for an instance.
--
-- 'schedules', 'policyDetails_schedules' - __[Snapshot and AMI policies only]__ The schedules of policy-defined
-- actions for snapshot and AMI lifecycle policies. A policy can have up to
-- four schedules—one mandatory schedule and up to three optional
-- schedules.
--
-- 'targetTags', 'policyDetails_targetTags' - __[Snapshot and AMI policies only]__ The single tag that identifies
-- targeted resources for this policy.
newPolicyDetails ::
  PolicyDetails
newPolicyDetails :: PolicyDetails
newPolicyDetails =
  PolicyDetails'
    { $sel:actions:PolicyDetails' :: Maybe (NonEmpty Action)
actions = forall a. Maybe a
Prelude.Nothing,
      $sel:eventSource:PolicyDetails' :: Maybe EventSource
eventSource = forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:PolicyDetails' :: Maybe Parameters
parameters = forall a. Maybe a
Prelude.Nothing,
      $sel:policyType:PolicyDetails' :: Maybe PolicyTypeValues
policyType = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceLocations:PolicyDetails' :: Maybe (NonEmpty ResourceLocationValues)
resourceLocations = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTypes:PolicyDetails' :: Maybe (NonEmpty ResourceTypeValues)
resourceTypes = forall a. Maybe a
Prelude.Nothing,
      $sel:schedules:PolicyDetails' :: Maybe (NonEmpty Schedule)
schedules = forall a. Maybe a
Prelude.Nothing,
      $sel:targetTags:PolicyDetails' :: Maybe (NonEmpty Tag)
targetTags = forall a. Maybe a
Prelude.Nothing
    }

-- | __[Event-based policies only]__ The actions to be performed when the
-- event-based policy is activated. You can specify only one action per
-- policy.
policyDetails_actions :: Lens.Lens' PolicyDetails (Prelude.Maybe (Prelude.NonEmpty Action))
policyDetails_actions :: Lens' PolicyDetails (Maybe (NonEmpty Action))
policyDetails_actions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe (NonEmpty Action)
actions :: Maybe (NonEmpty Action)
$sel:actions:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Action)
actions} -> Maybe (NonEmpty Action)
actions) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe (NonEmpty Action)
a -> PolicyDetails
s {$sel:actions:PolicyDetails' :: Maybe (NonEmpty Action)
actions = Maybe (NonEmpty Action)
a} :: PolicyDetails) 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

-- | __[Event-based policies only]__ The event that activates the event-based
-- policy.
policyDetails_eventSource :: Lens.Lens' PolicyDetails (Prelude.Maybe EventSource)
policyDetails_eventSource :: Lens' PolicyDetails (Maybe EventSource)
policyDetails_eventSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe EventSource
eventSource :: Maybe EventSource
$sel:eventSource:PolicyDetails' :: PolicyDetails -> Maybe EventSource
eventSource} -> Maybe EventSource
eventSource) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe EventSource
a -> PolicyDetails
s {$sel:eventSource:PolicyDetails' :: Maybe EventSource
eventSource = Maybe EventSource
a} :: PolicyDetails)

-- | __[Snapshot and AMI policies only]__ A set of optional parameters for
-- snapshot and AMI lifecycle policies.
--
-- If you are modifying a policy that was created or previously modified
-- using the Amazon Data Lifecycle Manager console, then you must include
-- this parameter and specify either the default values or the new values
-- that you require. You can\'t omit this parameter or set its values to
-- null.
policyDetails_parameters :: Lens.Lens' PolicyDetails (Prelude.Maybe Parameters)
policyDetails_parameters :: Lens' PolicyDetails (Maybe Parameters)
policyDetails_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe Parameters
parameters :: Maybe Parameters
$sel:parameters:PolicyDetails' :: PolicyDetails -> Maybe Parameters
parameters} -> Maybe Parameters
parameters) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe Parameters
a -> PolicyDetails
s {$sel:parameters:PolicyDetails' :: Maybe Parameters
parameters = Maybe Parameters
a} :: PolicyDetails)

-- | __[All policy types]__ The valid target resource types and actions a
-- policy can manage. Specify @EBS_SNAPSHOT_MANAGEMENT@ to create a
-- lifecycle policy that manages the lifecycle of Amazon EBS snapshots.
-- Specify @IMAGE_MANAGEMENT@ to create a lifecycle policy that manages the
-- lifecycle of EBS-backed AMIs. Specify @EVENT_BASED_POLICY @ to create an
-- event-based policy that performs specific actions when a defined event
-- occurs in your Amazon Web Services account.
--
-- The default is @EBS_SNAPSHOT_MANAGEMENT@.
policyDetails_policyType :: Lens.Lens' PolicyDetails (Prelude.Maybe PolicyTypeValues)
policyDetails_policyType :: Lens' PolicyDetails (Maybe PolicyTypeValues)
policyDetails_policyType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe PolicyTypeValues
policyType :: Maybe PolicyTypeValues
$sel:policyType:PolicyDetails' :: PolicyDetails -> Maybe PolicyTypeValues
policyType} -> Maybe PolicyTypeValues
policyType) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe PolicyTypeValues
a -> PolicyDetails
s {$sel:policyType:PolicyDetails' :: Maybe PolicyTypeValues
policyType = Maybe PolicyTypeValues
a} :: PolicyDetails)

-- | __[Snapshot and AMI policies only]__ The location of the resources to
-- backup. If the source resources are located in an Amazon Web Services
-- Region, specify @CLOUD@. If the source resources are located on an
-- Outpost in your account, specify @OUTPOST@.
--
-- If you specify @OUTPOST@, Amazon Data Lifecycle Manager backs up all
-- resources of the specified type with matching target tags across all of
-- the Outposts in your account.
policyDetails_resourceLocations :: Lens.Lens' PolicyDetails (Prelude.Maybe (Prelude.NonEmpty ResourceLocationValues))
policyDetails_resourceLocations :: Lens' PolicyDetails (Maybe (NonEmpty ResourceLocationValues))
policyDetails_resourceLocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe (NonEmpty ResourceLocationValues)
resourceLocations :: Maybe (NonEmpty ResourceLocationValues)
$sel:resourceLocations:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceLocationValues)
resourceLocations} -> Maybe (NonEmpty ResourceLocationValues)
resourceLocations) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe (NonEmpty ResourceLocationValues)
a -> PolicyDetails
s {$sel:resourceLocations:PolicyDetails' :: Maybe (NonEmpty ResourceLocationValues)
resourceLocations = Maybe (NonEmpty ResourceLocationValues)
a} :: PolicyDetails) 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

-- | __[Snapshot policies only]__ The target resource type for snapshot and
-- AMI lifecycle policies. Use @VOLUME @to create snapshots of individual
-- volumes or use @INSTANCE@ to create multi-volume snapshots from the
-- volumes for an instance.
policyDetails_resourceTypes :: Lens.Lens' PolicyDetails (Prelude.Maybe (Prelude.NonEmpty ResourceTypeValues))
policyDetails_resourceTypes :: Lens' PolicyDetails (Maybe (NonEmpty ResourceTypeValues))
policyDetails_resourceTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe (NonEmpty ResourceTypeValues)
resourceTypes :: Maybe (NonEmpty ResourceTypeValues)
$sel:resourceTypes:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceTypeValues)
resourceTypes} -> Maybe (NonEmpty ResourceTypeValues)
resourceTypes) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe (NonEmpty ResourceTypeValues)
a -> PolicyDetails
s {$sel:resourceTypes:PolicyDetails' :: Maybe (NonEmpty ResourceTypeValues)
resourceTypes = Maybe (NonEmpty ResourceTypeValues)
a} :: PolicyDetails) 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

-- | __[Snapshot and AMI policies only]__ The schedules of policy-defined
-- actions for snapshot and AMI lifecycle policies. A policy can have up to
-- four schedules—one mandatory schedule and up to three optional
-- schedules.
policyDetails_schedules :: Lens.Lens' PolicyDetails (Prelude.Maybe (Prelude.NonEmpty Schedule))
policyDetails_schedules :: Lens' PolicyDetails (Maybe (NonEmpty Schedule))
policyDetails_schedules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe (NonEmpty Schedule)
schedules :: Maybe (NonEmpty Schedule)
$sel:schedules:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Schedule)
schedules} -> Maybe (NonEmpty Schedule)
schedules) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe (NonEmpty Schedule)
a -> PolicyDetails
s {$sel:schedules:PolicyDetails' :: Maybe (NonEmpty Schedule)
schedules = Maybe (NonEmpty Schedule)
a} :: PolicyDetails) 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

-- | __[Snapshot and AMI policies only]__ The single tag that identifies
-- targeted resources for this policy.
policyDetails_targetTags :: Lens.Lens' PolicyDetails (Prelude.Maybe (Prelude.NonEmpty Tag))
policyDetails_targetTags :: Lens' PolicyDetails (Maybe (NonEmpty Tag))
policyDetails_targetTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyDetails' {Maybe (NonEmpty Tag)
targetTags :: Maybe (NonEmpty Tag)
$sel:targetTags:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Tag)
targetTags} -> Maybe (NonEmpty Tag)
targetTags) (\s :: PolicyDetails
s@PolicyDetails' {} Maybe (NonEmpty Tag)
a -> PolicyDetails
s {$sel:targetTags:PolicyDetails' :: Maybe (NonEmpty Tag)
targetTags = Maybe (NonEmpty Tag)
a} :: PolicyDetails) 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

instance Data.FromJSON PolicyDetails where
  parseJSON :: Value -> Parser PolicyDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PolicyDetails"
      ( \Object
x ->
          Maybe (NonEmpty Action)
-> Maybe EventSource
-> Maybe Parameters
-> Maybe PolicyTypeValues
-> Maybe (NonEmpty ResourceLocationValues)
-> Maybe (NonEmpty ResourceTypeValues)
-> Maybe (NonEmpty Schedule)
-> Maybe (NonEmpty Tag)
-> PolicyDetails
PolicyDetails'
            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
"Actions")
            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
"EventSource")
            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
"Parameters")
            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
"PolicyType")
            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
"ResourceLocations")
            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
"ResourceTypes")
            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
"Schedules")
            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
"TargetTags")
      )

instance Prelude.Hashable PolicyDetails where
  hashWithSalt :: Int -> PolicyDetails -> Int
hashWithSalt Int
_salt PolicyDetails' {Maybe (NonEmpty ResourceLocationValues)
Maybe (NonEmpty ResourceTypeValues)
Maybe (NonEmpty Action)
Maybe (NonEmpty Tag)
Maybe (NonEmpty Schedule)
Maybe EventSource
Maybe PolicyTypeValues
Maybe Parameters
targetTags :: Maybe (NonEmpty Tag)
schedules :: Maybe (NonEmpty Schedule)
resourceTypes :: Maybe (NonEmpty ResourceTypeValues)
resourceLocations :: Maybe (NonEmpty ResourceLocationValues)
policyType :: Maybe PolicyTypeValues
parameters :: Maybe Parameters
eventSource :: Maybe EventSource
actions :: Maybe (NonEmpty Action)
$sel:targetTags:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Tag)
$sel:schedules:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Schedule)
$sel:resourceTypes:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceTypeValues)
$sel:resourceLocations:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceLocationValues)
$sel:policyType:PolicyDetails' :: PolicyDetails -> Maybe PolicyTypeValues
$sel:parameters:PolicyDetails' :: PolicyDetails -> Maybe Parameters
$sel:eventSource:PolicyDetails' :: PolicyDetails -> Maybe EventSource
$sel:actions:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Action)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Action)
actions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventSource
eventSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Parameters
parameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PolicyTypeValues
policyType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ResourceLocationValues)
resourceLocations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ResourceTypeValues)
resourceTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Schedule)
schedules
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
targetTags

instance Prelude.NFData PolicyDetails where
  rnf :: PolicyDetails -> ()
rnf PolicyDetails' {Maybe (NonEmpty ResourceLocationValues)
Maybe (NonEmpty ResourceTypeValues)
Maybe (NonEmpty Action)
Maybe (NonEmpty Tag)
Maybe (NonEmpty Schedule)
Maybe EventSource
Maybe PolicyTypeValues
Maybe Parameters
targetTags :: Maybe (NonEmpty Tag)
schedules :: Maybe (NonEmpty Schedule)
resourceTypes :: Maybe (NonEmpty ResourceTypeValues)
resourceLocations :: Maybe (NonEmpty ResourceLocationValues)
policyType :: Maybe PolicyTypeValues
parameters :: Maybe Parameters
eventSource :: Maybe EventSource
actions :: Maybe (NonEmpty Action)
$sel:targetTags:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Tag)
$sel:schedules:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Schedule)
$sel:resourceTypes:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceTypeValues)
$sel:resourceLocations:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceLocationValues)
$sel:policyType:PolicyDetails' :: PolicyDetails -> Maybe PolicyTypeValues
$sel:parameters:PolicyDetails' :: PolicyDetails -> Maybe Parameters
$sel:eventSource:PolicyDetails' :: PolicyDetails -> Maybe EventSource
$sel:actions:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Action)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Action)
actions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventSource
eventSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Parameters
parameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PolicyTypeValues
policyType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ResourceLocationValues)
resourceLocations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ResourceTypeValues)
resourceTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Schedule)
schedules
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
targetTags

instance Data.ToJSON PolicyDetails where
  toJSON :: PolicyDetails -> Value
toJSON PolicyDetails' {Maybe (NonEmpty ResourceLocationValues)
Maybe (NonEmpty ResourceTypeValues)
Maybe (NonEmpty Action)
Maybe (NonEmpty Tag)
Maybe (NonEmpty Schedule)
Maybe EventSource
Maybe PolicyTypeValues
Maybe Parameters
targetTags :: Maybe (NonEmpty Tag)
schedules :: Maybe (NonEmpty Schedule)
resourceTypes :: Maybe (NonEmpty ResourceTypeValues)
resourceLocations :: Maybe (NonEmpty ResourceLocationValues)
policyType :: Maybe PolicyTypeValues
parameters :: Maybe Parameters
eventSource :: Maybe EventSource
actions :: Maybe (NonEmpty Action)
$sel:targetTags:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Tag)
$sel:schedules:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Schedule)
$sel:resourceTypes:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceTypeValues)
$sel:resourceLocations:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty ResourceLocationValues)
$sel:policyType:PolicyDetails' :: PolicyDetails -> Maybe PolicyTypeValues
$sel:parameters:PolicyDetails' :: PolicyDetails -> Maybe Parameters
$sel:eventSource:PolicyDetails' :: PolicyDetails -> Maybe EventSource
$sel:actions:PolicyDetails' :: PolicyDetails -> Maybe (NonEmpty Action)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Actions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Action)
actions,
            (Key
"EventSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EventSource
eventSource,
            (Key
"Parameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Parameters
parameters,
            (Key
"PolicyType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PolicyTypeValues
policyType,
            (Key
"ResourceLocations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourceLocationValues)
resourceLocations,
            (Key
"ResourceTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourceTypeValues)
resourceTypes,
            (Key
"Schedules" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Schedule)
schedules,
            (Key
"TargetTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
targetTags
          ]
      )