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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.Target
import Amazonka.SSM.Types.TargetLocation

-- | Information about an Automation runbook used in a runbook workflow in
-- Change Manager.
--
-- The Automation runbooks specified for the runbook workflow can\'t run
-- until all required approvals for the change request have been received.
--
-- /See:/ 'newRunbook' smart constructor.
data Runbook = Runbook'
  { -- | The version of the Automation runbook used in a runbook workflow.
    Runbook -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | The @MaxConcurrency@ value specified by the user when the operation
    -- started, indicating the maximum number of resources that the runbook
    -- operation can run on at the same time.
    Runbook -> Maybe Text
maxConcurrency :: Prelude.Maybe Prelude.Text,
    -- | The @MaxErrors@ value specified by the user when the execution started,
    -- indicating the maximum number of errors that can occur during the
    -- operation before the updates are stopped or rolled back.
    Runbook -> Maybe Text
maxErrors :: Prelude.Maybe Prelude.Text,
    -- | The key-value map of execution parameters, which were supplied when
    -- calling @StartChangeRequestExecution@.
    Runbook -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | Information about the Amazon Web Services Regions and Amazon Web
    -- Services accounts targeted by the current Runbook operation.
    Runbook -> Maybe (NonEmpty TargetLocation)
targetLocations :: Prelude.Maybe (Prelude.NonEmpty TargetLocation),
    -- | A key-value mapping of runbook parameters to target resources. Both
    -- Targets and TargetMaps can\'t be specified together.
    Runbook -> Maybe [HashMap Text [Text]]
targetMaps :: Prelude.Maybe [Prelude.HashMap Prelude.Text [Prelude.Text]],
    -- | The name of the parameter used as the target resource for the
    -- rate-controlled runbook workflow. Required if you specify @Targets@.
    Runbook -> Maybe Text
targetParameterName :: Prelude.Maybe Prelude.Text,
    -- | A key-value mapping to target resources that the runbook operation
    -- performs tasks on. Required if you specify @TargetParameterName@.
    Runbook -> Maybe [Target]
targets :: Prelude.Maybe [Target],
    -- | The name of the Automation runbook used in a runbook workflow.
    Runbook -> Text
documentName :: Prelude.Text
  }
  deriving (Runbook -> Runbook -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Runbook -> Runbook -> Bool
$c/= :: Runbook -> Runbook -> Bool
== :: Runbook -> Runbook -> Bool
$c== :: Runbook -> Runbook -> Bool
Prelude.Eq, ReadPrec [Runbook]
ReadPrec Runbook
Int -> ReadS Runbook
ReadS [Runbook]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Runbook]
$creadListPrec :: ReadPrec [Runbook]
readPrec :: ReadPrec Runbook
$creadPrec :: ReadPrec Runbook
readList :: ReadS [Runbook]
$creadList :: ReadS [Runbook]
readsPrec :: Int -> ReadS Runbook
$creadsPrec :: Int -> ReadS Runbook
Prelude.Read, Int -> Runbook -> ShowS
[Runbook] -> ShowS
Runbook -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Runbook] -> ShowS
$cshowList :: [Runbook] -> ShowS
show :: Runbook -> String
$cshow :: Runbook -> String
showsPrec :: Int -> Runbook -> ShowS
$cshowsPrec :: Int -> Runbook -> ShowS
Prelude.Show, forall x. Rep Runbook x -> Runbook
forall x. Runbook -> Rep Runbook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Runbook x -> Runbook
$cfrom :: forall x. Runbook -> Rep Runbook x
Prelude.Generic)

-- |
-- Create a value of 'Runbook' 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:
--
-- 'documentVersion', 'runbook_documentVersion' - The version of the Automation runbook used in a runbook workflow.
--
-- 'maxConcurrency', 'runbook_maxConcurrency' - The @MaxConcurrency@ value specified by the user when the operation
-- started, indicating the maximum number of resources that the runbook
-- operation can run on at the same time.
--
-- 'maxErrors', 'runbook_maxErrors' - The @MaxErrors@ value specified by the user when the execution started,
-- indicating the maximum number of errors that can occur during the
-- operation before the updates are stopped or rolled back.
--
-- 'parameters', 'runbook_parameters' - The key-value map of execution parameters, which were supplied when
-- calling @StartChangeRequestExecution@.
--
-- 'targetLocations', 'runbook_targetLocations' - Information about the Amazon Web Services Regions and Amazon Web
-- Services accounts targeted by the current Runbook operation.
--
-- 'targetMaps', 'runbook_targetMaps' - A key-value mapping of runbook parameters to target resources. Both
-- Targets and TargetMaps can\'t be specified together.
--
-- 'targetParameterName', 'runbook_targetParameterName' - The name of the parameter used as the target resource for the
-- rate-controlled runbook workflow. Required if you specify @Targets@.
--
-- 'targets', 'runbook_targets' - A key-value mapping to target resources that the runbook operation
-- performs tasks on. Required if you specify @TargetParameterName@.
--
-- 'documentName', 'runbook_documentName' - The name of the Automation runbook used in a runbook workflow.
newRunbook ::
  -- | 'documentName'
  Prelude.Text ->
  Runbook
