{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticBeanstalk.Types.ManagedAction where

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

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

-- | A description of the managed action.
managedAction_actionDescription :: Lens.Lens' ManagedAction (Prelude.Maybe Prelude.Text)
managedAction_actionDescription :: Lens' ManagedAction (Maybe Text)
managedAction_actionDescription = 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)

-- | A unique identifier for the managed action.
managedAction_actionId :: Lens.Lens' ManagedAction (Prelude.Maybe Prelude.Text)
managedAction_actionId :: Lens' ManagedAction (Maybe Text)
managedAction_actionId = 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 type of managed action.
managedAction_actionType :: Lens.Lens' ManagedAction (Prelude.Maybe ActionType)
managedAction_actionType :: Lens' ManagedAction (Maybe ActionType)
managedAction_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)

-- | 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 :: Lens' ManagedAction (Maybe ActionStatus)
managedAction_status = 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)

-- | 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 :: Lens' ManagedAction (Maybe UTCTime)
managedAction_windowStartTime = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance Prelude.Hashable ManagedAction where
  hashWithSalt :: Int -> ManagedAction -> Int
hashWithSalt Int
_salt ManagedAction' {Maybe Text
Maybe ISO8601
Maybe ActionStatus
Maybe ActionType
windowStartTime :: Maybe ISO8601
status :: Maybe ActionStatus
actionType :: Maybe ActionType
actionId :: Maybe Text
actionDescription :: Maybe Text
$sel:windowStartTime:ManagedAction' :: ManagedAction -> Maybe ISO8601
$sel:status:ManagedAction' :: ManagedAction -> Maybe ActionStatus
$sel:actionType:ManagedAction' :: ManagedAction -> Maybe ActionType
$sel:actionId:ManagedAction' :: ManagedAction -> Maybe Text
$sel:actionDescription:ManagedAction' :: ManagedAction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
actionDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
actionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionType
actionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
windowStartTime

instance Prelude.NFData ManagedAction where
  rnf :: ManagedAction -> ()
rnf ManagedAction' {Maybe Text
Maybe ISO8601
Maybe ActionStatus
Maybe ActionType
windowStartTime :: Maybe ISO8601
status :: Maybe ActionStatus
actionType :: Maybe ActionType
actionId :: Maybe Text
actionDescription :: Maybe Text
$sel:windowStartTime:ManagedAction' :: ManagedAction -> Maybe ISO8601
$sel:status:ManagedAction' :: ManagedAction -> Maybe ActionStatus
$sel:actionType:ManagedAction' :: ManagedAction -> Maybe ActionType
$sel:actionId:ManagedAction' :: ManagedAction -> Maybe Text
$sel:actionDescription:ManagedAction' :: ManagedAction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
actionDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
actionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionType
actionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
windowStartTime