{-# 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.AssociationExecution
-- 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.AssociationExecution where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Includes information about the specified association.
--
-- /See:/ 'newAssociationExecution' smart constructor.
data AssociationExecution = AssociationExecution'
  { -- | The association ID.
    AssociationExecution -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
    -- | Detailed status information about the execution.
    AssociationExecution -> Maybe Text
detailedStatus :: Prelude.Maybe Prelude.Text,
    -- | The status of the association execution.
    AssociationExecution -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The execution ID for the association.
    AssociationExecution -> Maybe Text
executionId :: Prelude.Maybe Prelude.Text,
    -- | The time the execution started.
    AssociationExecution -> Maybe POSIX
createdTime :: Prelude.Maybe Core.POSIX,
    -- | An aggregate status of the resources in the execution based on the
    -- status type.
    AssociationExecution -> Maybe Text
resourceCountByStatus :: Prelude.Maybe Prelude.Text,
    -- | The date of the last execution.
    AssociationExecution -> Maybe POSIX
lastExecutionDate :: Prelude.Maybe Core.POSIX,
    -- | The association version.
    AssociationExecution -> Maybe Text
associationVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (AssociationExecution -> AssociationExecution -> Bool
(AssociationExecution -> AssociationExecution -> Bool)
-> (AssociationExecution -> AssociationExecution -> Bool)
-> Eq AssociationExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociationExecution -> AssociationExecution -> Bool
$c/= :: AssociationExecution -> AssociationExecution -> Bool
== :: AssociationExecution -> AssociationExecution -> Bool
$c== :: AssociationExecution -> AssociationExecution -> Bool
Prelude.Eq, ReadPrec [AssociationExecution]
ReadPrec AssociationExecution
Int -> ReadS AssociationExecution
ReadS [AssociationExecution]
(Int -> ReadS AssociationExecution)
-> ReadS [AssociationExecution]
-> ReadPrec AssociationExecution
-> ReadPrec [AssociationExecution]
-> Read AssociationExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociationExecution]
$creadListPrec :: ReadPrec [AssociationExecution]
readPrec :: ReadPrec AssociationExecution
$creadPrec :: ReadPrec AssociationExecution
readList :: ReadS [AssociationExecution]
$creadList :: ReadS [AssociationExecution]
readsPrec :: Int -> ReadS AssociationExecution
$creadsPrec :: Int -> ReadS AssociationExecution
Prelude.Read, Int -> AssociationExecution -> ShowS
[AssociationExecution] -> ShowS
AssociationExecution -> String
(Int -> AssociationExecution -> ShowS)
-> (AssociationExecution -> String)
-> ([AssociationExecution] -> ShowS)
-> Show AssociationExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociationExecution] -> ShowS
$cshowList :: [AssociationExecution] -> ShowS
show :: AssociationExecution -> String
$cshow :: AssociationExecution -> String
showsPrec :: Int -> AssociationExecution -> ShowS
$cshowsPrec :: Int -> AssociationExecution -> ShowS
Prelude.Show, (forall x. AssociationExecution -> Rep AssociationExecution x)
-> (forall x. Rep AssociationExecution x -> AssociationExecution)
-> Generic AssociationExecution
forall x. Rep AssociationExecution x -> AssociationExecution
forall x. AssociationExecution -> Rep AssociationExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociationExecution x -> AssociationExecution
$cfrom :: forall x. AssociationExecution -> Rep AssociationExecution x
Prelude.Generic)

-- |
-- Create a value of 'AssociationExecution' 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:
--
-- 'associationId', 'associationExecution_associationId' - The association ID.
--
-- 'detailedStatus', 'associationExecution_detailedStatus' - Detailed status information about the execution.
--
-- 'status', 'associationExecution_status' - The status of the association execution.
--
-- 'executionId', 'associationExecution_executionId' - The execution ID for the association.
--
-- 'createdTime', 'associationExecution_createdTime' - The time the execution started.
--
-- 'resourceCountByStatus', 'associationExecution_resourceCountByStatus' - An aggregate status of the resources in the execution based on the
-- status type.
--
-- 'lastExecutionDate', 'associationExecution_lastExecutionDate' - The date of the last execution.
--
-- 'associationVersion', 'associationExecution_associationVersion' - The association version.
newAssociationExecution ::
  AssociationExecution
