{-# 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.MGN.Types.PostLaunchActions
-- 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.MGN.Types.PostLaunchActions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MGN.Types.PostLaunchActionsDeploymentType
import Amazonka.MGN.Types.SsmDocument
import qualified Amazonka.Prelude as Prelude

-- | Post Launch Actions to executed on the Test or Cutover instance.
--
-- /See:/ 'newPostLaunchActions' smart constructor.
data PostLaunchActions = PostLaunchActions'
  { -- | AWS Systems Manager Command\'s CloudWatch log group name.
    PostLaunchActions -> Maybe Text
cloudWatchLogGroupName :: Prelude.Maybe Prelude.Text,
    -- | Deployment type in which AWS Systems Manager Documents will be executed.
    PostLaunchActions -> Maybe PostLaunchActionsDeploymentType
deployment :: Prelude.Maybe PostLaunchActionsDeploymentType,
    -- | AWS Systems Manager Command\'s logs S3 log bucket.
    PostLaunchActions -> Maybe Text
s3LogBucket :: Prelude.Maybe Prelude.Text,
    -- | AWS Systems Manager Command\'s logs S3 output key prefix.
    PostLaunchActions -> Maybe Text
s3OutputKeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | AWS Systems Manager Documents.
    PostLaunchActions -> Maybe [SsmDocument]
ssmDocuments :: Prelude.Maybe [SsmDocument]
  }
  deriving (PostLaunchActions -> PostLaunchActions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostLaunchActions -> PostLaunchActions -> Bool
$c/= :: PostLaunchActions -> PostLaunchActions -> Bool
== :: PostLaunchActions -> PostLaunchActions -> Bool
$c== :: PostLaunchActions -> PostLaunchActions -> Bool
Prelude.Eq, ReadPrec [PostLaunchActions]
ReadPrec PostLaunchActions
Int -> ReadS PostLaunchActions
ReadS [PostLaunchActions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostLaunchActions]
$creadListPrec :: ReadPrec [PostLaunchActions]
readPrec :: ReadPrec PostLaunchActions
$creadPrec :: ReadPrec PostLaunchActions
readList :: ReadS [PostLaunchActions]
$creadList :: ReadS [PostLaunchActions]
readsPrec :: Int -> ReadS PostLaunchActions
$creadsPrec :: Int -> ReadS PostLaunchActions
Prelude.Read, Int -> PostLaunchActions -> ShowS
[PostLaunchActions] -> ShowS
PostLaunchActions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostLaunchActions] -> ShowS
$cshowList :: [PostLaunchActions] -> ShowS
show :: PostLaunchActions -> String
$cshow :: PostLaunchActions -> String
showsPrec :: Int -> PostLaunchActions -> ShowS
$cshowsPrec :: Int -> PostLaunchActions -> ShowS
Prelude.Show, forall x. Rep PostLaunchActions x -> PostLaunchActions
forall x. PostLaunchActions -> Rep PostLaunchActions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PostLaunchActions x -> PostLaunchActions
$cfrom :: forall x. PostLaunchActions -> Rep PostLaunchActions x
Prelude.Generic)

-- |
-- Create a value of 'PostLaunchActions' 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:
--
-- 'cloudWatchLogGroupName', 'postLaunchActions_cloudWatchLogGroupName' - AWS Systems Manager Command\'s CloudWatch log group name.
--
-- 'deployment', 'postLaunchActions_deployment' - Deployment type in which AWS Systems Manager Documents will be executed.
--
-- 's3LogBucket', 'postLaunchActions_s3LogBucket' - AWS Systems Manager Command\'s logs S3 log bucket.
--
-- 's3OutputKeyPrefix', 'postLaunchActions_s3OutputKeyPrefix' - AWS Systems Manager Command\'s logs S3 output key prefix.
--
-- 'ssmDocuments', 'postLaunchActions_ssmDocuments' - AWS Systems Manager Documents.
newPostLaunchActions ::
  PostLaunchActions
newPostLaunchActions :: PostLaunchActions
newPostLaunchActions =
  PostLaunchActions'
    { $sel:cloudWatchLogGroupName:PostLaunchActions' :: Maybe Text
cloudWatchLogGroupName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:deployment:PostLaunchActions' :: Maybe PostLaunchActionsDeploymentType
deployment = forall a. Maybe a
Prelude.Nothing,
      $sel:s3LogBucket:PostLaunchActions' :: Maybe Text
s3LogBucket = forall a. Maybe a
Prelude.Nothing,
      $sel:s3OutputKeyPrefix:PostLaunchActions' :: Maybe Text
s3OutputKeyPrefix = forall a. Maybe a
Prelude.Nothing,
      $sel:ssmDocuments:PostLaunchActions' :: Maybe [SsmDocument]
ssmDocuments = forall a. Maybe a
Prelude.Nothing
    }

