{-# 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.SSM.Types.MaintenanceWindowExecution
-- 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.SSM.Types.MaintenanceWindowExecution where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.MaintenanceWindowExecutionStatus

-- | Describes the information about an execution of a maintenance window.
--
-- /See:/ 'newMaintenanceWindowExecution' smart constructor.
data MaintenanceWindowExecution = MaintenanceWindowExecution'
  { -- | The status of the execution.
    MaintenanceWindowExecution
-> Maybe MaintenanceWindowExecutionStatus
status :: Prelude.Maybe MaintenanceWindowExecutionStatus,
    -- | The time the execution started.
    MaintenanceWindowExecution -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of the maintenance window execution.
    MaintenanceWindowExecution -> Maybe Text
windowExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The details explaining the status. Not available for all status values.
    MaintenanceWindowExecution -> Maybe Text
statusDetails :: Prelude.Maybe Prelude.Text,
    -- | The time the execution finished.
    MaintenanceWindowExecution -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of the maintenance window.
    MaintenanceWindowExecution -> Maybe Text
windowId :: Prelude.Maybe Prelude.Text
  }
  deriving (MaintenanceWindowExecution -> MaintenanceWindowExecution -> Bool
(MaintenanceWindowExecution -> MaintenanceWindowExecution -> Bool)
-> (MaintenanceWindowExecution
    -> MaintenanceWindowExecution -> Bool)
-> Eq MaintenanceWindowExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaintenanceWindowExecution -> MaintenanceWindowExecution -> Bool
$c/= :: MaintenanceWindowExecution -> MaintenanceWindowExecution -> Bool
== :: MaintenanceWindowExecution -> MaintenanceWindowExecution -> Bool
$c== :: MaintenanceWindowExecution -> MaintenanceWindowExecution -> Bool
Prelude.Eq, ReadPrec [MaintenanceWindowExecution]
ReadPrec MaintenanceWindowExecution
Int -> ReadS MaintenanceWindowExecution
ReadS [MaintenanceWindowExecution]
(Int -> ReadS MaintenanceWindowExecution)
-> ReadS [MaintenanceWindowExecution]
-> ReadPrec MaintenanceWindowExecution
-> ReadPrec [MaintenanceWindowExecution]
-> Read MaintenanceWindowExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MaintenanceWindowExecution]
$creadListPrec :: ReadPrec [MaintenanceWindowExecution]
readPrec :: ReadPrec MaintenanceWindowExecution
$creadPrec :: ReadPrec MaintenanceWindowExecution
readList :: ReadS [MaintenanceWindowExecution]
$creadList :: ReadS [MaintenanceWindowExecution]
readsPrec :: Int -> ReadS MaintenanceWindowExecution
$creadsPrec :: Int -> ReadS MaintenanceWindowExecution
Prelude.Read, Int -> MaintenanceWindowExecution -> ShowS
[MaintenanceWindowExecution] -> ShowS
MaintenanceWindowExecution -> String
(Int -> MaintenanceWindowExecution -> ShowS)
-> (MaintenanceWindowExecution -> String)
-> ([MaintenanceWindowExecution] -> ShowS)
-> Show MaintenanceWindowExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaintenanceWindowExecution] -> ShowS
$cshowList :: [MaintenanceWindowExecution] -> ShowS
show :: MaintenanceWindowExecution -> String
$cshow :: MaintenanceWindowExecution -> String
showsPrec :: Int -> MaintenanceWindowExecution -> ShowS
$cshowsPrec :: Int -> MaintenanceWindowExecution -> ShowS
Prelude.Show, (forall x.
 MaintenanceWindowExecution -> Rep MaintenanceWindowExecution x)
-> (forall x.
    Rep MaintenanceWindowExecution x -> MaintenanceWindowExecution)
-> Generic MaintenanceWindowExecution
forall x.
Rep MaintenanceWindowExecution x -> MaintenanceWindowExecution
forall x.
MaintenanceWindowExecution -> Rep MaintenanceWindowExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MaintenanceWindowExecution x -> MaintenanceWindowExecution
$cfrom :: forall x.
MaintenanceWindowExecution -> Rep MaintenanceWindowExecution x
Prelude.Generic)

-- |
-- Create a value of 'MaintenanceWindowExecution' 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', 'maintenanceWindowExecution_status' - The status of the execution.
--
-- 'startTime', 'maintenanceWindowExecution_startTime' - The time the execution started.
--
-- 'windowExecutionId', 'maintenanceWindowExecution_windowExecutionId' - The ID of the maintenance window execution.
--
-- 'statusDetails', 'maintenanceWindowExecution_statusDetails' - The details explaining the status. Not available for all status values.
--
-- 'endTime', 'maintenanceWindowExecution_endTime' - The time the execution finished.
--
-- 'windowId', 'maintenanceWindowExecution_windowId' - The ID of the maintenance window.
newMaintenanceWindowExecution ::
  MaintenanceWindowExecution
