{-# 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.LaunchConfig
-- 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.RobOMaker.Types.LaunchConfig 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.RobOMaker.Types.PortForwardingConfig

-- | Information about a launch configuration.
--
-- /See:/ 'newLaunchConfig' smart constructor.
data LaunchConfig = LaunchConfig'
  { -- | If you\'ve specified @General@ as the value for your
    -- @RobotSoftwareSuite@, you can use this field to specify a list of
    -- commands for your container image.
    --
    -- If you\'ve specified @SimulationRuntime@ as the value for your
    -- @SimulationSoftwareSuite@, you can use this field to specify a list of
    -- commands for your container image.
    LaunchConfig -> Maybe [Text]
command :: Prelude.Maybe [Prelude.Text],
    -- | The environment variables for the application launch.
    LaunchConfig -> Maybe (HashMap Text Text)
environmentVariables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The launch file name.
    LaunchConfig -> Maybe Text
launchFile :: Prelude.Maybe Prelude.Text,
    -- | The package name.
    LaunchConfig -> Maybe Text
packageName :: Prelude.Maybe Prelude.Text,
    -- | The port forwarding configuration.
    LaunchConfig -> Maybe PortForwardingConfig
portForwardingConfig :: Prelude.Maybe PortForwardingConfig,
    -- | Boolean indicating whether a streaming session will be configured for
    -- the application. If @True@, AWS RoboMaker will configure a connection so
    -- you can interact with your application as it is running in the
    -- simulation. You must configure and launch the component. It must have a
    -- graphical user interface.
    LaunchConfig -> Maybe Bool
streamUI :: Prelude.Maybe Prelude.Bool
  }
  deriving (LaunchConfig -> LaunchConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchConfig -> LaunchConfig -> Bool
$c/= :: LaunchConfig -> LaunchConfig -> Bool
== :: LaunchConfig -> LaunchConfig -> Bool
$c== :: LaunchConfig -> LaunchConfig -> Bool
Prelude.Eq, ReadPrec [LaunchConfig]
ReadPrec LaunchConfig
Int -> ReadS LaunchConfig
ReadS [LaunchConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchConfig]
$creadListPrec :: ReadPrec [LaunchConfig]
readPrec :: ReadPrec LaunchConfig
$creadPrec :: ReadPrec LaunchConfig
readList :: ReadS [LaunchConfig]
$creadList :: ReadS [LaunchConfig]
readsPrec :: Int -> ReadS LaunchConfig
$creadsPrec :: Int -> ReadS LaunchConfig
Prelude.Read, Int -> LaunchConfig -> ShowS
[LaunchConfig] -> ShowS
LaunchConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchConfig] -> ShowS
$cshowList :: [LaunchConfig] -> ShowS
show :: LaunchConfig -> String
$cshow :: LaunchConfig -> String
showsPrec :: Int -> LaunchConfig -> ShowS
$cshowsPrec :: Int -> LaunchConfig -> ShowS
Prelude.Show, forall x. Rep LaunchConfig x -> LaunchConfig
forall x. LaunchConfig -> Rep LaunchConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LaunchConfig x -> LaunchConfig
$cfrom :: forall x. LaunchConfig -> Rep LaunchConfig x
Prelude.Generic)

-- |
-- Create a value of 'LaunchConfig' 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:
--
-- 'command', 'launchConfig_command' - If you\'ve specified @General@ as the value for your
-- @RobotSoftwareSuite@, you can use this field to specify a list of
-- commands for your container image.
--
-- If you\'ve specified @SimulationRuntime@ as the value for your
-- @SimulationSoftwareSuite@, you can use this field to specify a list of
-- commands for your container image.
--
-- 'environmentVariables', 'launchConfig_environmentVariables' - The environment variables for the application launch.
--
-- 'launchFile', 'launchConfig_launchFile' - The launch file name.
--
-- 'packageName', 'launchConfig_packageName' - The package name.
--
-- 'portForwardingConfig', 'launchConfig_portForwardingConfig' - The port forwarding configuration.
--
-- 'streamUI', 'launchConfig_streamUI' - Boolean indicating whether a streaming session will be configured for
-- the application. If @True@, AWS RoboMaker will configure a connection so
-- you can interact with your application as it is running in the
-- simulation. You must configure and launch the component. It must have a
-- graphical user interface.
newLaunchConfig ::
  LaunchConfig
