{-# 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.AutoScalingPlans.Types.ScalingPlan
-- 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.AutoScalingPlans.Types.ScalingPlan where

import Amazonka.AutoScalingPlans.Types.ApplicationSource
import Amazonka.AutoScalingPlans.Types.ScalingInstruction
import Amazonka.AutoScalingPlans.Types.ScalingPlanStatusCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a scaling plan.
--
-- /See:/ 'newScalingPlan' smart constructor.
data ScalingPlan = ScalingPlan'
  { -- | The Unix time stamp when the scaling plan was created.
    ScalingPlan -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The Unix time stamp when the scaling plan entered the current status.
    ScalingPlan -> Maybe POSIX
statusStartTime :: Prelude.Maybe Core.POSIX,
    -- | A simple message about the current status of the scaling plan.
    ScalingPlan -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The name of the scaling plan.
    ScalingPlan -> Text
scalingPlanName :: Prelude.Text,
    -- | The version number of the scaling plan.
    ScalingPlan -> Integer
scalingPlanVersion :: Prelude.Integer,
    -- | A CloudFormation stack or a set of tags. You can create one scaling plan
    -- per application source.
    ScalingPlan -> ApplicationSource
applicationSource :: ApplicationSource,
    -- | The scaling instructions.
    ScalingPlan -> [ScalingInstruction]
scalingInstructions :: [ScalingInstruction],
    -- | The status of the scaling plan.
    --
    -- -   @Active@ - The scaling plan is active.
    --
    -- -   @ActiveWithProblems@ - The scaling plan is active, but the scaling
    --     configuration for one or more resources could not be applied.
    --
    -- -   @CreationInProgress@ - The scaling plan is being created.
    --
    -- -   @CreationFailed@ - The scaling plan could not be created.
    --
    -- -   @DeletionInProgress@ - The scaling plan is being deleted.
    --
    -- -   @DeletionFailed@ - The scaling plan could not be deleted.
    --
    -- -   @UpdateInProgress@ - The scaling plan is being updated.
    --
    -- -   @UpdateFailed@ - The scaling plan could not be updated.
    ScalingPlan -> ScalingPlanStatusCode
statusCode :: ScalingPlanStatusCode
  }
  deriving (ScalingPlan -> ScalingPlan -> Bool
(ScalingPlan -> ScalingPlan -> Bool)
-> (ScalingPlan -> ScalingPlan -> Bool) -> Eq ScalingPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingPlan -> ScalingPlan -> Bool
$c/= :: ScalingPlan -> ScalingPlan -> Bool
== :: ScalingPlan -> ScalingPlan -> Bool
$c== :: ScalingPlan -> ScalingPlan -> Bool
Prelude.Eq, ReadPrec [ScalingPlan]
ReadPrec ScalingPlan
Int -> ReadS ScalingPlan
ReadS [ScalingPlan]
(Int -> ReadS ScalingPlan)
-> ReadS [ScalingPlan]
-> ReadPrec ScalingPlan
-> ReadPrec [ScalingPlan]
-> Read ScalingPlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingPlan]
$creadListPrec :: ReadPrec [ScalingPlan]
readPrec :: ReadPrec ScalingPlan
$creadPrec :: ReadPrec ScalingPlan
readList :: ReadS [ScalingPlan]
$creadList :: ReadS [ScalingPlan]
readsPrec :: Int -> ReadS ScalingPlan
$creadsPrec :: Int -> ReadS ScalingPlan
Prelude.Read, Int -> ScalingPlan -> ShowS
[ScalingPlan] -> ShowS
ScalingPlan -> String
(Int -> ScalingPlan -> ShowS)
-> (ScalingPlan -> String)
-> ([ScalingPlan] -> ShowS)
-> Show ScalingPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingPlan] -> ShowS
$cshowList :: [ScalingPlan] -> ShowS
show :: ScalingPlan -> String
$cshow :: ScalingPlan -> String
showsPrec :: Int -> ScalingPlan -> ShowS
$cshowsPrec :: Int -> ScalingPlan -> ShowS
Prelude.Show, (forall x. ScalingPlan -> Rep ScalingPlan x)
-> (forall x. Rep ScalingPlan x -> ScalingPlan)
-> Generic ScalingPlan
forall x. Rep ScalingPlan x -> ScalingPlan
forall x. ScalingPlan -> Rep ScalingPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingPlan x -> ScalingPlan
$cfrom :: forall x. ScalingPlan -> Rep ScalingPlan x
Prelude.Generic)

