{-# 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.MigrationHubOrchestrator.Types.PlatformScriptKey
-- 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.MigrationHubOrchestrator.Types.PlatformScriptKey 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

-- | The script location for a particular operating system.
--
-- /See:/ 'newPlatformScriptKey' smart constructor.
data PlatformScriptKey = PlatformScriptKey'
  { -- | The script location for Linux.
    PlatformScriptKey -> Maybe Text
linux :: Prelude.Maybe Prelude.Text,
    -- | The script location for Windows.
    PlatformScriptKey -> Maybe Text
windows :: Prelude.Maybe Prelude.Text
  }
  deriving (PlatformScriptKey -> PlatformScriptKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlatformScriptKey -> PlatformScriptKey -> Bool
$c/= :: PlatformScriptKey -> PlatformScriptKey -> Bool
== :: PlatformScriptKey -> PlatformScriptKey -> Bool
$c== :: PlatformScriptKey -> PlatformScriptKey -> Bool
Prelude.Eq, ReadPrec [PlatformScriptKey]
ReadPrec PlatformScriptKey
Int -> ReadS PlatformScriptKey
ReadS [PlatformScriptKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlatformScriptKey]
$creadListPrec :: ReadPrec [PlatformScriptKey]
readPrec :: ReadPrec PlatformScriptKey
$creadPrec :: ReadPrec PlatformScriptKey
readList :: ReadS [PlatformScriptKey]
$creadList :: ReadS [PlatformScriptKey]
readsPrec :: Int -> ReadS PlatformScriptKey
$creadsPrec :: Int -> ReadS PlatformScriptKey
Prelude.Read, Int -> PlatformScriptKey -> ShowS
[PlatformScriptKey] -> ShowS
PlatformScriptKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlatformScriptKey] -> ShowS
$cshowList :: [PlatformScriptKey] -> ShowS
show :: PlatformScriptKey -> String
$cshow :: PlatformScriptKey -> String
showsPrec :: Int -> PlatformScriptKey -> ShowS
$cshowsPrec :: Int -> PlatformScriptKey -> ShowS
Prelude.Show, forall x. Rep PlatformScriptKey x -> PlatformScriptKey
forall x. PlatformScriptKey -> Rep PlatformScriptKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlatformScriptKey x -> PlatformScriptKey
$cfrom :: forall x. PlatformScriptKey -> Rep PlatformScriptKey x
Prelude.Generic)

-- |
-- Create a value of 'PlatformScriptKey' 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:
--
-- 'linux', 'platformScriptKey_linux' - The script location for Linux.
--
-- 'windows', 'platformScriptKey_windows' - The script location for Windows.
newPlatformScriptKey ::
  PlatformScriptKey
newPlatformScriptKey :: PlatformScriptKey
newPlatformScriptKey =
  PlatformScriptKey'
    { $sel:linux:PlatformScriptKey' :: Maybe Text
linux = forall a. Maybe a
Prelude.Nothing,
      $sel:windows:PlatformScriptKey' :: Maybe Text
windows = forall a. Maybe a
Prelude.Nothing
    }

-- | The script location for Linux.
platformScriptKey_linux :: Lens.Lens' PlatformScriptKey (Prelude.Maybe Prelude.Text)
platformScriptKey_linux :: Lens' PlatformScriptKey (Maybe Text)
platformScriptKey_linux = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformScriptKey' {Maybe Text
linux :: Maybe Text
$sel:linux:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
linux} -> Maybe Text
linux) (\s :: PlatformScriptKey
s@PlatformScriptKey' {} Maybe Text
a -> PlatformScriptKey
s {$sel:linux:PlatformScriptKey' :: Maybe Text
linux = Maybe Text
a} :: PlatformScriptKey)

-- | The script location for Windows.
platformScriptKey_windows :: Lens.Lens' PlatformScriptKey (Prelude.Maybe Prelude.Text)
platformScriptKey_windows :: Lens' PlatformScriptKey (Maybe Text)
platformScriptKey_windows = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformScriptKey' {Maybe Text
windows :: Maybe Text
$sel:windows:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
windows} -> Maybe Text
windows) (\s :: PlatformScriptKey
s@PlatformScriptKey' {} Maybe Text
a -> PlatformScriptKey
s {$sel:windows:PlatformScriptKey' :: Maybe Text
windows = Maybe Text
a} :: PlatformScriptKey)

instance Data.FromJSON PlatformScriptKey where
  parseJSON :: Value -> Parser PlatformScriptKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PlatformScriptKey"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> PlatformScriptKey
PlatformScriptKey'
            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
"linux")
            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
"windows")
      )

instance Prelude.Hashable PlatformScriptKey where
  hashWithSalt :: Int -> PlatformScriptKey -> Int
hashWithSalt Int
_salt PlatformScriptKey' {Maybe Text
windows :: Maybe Text
linux :: Maybe Text
$sel:windows:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
$sel:linux:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linux
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
windows

instance Prelude.NFData PlatformScriptKey where
  rnf :: PlatformScriptKey -> ()
rnf PlatformScriptKey' {Maybe Text
windows :: Maybe Text
linux :: Maybe Text
$sel:windows:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
$sel:linux:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linux seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
windows

instance Data.ToJSON PlatformScriptKey where
  toJSON :: PlatformScriptKey -> Value
toJSON PlatformScriptKey' {Maybe Text
windows :: Maybe Text
linux :: Maybe Text
$sel:windows:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
$sel:linux:PlatformScriptKey' :: PlatformScriptKey -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"linux" 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
linux,
            (Key
"windows" 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
windows
          ]
      )