{-# 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.AppStream.Types.Application
-- 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.AppStream.Types.Application where

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

-- | Describes an application in the application catalog.
--
-- /See:/ 'newApplication' smart constructor.
data Application = Application'
  { -- | If there is a problem, the application can be disabled after image
    -- creation.
    Application -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The path to the application executable in the instance.
    Application -> Maybe Text
launchPath :: Prelude.Maybe Prelude.Text,
    -- | The arguments that are passed to the application at launch.
    Application -> Maybe Text
launchParameters :: Prelude.Maybe Prelude.Text,
    -- | The name of the application.
    Application -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The application name to display.
    Application -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | Additional attributes that describe the application.
    Application -> Maybe (HashMap Text Text)
metadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The URL for the application icon. This URL might be time-limited.
    Application -> Maybe Text
iconURL :: Prelude.Maybe Prelude.Text
  }
  deriving (Application -> Application -> Bool
(Application -> Application -> Bool)
-> (Application -> Application -> Bool) -> Eq Application
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Application -> Application -> Bool
$c/= :: Application -> Application -> Bool
== :: Application -> Application -> Bool
$c== :: Application -> Application -> Bool
Prelude.Eq, ReadPrec [Application]
ReadPrec Application
Int -> ReadS Application
ReadS [Application]
(Int -> ReadS Application)
-> ReadS [Application]
-> ReadPrec Application
-> ReadPrec [Application]
-> Read Application
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Application]
$creadListPrec :: ReadPrec [Application]
readPrec :: ReadPrec Application
$creadPrec :: ReadPrec Application
readList :: ReadS [Application]
$creadList :: ReadS [Application]
readsPrec :: Int -> ReadS Application
$creadsPrec :: Int -> ReadS Application
Prelude.Read, Int -> Application -> ShowS
[Application] -> ShowS
Application -> String
(Int -> Application -> ShowS)
-> (Application -> String)
-> ([Application] -> ShowS)
-> Show Application
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Application] -> ShowS
$cshowList :: [Application] -> ShowS
show :: Application -> String
$cshow :: Application -> String
showsPrec :: Int -> Application -> ShowS
$cshowsPrec :: Int -> Application -> ShowS
Prelude.Show, (forall x. Application -> Rep Application x)
-> (forall x. Rep Application x -> Application)
-> Generic Application
forall x. Rep Application x -> Application
forall x. Application -> Rep Application x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Application x -> Application
$cfrom :: forall x. Application -> Rep Application x
Prelude.Generic)

-- |
-- Create a value of 'Application' 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:
--
-- 'enabled', 'application_enabled' - If there is a problem, the application can be disabled after image
-- creation.
--
-- 'launchPath', 'application_launchPath' - The path to the application executable in the instance.
--
-- 'launchParameters', 'application_launchParameters' - The arguments that are passed to the application at launch.
--
-- 'name', 'application_name' - The name of the application.
--
-- 'displayName', 'application_displayName' - The application name to display.
--
-- 'metadata', 'application_metadata' - Additional attributes that describe the application.
--
-- 'iconURL', 'application_iconURL' - The URL for the application icon. This URL might be time-limited.
newApplication ::
  Application
newApplication :: Application
newApplication =
  Application' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Application
Application'
    { $sel:enabled:Application' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:launchPath:Application' :: Maybe Text
launchPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:launchParameters:Application' :: Maybe Text
launchParameters = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Application' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:Application' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:Application' :: Maybe (HashMap Text Text)
metadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:iconURL:Application' :: Maybe Text
iconURL = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If there is a problem, the application can be disabled after image
-- creation.
application_enabled :: Lens.Lens' Application (Prelude.Maybe Prelude.Bool)
application_enabled :: (Maybe Bool -> f (Maybe Bool)) -> Application -> f Application
application_enabled = (Application -> Maybe Bool)
-> (Application -> Maybe Bool -> Application)
-> Lens Application Application (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Application' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:Application' :: Application -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: Application
s@Application' {} Maybe Bool
a -> Application
s {$sel:enabled:Application' :: Maybe Bool
enabled = Maybe Bool
a} :: Application)

-- | The path to the application executable in the instance.
application_launchPath :: Lens.Lens' Application (Prelude.Maybe Prelude.Text)
application_launchPath :: (Maybe Text -> f (Maybe Text)) -> Application -> f Application
application_launchPath = (Application -> Maybe Text)
-> (Application -> Maybe Text -> Application)
-> Lens Application Application (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Application' {Maybe Text
launchPath :: Maybe Text
$sel:launchPath:Application' :: Application -> Maybe Text
launchPath} -> Maybe Text
launchPath) (\s :: Application
s@Application' {} Maybe Text
a -> Application
s {$sel:launchPath:Application' :: Maybe Text
launchPath = Maybe Text
a} :: Application)

