{-# 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.ServiceCatalog.Types.ResourceChangeDetail
-- 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.ServiceCatalog.Types.ResourceChangeDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ServiceCatalog.Types.EvaluationType
import Amazonka.ServiceCatalog.Types.ResourceTargetDefinition

-- | Information about a change to a resource attribute.
--
-- /See:/ 'newResourceChangeDetail' smart constructor.
data ResourceChangeDetail = ResourceChangeDetail'
  { -- | The ID of the entity that caused the change.
    ResourceChangeDetail -> Maybe Text
causingEntity :: Prelude.Maybe Prelude.Text,
    -- | For static evaluations, the value of the resource attribute will change
    -- and the new value is known. For dynamic evaluations, the value might
    -- change, and any new value will be determined when the plan is updated.
    ResourceChangeDetail -> Maybe EvaluationType
evaluation :: Prelude.Maybe EvaluationType,
    -- | Information about the resource attribute to be modified.
    ResourceChangeDetail -> Maybe ResourceTargetDefinition
target :: Prelude.Maybe ResourceTargetDefinition
  }
  deriving (ResourceChangeDetail -> ResourceChangeDetail -> Bool
(ResourceChangeDetail -> ResourceChangeDetail -> Bool)
-> (ResourceChangeDetail -> ResourceChangeDetail -> Bool)
-> Eq ResourceChangeDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceChangeDetail -> ResourceChangeDetail -> Bool
$c/= :: ResourceChangeDetail -> ResourceChangeDetail -> Bool
== :: ResourceChangeDetail -> ResourceChangeDetail -> Bool
$c== :: ResourceChangeDetail -> ResourceChangeDetail -> Bool
Prelude.Eq, ReadPrec [ResourceChangeDetail]
ReadPrec ResourceChangeDetail
Int -> ReadS ResourceChangeDetail
ReadS [ResourceChangeDetail]
(Int -> ReadS ResourceChangeDetail)
-> ReadS [ResourceChangeDetail]
-> ReadPrec ResourceChangeDetail
-> ReadPrec [ResourceChangeDetail]
-> Read ResourceChangeDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceChangeDetail]
$creadListPrec :: ReadPrec [ResourceChangeDetail]
readPrec :: ReadPrec ResourceChangeDetail
$creadPrec :: ReadPrec ResourceChangeDetail
readList :: ReadS [ResourceChangeDetail]
$creadList :: ReadS [ResourceChangeDetail]
readsPrec :: Int -> ReadS ResourceChangeDetail
$creadsPrec :: Int -> ReadS ResourceChangeDetail
Prelude.Read, Int -> ResourceChangeDetail -> ShowS
[ResourceChangeDetail] -> ShowS
ResourceChangeDetail -> String
(Int -> ResourceChangeDetail -> ShowS)
-> (ResourceChangeDetail -> String)
-> ([ResourceChangeDetail] -> ShowS)
-> Show ResourceChangeDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceChangeDetail] -> ShowS
$cshowList :: [ResourceChangeDetail] -> ShowS
show :: ResourceChangeDetail -> String
$cshow :: ResourceChangeDetail -> String
showsPrec :: Int -> ResourceChangeDetail -> ShowS
$cshowsPrec :: Int -> ResourceChangeDetail -> ShowS
Prelude.Show, (forall x. ResourceChangeDetail -> Rep ResourceChangeDetail x)
-> (forall x. Rep ResourceChangeDetail x -> ResourceChangeDetail)
-> Generic ResourceChangeDetail
forall x. Rep ResourceChangeDetail x -> ResourceChangeDetail
forall x. ResourceChangeDetail -> Rep ResourceChangeDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceChangeDetail x -> ResourceChangeDetail
$cfrom :: forall x. ResourceChangeDetail -> Rep ResourceChangeDetail x
Prelude.Generic)

-- |
-- Create a value of 'ResourceChangeDetail' 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:
--
-- 'causingEntity', 'resourceChangeDetail_causingEntity' - The ID of the entity that caused the change.
--
-- 'evaluation', 'resourceChangeDetail_evaluation' - For static evaluations, the value of the resource attribute will change
-- and the new value is known. For dynamic evaluations, the value might
-- change, and any new value will be determined when the plan is updated.
--
-- 'target', 'resourceChangeDetail_target' - Information about the resource attribute to be modified.
newResourceChangeDetail ::
  ResourceChangeDetail
newResourceChangeDetail :: ResourceChangeDetail
newResourceChangeDetail =
  ResourceChangeDetail' :: Maybe Text
