{-# 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.ResilienceHub.Types.AppComponentCompliance
-- 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.ResilienceHub.Types.AppComponentCompliance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.ResilienceHub.Types.ComplianceStatus
import Amazonka.ResilienceHub.Types.Cost
import Amazonka.ResilienceHub.Types.DisruptionCompliance
import Amazonka.ResilienceHub.Types.DisruptionType
import Amazonka.ResilienceHub.Types.ResiliencyScore

-- | Defines the compliance of an application component against the
-- resiliency policy.
--
-- /See:/ 'newAppComponentCompliance' smart constructor.
data AppComponentCompliance = AppComponentCompliance'
  { -- | The name of the application component.
    AppComponentCompliance -> Maybe Text
appComponentName :: Prelude.Maybe Prelude.Text,
    -- | The compliance of the application component against the resiliency
    -- policy.
    AppComponentCompliance
-> Maybe (HashMap DisruptionType DisruptionCompliance)
compliance :: Prelude.Maybe (Prelude.HashMap DisruptionType DisruptionCompliance),
    -- | The cost for the application.
    AppComponentCompliance -> Maybe Cost
cost :: Prelude.Maybe Cost,
    -- | The compliance message.
    AppComponentCompliance -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The current resiliency score for the application.
    AppComponentCompliance -> Maybe ResiliencyScore
resiliencyScore :: Prelude.Maybe ResiliencyScore,
    -- | The status of the action.
    AppComponentCompliance -> Maybe ComplianceStatus
status :: Prelude.Maybe ComplianceStatus
  }
  deriving (AppComponentCompliance -> AppComponentCompliance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppComponentCompliance -> AppComponentCompliance -> Bool
$c/= :: AppComponentCompliance -> AppComponentCompliance -> Bool
== :: AppComponentCompliance -> AppComponentCompliance -> Bool
$c== :: AppComponentCompliance -> AppComponentCompliance -> Bool
Prelude.Eq, ReadPrec [AppComponentCompliance]
ReadPrec AppComponentCompliance
Int -> ReadS AppComponentCompliance
ReadS [AppComponentCompliance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppComponentCompliance]
$creadListPrec :: ReadPrec [AppComponentCompliance]
readPrec :: ReadPrec AppComponentCompliance
$creadPrec :: ReadPrec AppComponentCompliance
readList :: ReadS [AppComponentCompliance]
$creadList :: ReadS [AppComponentCompliance]
readsPrec :: Int -> ReadS AppComponentCompliance
$creadsPrec :: Int -> ReadS AppComponentCompliance
Prelude.Read, Int -> AppComponentCompliance -> ShowS
[AppComponentCompliance] -> ShowS
AppComponentCompliance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppComponentCompliance] -> ShowS
$cshowList :: [AppComponentCompliance] -> ShowS
show :: AppComponentCompliance -> String
$cshow :: AppComponentCompliance -> String
showsPrec :: Int -> AppComponentCompliance -> ShowS
$cshowsPrec :: Int -> AppComponentCompliance -> ShowS
Prelude.Show, forall x. Rep AppComponentCompliance x -> AppComponentCompliance
forall x. AppComponentCompliance -> Rep AppComponentCompliance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppComponentCompliance x -> AppComponentCompliance
$cfrom :: forall x. AppComponentCompliance -> Rep AppComponentCompliance x
Prelude.Generic)

-- |
-- Create a value of 'AppComponentCompliance' 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:
--
-- 'appComponentName', 'appComponentCompliance_appComponentName' - The name of the application component.
--
-- 'compliance', 'appComponentCompliance_compliance' - The compliance of the application component against the resiliency
-- policy.
--
-- 'cost', 'appComponentCompliance_cost' - The cost for the application.
--
-- 'message', 'appComponentCompliance_message' - The compliance message.
--
-- 'resiliencyScore', 'appComponentCompliance_resiliencyScore' - The current resiliency score for the application.
--
-- 'status', 'appComponentCompliance_status' - The status of the action.
newAppComponentCompliance ::
  AppComponentCompliance