-- | AWS Systems Manager Command\'s CloudWatch log group name.
postLaunchActions_cloudWatchLogGroupName :: Lens.Lens' PostLaunchActions (Prelude.Maybe Prelude.Text)
postLaunchActions_cloudWatchLogGroupName :: Lens' PostLaunchActions (Maybe Text)
postLaunchActions_cloudWatchLogGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostLaunchActions' {Maybe Text
cloudWatchLogGroupName :: Maybe Text
$sel:cloudWatchLogGroupName:PostLaunchActions' :: PostLaunchActions -> Maybe Text
cloudWatchLogGroupName} -> Maybe Text
cloudWatchLogGroupName) (\s :: PostLaunchActions
s@PostLaunchActions' {} Maybe Text
a -> PostLaunchActions
s {$sel:cloudWatchLogGroupName:PostLaunchActions' :: Maybe Text
cloudWatchLogGroupName = Maybe Text
a} :: PostLaunchActions)

-- | Deployment type in which AWS Systems Manager Documents will be executed.
postLaunchActions_deployment :: Lens.Lens' PostLaunchActions (Prelude.Maybe PostLaunchActionsDeploymentType)
postLaunchActions_deployment :: Lens' PostLaunchActions (Maybe PostLaunchActionsDeploymentType)
postLaunchActions_deployment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostLaunchActions' {Maybe PostLaunchActionsDeploymentType
deployment :: Maybe PostLaunchActionsDeploymentType
$sel:deployment:PostLaunchActions' :: PostLaunchActions -> Maybe PostLaunchActionsDeploymentType
deployment} -> Maybe PostLaunchActionsDeploymentType
deployment) (\s :: PostLaunchActions
s@PostLaunchActions' {} Maybe PostLaunchActionsDeploymentType
a -> PostLaunchActions
s {$sel:deployment:PostLaunchActions' :: Maybe PostLaunchActionsDeploymentType
deployment = Maybe PostLaunchActionsDeploymentType
a} :: PostLaunchActions)

-- | AWS Systems Manager Command\'s logs S3 log bucket.
postLaunchActions_s3LogBucket :: Lens.Lens' PostLaunchActions (Prelude.Maybe Prelude.Text)
postLaunchActions_s3LogBucket :: Lens' PostLaunchActions (Maybe Text)
postLaunchActions_s3LogBucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostLaunchActions' {Maybe Text
s3LogBucket :: Maybe Text
$sel:s3LogBucket:PostLaunchActions' :: PostLaunchActions -> Maybe Text
s3LogBucket} -> Maybe Text
s3LogBucket) (\s :: PostLaunchActions
s@PostLaunchActions' {} Maybe Text
a -> PostLaunchActions
s {$sel:s3LogBucket:PostLaunchActions' :: Maybe Text
s3LogBucket = Maybe Text
a} :: PostLaunchActions)

-- | AWS Systems Manager Command\'s logs S3 output key prefix.
postLaunchActions_s3OutputKeyPrefix :: Lens.Lens' PostLaunchActions (Prelude.Maybe Prelude.Text)
postLaunchActions_s3OutputKeyPrefix :: Lens' PostLaunchActions (Maybe Text)
postLaunchActions_s3OutputKeyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostLaunchActions' {Maybe Text
s3OutputKeyPrefix :: Maybe Text
$sel:s3OutputKeyPrefix:PostLaunchActions' :: PostLaunchActions -> Maybe Text
s3OutputKeyPrefix} -> Maybe Text
s3OutputKeyPrefix) (\s :: PostLaunchActions
s@PostLaunchActions' {} Maybe Text
a -> PostLaunchActions
s {$sel:s3OutputKeyPrefix:PostLaunchActions' :: Maybe Text
s3OutputKeyPrefix = Maybe Text
a} :: PostLaunchActions)

-- | AWS Systems Manager Documents.
postLaunchActions_ssmDocuments :: Lens.Lens' PostLaunchActions (Prelude.Maybe [SsmDocument])
postLaunchActions_ssmDocuments :: Lens' PostLaunchActions (Maybe [SsmDocument])
postLaunchActions_ssmDocuments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostLaunchActions' {Maybe [SsmDocument]
ssmDocuments :: Maybe [SsmDocument]
$sel:ssmDocuments:PostLaunchActions' :: PostLaunchActions -> Maybe [SsmDocument]
ssmDocuments} -> Maybe [SsmDocument]
ssmDocuments) (\s :: PostLaunchActions
s@PostLaunchActions' {} Maybe [SsmDocument]
a -> PostLaunchActions
s {$sel:ssmDocuments:PostLaunchActions' :: Maybe [SsmDocument]
ssmDocuments = Maybe [SsmDocument]
a} :: PostLaunchActions) 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