newAssociationExecution :: AssociationExecution
newAssociationExecution =
  AssociationExecution' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> AssociationExecution
AssociationExecution'
    { $sel:associationId:AssociationExecution' :: Maybe Text
associationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:detailedStatus:AssociationExecution' :: Maybe Text
detailedStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:AssociationExecution' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:executionId:AssociationExecution' :: Maybe Text
executionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:AssociationExecution' :: Maybe POSIX
createdTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceCountByStatus:AssociationExecution' :: Maybe Text
resourceCountByStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastExecutionDate:AssociationExecution' :: Maybe POSIX
lastExecutionDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:associationVersion:AssociationExecution' :: Maybe Text
associationVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The association ID.
associationExecution_associationId :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.Text)
associationExecution_associationId :: (Maybe Text -> f (Maybe Text))
-> AssociationExecution -> f AssociationExecution
associationExecution_associationId = (AssociationExecution -> Maybe Text)
-> (AssociationExecution -> Maybe Text -> AssociationExecution)
-> Lens
     AssociationExecution AssociationExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe Text
associationId :: Maybe Text
$sel:associationId:AssociationExecution' :: AssociationExecution -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe Text
a -> AssociationExecution
s {$sel:associationId:AssociationExecution' :: Maybe Text
associationId = Maybe Text
a} :: AssociationExecution)

-- | Detailed status information about the execution.
associationExecution_detailedStatus :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.Text)
associationExecution_detailedStatus :: (Maybe Text -> f (Maybe Text))
-> AssociationExecution -> f AssociationExecution
associationExecution_detailedStatus = (AssociationExecution -> Maybe Text)
-> (AssociationExecution -> Maybe Text -> AssociationExecution)
-> Lens
     AssociationExecution AssociationExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe Text
detailedStatus :: Maybe Text
$sel:detailedStatus:AssociationExecution' :: AssociationExecution -> Maybe Text
detailedStatus} -> Maybe Text
detailedStatus) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe Text
a -> AssociationExecution
s {$sel:detailedStatus:AssociationExecution' :: Maybe Text
detailedStatus = Maybe Text
a} :: AssociationExecution)

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

-- | The execution ID for the association.
associationExecution_executionId :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.Text)
associationExecution_executionId :: (Maybe Text -> f (Maybe Text))
-> AssociationExecution -> f AssociationExecution
associationExecution_executionId = (AssociationExecution -> Maybe Text)
-> (AssociationExecution -> Maybe Text -> AssociationExecution)
-> Lens
     AssociationExecution AssociationExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe Text
executionId :: Maybe Text
$sel:executionId:AssociationExecution' :: AssociationExecution -> Maybe Text
executionId} -> Maybe Text
executionId) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe Text
a -> AssociationExecution
s {$sel:executionId:AssociationExecution' :: Maybe Text
executionId = Maybe Text
a} :: AssociationExecution)

-- | The time the execution started.
associationExecution_createdTime :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.UTCTime)
associationExecution_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AssociationExecution -> f AssociationExecution
associationExecution_createdTime = (AssociationExecution -> Maybe POSIX)
-> (AssociationExecution -> Maybe POSIX -> AssociationExecution)
-> Lens
     AssociationExecution
     AssociationExecution
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:AssociationExecution' :: AssociationExecution -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe POSIX
a -> AssociationExecution
s {$sel:createdTime:AssociationExecution' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: AssociationExecution) ((Maybe POSIX -> f (Maybe POSIX))
 -> AssociationExecution -> f AssociationExecution)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AssociationExecution
-> f AssociationExecution
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

