{-# 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.RobOMaker.Types.DeploymentLaunchConfig
-- 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.RobOMaker.Types.DeploymentLaunchConfig where

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

-- | Configuration information for a deployment launch.
--
-- /See:/ 'newDeploymentLaunchConfig' smart constructor.
data DeploymentLaunchConfig = DeploymentLaunchConfig'
  { -- | The deployment pre-launch file. This file will be executed prior to the
    -- launch file.
    DeploymentLaunchConfig -> Maybe Text
preLaunchFile :: Prelude.Maybe Prelude.Text,
    -- | The deployment post-launch file. This file will be executed after the
    -- launch file.
    DeploymentLaunchConfig -> Maybe Text
postLaunchFile :: Prelude.Maybe Prelude.Text,
    -- | An array of key\/value pairs specifying environment variables for the
    -- robot application
    DeploymentLaunchConfig -> Maybe (HashMap Text Text)
environmentVariables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The package name.
    DeploymentLaunchConfig -> Text
packageName :: Prelude.Text,
    -- | The launch file name.
    DeploymentLaunchConfig -> Text
launchFile :: Prelude.Text
  }
  deriving (DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool
(DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool)
-> (DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool)
-> Eq DeploymentLaunchConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool
$c/= :: DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool
== :: DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool
$c== :: DeploymentLaunchConfig -> DeploymentLaunchConfig -> Bool
Prelude.Eq, ReadPrec [DeploymentLaunchConfig]
ReadPrec DeploymentLaunchConfig
Int -> ReadS DeploymentLaunchConfig
ReadS [DeploymentLaunchConfig]
(Int -> ReadS DeploymentLaunchConfig)
-> ReadS [DeploymentLaunchConfig]
-> ReadPrec DeploymentLaunchConfig
-> ReadPrec [DeploymentLaunchConfig]
-> Read DeploymentLaunchConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentLaunchConfig]
$creadListPrec :: ReadPrec [DeploymentLaunchConfig]
readPrec :: ReadPrec DeploymentLaunchConfig
$creadPrec :: ReadPrec DeploymentLaunchConfig
readList :: ReadS [DeploymentLaunchConfig]
$creadList :: ReadS [DeploymentLaunchConfig]
readsPrec :: Int -> ReadS DeploymentLaunchConfig
$creadsPrec :: Int -> ReadS DeploymentLaunchConfig
Prelude.Read, Int -> DeploymentLaunchConfig -> ShowS
[DeploymentLaunchConfig] -> ShowS
DeploymentLaunchConfig -> String
(Int -> DeploymentLaunchConfig -> ShowS)
-> (DeploymentLaunchConfig -> String)
-> ([DeploymentLaunchConfig] -> ShowS)
-> Show DeploymentLaunchConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentLaunchConfig] -> ShowS
$cshowList :: [DeploymentLaunchConfig] -> ShowS
show :: DeploymentLaunchConfig -> String
$cshow :: DeploymentLaunchConfig -> String
showsPrec :: Int -> DeploymentLaunchConfig -> ShowS
$cshowsPrec :: Int -> DeploymentLaunchConfig -> ShowS
Prelude.Show, (forall x. DeploymentLaunchConfig -> Rep DeploymentLaunchConfig x)
-> (forall x.
    Rep DeploymentLaunchConfig x -> DeploymentLaunchConfig)
-> Generic DeploymentLaunchConfig
forall x. Rep DeploymentLaunchConfig x -> DeploymentLaunchConfig
forall x. DeploymentLaunchConfig -> Rep DeploymentLaunchConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentLaunchConfig x -> DeploymentLaunchConfig
$cfrom :: forall x. DeploymentLaunchConfig -> Rep DeploymentLaunchConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentLaunchConfig' 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:
--
-- 'preLaunchFile', 'deploymentLaunchConfig_preLaunchFile' - The deployment pre-launch file. This file will be executed prior to the
-- launch file.
--
-- 'postLaunchFile', 'deploymentLaunchConfig_postLaunchFile' - The deployment post-launch file. This file will be executed after the
-- launch file.
--
-- 'environmentVariables', 'deploymentLaunchConfig_environmentVariables' - An array of key\/value pairs specifying environment variables for the
-- robot application
--
-- 'packageName', 'deploymentLaunchConfig_packageName' - The package name.
--
-- 'launchFile', 'deploymentLaunchConfig_launchFile' - The launch file name.
newDeploymentLaunchConfig ::
  -- | 'packageName'
  Prelude.Text ->
  -- | 'launchFile'
  Prelude.Text ->
  DeploymentLaunchConfig