-- |
-- Create a value of 'ScalingPlan' 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:
--
-- 'creationTime', 'scalingPlan_creationTime' - The Unix time stamp when the scaling plan was created.
--
-- 'statusStartTime', 'scalingPlan_statusStartTime' - The Unix time stamp when the scaling plan entered the current status.
--
-- 'statusMessage', 'scalingPlan_statusMessage' - A simple message about the current status of the scaling plan.
--
-- 'scalingPlanName', 'scalingPlan_scalingPlanName' - The name of the scaling plan.
--
-- 'scalingPlanVersion', 'scalingPlan_scalingPlanVersion' - The version number of the scaling plan.
--
-- 'applicationSource', 'scalingPlan_applicationSource' - A CloudFormation stack or a set of tags. You can create one scaling plan
-- per application source.
--
-- 'scalingInstructions', 'scalingPlan_scalingInstructions' - The scaling instructions.
--
-- 'statusCode', 'scalingPlan_statusCode' - The status of the scaling plan.
--
-- -   @Active@ - The scaling plan is active.
--
-- -   @ActiveWithProblems@ - The scaling plan is active, but the scaling
--     configuration for one or more resources could not be applied.
--
-- -   @CreationInProgress@ - The scaling plan is being created.
--
-- -   @CreationFailed@ - The scaling plan could not be created.
--
-- -   @DeletionInProgress@ - The scaling plan is being deleted.
--
-- -   @DeletionFailed@ - The scaling plan could not be deleted.
--
-- -   @UpdateInProgress@ - The scaling plan is being updated.
--
-- -   @UpdateFailed@ - The scaling plan could not be updated.
newScalingPlan ::
  -- | 'scalingPlanName'
  Prelude.Text ->
  -- | 'scalingPlanVersion'
  Prelude.Integer ->
  -- | 'applicationSource'
  ApplicationSource ->
  -- | 'statusCode'
  ScalingPlanStatusCode ->
  ScalingPlan
newScalingPlan :: Text
-> Integer
-> ApplicationSource
-> ScalingPlanStatusCode
-> ScalingPlan
newScalingPlan
  Text
pScalingPlanName_
  Integer
pScalingPlanVersion_
  ApplicationSource
pApplicationSource_
  ScalingPlanStatusCode
pStatusCode_ =
    ScalingPlan' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Text
-> Integer
-> ApplicationSource
-> [ScalingInstruction]
-> ScalingPlanStatusCode
-> ScalingPlan
ScalingPlan'
      { $sel:creationTime:ScalingPlan' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:statusStartTime:ScalingPlan' :: Maybe POSIX
statusStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:statusMessage:ScalingPlan' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:scalingPlanName:ScalingPlan' :: Text
scalingPlanName = Text
pScalingPlanName_,
        $sel:scalingPlanVersion:ScalingPlan' :: Integer
scalingPlanVersion = Integer
pScalingPlanVersion_,
        $sel:applicationSource:ScalingPlan' :: ApplicationSource
applicationSource = ApplicationSource
pApplicationSource_,
        $sel:scalingInstructions:ScalingPlan' :: [ScalingInstruction]
scalingInstructions = [ScalingInstruction]
forall a. Monoid a => a
Prelude.mempty,
        $sel:statusCode:ScalingPlan' :: ScalingPlanStatusCode
statusCode = ScalingPlanStatusCode
pStatusCode_
      }