-- | An aggregate status of the resources in the execution based on the
-- status type.
associationExecution_resourceCountByStatus :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.Text)
associationExecution_resourceCountByStatus :: (Maybe Text -> f (Maybe Text))
-> AssociationExecution -> f AssociationExecution
associationExecution_resourceCountByStatus = (AssociationExecution -> Maybe Text)
-> (AssociationExecution -> Maybe Text -> AssociationExecution)
-> Lens
     AssociationExecution AssociationExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe Text
resourceCountByStatus :: Maybe Text
$sel:resourceCountByStatus:AssociationExecution' :: AssociationExecution -> Maybe Text
resourceCountByStatus} -> Maybe Text
resourceCountByStatus) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe Text
a -> AssociationExecution
s {$sel:resourceCountByStatus:AssociationExecution' :: Maybe Text
resourceCountByStatus = Maybe Text
a} :: AssociationExecution)

-- | The date of the last execution.
associationExecution_lastExecutionDate :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.UTCTime)
associationExecution_lastExecutionDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AssociationExecution -> f AssociationExecution
associationExecution_lastExecutionDate = (AssociationExecution -> Maybe POSIX)
-> (AssociationExecution -> Maybe POSIX -> AssociationExecution)
-> Lens
     AssociationExecution
     AssociationExecution
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe POSIX
lastExecutionDate :: Maybe POSIX
$sel:lastExecutionDate:AssociationExecution' :: AssociationExecution -> Maybe POSIX
lastExecutionDate} -> Maybe POSIX
lastExecutionDate) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe POSIX
a -> AssociationExecution
s {$sel:lastExecutionDate:AssociationExecution' :: Maybe POSIX
lastExecutionDate = Maybe POSIX
a} :: AssociationExecution) ((Maybe POSIX -> f (Maybe POSIX))
 -> AssociationExecution -> f AssociationExecution)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AssociationExecution
-> f AssociationExecution
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 association version.
associationExecution_associationVersion :: Lens.Lens' AssociationExecution (Prelude.Maybe Prelude.Text)
associationExecution_associationVersion :: (Maybe Text -> f (Maybe Text))
-> AssociationExecution -> f AssociationExecution
associationExecution_associationVersion = (AssociationExecution -> Maybe Text)
-> (AssociationExecution -> Maybe Text -> AssociationExecution)
-> Lens
     AssociationExecution AssociationExecution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationExecution' {Maybe Text
associationVersion :: Maybe Text
$sel:associationVersion:AssociationExecution' :: AssociationExecution -> Maybe Text
associationVersion} -> Maybe Text
associationVersion) (\s :: AssociationExecution
s@AssociationExecution' {} Maybe Text
a -> AssociationExecution
s {$sel:associationVersion:AssociationExecution' :: Maybe Text
associationVersion = Maybe Text
a} :: AssociationExecution)

instance Core.FromJSON AssociationExecution where
  parseJSON :: Value -> Parser AssociationExecution
parseJSON =
    String
-> (Object -> Parser AssociationExecution)
-> Value
-> Parser AssociationExecution
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AssociationExecution"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> AssociationExecution
AssociationExecution'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> AssociationExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> AssociationExecution)
forall (f :: * -> *) a b. Functor 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
"AssociationId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> AssociationExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> AssociationExecution)
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
"DetailedStatus")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> AssociationExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> AssociationExecution)
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
"Status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> AssociationExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe POSIX -> Maybe Text -> AssociationExecution)
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
"ExecutionId")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe POSIX -> Maybe Text -> AssociationExecution)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe Text -> AssociationExecution)
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
"CreatedTime")
            Parser
  (Maybe Text -> Maybe POSIX -> Maybe Text -> AssociationExecution)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> AssociationExecution)
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
"ResourceCountByStatus")
            Parser (Maybe POSIX -> Maybe Text -> AssociationExecution)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> AssociationExecution)
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
"LastExecutionDate")
            Parser (Maybe Text -> AssociationExecution)
-> Parser (Maybe Text) -> Parser AssociationExecution
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
"AssociationVersion")
      )

instance Prelude.Hashable AssociationExecution

instance Prelude.NFData AssociationExecution