newDeploymentLaunchConfig :: Text -> Text -> DeploymentLaunchConfig
newDeploymentLaunchConfig Text
pPackageName_ Text
pLaunchFile_ =
  DeploymentLaunchConfig' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> DeploymentLaunchConfig
DeploymentLaunchConfig'
    { $sel:preLaunchFile:DeploymentLaunchConfig' :: Maybe Text
preLaunchFile =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:postLaunchFile:DeploymentLaunchConfig' :: Maybe Text
postLaunchFile = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentVariables:DeploymentLaunchConfig' :: Maybe (HashMap Text Text)
environmentVariables = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:packageName:DeploymentLaunchConfig' :: Text
packageName = Text
pPackageName_,
      $sel:launchFile:DeploymentLaunchConfig' :: Text
launchFile = Text
pLaunchFile_
    }

-- | The deployment pre-launch file. This file will be executed prior to the
-- launch file.
deploymentLaunchConfig_preLaunchFile :: Lens.Lens' DeploymentLaunchConfig (Prelude.Maybe Prelude.Text)
deploymentLaunchConfig_preLaunchFile :: (Maybe Text -> f (Maybe Text))
-> DeploymentLaunchConfig -> f DeploymentLaunchConfig
deploymentLaunchConfig_preLaunchFile = (DeploymentLaunchConfig -> Maybe Text)
-> (DeploymentLaunchConfig -> Maybe Text -> DeploymentLaunchConfig)
-> Lens
     DeploymentLaunchConfig
     DeploymentLaunchConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentLaunchConfig' {Maybe Text
preLaunchFile :: Maybe Text
$sel:preLaunchFile:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Maybe Text
preLaunchFile} -> Maybe Text
preLaunchFile) (\s :: DeploymentLaunchConfig
s@DeploymentLaunchConfig' {} Maybe Text
a -> DeploymentLaunchConfig
s {$sel:preLaunchFile:DeploymentLaunchConfig' :: Maybe Text
preLaunchFile = Maybe Text
a} :: DeploymentLaunchConfig)

-- | The deployment post-launch file. This file will be executed after the
-- launch file.
deploymentLaunchConfig_postLaunchFile :: Lens.Lens' DeploymentLaunchConfig (Prelude.Maybe Prelude.Text)
deploymentLaunchConfig_postLaunchFile :: (Maybe Text -> f (Maybe Text))
-> DeploymentLaunchConfig -> f DeploymentLaunchConfig
deploymentLaunchConfig_postLaunchFile = (DeploymentLaunchConfig -> Maybe Text)
-> (DeploymentLaunchConfig -> Maybe Text -> DeploymentLaunchConfig)
-> Lens
     DeploymentLaunchConfig
     DeploymentLaunchConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentLaunchConfig' {Maybe Text
postLaunchFile :: Maybe Text
$sel:postLaunchFile:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Maybe Text
postLaunchFile} -> Maybe Text
postLaunchFile) (\s :: DeploymentLaunchConfig
s@DeploymentLaunchConfig' {} Maybe Text
a -> DeploymentLaunchConfig
s {$sel:postLaunchFile:DeploymentLaunchConfig' :: Maybe Text
postLaunchFile = Maybe Text
a} :: DeploymentLaunchConfig)

-- | An array of key\/value pairs specifying environment variables for the
-- robot application
deploymentLaunchConfig_environmentVariables :: Lens.Lens' DeploymentLaunchConfig (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
deploymentLaunchConfig_environmentVariables :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeploymentLaunchConfig -> f DeploymentLaunchConfig
deploymentLaunchConfig_environmentVariables = (DeploymentLaunchConfig -> Maybe (HashMap Text Text))
-> (DeploymentLaunchConfig
    -> Maybe (HashMap Text Text) -> DeploymentLaunchConfig)