-- | The Unix time stamp when the scaling plan was created.
scalingPlan_creationTime :: Lens.Lens' ScalingPlan (Prelude.Maybe Prelude.UTCTime)
scalingPlan_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ScalingPlan -> f ScalingPlan
scalingPlan_creationTime = (ScalingPlan -> Maybe POSIX)
-> (ScalingPlan -> Maybe POSIX -> ScalingPlan)
-> Lens ScalingPlan ScalingPlan (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:ScalingPlan' :: ScalingPlan -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: ScalingPlan
s@ScalingPlan' {} Maybe POSIX
a -> ScalingPlan
s {$sel:creationTime:ScalingPlan' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: ScalingPlan) ((Maybe POSIX -> f (Maybe POSIX)) -> ScalingPlan -> f ScalingPlan)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ScalingPlan
-> f ScalingPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Unix time stamp when the scaling plan entered the current status.
scalingPlan_statusStartTime :: Lens.Lens' ScalingPlan (Prelude.Maybe Prelude.UTCTime)
scalingPlan_statusStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ScalingPlan -> f ScalingPlan
scalingPlan_statusStartTime = (ScalingPlan -> Maybe POSIX)
-> (ScalingPlan -> Maybe POSIX -> ScalingPlan)
-> Lens ScalingPlan ScalingPlan (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {Maybe POSIX
statusStartTime :: Maybe POSIX
$sel:statusStartTime:ScalingPlan' :: ScalingPlan -> Maybe POSIX
statusStartTime} -> Maybe POSIX
statusStartTime) (\s :: ScalingPlan
s@ScalingPlan' {} Maybe POSIX
a -> ScalingPlan
s {$sel:statusStartTime:ScalingPlan' :: Maybe POSIX
statusStartTime = Maybe POSIX
a} :: ScalingPlan) ((Maybe POSIX -> f (Maybe POSIX)) -> ScalingPlan -> f ScalingPlan)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ScalingPlan
-> f ScalingPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A simple message about the current status of the scaling plan.
scalingPlan_statusMessage :: Lens.Lens' ScalingPlan (Prelude.Maybe Prelude.Text)
scalingPlan_statusMessage :: (Maybe Text -> f (Maybe Text)) -> ScalingPlan -> f ScalingPlan
scalingPlan_statusMessage = (ScalingPlan -> Maybe Text)
-> (ScalingPlan -> Maybe Text -> ScalingPlan)
-> Lens ScalingPlan ScalingPlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ScalingPlan' :: ScalingPlan -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ScalingPlan
s@ScalingPlan' {} Maybe Text
a -> ScalingPlan
s {$sel:statusMessage:ScalingPlan' :: Maybe Text
statusMessage = Maybe Text
a} :: ScalingPlan)

-- | The name of the scaling plan.
scalingPlan_scalingPlanName :: Lens.Lens' ScalingPlan Prelude.Text
scalingPlan_scalingPlanName :: (Text -> f Text) -> ScalingPlan -> f ScalingPlan
scalingPlan_scalingPlanName = (ScalingPlan -> Text)
-> (ScalingPlan -> Text -> ScalingPlan)
-> Lens ScalingPlan ScalingPlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {Text
scalingPlanName :: Text
$sel:scalingPlanName:ScalingPlan' :: ScalingPlan -> Text
scalingPlanName} -> Text
scalingPlanName) (\s :: ScalingPlan
s@ScalingPlan' {} Text
a -> ScalingPlan
s {$sel:scalingPlanName:ScalingPlan' :: Text
scalingPlanName = Text
a} :: ScalingPlan)

-- | The version number of the scaling plan.
scalingPlan_scalingPlanVersion :: Lens.Lens' ScalingPlan Prelude.Integer
scalingPlan_scalingPlanVersion :: (Integer -> f Integer) -> ScalingPlan -> f ScalingPlan
scalingPlan_scalingPlanVersion = (ScalingPlan -> Integer)
-> (ScalingPlan -> Integer -> ScalingPlan)
-> Lens ScalingPlan ScalingPlan Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {Integer
scalingPlanVersion :: Integer
$sel:scalingPlanVersion:ScalingPlan' :: ScalingPlan -> Integer
scalingPlanVersion} -> Integer
scalingPlanVersion) (\s :: ScalingPlan
s@ScalingPlan' {} Integer
a -> ScalingPlan
s {$sel:scalingPlanVersion:ScalingPlan' :: Integer
scalingPlanVersion = Integer
a} :: ScalingPlan)