newRunbook :: Text -> Runbook
newRunbook Text
pDocumentName_ =
  Runbook'
    { $sel:documentVersion:Runbook' :: Maybe Text
documentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrency:Runbook' :: Maybe Text
maxConcurrency = forall a. Maybe a
Prelude.Nothing,
      $sel:maxErrors:Runbook' :: Maybe Text
maxErrors = forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:Runbook' :: Maybe (HashMap Text [Text])
parameters = forall a. Maybe a
Prelude.Nothing,
      $sel:targetLocations:Runbook' :: Maybe (NonEmpty TargetLocation)
targetLocations = forall a. Maybe a
Prelude.Nothing,
      $sel:targetMaps:Runbook' :: Maybe [HashMap Text [Text]]
targetMaps = forall a. Maybe a
Prelude.Nothing,
      $sel:targetParameterName:Runbook' :: Maybe Text
targetParameterName = forall a. Maybe a
Prelude.Nothing,
      $sel:targets:Runbook' :: Maybe [Target]
targets = forall a. Maybe a
Prelude.Nothing,
      $sel:documentName:Runbook' :: Text
documentName = Text
pDocumentName_
    }

-- | The version of the Automation runbook used in a runbook workflow.
runbook_documentVersion :: Lens.Lens' Runbook (Prelude.Maybe Prelude.Text)
runbook_documentVersion :: Lens' Runbook (Maybe Text)
runbook_documentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:Runbook' :: Runbook -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: Runbook
s@Runbook' {} Maybe Text
a -> Runbook
s {$sel:documentVersion:Runbook' :: Maybe Text
documentVersion = Maybe Text
a} :: Runbook)

-- | The @MaxConcurrency@ value specified by the user when the operation
-- started, indicating the maximum number of resources that the runbook
-- operation can run on at the same time.
runbook_maxConcurrency :: Lens.Lens' Runbook (Prelude.Maybe Prelude.Text)
runbook_maxConcurrency :: Lens' Runbook (Maybe Text)
runbook_maxConcurrency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe Text
maxConcurrency :: Maybe Text
$sel:maxConcurrency:Runbook' :: Runbook -> Maybe Text
maxConcurrency} -> Maybe Text
maxConcurrency) (\s :: Runbook
s@Runbook' {} Maybe Text
a -> Runbook
s {$sel:maxConcurrency:Runbook' :: Maybe Text
maxConcurrency = Maybe Text
a} :: Runbook)

-- | The @MaxErrors@ value specified by the user when the execution started,
-- indicating the maximum number of errors that can occur during the
-- operation before the updates are stopped or rolled back.
runbook_maxErrors :: Lens.Lens' Runbook (Prelude.Maybe Prelude.Text)
runbook_maxErrors :: Lens' Runbook (Maybe Text)
runbook_maxErrors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe Text
maxErrors :: Maybe Text
$sel:maxErrors:Runbook' :: Runbook -> Maybe Text
maxErrors} -> Maybe Text
maxErrors) (\s :: Runbook
s@Runbook' {} Maybe Text
a -> Runbook
s {$sel:maxErrors:Runbook' :: Maybe Text
maxErrors = Maybe Text
a} :: Runbook)