newAppComponentCompliance :: AppComponentCompliance
newAppComponentCompliance =
  AppComponentCompliance'
    { $sel:appComponentName:AppComponentCompliance' :: Maybe Text
appComponentName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:compliance:AppComponentCompliance' :: Maybe (HashMap DisruptionType DisruptionCompliance)
compliance = forall a. Maybe a
Prelude.Nothing,
      $sel:cost:AppComponentCompliance' :: Maybe Cost
cost = forall a. Maybe a
Prelude.Nothing,
      $sel:message:AppComponentCompliance' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:resiliencyScore:AppComponentCompliance' :: Maybe ResiliencyScore
resiliencyScore = forall a. Maybe a
Prelude.Nothing,
      $sel:status:AppComponentCompliance' :: Maybe ComplianceStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the application component.
appComponentCompliance_appComponentName :: Lens.Lens' AppComponentCompliance (Prelude.Maybe Prelude.Text)
appComponentCompliance_appComponentName :: Lens' AppComponentCompliance (Maybe Text)
appComponentCompliance_appComponentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponentCompliance' {Maybe Text
appComponentName :: Maybe Text
$sel:appComponentName:AppComponentCompliance' :: AppComponentCompliance -> Maybe Text
appComponentName} -> Maybe Text
appComponentName) (\s :: AppComponentCompliance
s@AppComponentCompliance' {} Maybe Text
a -> AppComponentCompliance
s {$sel:appComponentName:AppComponentCompliance' :: Maybe Text
appComponentName = Maybe Text
a} :: AppComponentCompliance)

-- | The compliance of the application component against the resiliency
-- policy.
appComponentCompliance_compliance :: Lens.Lens' AppComponentCompliance (Prelude.Maybe (Prelude.HashMap DisruptionType DisruptionCompliance))
appComponentCompliance_compliance :: Lens'
  AppComponentCompliance
  (Maybe (HashMap DisruptionType DisruptionCompliance))
appComponentCompliance_compliance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponentCompliance' {Maybe (HashMap DisruptionType DisruptionCompliance)
compliance :: Maybe (HashMap DisruptionType DisruptionCompliance)
$sel:compliance:AppComponentCompliance' :: AppComponentCompliance
-> Maybe (HashMap DisruptionType DisruptionCompliance)
compliance} -> Maybe (HashMap DisruptionType DisruptionCompliance)
compliance) (\s :: AppComponentCompliance
s@AppComponentCompliance' {} Maybe (HashMap DisruptionType DisruptionCompliance)
a -> AppComponentCompliance
s {$sel:compliance:AppComponentCompliance' :: Maybe (HashMap DisruptionType DisruptionCompliance)
compliance = Maybe (HashMap DisruptionType DisruptionCompliance)
a} :: AppComponentCompliance) 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

-- | The cost for the application.
appComponentCompliance_cost :: Lens.Lens' AppComponentCompliance (Prelude.Maybe Cost)
appComponentCompliance_cost :: Lens' AppComponentCompliance (Maybe Cost)
appComponentCompliance_cost = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponentCompliance' {Maybe Cost
cost :: Maybe Cost
$sel:cost:AppComponentCompliance' :: AppComponentCompliance -> Maybe Cost
cost} -> Maybe Cost
cost) (\s :: AppComponentCompliance
s@AppComponentCompliance' {} Maybe Cost
a -> AppComponentCompliance
s {$sel:cost:AppComponentCompliance' :: Maybe Cost
cost = Maybe Cost
a} :: AppComponentCompliance)

-- | The compliance message.
appComponentCompliance_message :: Lens.Lens' AppComponentCompliance (Prelude.Maybe Prelude.Text)
appComponentCompliance_message :: Lens' AppComponentCompliance (Maybe Text)
appComponentCompliance_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponentCompliance' {Maybe Text
message :: Maybe Text
$sel:message:AppComponentCompliance' :: AppComponentCompliance -> Maybe Text
message} -> Maybe Text
message) (\s :: AppComponentCompliance
s@AppComponentCompliance' {} Maybe Text
a -> AppComponentCompliance
s {$sel:message:AppComponentCompliance' :: Maybe Text
message = Maybe Text
a} :: AppComponentCompliance)

-- | The current resiliency score for the application.
appComponentCompliance_resiliencyScore :: Lens.Lens' AppComponentCompliance (Prelude.Maybe ResiliencyScore)
appComponentCompliance_resiliencyScore :: Lens' AppComponentCompliance (Maybe ResiliencyScore)
appComponentCompliance_resiliencyScore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponentCompliance' {Maybe ResiliencyScore
resiliencyScore :: Maybe ResiliencyScore
$sel:resiliencyScore:AppComponentCompliance' :: AppComponentCompliance -> Maybe ResiliencyScore
resiliencyScore} -> Maybe ResiliencyScore
resiliencyScore) (\s :: AppComponentCompliance
s@AppComponentCompliance' {} Maybe ResiliencyScore
a -> AppComponentCompliance
s {$sel:resiliencyScore:AppComponentCompliance' :: Maybe ResiliencyScore
resiliencyScore = Maybe ResiliencyScore
a} :: AppComponentCompliance)