-> Lens
     DeploymentLaunchConfig
     DeploymentLaunchConfig
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentLaunchConfig' {Maybe (HashMap Text Text)
environmentVariables :: Maybe (HashMap Text Text)
$sel:environmentVariables:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Maybe (HashMap Text Text)
environmentVariables} -> Maybe (HashMap Text Text)
environmentVariables) (\s :: DeploymentLaunchConfig
s@DeploymentLaunchConfig' {} Maybe (HashMap Text Text)
a -> DeploymentLaunchConfig
s {$sel:environmentVariables:DeploymentLaunchConfig' :: Maybe (HashMap Text Text)
environmentVariables = Maybe (HashMap Text Text)
a} :: DeploymentLaunchConfig) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DeploymentLaunchConfig -> f DeploymentLaunchConfig)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeploymentLaunchConfig
-> f DeploymentLaunchConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The package name.
deploymentLaunchConfig_packageName :: Lens.Lens' DeploymentLaunchConfig Prelude.Text
deploymentLaunchConfig_packageName :: (Text -> f Text)
-> DeploymentLaunchConfig -> f DeploymentLaunchConfig
deploymentLaunchConfig_packageName = (DeploymentLaunchConfig -> Text)
-> (DeploymentLaunchConfig -> Text -> DeploymentLaunchConfig)
-> Lens DeploymentLaunchConfig DeploymentLaunchConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentLaunchConfig' {Text
packageName :: Text
$sel:packageName:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Text
packageName} -> Text
packageName) (\s :: DeploymentLaunchConfig
s@DeploymentLaunchConfig' {} Text
a -> DeploymentLaunchConfig
s {$sel:packageName:DeploymentLaunchConfig' :: Text
packageName = Text
a} :: DeploymentLaunchConfig)

-- | The launch file name.
deploymentLaunchConfig_launchFile :: Lens.Lens' DeploymentLaunchConfig Prelude.Text
deploymentLaunchConfig_launchFile :: (Text -> f Text)
-> DeploymentLaunchConfig -> f DeploymentLaunchConfig
deploymentLaunchConfig_launchFile = (DeploymentLaunchConfig -> Text)
-> (DeploymentLaunchConfig -> Text -> DeploymentLaunchConfig)
-> Lens DeploymentLaunchConfig DeploymentLaunchConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentLaunchConfig' {Text
launchFile :: Text
$sel:launchFile:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Text
launchFile} -> Text
launchFile) (\s :: DeploymentLaunchConfig
s@DeploymentLaunchConfig' {} Text
a -> DeploymentLaunchConfig
s {$sel:launchFile:DeploymentLaunchConfig' :: Text
launchFile = Text
a} :: DeploymentLaunchConfig)

instance Core.FromJSON DeploymentLaunchConfig where
  parseJSON :: Value -> Parser DeploymentLaunchConfig
parseJSON =
    String
-> (Object -> Parser DeploymentLaunchConfig)
-> Value
-> Parser DeploymentLaunchConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeploymentLaunchConfig"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> DeploymentLaunchConfig
DeploymentLaunchConfig'
            (Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> Text
 -> DeploymentLaunchConfig)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> DeploymentLaunchConfig)
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
"preLaunchFile")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> DeploymentLaunchConfig)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text -> Text -> DeploymentLaunchConfig)
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
"postLaunchFile")
            Parser
  (Maybe (HashMap Text Text)
   -> Text -> Text -> DeploymentLaunchConfig)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> DeploymentLaunchConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"environmentVariables"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> Text -> DeploymentLaunchConfig)
-> Parser Text -> Parser (Text -> DeploymentLaunchConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"packageName")
            Parser (Text -> DeploymentLaunchConfig)
-> Parser Text -> Parser DeploymentLaunchConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"launchFile")
      )

instance Prelude.Hashable DeploymentLaunchConfig

instance Prelude.NFData DeploymentLaunchConfig

instance Core.ToJSON DeploymentLaunchConfig where
  toJSON :: DeploymentLaunchConfig -> Value
toJSON DeploymentLaunchConfig' {Maybe Text
Maybe (HashMap Text Text)
Text
launchFile :: Text
packageName :: Text
environmentVariables :: Maybe (HashMap Text Text)
postLaunchFile :: Maybe Text
preLaunchFile :: Maybe Text
$sel:launchFile:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Text
$sel:packageName:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Text
$sel:environmentVariables:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Maybe (HashMap Text Text)
$sel:postLaunchFile:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Maybe Text
$sel:preLaunchFile:DeploymentLaunchConfig' :: DeploymentLaunchConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"preLaunchFile" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
preLaunchFile,
            (Text
"postLaunchFile" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
postLaunchFile,
            (Text
"environmentVariables" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
environmentVariables,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"packageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
packageName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"launchFile" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
launchFile)
          ]
      )