-- | The key-value map of execution parameters, which were supplied when
-- calling @StartChangeRequestExecution@.
runbook_parameters :: Lens.Lens' Runbook (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
runbook_parameters :: Lens' Runbook (Maybe (HashMap Text [Text]))
runbook_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:Runbook' :: Runbook -> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: Runbook
s@Runbook' {} Maybe (HashMap Text [Text])
a -> Runbook
s {$sel:parameters:Runbook' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: Runbook) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about the Amazon Web Services Regions and Amazon Web
-- Services accounts targeted by the current Runbook operation.
runbook_targetLocations :: Lens.Lens' Runbook (Prelude.Maybe (Prelude.NonEmpty TargetLocation))
runbook_targetLocations :: Lens' Runbook (Maybe (NonEmpty TargetLocation))
runbook_targetLocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe (NonEmpty TargetLocation)
targetLocations :: Maybe (NonEmpty TargetLocation)
$sel:targetLocations:Runbook' :: Runbook -> Maybe (NonEmpty TargetLocation)
targetLocations} -> Maybe (NonEmpty TargetLocation)
targetLocations) (\s :: Runbook
s@Runbook' {} Maybe (NonEmpty TargetLocation)
a -> Runbook
s {$sel:targetLocations:Runbook' :: Maybe (NonEmpty TargetLocation)
targetLocations = Maybe (NonEmpty TargetLocation)
a} :: Runbook) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A key-value mapping of runbook parameters to target resources. Both
-- Targets and TargetMaps can\'t be specified together.
runbook_targetMaps :: Lens.Lens' Runbook (Prelude.Maybe [Prelude.HashMap Prelude.Text [Prelude.Text]])
runbook_targetMaps :: Lens' Runbook (Maybe [HashMap Text [Text]])
runbook_targetMaps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe [HashMap Text [Text]]
targetMaps :: Maybe [HashMap Text [Text]]
$sel:targetMaps:Runbook' :: Runbook -> Maybe [HashMap Text [Text]]
targetMaps} -> Maybe [HashMap Text [Text]]
targetMaps) (\s :: Runbook
s@Runbook' {} Maybe [HashMap Text [Text]]
a -> Runbook
s {$sel:targetMaps:Runbook' :: Maybe [HashMap Text [Text]]
targetMaps = Maybe [HashMap Text [Text]]
a} :: Runbook) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the parameter used as the target resource for the
-- rate-controlled runbook workflow. Required if you specify @Targets@.
runbook_targetParameterName :: Lens.Lens' Runbook (Prelude.Maybe Prelude.Text)
runbook_targetParameterName :: Lens' Runbook (Maybe Text)
runbook_targetParameterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe Text
targetParameterName :: Maybe Text
$sel:targetParameterName:Runbook' :: Runbook -> Maybe Text
targetParameterName} -> Maybe Text
targetParameterName) (\s :: Runbook
s@Runbook' {} Maybe Text
a -> Runbook
s {$sel:targetParameterName:Runbook' :: Maybe Text
targetParameterName = Maybe Text
a} :: Runbook)

-- | A key-value mapping to target resources that the runbook operation
-- performs tasks on. Required if you specify @TargetParameterName@.
runbook_targets :: Lens.Lens' Runbook (Prelude.Maybe [Target])
runbook_targets :: Lens' Runbook (Maybe [Target])
runbook_targets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:Runbook' :: Runbook -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: Runbook
s@Runbook' {} Maybe [Target]
a -> Runbook
s {$sel:targets:Runbook' :: Maybe [Target]
targets = Maybe [Target]
a} :: Runbook) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the Automation runbook used in a runbook workflow.
runbook_documentName :: Lens.Lens' Runbook Prelude.Text
runbook_documentName :: Lens' Runbook Text
runbook_documentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Runbook' {Text
documentName :: Text
$sel:documentName:Runbook' :: Runbook -> Text
documentName} -> Text
documentName) (\s :: Runbook
s@Runbook' {} Text
a -> Runbook
s {$sel:documentName:Runbook' :: Text
documentName = Text
a} :: Runbook)

instance Data.FromJSON Runbook where
  parseJSON :: Value -> Parser Runbook
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Runbook"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text [Text])
-> Maybe (NonEmpty TargetLocation)
-> Maybe [HashMap Text [Text]]
-> Maybe Text
-> Maybe [Target]
-> Text
-> Runbook
Runbook'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DocumentVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MaxConcurrency")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MaxErrors")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Parameters" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TargetLocations")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TargetMaps" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TargetParameterName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Targets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DocumentName")
      )

instance Prelude.Hashable Runbook where
  hashWithSalt :: Int -> Runbook -> Int