newLaunchConfig :: LaunchConfig
newLaunchConfig =
  LaunchConfig'
    { $sel:command:LaunchConfig' :: Maybe [Text]
command = forall a. Maybe a
Prelude.Nothing,
      $sel:environmentVariables:LaunchConfig' :: Maybe (HashMap Text Text)
environmentVariables = forall a. Maybe a
Prelude.Nothing,
      $sel:launchFile:LaunchConfig' :: Maybe Text
launchFile = forall a. Maybe a
Prelude.Nothing,
      $sel:packageName:LaunchConfig' :: Maybe Text
packageName = forall a. Maybe a
Prelude.Nothing,
      $sel:portForwardingConfig:LaunchConfig' :: Maybe PortForwardingConfig
portForwardingConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:streamUI:LaunchConfig' :: Maybe Bool
streamUI = forall a. Maybe a
Prelude.Nothing
    }

-- | If you\'ve specified @General@ as the value for your
-- @RobotSoftwareSuite@, you can use this field to specify a list of
-- commands for your container image.
--
-- If you\'ve specified @SimulationRuntime@ as the value for your
-- @SimulationSoftwareSuite@, you can use this field to specify a list of
-- commands for your container image.
launchConfig_command :: Lens.Lens' LaunchConfig (Prelude.Maybe [Prelude.Text])
launchConfig_command :: Lens' LaunchConfig (Maybe [Text])
launchConfig_command = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfig' {Maybe [Text]
command :: Maybe [Text]
$sel:command:LaunchConfig' :: LaunchConfig -> Maybe [Text]
command} -> Maybe [Text]
command) (\s :: LaunchConfig
s@LaunchConfig' {} Maybe [Text]
a -> LaunchConfig
s {$sel:command:LaunchConfig' :: Maybe [Text]
command = Maybe [Text]
a} :: LaunchConfig) 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 environment variables for the application launch.
launchConfig_environmentVariables :: Lens.Lens' LaunchConfig (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
launchConfig_environmentVariables :: Lens' LaunchConfig (Maybe (HashMap Text Text))
launchConfig_environmentVariables = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfig' {Maybe (HashMap Text Text)
environmentVariables :: Maybe (HashMap Text Text)
$sel:environmentVariables:LaunchConfig' :: LaunchConfig -> Maybe (HashMap Text Text)
environmentVariables} -> Maybe (HashMap Text Text)
environmentVariables) (\s :: LaunchConfig
s@LaunchConfig' {} Maybe (HashMap Text Text)
a -> LaunchConfig
s {$sel:environmentVariables:LaunchConfig' :: Maybe (HashMap Text Text)
environmentVariables = Maybe (HashMap Text Text)
a} :: LaunchConfig) 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 launch file name.
launchConfig_launchFile :: Lens.Lens' LaunchConfig (Prelude.Maybe Prelude.Text)
launchConfig_launchFile :: Lens' LaunchConfig (Maybe Text)
launchConfig_launchFile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfig' {Maybe Text
launchFile :: Maybe Text
$sel:launchFile:LaunchConfig' :: LaunchConfig -> Maybe Text
launchFile} -> Maybe Text
launchFile) (\s :: LaunchConfig
s@LaunchConfig' {} Maybe Text
a -> LaunchConfig
s {$sel:launchFile:LaunchConfig' :: Maybe Text
launchFile = Maybe Text
a} :: LaunchConfig)

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

-- | The port forwarding configuration.
launchConfig_portForwardingConfig :: Lens.Lens' LaunchConfig (Prelude.Maybe PortForwardingConfig)
launchConfig_portForwardingConfig :: Lens' LaunchConfig (Maybe PortForwardingConfig)
launchConfig_portForwardingConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfig' {Maybe PortForwardingConfig
portForwardingConfig :: Maybe PortForwardingConfig
$sel:portForwardingConfig:LaunchConfig' :: LaunchConfig -> Maybe PortForwardingConfig
portForwardingConfig} -> Maybe PortForwardingConfig
portForwardingConfig) (\s :: LaunchConfig
s@LaunchConfig' {} Maybe PortForwardingConfig
a -> LaunchConfig
s {$sel:portForwardingConfig:LaunchConfig' :: Maybe PortForwardingConfig
portForwardingConfig = Maybe PortForwardingConfig
a} :: LaunchConfig)