newMaintenanceWindowExecution :: MaintenanceWindowExecution
newMaintenanceWindowExecution =
  MaintenanceWindowExecution' :: Maybe MaintenanceWindowExecutionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> MaintenanceWindowExecution
MaintenanceWindowExecution'
    { $sel:status:MaintenanceWindowExecution' :: Maybe MaintenanceWindowExecutionStatus
status =
        Maybe MaintenanceWindowExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:MaintenanceWindowExecution' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:windowExecutionId:MaintenanceWindowExecution' :: Maybe Text
windowExecutionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusDetails:MaintenanceWindowExecution' :: Maybe Text
statusDetails = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:MaintenanceWindowExecution' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:windowId:MaintenanceWindowExecution' :: Maybe Text
windowId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the execution.
maintenanceWindowExecution_status :: Lens.Lens' MaintenanceWindowExecution (Prelude.Maybe MaintenanceWindowExecutionStatus)
maintenanceWindowExecution_status :: (Maybe MaintenanceWindowExecutionStatus
 -> f (Maybe MaintenanceWindowExecutionStatus))
-> MaintenanceWindowExecution -> f MaintenanceWindowExecution
maintenanceWindowExecution_status = (MaintenanceWindowExecution
 -> Maybe MaintenanceWindowExecutionStatus)
-> (MaintenanceWindowExecution
    -> Maybe MaintenanceWindowExecutionStatus
    -> MaintenanceWindowExecution)
-> Lens
     MaintenanceWindowExecution
     MaintenanceWindowExecution
     (Maybe MaintenanceWindowExecutionStatus)
     (Maybe MaintenanceWindowExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowExecution' {Maybe MaintenanceWindowExecutionStatus
status :: Maybe MaintenanceWindowExecutionStatus
$sel:status:MaintenanceWindowExecution' :: MaintenanceWindowExecution
-> Maybe MaintenanceWindowExecutionStatus
status} -> Maybe MaintenanceWindowExecutionStatus
status) (\s :: MaintenanceWindowExecution
s@MaintenanceWindowExecution' {} Maybe MaintenanceWindowExecutionStatus
a -> MaintenanceWindowExecution
s {$sel:status:MaintenanceWindowExecution' :: Maybe MaintenanceWindowExecutionStatus
status = Maybe MaintenanceWindowExecutionStatus
a} :: MaintenanceWindowExecution)

-- | The time the execution started.
maintenanceWindowExecution_startTime :: Lens.Lens' MaintenanceWindowExecution (Prelude.Maybe Prelude.UTCTime)
maintenanceWindowExecution_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MaintenanceWindowExecution -> f MaintenanceWindowExecution
maintenanceWindowExecution_startTime = (MaintenanceWindowExecution -> Maybe POSIX)
-> (MaintenanceWindowExecution
    -> Maybe POSIX -> MaintenanceWindowExecution)
-> Lens
     MaintenanceWindowExecution
     MaintenanceWindowExecution
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowExecution' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:MaintenanceWindowExecution' :: MaintenanceWindowExecution -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: MaintenanceWindowExecution
s@MaintenanceWindowExecution' {} Maybe POSIX
a -> MaintenanceWindowExecution
s {$sel:startTime:MaintenanceWindowExecution' :: Maybe POSIX
startTime = Maybe POSIX
a} :: MaintenanceWindowExecution) ((Maybe POSIX -> f (Maybe POSIX))
 -> MaintenanceWindowExecution -> f MaintenanceWindowExecution)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MaintenanceWindowExecution
-> f MaintenanceWindowExecution
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 ID of the maintenance window execution.
maintenanceWindowExecution_windowExecutionId :: Lens.Lens' MaintenanceWindowExecution (Prelude.Maybe Prelude.Text)
maintenanceWindowExecution_windowExecutionId :: (Maybe Text -> f (Maybe Text))
-> MaintenanceWindowExecution -> f MaintenanceWindowExecution
maintenanceWindowExecution_windowExecutionId = (MaintenanceWindowExecution -> Maybe Text)
-> (MaintenanceWindowExecution
    -> Maybe Text -> MaintenanceWindowExecution)
-> Lens
     MaintenanceWindowExecution
     MaintenanceWindowExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowExecution' {Maybe Text
windowExecutionId :: Maybe Text
$sel:windowExecutionId:MaintenanceWindowExecution' :: MaintenanceWindowExecution -> Maybe Text
windowExecutionId} -> Maybe Text
windowExecutionId) (\s :: MaintenanceWindowExecution
s@MaintenanceWindowExecution' {} Maybe Text
a -> MaintenanceWindowExecution
s {$sel:windowExecutionId:MaintenanceWindowExecution' :: Maybe Text
windowExecutionId = Maybe Text
a} :: MaintenanceWindowExecution)