instance Data.FromJSON PostLaunchActions where
  parseJSON :: Value -> Parser PostLaunchActions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PostLaunchActions"
      ( \Object
x ->
          Maybe Text
-> Maybe PostLaunchActionsDeploymentType
-> Maybe Text
-> Maybe Text
-> Maybe [SsmDocument]
-> PostLaunchActions
PostLaunchActions'
            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
"cloudWatchLogGroupName")
            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
"deployment")
            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
"s3LogBucket")
            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
"s3OutputKeyPrefix")
            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
"ssmDocuments" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable PostLaunchActions where
  hashWithSalt :: Int -> PostLaunchActions -> Int
hashWithSalt Int
_salt PostLaunchActions' {Maybe [SsmDocument]
Maybe Text
Maybe PostLaunchActionsDeploymentType
ssmDocuments :: Maybe [SsmDocument]
s3OutputKeyPrefix :: Maybe Text
s3LogBucket :: Maybe Text
deployment :: Maybe PostLaunchActionsDeploymentType
cloudWatchLogGroupName :: Maybe Text
$sel:ssmDocuments:PostLaunchActions' :: PostLaunchActions -> Maybe [SsmDocument]
$sel:s3OutputKeyPrefix:PostLaunchActions' :: PostLaunchActions -> Maybe Text
$sel:s3LogBucket:PostLaunchActions' :: PostLaunchActions -> Maybe Text
$sel:deployment:PostLaunchActions' :: PostLaunchActions -> Maybe PostLaunchActionsDeploymentType
$sel:cloudWatchLogGroupName:PostLaunchActions' :: PostLaunchActions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudWatchLogGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PostLaunchActionsDeploymentType
deployment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3LogBucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3OutputKeyPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SsmDocument]
ssmDocuments

instance Prelude.NFData PostLaunchActions where
  rnf :: PostLaunchActions -> ()
rnf PostLaunchActions' {Maybe [SsmDocument]
Maybe Text
Maybe PostLaunchActionsDeploymentType
ssmDocuments :: Maybe [SsmDocument]
s3OutputKeyPrefix :: Maybe Text
s3LogBucket :: Maybe Text
deployment :: Maybe PostLaunchActionsDeploymentType
cloudWatchLogGroupName :: Maybe Text
$sel:ssmDocuments:PostLaunchActions' :: PostLaunchActions -> Maybe [SsmDocument]
$sel:s3OutputKeyPrefix:PostLaunchActions' :: PostLaunchActions -> Maybe Text
$sel:s3LogBucket:PostLaunchActions' :: PostLaunchActions -> Maybe Text
$sel:deployment:PostLaunchActions' :: PostLaunchActions -> Maybe PostLaunchActionsDeploymentType
$sel:cloudWatchLogGroupName:PostLaunchActions' :: PostLaunchActions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudWatchLogGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PostLaunchActionsDeploymentType
deployment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3LogBucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3OutputKeyPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SsmDocument]
ssmDocuments

instance Data.ToJSON PostLaunchActions where
  toJSON :: PostLaunchActions -> Value
toJSON PostLaunchActions' {Maybe [SsmDocument]
Maybe Text
Maybe PostLaunchActionsDeploymentType
ssmDocuments :: Maybe [SsmDocument]
s3OutputKeyPrefix :: Maybe Text
s3LogBucket :: Maybe Text
deployment :: Maybe PostLaunchActionsDeploymentType
cloudWatchLogGroupName :: Maybe Text
$sel:ssmDocuments:PostLaunchActions' :: PostLaunchActions -> Maybe [SsmDocument]
$sel:s3OutputKeyPrefix:PostLaunchActions' :: PostLaunchActions -> Maybe Text
$sel:s3LogBucket:PostLaunchActions' :: PostLaunchActions -> Maybe Text
$sel:deployment:PostLaunchActions' :: PostLaunchActions -> Maybe PostLaunchActionsDeploymentType
$sel:cloudWatchLogGroupName:PostLaunchActions' :: PostLaunchActions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"cloudWatchLogGroupName" 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
cloudWatchLogGroupName,
            (Key
"deployment" 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 PostLaunchActionsDeploymentType
deployment,
            (Key
"s3LogBucket" 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
s3LogBucket,
            (Key
"s3OutputKeyPrefix" 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
s3OutputKeyPrefix,
            (Key
"ssmDocuments" 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 [SsmDocument]
ssmDocuments
          ]
      )