{-# 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.ElasticBeanstalk.Types.ManagedAction
-- 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.ElasticBeanstalk.Types.ManagedAction where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.Types.ActionStatus
import Amazonka.ElasticBeanstalk.Types.ActionType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The record of an upcoming or in-progress managed action.
--
-- /See:/ 'newManagedAction' smart constructor.
data ManagedAction = ManagedAction'
  { -- | The status of the managed action. If the action is @Scheduled@, you can
    -- apply it immediately with ApplyEnvironmentManagedAction.
    ManagedAction -> Maybe ActionStatus
status :: Prelude.Maybe ActionStatus,
    -- | A unique identifier for the managed action.
    ManagedAction -> Maybe Text
actionId :: Prelude.Maybe Prelude.Text,
    -- | The start time of the maintenance window in which the managed action
    -- will execute.
    ManagedAction -> Maybe ISO8601
windowStartTime :: Prelude.Maybe Core.ISO8601,
    -- | A description of the managed action.
    ManagedAction -> Maybe Text
actionDescription :: Prelude.Maybe Prelude.Text,
    -- | The type of managed action.
    ManagedAction -> Maybe ActionType
actionType :: Prelude.Maybe ActionType
  }
  deriving (ManagedAction -> ManagedAction -> Bool
(ManagedAction -> ManagedAction -> Bool)
-> (ManagedAction -> ManagedAction -> Bool) -> Eq ManagedAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedAction -> ManagedAction -> Bool
$c/= :: ManagedAction -> ManagedAction -> Bool
== :: ManagedAction -> ManagedAction -> Bool
$c== :: ManagedAction -> ManagedAction -> Bool
Prelude.Eq, ReadPrec [ManagedAction]
ReadPrec ManagedAction
Int -> ReadS ManagedAction
ReadS [ManagedAction]
(Int -> ReadS ManagedAction)
-> ReadS [ManagedAction]
-> ReadPrec ManagedAction
-> ReadPrec [ManagedAction]
-> Read ManagedAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedAction]
$creadListPrec :: ReadPrec [ManagedAction]
readPrec :: ReadPrec ManagedAction
$creadPrec :: ReadPrec ManagedAction
readList :: ReadS [ManagedAction]
$creadList :: ReadS [ManagedAction]
readsPrec :: Int -> ReadS ManagedAction
$creadsPrec :: Int -> ReadS ManagedAction
Prelude.Read, Int -> ManagedAction -> ShowS
[ManagedAction] -> ShowS
ManagedAction -> String
(Int -> ManagedAction -> ShowS)
-> (ManagedAction -> String)
-> ([ManagedAction] -> ShowS)
-> Show ManagedAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedAction] -> ShowS
$cshowList :: [ManagedAction] -> ShowS
show :: ManagedAction -> String
$cshow :: ManagedAction -> String
showsPrec :: Int -> ManagedAction -> ShowS
$cshowsPrec :: Int -> ManagedAction -> ShowS
Prelude.Show, (forall x. ManagedAction -> Rep ManagedAction x)
-> (forall x. Rep ManagedAction x -> ManagedAction)
-> Generic ManagedAction
forall x. Rep ManagedAction x -> ManagedAction
forall x. ManagedAction -> Rep ManagedAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedAction x -> ManagedAction
$cfrom :: forall x. ManagedAction -> Rep ManagedAction x
Prelude.Generic)

-- |
-- Create a value of 'ManagedAction' 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:
--
-- 'status', 'managedAction_status' - The status of the managed action. If the action is @Scheduled@, you can
-- apply it immediately with ApplyEnvironmentManagedAction.
--
-- 'actionId', 'managedAction_actionId' - A unique identifier for the managed action.
--
-- 'windowStartTime', 'managedAction_windowStartTime' - The start time of the maintenance window in which the managed action
-- will execute.
--
-- 'actionDescription', 'managedAction_actionDescription' - A description of the managed action.
--
-- 'actionType', 'managedAction_actionType' - The type of managed action.
newManagedAction ::
  ManagedAction
newManagedAction :: ManagedAction
newManagedAction =
  ManagedAction' :: Maybe ActionStatus
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe ActionType
-> ManagedAction
ManagedAction'
    { $sel:status:ManagedAction' :: Maybe ActionStatus
status = Maybe ActionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:actionId:ManagedAction' :: Maybe Text
actionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:windowStartTime:ManagedAction' :: Maybe ISO8601
windowStartTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:actionDescription:ManagedAction' :: Maybe Text
actionDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actionType:ManagedAction' :: Maybe ActionType
actionType = Maybe ActionType
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the managed action. If the action is @Scheduled@, you can
-- apply it immediately with ApplyEnvironmentManagedAction.
managedAction_status :: Lens.Lens' ManagedAction (Prelude.Maybe ActionStatus)
managedAction_status :: (Maybe ActionStatus -> f (Maybe ActionStatus))
-> ManagedAction -> f ManagedAction
managedAction_status = (ManagedAction -> Maybe ActionStatus)
-> (ManagedAction -> Maybe ActionStatus -> ManagedAction)
-> Lens
     ManagedAction
     ManagedAction
     (Maybe ActionStatus)
     (Maybe ActionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAction' {Maybe ActionStatus
status :: Maybe ActionStatus
$sel:status:ManagedAction' :: ManagedAction -> Maybe ActionStatus
status} -> Maybe ActionStatus
status) (\s :: ManagedAction
s@ManagedAction' {} Maybe ActionStatus
a -> ManagedAction
s {$sel:status:ManagedAction' :: Maybe ActionStatus
status = Maybe ActionStatus
a} :: ManagedAction)