-- | A CloudFormation stack or a set of tags. You can create one scaling plan
-- per application source.
scalingPlan_applicationSource :: Lens.Lens' ScalingPlan ApplicationSource
scalingPlan_applicationSource :: (ApplicationSource -> f ApplicationSource)
-> ScalingPlan -> f ScalingPlan
scalingPlan_applicationSource = (ScalingPlan -> ApplicationSource)
-> (ScalingPlan -> ApplicationSource -> ScalingPlan)
-> Lens ScalingPlan ScalingPlan ApplicationSource ApplicationSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {ApplicationSource
applicationSource :: ApplicationSource
$sel:applicationSource:ScalingPlan' :: ScalingPlan -> ApplicationSource
applicationSource} -> ApplicationSource
applicationSource) (\s :: ScalingPlan
s@ScalingPlan' {} ApplicationSource
a -> ScalingPlan
s {$sel:applicationSource:ScalingPlan' :: ApplicationSource
applicationSource = ApplicationSource
a} :: ScalingPlan)

-- | The scaling instructions.
scalingPlan_scalingInstructions :: Lens.Lens' ScalingPlan [ScalingInstruction]
scalingPlan_scalingInstructions :: ([ScalingInstruction] -> f [ScalingInstruction])
-> ScalingPlan -> f ScalingPlan
scalingPlan_scalingInstructions = (ScalingPlan -> [ScalingInstruction])
-> (ScalingPlan -> [ScalingInstruction] -> ScalingPlan)
-> Lens
     ScalingPlan ScalingPlan [ScalingInstruction] [ScalingInstruction]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {[ScalingInstruction]
scalingInstructions :: [ScalingInstruction]
$sel:scalingInstructions:ScalingPlan' :: ScalingPlan -> [ScalingInstruction]
scalingInstructions} -> [ScalingInstruction]
scalingInstructions) (\s :: ScalingPlan
s@ScalingPlan' {} [ScalingInstruction]
a -> ScalingPlan
s {$sel:scalingInstructions:ScalingPlan' :: [ScalingInstruction]
scalingInstructions = [ScalingInstruction]
a} :: ScalingPlan) (([ScalingInstruction] -> f [ScalingInstruction])
 -> ScalingPlan -> f ScalingPlan)
-> (([ScalingInstruction] -> f [ScalingInstruction])
    -> [ScalingInstruction] -> f [ScalingInstruction])
-> ([ScalingInstruction] -> f [ScalingInstruction])
-> ScalingPlan
-> f ScalingPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ScalingInstruction] -> f [ScalingInstruction])
-> [ScalingInstruction] -> f [ScalingInstruction]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The status of the scaling plan.
--
-- -   @Active@ - The scaling plan is active.
--
-- -   @ActiveWithProblems@ - The scaling plan is active, but the scaling
--     configuration for one or more resources could not be applied.
--
-- -   @CreationInProgress@ - The scaling plan is being created.
--
-- -   @CreationFailed@ - The scaling plan could not be created.
--
-- -   @DeletionInProgress@ - The scaling plan is being deleted.
--
-- -   @DeletionFailed@ - The scaling plan could not be deleted.
--
-- -   @UpdateInProgress@ - The scaling plan is being updated.
--
-- -   @UpdateFailed@ - The scaling plan could not be updated.
scalingPlan_statusCode :: Lens.Lens' ScalingPlan ScalingPlanStatusCode
scalingPlan_statusCode :: (ScalingPlanStatusCode -> f ScalingPlanStatusCode)
-> ScalingPlan -> f ScalingPlan
scalingPlan_statusCode = (ScalingPlan -> ScalingPlanStatusCode)
-> (ScalingPlan -> ScalingPlanStatusCode -> ScalingPlan)
-> Lens
     ScalingPlan ScalingPlan ScalingPlanStatusCode ScalingPlanStatusCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPlan' {ScalingPlanStatusCode