-- | The details explaining the status. Not available for all status values.
maintenanceWindowExecution_statusDetails :: Lens.Lens' MaintenanceWindowExecution (Prelude.Maybe Prelude.Text)
maintenanceWindowExecution_statusDetails :: (Maybe Text -> f (Maybe Text))
-> MaintenanceWindowExecution -> f MaintenanceWindowExecution
maintenanceWindowExecution_statusDetails = (MaintenanceWindowExecution -> Maybe Text)
-> (MaintenanceWindowExecution
    -> Maybe Text -> MaintenanceWindowExecution)
-> Lens
     MaintenanceWindowExecution
     MaintenanceWindowExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowExecution' {Maybe Text
statusDetails :: Maybe Text
$sel:statusDetails:MaintenanceWindowExecution' :: MaintenanceWindowExecution -> Maybe Text
statusDetails} -> Maybe Text
statusDetails) (\s :: MaintenanceWindowExecution
s@MaintenanceWindowExecution' {} Maybe Text
a -> MaintenanceWindowExecution
s {$sel:statusDetails:MaintenanceWindowExecution' :: Maybe Text
statusDetails = Maybe Text
a} :: MaintenanceWindowExecution)

-- | The time the execution finished.
maintenanceWindowExecution_endTime :: Lens.Lens' MaintenanceWindowExecution (Prelude.Maybe Prelude.UTCTime)
maintenanceWindowExecution_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MaintenanceWindowExecution -> f MaintenanceWindowExecution
maintenanceWindowExecution_endTime = (MaintenanceWindowExecution -> Maybe POSIX)
-> (MaintenanceWindowExecution
    -> Maybe POSIX -> MaintenanceWindowExecution)
-> Lens
     MaintenanceWindowExecution
     MaintenanceWindowExecution
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowExecution' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:MaintenanceWindowExecution' :: MaintenanceWindowExecution -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: MaintenanceWindowExecution
s@MaintenanceWindowExecution' {} Maybe POSIX
a -> MaintenanceWindowExecution
s {$sel:endTime:MaintenanceWindowExecution' :: Maybe POSIX
endTime = Maybe POSIX
a} :: MaintenanceWindowExecution) ((Maybe POSIX -> f (Maybe POSIX))
 -> MaintenanceWindowExecution -> f MaintenanceWindowExecution)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MaintenanceWindowExecution
-> f MaintenanceWindowExecution
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 ID of the maintenance window.
maintenanceWindowExecution_windowId :: Lens.Lens' MaintenanceWindowExecution (Prelude.Maybe Prelude.Text)
maintenanceWindowExecution_windowId :: (Maybe Text -> f (Maybe Text))
-> MaintenanceWindowExecution -> f MaintenanceWindowExecution
maintenanceWindowExecution_windowId = (MaintenanceWindowExecution -> Maybe Text)
-> (MaintenanceWindowExecution
    -> Maybe Text -> MaintenanceWindowExecution)
-> Lens
     MaintenanceWindowExecution
     MaintenanceWindowExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowExecution' {Maybe Text
windowId :: Maybe Text
$sel:windowId:MaintenanceWindowExecution' :: MaintenanceWindowExecution -> Maybe Text
windowId} -> Maybe Text
windowId) (\s :: MaintenanceWindowExecution
s@MaintenanceWindowExecution' {} Maybe Text
a -> MaintenanceWindowExecution
s {$sel:windowId:MaintenanceWindowExecution' :: Maybe Text
windowId = Maybe Text
a} :: MaintenanceWindowExecution)

instance Core.FromJSON MaintenanceWindowExecution where
  parseJSON :: Value -> Parser MaintenanceWindowExecution
parseJSON =
    String
-> (Object -> Parser MaintenanceWindowExecution)
-> Value
-> Parser MaintenanceWindowExecution
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MaintenanceWindowExecution"
      ( \Object
x ->
          Maybe MaintenanceWindowExecutionStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> MaintenanceWindowExecution
MaintenanceWindowExecution'
            (Maybe MaintenanceWindowExecutionStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> MaintenanceWindowExecution)
-> Parser (Maybe MaintenanceWindowExecutionStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> MaintenanceWindowExecution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MaintenanceWindowExecutionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> MaintenanceWindowExecution)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> MaintenanceWindowExecution)
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
"StartTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> MaintenanceWindowExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> MaintenanceWindowExecution)
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
"WindowExecutionId")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> MaintenanceWindowExecution)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> MaintenanceWindowExecution)
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
"StatusDetails")
            Parser (Maybe POSIX -> Maybe Text -> MaintenanceWindowExecution)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> MaintenanceWindowExecution)
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
"EndTime")
            Parser (Maybe Text -> MaintenanceWindowExecution)
-> Parser (Maybe Text) -> Parser MaintenanceWindowExecution
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
"WindowId")
      )

instance Prelude.Hashable MaintenanceWindowExecution

instance Prelude.NFData MaintenanceWindowExecution