hashWithSalt Int
_salt Runbook' {Maybe [HashMap Text [Text]]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (HashMap Text [Text])
Text
documentName :: Text
targets :: Maybe [Target]
targetParameterName :: Maybe Text
targetMaps :: Maybe [HashMap Text [Text]]
targetLocations :: Maybe (NonEmpty TargetLocation)
parameters :: Maybe (HashMap Text [Text])
maxErrors :: Maybe Text
maxConcurrency :: Maybe Text
documentVersion :: Maybe Text
$sel:documentName:Runbook' :: Runbook -> Text
$sel:targets:Runbook' :: Runbook -> Maybe [Target]
$sel:targetParameterName:Runbook' :: Runbook -> Maybe Text
$sel:targetMaps:Runbook' :: Runbook -> Maybe [HashMap Text [Text]]
$sel:targetLocations:Runbook' :: Runbook -> Maybe (NonEmpty TargetLocation)
$sel:parameters:Runbook' :: Runbook -> Maybe (HashMap Text [Text])
$sel:maxErrors:Runbook' :: Runbook -> Maybe Text
$sel:maxConcurrency:Runbook' :: Runbook -> Maybe Text
$sel:documentVersion:Runbook' :: Runbook -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxConcurrency
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxErrors
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text [Text])
parameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty TargetLocation)
targetLocations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [HashMap Text [Text]]
targetMaps
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetParameterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Target]
targets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
documentName

instance Prelude.NFData Runbook where
  rnf :: Runbook -> ()
rnf Runbook' {Maybe [HashMap Text [Text]]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (HashMap Text [Text])
Text
documentName :: Text
targets :: Maybe [Target]
targetParameterName :: Maybe Text
targetMaps :: Maybe [HashMap Text [Text]]
targetLocations :: Maybe (NonEmpty TargetLocation)
parameters :: Maybe (HashMap Text [Text])
maxErrors :: Maybe Text
maxConcurrency :: Maybe Text
documentVersion :: Maybe Text
$sel:documentName:Runbook' :: Runbook -> Text
$sel:targets:Runbook' :: Runbook -> Maybe [Target]
$sel:targetParameterName:Runbook' :: Runbook -> Maybe Text
$sel:targetMaps:Runbook' :: Runbook -> Maybe [HashMap Text [Text]]
$sel:targetLocations:Runbook' :: Runbook -> Maybe (NonEmpty TargetLocation)
$sel:parameters:Runbook' :: Runbook -> Maybe (HashMap Text [Text])
$sel:maxErrors:Runbook' :: Runbook -> Maybe Text
$sel:maxConcurrency:Runbook' :: Runbook -> Maybe Text
$sel:documentVersion:Runbook' :: Runbook -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxConcurrency
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxErrors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text [Text])
parameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty TargetLocation)
targetLocations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [HashMap Text [Text]]
targetMaps
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetParameterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Target]
targets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
documentName

instance Data.ToJSON Runbook where
  toJSON :: Runbook -> Value
toJSON Runbook' {Maybe [HashMap Text [Text]]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (HashMap Text [Text])
Text
documentName :: Text
targets :: Maybe [Target]
targetParameterName :: Maybe Text
targetMaps :: Maybe [HashMap Text [Text]]
targetLocations :: Maybe (NonEmpty TargetLocation)
parameters :: Maybe (HashMap Text [Text])
maxErrors :: Maybe Text
maxConcurrency :: Maybe Text
documentVersion :: Maybe Text
$sel:documentName:Runbook' :: Runbook -> Text
$sel:targets:Runbook' :: Runbook -> Maybe [Target]
$sel:targetParameterName:Runbook' :: Runbook -> Maybe Text
$sel:targetMaps:Runbook' :: Runbook -> Maybe [HashMap Text [Text]]
$sel:targetLocations:Runbook' :: Runbook -> Maybe (NonEmpty TargetLocation)
$sel:parameters:Runbook' :: Runbook -> Maybe (HashMap Text [Text])
$sel:maxErrors:Runbook' :: Runbook -> Maybe Text
$sel:maxConcurrency:Runbook' :: Runbook -> Maybe Text
$sel:documentVersion:Runbook' :: Runbook -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DocumentVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentVersion,
            (Key
"MaxConcurrency" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxConcurrency,
            (Key
"MaxErrors" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxErrors,
            (Key
"Parameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
parameters,
            (Key
"TargetLocations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty TargetLocation)
targetLocations,
            (Key
"TargetMaps" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [HashMap Text [Text]]
targetMaps,
            (Key
"TargetParameterName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
targetParameterName,
            (Key
"Targets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Target]
targets,
            forall a. a -> Maybe a
Prelude.Just (Key
"DocumentName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
documentName)
          ]
      )