statusCode :: ScalingPlanStatusCode
$sel:statusCode:ScalingPlan' :: ScalingPlan -> ScalingPlanStatusCode
statusCode} -> ScalingPlanStatusCode
statusCode) (\s :: ScalingPlan
s@ScalingPlan' {} ScalingPlanStatusCode
a -> ScalingPlan
s {$sel:statusCode:ScalingPlan' :: ScalingPlanStatusCode
statusCode = ScalingPlanStatusCode
a} :: ScalingPlan)

instance Core.FromJSON ScalingPlan where
  parseJSON :: Value -> Parser ScalingPlan
parseJSON =
    String
-> (Object -> Parser ScalingPlan) -> Value -> Parser ScalingPlan
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ScalingPlan"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Text
-> Integer
-> ApplicationSource
-> [ScalingInstruction]
-> ScalingPlanStatusCode
-> ScalingPlan
ScalingPlan'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Text
 -> Integer
 -> ApplicationSource
 -> [ScalingInstruction]
 -> ScalingPlanStatusCode
 -> ScalingPlan)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Text
      -> Integer
      -> ApplicationSource
      -> [ScalingInstruction]
      -> ScalingPlanStatusCode
      -> ScalingPlan)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Text
   -> Integer
   -> ApplicationSource
   -> [ScalingInstruction]
   -> ScalingPlanStatusCode
   -> ScalingPlan)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Text
      -> Integer
      -> ApplicationSource
      -> [ScalingInstruction]
      -> ScalingPlanStatusCode
      -> ScalingPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusStartTime")
            Parser
  (Maybe Text
   -> Text
   -> Integer
   -> ApplicationSource
   -> [ScalingInstruction]
   -> ScalingPlanStatusCode
   -> ScalingPlan)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Integer
      -> ApplicationSource
      -> [ScalingInstruction]
      -> ScalingPlanStatusCode
      -> ScalingPlan)
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
"StatusMessage")
            Parser
  (Text
   -> Integer
   -> ApplicationSource
   -> [ScalingInstruction]
   -> ScalingPlanStatusCode
   -> ScalingPlan)
-> Parser Text
-> Parser
     (Integer
      -> ApplicationSource
      -> [ScalingInstruction]
      -> ScalingPlanStatusCode
      -> ScalingPlan)
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
"ScalingPlanName")
            Parser
  (Integer
   -> ApplicationSource
   -> [ScalingInstruction]
   -> ScalingPlanStatusCode
   -> ScalingPlan)
-> Parser Integer
-> Parser
     (ApplicationSource
      -> [ScalingInstruction] -> ScalingPlanStatusCode -> ScalingPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ScalingPlanVersion")
            Parser
  (ApplicationSource
   -> [ScalingInstruction] -> ScalingPlanStatusCode -> ScalingPlan)
-> Parser ApplicationSource
-> Parser
     ([ScalingInstruction] -> ScalingPlanStatusCode -> ScalingPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ApplicationSource
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ApplicationSource")
            Parser
  ([ScalingInstruction] -> ScalingPlanStatusCode -> ScalingPlan)
-> Parser [ScalingInstruction]
-> Parser (ScalingPlanStatusCode -> ScalingPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [ScalingInstruction])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScalingInstructions"
                            Parser (Maybe [ScalingInstruction])
-> [ScalingInstruction] -> Parser [ScalingInstruction]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ScalingInstruction]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (ScalingPlanStatusCode -> ScalingPlan)
-> Parser ScalingPlanStatusCode -> Parser ScalingPlan
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ScalingPlanStatusCode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StatusCode")
      )

instance Prelude.Hashable ScalingPlan

instance Prelude.NFData ScalingPlan