-- | Boolean indicating whether a streaming session will be configured for
-- the application. If @True@, AWS RoboMaker will configure a connection so
-- you can interact with your application as it is running in the
-- simulation. You must configure and launch the component. It must have a
-- graphical user interface.
launchConfig_streamUI :: Lens.Lens' LaunchConfig (Prelude.Maybe Prelude.Bool)
launchConfig_streamUI :: Lens' LaunchConfig (Maybe Bool)
launchConfig_streamUI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfig' {Maybe Bool
streamUI :: Maybe Bool
$sel:streamUI:LaunchConfig' :: LaunchConfig -> Maybe Bool
streamUI} -> Maybe Bool
streamUI) (\s :: LaunchConfig
s@LaunchConfig' {} Maybe Bool
a -> LaunchConfig
s {$sel:streamUI:LaunchConfig' :: Maybe Bool
streamUI = Maybe Bool
a} :: LaunchConfig)

instance Data.FromJSON LaunchConfig where
  parseJSON :: Value -> Parser LaunchConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LaunchConfig"
      ( \Object
x ->
          Maybe [Text]
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe PortForwardingConfig
-> Maybe Bool
-> LaunchConfig
LaunchConfig'
            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
"command" 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
"environmentVariables"
                            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
"launchFile")
            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
"packageName")
            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
"portForwardingConfig")
            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
"streamUI")
      )

instance Prelude.Hashable LaunchConfig where
  hashWithSalt :: Int -> LaunchConfig -> Int
hashWithSalt Int
_salt LaunchConfig' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe PortForwardingConfig
streamUI :: Maybe Bool
portForwardingConfig :: Maybe PortForwardingConfig
packageName :: Maybe Text
launchFile :: Maybe Text
environmentVariables :: Maybe (HashMap Text Text)
command :: Maybe [Text]
$sel:streamUI:LaunchConfig' :: LaunchConfig -> Maybe Bool
$sel:portForwardingConfig:LaunchConfig' :: LaunchConfig -> Maybe PortForwardingConfig
$sel:packageName:LaunchConfig' :: LaunchConfig -> Maybe Text
$sel:launchFile:LaunchConfig' :: LaunchConfig -> Maybe Text
$sel:environmentVariables:LaunchConfig' :: LaunchConfig -> Maybe (HashMap Text Text)
$sel:command:LaunchConfig' :: LaunchConfig -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
command
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
environmentVariables
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
launchFile
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PortForwardingConfig
portForwardingConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
streamUI

instance Prelude.NFData LaunchConfig where
  rnf :: LaunchConfig -> ()
rnf LaunchConfig' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe PortForwardingConfig
streamUI :: Maybe Bool
portForwardingConfig :: Maybe PortForwardingConfig
packageName :: Maybe Text
launchFile :: Maybe Text
environmentVariables :: Maybe (HashMap Text Text)
command :: Maybe [Text]
$sel:streamUI:LaunchConfig' :: LaunchConfig -> Maybe Bool
$sel:portForwardingConfig:LaunchConfig' :: LaunchConfig -> Maybe PortForwardingConfig
$sel:packageName:LaunchConfig' :: LaunchConfig -> Maybe Text
$sel:launchFile:LaunchConfig' :: LaunchConfig -> Maybe Text
$sel:environmentVariables:LaunchConfig' :: LaunchConfig -> Maybe (HashMap Text Text)
$sel:command:LaunchConfig' :: LaunchConfig -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
command
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
environmentVariables
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
launchFile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PortForwardingConfig
portForwardingConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
streamUI

instance Data.ToJSON LaunchConfig where
  toJSON :: LaunchConfig -> Value
toJSON LaunchConfig' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe PortForwardingConfig
streamUI :: Maybe Bool
portForwardingConfig :: Maybe PortForwardingConfig
packageName :: Maybe Text
launchFile :: Maybe Text
environmentVariables :: Maybe (HashMap Text Text)
command :: Maybe [Text]
$sel:streamUI:LaunchConfig' :: LaunchConfig -> Maybe Bool
$sel:portForwardingConfig:LaunchConfig' :: LaunchConfig -> Maybe PortForwardingConfig
$sel:packageName:LaunchConfig' :: LaunchConfig -> Maybe Text
$sel:launchFile:LaunchConfig' :: LaunchConfig -> Maybe Text
$sel:environmentVariables:LaunchConfig' :: LaunchConfig -> Maybe (HashMap Text Text)
$sel:command:LaunchConfig' :: LaunchConfig -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"command" 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]
command,
            (Key
"environmentVariables" 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)
environmentVariables,
            (Key
"launchFile" 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
launchFile,
            (Key
"packageName" 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
packageName,
            (Key
"portForwardingConfig" 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 PortForwardingConfig
portForwardingConfig,
            (Key
"streamUI" 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 Bool
streamUI
          ]
      )