-- | The arguments that are passed to the application at launch.
application_launchParameters :: Lens.Lens' Application (Prelude.Maybe Prelude.Text)
application_launchParameters :: (Maybe Text -> f (Maybe Text)) -> Application -> f Application
application_launchParameters = (Application -> Maybe Text)
-> (Application -> Maybe Text -> Application)
-> Lens Application Application (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Application' {Maybe Text
launchParameters :: Maybe Text
$sel:launchParameters:Application' :: Application -> Maybe Text
launchParameters} -> Maybe Text
launchParameters) (\s :: Application
s@Application' {} Maybe Text
a -> Application
s {$sel:launchParameters:Application' :: Maybe Text
launchParameters = Maybe Text
a} :: Application)

-- | The name of the application.
application_name :: Lens.Lens' Application (Prelude.Maybe Prelude.Text)
application_name :: (Maybe Text -> f (Maybe Text)) -> Application -> f Application
application_name = (Application -> Maybe Text)
-> (Application -> Maybe Text -> Application)
-> Lens Application Application (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Application' {Maybe Text
name :: Maybe Text
$sel:name:Application' :: Application -> Maybe Text
name} -> Maybe Text
name) (\s :: Application
s@Application' {} Maybe Text
a -> Application
s {$sel:name:Application' :: Maybe Text
name = Maybe Text
a} :: Application)

-- | The application name to display.
application_displayName :: Lens.Lens' Application (Prelude.Maybe Prelude.Text)
application_displayName :: (Maybe Text -> f (Maybe Text)) -> Application -> f Application
application_displayName = (Application -> Maybe Text)
-> (Application -> Maybe Text -> Application)
-> Lens Application Application (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Application' {Maybe Text
displayName :: Maybe Text
$sel:displayName:Application' :: Application -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: Application
s@Application' {} Maybe Text
a -> Application
s {$sel:displayName:Application' :: Maybe Text
displayName = Maybe Text
a} :: Application)

-- | Additional attributes that describe the application.
application_metadata :: Lens.Lens' Application (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
application_metadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Application -> f Application
application_metadata = (Application -> Maybe (HashMap Text Text))
-> (Application -> Maybe (HashMap Text Text) -> Application)
-> Lens
     Application
     Application
     (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 (\Application' {Maybe (HashMap Text Text)
metadata :: Maybe (HashMap Text Text)
$sel:metadata:Application' :: Application -> Maybe (HashMap Text Text)
metadata} -> Maybe (HashMap Text Text)
metadata) (\s :: Application
s@Application' {} Maybe (HashMap Text Text)
a -> Application
s {$sel:metadata:Application' :: Maybe (HashMap Text Text)
metadata = Maybe (HashMap Text Text)
a} :: Application) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Application -> f Application)
-> ((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)))
-> Application
-> f Application
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 URL for the application icon. This URL might be time-limited.
application_iconURL :: Lens.Lens' Application (Prelude.Maybe Prelude.Text)
application_iconURL :: (Maybe Text -> f (Maybe Text)) -> Application -> f Application
application_iconURL = (Application -> Maybe Text)
-> (Application -> Maybe Text -> Application)
-> Lens Application Application (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Application' {Maybe Text
iconURL :: Maybe Text
$sel:iconURL:Application' :: Application -> Maybe Text
iconURL} -> Maybe Text
iconURL) (\s :: Application
s@Application' {} Maybe Text
a -> Application
s {$sel:iconURL:Application' :: Maybe Text
iconURL = Maybe Text
a} :: Application)

instance Core.FromJSON Application where
  parseJSON :: Value -> Parser Application
parseJSON =
    String
-> (Object -> Parser Application) -> Value -> Parser Application
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Application"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Application
Application'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Application)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Application)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Enabled")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Application)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Application)
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
"LaunchPath")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Application)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Application)
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
"LaunchParameters")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Application)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text) -> Maybe Text -> Application)
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
"Name")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text) -> Maybe Text -> Application)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> Maybe Text -> Application)
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
"DisplayName")
            Parser (Maybe (HashMap Text Text) -> Maybe Text -> Application)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Text -> Application)
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
"Metadata" 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 (Maybe Text -> Application)
-> Parser (Maybe Text) -> Parser Application
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
"IconURL")
      )

instance Prelude.Hashable Application

instance Prelude.NFData Application