-- | A unique identifier for the managed action.
managedAction_actionId :: Lens.Lens' ManagedAction (Prelude.Maybe Prelude.Text)
managedAction_actionId :: (Maybe Text -> f (Maybe Text)) -> ManagedAction -> f ManagedAction
managedAction_actionId = (ManagedAction -> Maybe Text)
-> (ManagedAction -> Maybe Text -> ManagedAction)
-> Lens ManagedAction ManagedAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAction' {Maybe Text
actionId :: Maybe Text
$sel:actionId:ManagedAction' :: ManagedAction -> Maybe Text
actionId} -> Maybe Text
actionId) (\s :: ManagedAction
s@ManagedAction' {} Maybe Text
a -> ManagedAction
s {$sel:actionId:ManagedAction' :: Maybe Text
actionId = Maybe Text
a} :: ManagedAction)

-- | The start time of the maintenance window in which the managed action
-- will execute.
managedAction_windowStartTime :: Lens.Lens' ManagedAction (Prelude.Maybe Prelude.UTCTime)
managedAction_windowStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ManagedAction -> f ManagedAction
managedAction_windowStartTime = (ManagedAction -> Maybe ISO8601)
-> (ManagedAction -> Maybe ISO8601 -> ManagedAction)
-> Lens ManagedAction ManagedAction (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAction' {Maybe ISO8601
windowStartTime :: Maybe ISO8601
$sel:windowStartTime:ManagedAction' :: ManagedAction -> Maybe ISO8601
windowStartTime} -> Maybe ISO8601
windowStartTime) (\s :: ManagedAction
s@ManagedAction' {} Maybe ISO8601
a -> ManagedAction
s {$sel:windowStartTime:ManagedAction' :: Maybe ISO8601
windowStartTime = Maybe ISO8601
a} :: ManagedAction) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ManagedAction -> f ManagedAction)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ManagedAction
-> f ManagedAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A description of the managed action.
managedAction_actionDescription :: Lens.Lens' ManagedAction (Prelude.Maybe Prelude.Text)
managedAction_actionDescription :: (Maybe Text -> f (Maybe Text)) -> ManagedAction -> f ManagedAction
managedAction_actionDescription = (ManagedAction -> Maybe Text)
-> (ManagedAction -> Maybe Text -> ManagedAction)
-> Lens ManagedAction ManagedAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAction' {Maybe Text
actionDescription :: Maybe Text
$sel:actionDescription:ManagedAction' :: ManagedAction -> Maybe Text
actionDescription} -> Maybe Text
actionDescription) (\s :: ManagedAction
s@ManagedAction' {} Maybe Text
a -> ManagedAction
s {$sel:actionDescription:ManagedAction' :: Maybe Text
actionDescription = Maybe Text
a} :: ManagedAction)

-- | The type of managed action.
managedAction_actionType :: Lens.Lens' ManagedAction (Prelude.Maybe ActionType)
managedAction_actionType :: (Maybe ActionType -> f (Maybe ActionType))
-> ManagedAction -> f ManagedAction
managedAction_actionType = (ManagedAction -> Maybe ActionType)
-> (ManagedAction -> Maybe ActionType -> ManagedAction)
-> Lens
     ManagedAction ManagedAction (Maybe ActionType) (Maybe ActionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAction' {Maybe ActionType
actionType :: Maybe ActionType
$sel:actionType:ManagedAction' :: ManagedAction -> Maybe ActionType
actionType} -> Maybe ActionType
actionType) (\s :: ManagedAction
s@ManagedAction' {} Maybe ActionType
a -> ManagedAction
s {$sel:actionType:ManagedAction' :: Maybe ActionType
actionType = Maybe ActionType
a} :: ManagedAction)

instance Core.FromXML ManagedAction where
  parseXML :: [Node] -> Either String ManagedAction
parseXML [Node]
x =
    Maybe ActionStatus
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe ActionType
-> ManagedAction
ManagedAction'
      (Maybe ActionStatus
 -> Maybe Text
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe ActionType
 -> ManagedAction)
-> Either String (Maybe ActionStatus)
-> Either
     String
     (Maybe Text
      -> Maybe ISO8601
      -> Maybe Text
      -> Maybe ActionType
      -> ManagedAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ActionStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either
  String
  (Maybe Text
   -> Maybe ISO8601
   -> Maybe Text
   -> Maybe ActionType
   -> ManagedAction)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ISO8601 -> Maybe Text -> Maybe ActionType -> ManagedAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActionId")
      Either
  String
  (Maybe ISO8601 -> Maybe Text -> Maybe ActionType -> ManagedAction)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> Maybe ActionType -> ManagedAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"WindowStartTime")
      Either String (Maybe Text -> Maybe ActionType -> ManagedAction)
-> Either String (Maybe Text)
-> Either String (Maybe ActionType -> ManagedAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActionDescription")
      Either String (Maybe ActionType -> ManagedAction)
-> Either String (Maybe ActionType) -> Either String ManagedAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ActionType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActionType")

instance Prelude.Hashable ManagedAction

instance Prelude.NFData ManagedAction