-> Maybe EvaluationType
-> Maybe ResourceTargetDefinition
-> ResourceChangeDetail
ResourceChangeDetail'
    { $sel:causingEntity:ResourceChangeDetail' :: Maybe Text
causingEntity =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluation:ResourceChangeDetail' :: Maybe EvaluationType
evaluation = Maybe EvaluationType
forall a. Maybe a
Prelude.Nothing,
      $sel:target:ResourceChangeDetail' :: Maybe ResourceTargetDefinition
target = Maybe ResourceTargetDefinition
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the entity that caused the change.
resourceChangeDetail_causingEntity :: Lens.Lens' ResourceChangeDetail (Prelude.Maybe Prelude.Text)
resourceChangeDetail_causingEntity :: (Maybe Text -> f (Maybe Text))
-> ResourceChangeDetail -> f ResourceChangeDetail
resourceChangeDetail_causingEntity = (ResourceChangeDetail -> Maybe Text)
-> (ResourceChangeDetail -> Maybe Text -> ResourceChangeDetail)
-> Lens
     ResourceChangeDetail ResourceChangeDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceChangeDetail' {Maybe Text
causingEntity :: Maybe Text
$sel:causingEntity:ResourceChangeDetail' :: ResourceChangeDetail -> Maybe Text
causingEntity} -> Maybe Text
causingEntity) (\s :: ResourceChangeDetail
s@ResourceChangeDetail' {} Maybe Text
a -> ResourceChangeDetail
s {$sel:causingEntity:ResourceChangeDetail' :: Maybe Text
causingEntity = Maybe Text
a} :: ResourceChangeDetail)

-- | For static evaluations, the value of the resource attribute will change
-- and the new value is known. For dynamic evaluations, the value might
-- change, and any new value will be determined when the plan is updated.
resourceChangeDetail_evaluation :: Lens.Lens' ResourceChangeDetail (Prelude.Maybe EvaluationType)
resourceChangeDetail_evaluation :: (Maybe EvaluationType -> f (Maybe EvaluationType))
-> ResourceChangeDetail -> f ResourceChangeDetail
resourceChangeDetail_evaluation = (ResourceChangeDetail -> Maybe EvaluationType)
-> (ResourceChangeDetail
    -> Maybe EvaluationType -> ResourceChangeDetail)
-> Lens
     ResourceChangeDetail
     ResourceChangeDetail
     (Maybe EvaluationType)
     (Maybe EvaluationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceChangeDetail' {Maybe EvaluationType
evaluation :: Maybe EvaluationType
$sel:evaluation:ResourceChangeDetail' :: ResourceChangeDetail -> Maybe EvaluationType
evaluation} -> Maybe EvaluationType
evaluation) (\s :: ResourceChangeDetail
s@ResourceChangeDetail' {} Maybe EvaluationType
a -> ResourceChangeDetail
s {$sel:evaluation:ResourceChangeDetail' :: Maybe EvaluationType
evaluation = Maybe EvaluationType
a} :: ResourceChangeDetail)

-- | Information about the resource attribute to be modified.
resourceChangeDetail_target :: Lens.Lens' ResourceChangeDetail (Prelude.Maybe ResourceTargetDefinition)
resourceChangeDetail_target :: (Maybe ResourceTargetDefinition
 -> f (Maybe ResourceTargetDefinition))
-> ResourceChangeDetail -> f ResourceChangeDetail
resourceChangeDetail_target = (ResourceChangeDetail -> Maybe ResourceTargetDefinition)
-> (ResourceChangeDetail
    -> Maybe ResourceTargetDefinition -> ResourceChangeDetail)
-> Lens
     ResourceChangeDetail
     ResourceChangeDetail
     (Maybe ResourceTargetDefinition)
     (Maybe ResourceTargetDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceChangeDetail' {Maybe ResourceTargetDefinition
target :: Maybe ResourceTargetDefinition
$sel:target:ResourceChangeDetail' :: ResourceChangeDetail -> Maybe ResourceTargetDefinition
target} -> Maybe ResourceTargetDefinition
target) (\s :: ResourceChangeDetail
s@ResourceChangeDetail' {} Maybe ResourceTargetDefinition
a -> ResourceChangeDetail
s {$sel:target:ResourceChangeDetail' :: Maybe ResourceTargetDefinition
target = Maybe ResourceTargetDefinition
a} :: ResourceChangeDetail)

instance Core.FromJSON ResourceChangeDetail where
  parseJSON :: Value -> Parser ResourceChangeDetail
parseJSON =
    String
-> (Object -> Parser ResourceChangeDetail)
-> Value
-> Parser ResourceChangeDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceChangeDetail"
      ( \Object
x ->
          Maybe Text
-> Maybe EvaluationType
-> Maybe ResourceTargetDefinition
-> ResourceChangeDetail
ResourceChangeDetail'
            (Maybe Text
 -> Maybe EvaluationType
 -> Maybe ResourceTargetDefinition
 -> ResourceChangeDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe EvaluationType
      -> Maybe ResourceTargetDefinition -> ResourceChangeDetail)
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
"CausingEntity")
            Parser
  (Maybe EvaluationType
   -> Maybe ResourceTargetDefinition -> ResourceChangeDetail)
-> Parser (Maybe EvaluationType)
-> Parser (Maybe ResourceTargetDefinition -> ResourceChangeDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EvaluationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Evaluation")
            Parser (Maybe ResourceTargetDefinition -> ResourceChangeDetail)
-> Parser (Maybe ResourceTargetDefinition)
-> Parser ResourceChangeDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceTargetDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Target")
      )

instance Prelude.Hashable ResourceChangeDetail

instance Prelude.NFData ResourceChangeDetail