-- | The status of the action.
appComponentCompliance_status :: Lens.Lens' AppComponentCompliance (Prelude.Maybe ComplianceStatus)
appComponentCompliance_status :: Lens' AppComponentCompliance (Maybe ComplianceStatus)
appComponentCompliance_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponentCompliance' {Maybe ComplianceStatus
status :: Maybe ComplianceStatus
$sel:status:AppComponentCompliance' :: AppComponentCompliance -> Maybe ComplianceStatus
status} -> Maybe ComplianceStatus
status) (\s :: AppComponentCompliance
s@AppComponentCompliance' {} Maybe ComplianceStatus
a -> AppComponentCompliance
s {$sel:status:AppComponentCompliance' :: Maybe ComplianceStatus
status = Maybe ComplianceStatus
a} :: AppComponentCompliance)

instance Data.FromJSON AppComponentCompliance where
  parseJSON :: Value -> Parser AppComponentCompliance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AppComponentCompliance"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap DisruptionType DisruptionCompliance)
-> Maybe Cost
-> Maybe Text
-> Maybe ResiliencyScore
-> Maybe ComplianceStatus
-> AppComponentCompliance
AppComponentCompliance'
            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
"appComponentName")
            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
"compliance" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"cost")
            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
"message")
            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
"resiliencyScore")
            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
"status")
      )

instance Prelude.Hashable AppComponentCompliance where
  hashWithSalt :: Int -> AppComponentCompliance -> Int
hashWithSalt Int
_salt AppComponentCompliance' {Maybe Text
Maybe (HashMap DisruptionType DisruptionCompliance)
Maybe ComplianceStatus
Maybe Cost
Maybe ResiliencyScore
status :: Maybe ComplianceStatus
resiliencyScore :: Maybe ResiliencyScore
message :: Maybe Text
cost :: Maybe Cost
compliance :: Maybe (HashMap DisruptionType DisruptionCompliance)
appComponentName :: Maybe Text
$sel:status:AppComponentCompliance' :: AppComponentCompliance -> Maybe ComplianceStatus
$sel:resiliencyScore:AppComponentCompliance' :: AppComponentCompliance -> Maybe ResiliencyScore
$sel:message:AppComponentCompliance' :: AppComponentCompliance -> Maybe Text
$sel:cost:AppComponentCompliance' :: AppComponentCompliance -> Maybe Cost
$sel:compliance:AppComponentCompliance' :: AppComponentCompliance
-> Maybe (HashMap DisruptionType DisruptionCompliance)
$sel:appComponentName:AppComponentCompliance' :: AppComponentCompliance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appComponentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap DisruptionType DisruptionCompliance)
compliance
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Cost
cost
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResiliencyScore
resiliencyScore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComplianceStatus
status

instance Prelude.NFData AppComponentCompliance where
  rnf :: AppComponentCompliance -> ()
rnf AppComponentCompliance' {Maybe Text
Maybe (HashMap DisruptionType DisruptionCompliance)
Maybe ComplianceStatus
Maybe Cost
Maybe ResiliencyScore
status :: Maybe ComplianceStatus
resiliencyScore :: Maybe ResiliencyScore
message :: Maybe Text
cost :: Maybe Cost
compliance :: Maybe (HashMap DisruptionType DisruptionCompliance)
appComponentName :: Maybe Text
$sel:status:AppComponentCompliance' :: AppComponentCompliance -> Maybe ComplianceStatus
$sel:resiliencyScore:AppComponentCompliance' :: AppComponentCompliance -> Maybe ResiliencyScore
$sel:message:AppComponentCompliance' :: AppComponentCompliance -> Maybe Text
$sel:cost:AppComponentCompliance' :: AppComponentCompliance -> Maybe Cost
$sel:compliance:AppComponentCompliance' :: AppComponentCompliance
-> Maybe (HashMap DisruptionType DisruptionCompliance)
$sel:appComponentName:AppComponentCompliance' :: AppComponentCompliance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appComponentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap DisruptionType DisruptionCompliance)
compliance
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Cost
cost
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResiliencyScore
resiliencyScore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ComplianceStatus
status