{-# 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 #-}
module Amazonka.ImageBuilder.Types.LaunchTemplateConfiguration 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
data LaunchTemplateConfiguration = LaunchTemplateConfiguration'
{
LaunchTemplateConfiguration -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
LaunchTemplateConfiguration -> Maybe Bool
setDefaultVersion :: Prelude.Maybe Prelude.Bool,
LaunchTemplateConfiguration -> Text
launchTemplateId :: Prelude.Text
}
deriving (LaunchTemplateConfiguration -> LaunchTemplateConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchTemplateConfiguration -> LaunchTemplateConfiguration -> Bool
$c/= :: LaunchTemplateConfiguration -> LaunchTemplateConfiguration -> Bool
== :: LaunchTemplateConfiguration -> LaunchTemplateConfiguration -> Bool
$c== :: LaunchTemplateConfiguration -> LaunchTemplateConfiguration -> Bool
Prelude.Eq, ReadPrec [LaunchTemplateConfiguration]
ReadPrec LaunchTemplateConfiguration
Int -> ReadS LaunchTemplateConfiguration
ReadS [LaunchTemplateConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchTemplateConfiguration]
$creadListPrec :: ReadPrec [LaunchTemplateConfiguration]
readPrec :: ReadPrec LaunchTemplateConfiguration
$creadPrec :: ReadPrec LaunchTemplateConfiguration
readList :: ReadS [LaunchTemplateConfiguration]
$creadList :: ReadS [LaunchTemplateConfiguration]
readsPrec :: Int -> ReadS LaunchTemplateConfiguration
$creadsPrec :: Int -> ReadS LaunchTemplateConfiguration
Prelude.Read, Int -> LaunchTemplateConfiguration -> ShowS
[LaunchTemplateConfiguration] -> ShowS
LaunchTemplateConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchTemplateConfiguration] -> ShowS
$cshowList :: [LaunchTemplateConfiguration] -> ShowS
show :: LaunchTemplateConfiguration -> String
$cshow :: LaunchTemplateConfiguration -> String
showsPrec :: Int -> LaunchTemplateConfiguration -> ShowS
$cshowsPrec :: Int -> LaunchTemplateConfiguration -> ShowS
Prelude.Show, forall x.
Rep LaunchTemplateConfiguration x -> LaunchTemplateConfiguration
forall x.
LaunchTemplateConfiguration -> Rep LaunchTemplateConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LaunchTemplateConfiguration x -> LaunchTemplateConfiguration
$cfrom :: forall x.
LaunchTemplateConfiguration -> Rep LaunchTemplateConfiguration x
Prelude.Generic)
newLaunchTemplateConfiguration ::
Prelude.Text ->
LaunchTemplateConfiguration
newLaunchTemplateConfiguration :: Text -> LaunchTemplateConfiguration
newLaunchTemplateConfiguration Text
pLaunchTemplateId_ =
LaunchTemplateConfiguration'
{ $sel:accountId:LaunchTemplateConfiguration' :: Maybe Text
accountId =
forall a. Maybe a
Prelude.Nothing,
$sel:setDefaultVersion:LaunchTemplateConfiguration' :: Maybe Bool
setDefaultVersion = forall a. Maybe a
Prelude.Nothing,
$sel:launchTemplateId:LaunchTemplateConfiguration' :: Text
launchTemplateId = Text
pLaunchTemplateId_
}
launchTemplateConfiguration_accountId :: Lens.Lens' LaunchTemplateConfiguration (Prelude.Maybe Prelude.Text)
launchTemplateConfiguration_accountId :: Lens' LaunchTemplateConfiguration (Maybe Text)
launchTemplateConfiguration_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateConfiguration' {Maybe Text
accountId :: Maybe Text
$sel:accountId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: LaunchTemplateConfiguration
s@LaunchTemplateConfiguration' {} Maybe Text
a -> LaunchTemplateConfiguration
s {$sel:accountId:LaunchTemplateConfiguration' :: Maybe Text
accountId = Maybe Text
a} :: LaunchTemplateConfiguration)
launchTemplateConfiguration_setDefaultVersion :: Lens.Lens' LaunchTemplateConfiguration (Prelude.Maybe Prelude.Bool)
launchTemplateConfiguration_setDefaultVersion :: Lens' LaunchTemplateConfiguration (Maybe Bool)
launchTemplateConfiguration_setDefaultVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateConfiguration' {Maybe Bool
setDefaultVersion :: Maybe Bool
$sel:setDefaultVersion:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Bool
setDefaultVersion} -> Maybe Bool
setDefaultVersion) (\s :: LaunchTemplateConfiguration
s@LaunchTemplateConfiguration' {} Maybe Bool
a -> LaunchTemplateConfiguration
s {$sel:setDefaultVersion:LaunchTemplateConfiguration' :: Maybe Bool
setDefaultVersion = Maybe Bool
a} :: LaunchTemplateConfiguration)
launchTemplateConfiguration_launchTemplateId :: Lens.Lens' LaunchTemplateConfiguration Prelude.Text
launchTemplateConfiguration_launchTemplateId :: Lens' LaunchTemplateConfiguration Text
launchTemplateConfiguration_launchTemplateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateConfiguration' {Text
launchTemplateId :: Text
$sel:launchTemplateId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Text
launchTemplateId} -> Text
launchTemplateId) (\s :: LaunchTemplateConfiguration
s@LaunchTemplateConfiguration' {} Text
a -> LaunchTemplateConfiguration
s {$sel:launchTemplateId:LaunchTemplateConfiguration' :: Text
launchTemplateId = Text
a} :: LaunchTemplateConfiguration)
instance Data.FromJSON LaunchTemplateConfiguration where
parseJSON :: Value -> Parser LaunchTemplateConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LaunchTemplateConfiguration"
( \Object
x ->
Maybe Text -> Maybe Bool -> Text -> LaunchTemplateConfiguration
LaunchTemplateConfiguration'
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
"accountId")
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
"setDefaultVersion")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"launchTemplateId")
)
instance Prelude.Hashable LaunchTemplateConfiguration where
hashWithSalt :: Int -> LaunchTemplateConfiguration -> Int
hashWithSalt Int
_salt LaunchTemplateConfiguration' {Maybe Bool
Maybe Text
Text
launchTemplateId :: Text
setDefaultVersion :: Maybe Bool
accountId :: Maybe Text
$sel:launchTemplateId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Text
$sel:setDefaultVersion:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Bool
$sel:accountId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
setDefaultVersion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
launchTemplateId
instance Prelude.NFData LaunchTemplateConfiguration where
rnf :: LaunchTemplateConfiguration -> ()
rnf LaunchTemplateConfiguration' {Maybe Bool
Maybe Text
Text
launchTemplateId :: Text
setDefaultVersion :: Maybe Bool
accountId :: Maybe Text
$sel:launchTemplateId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Text
$sel:setDefaultVersion:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Bool
$sel:accountId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
setDefaultVersion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
launchTemplateId
instance Data.ToJSON LaunchTemplateConfiguration where
toJSON :: LaunchTemplateConfiguration -> Value
toJSON LaunchTemplateConfiguration' {Maybe Bool
Maybe Text
Text
launchTemplateId :: Text
setDefaultVersion :: Maybe Bool
accountId :: Maybe Text
$sel:launchTemplateId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Text
$sel:setDefaultVersion:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Bool
$sel:accountId:LaunchTemplateConfiguration' :: LaunchTemplateConfiguration -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"accountId" 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
accountId,
(Key
"setDefaultVersion" 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
setDefaultVersion,
forall a. a -> Maybe a
Prelude.Just
(Key
"launchTemplateId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
launchTemplateId)
]
)