{-# 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.SageMaker.Types.TargetPlatform where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.TargetPlatformAccelerator
import Amazonka.SageMaker.Types.TargetPlatformArch
import Amazonka.SageMaker.Types.TargetPlatformOs
data TargetPlatform = TargetPlatform'
{
TargetPlatform -> Maybe TargetPlatformAccelerator
accelerator :: Prelude.Maybe TargetPlatformAccelerator,
TargetPlatform -> TargetPlatformOs
os :: TargetPlatformOs,
TargetPlatform -> TargetPlatformArch
arch :: TargetPlatformArch
}
deriving (TargetPlatform -> TargetPlatform -> Bool
(TargetPlatform -> TargetPlatform -> Bool)
-> (TargetPlatform -> TargetPlatform -> Bool) -> Eq TargetPlatform
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetPlatform -> TargetPlatform -> Bool
$c/= :: TargetPlatform -> TargetPlatform -> Bool
== :: TargetPlatform -> TargetPlatform -> Bool
$c== :: TargetPlatform -> TargetPlatform -> Bool
Prelude.Eq, ReadPrec [TargetPlatform]
ReadPrec TargetPlatform
Int -> ReadS TargetPlatform
ReadS [TargetPlatform]
(Int -> ReadS TargetPlatform)
-> ReadS [TargetPlatform]
-> ReadPrec TargetPlatform
-> ReadPrec [TargetPlatform]
-> Read TargetPlatform
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TargetPlatform]
$creadListPrec :: ReadPrec [TargetPlatform]
readPrec :: ReadPrec TargetPlatform
$creadPrec :: ReadPrec TargetPlatform
readList :: ReadS [TargetPlatform]
$creadList :: ReadS [TargetPlatform]
readsPrec :: Int -> ReadS TargetPlatform
$creadsPrec :: Int -> ReadS TargetPlatform
Prelude.Read, Int -> TargetPlatform -> ShowS
[TargetPlatform] -> ShowS
TargetPlatform -> String
(Int -> TargetPlatform -> ShowS)
-> (TargetPlatform -> String)
-> ([TargetPlatform] -> ShowS)
-> Show TargetPlatform
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetPlatform] -> ShowS
$cshowList :: [TargetPlatform] -> ShowS
show :: TargetPlatform -> String
$cshow :: TargetPlatform -> String
showsPrec :: Int -> TargetPlatform -> ShowS
$cshowsPrec :: Int -> TargetPlatform -> ShowS
Prelude.Show, (forall x. TargetPlatform -> Rep TargetPlatform x)
-> (forall x. Rep TargetPlatform x -> TargetPlatform)
-> Generic TargetPlatform
forall x. Rep TargetPlatform x -> TargetPlatform
forall x. TargetPlatform -> Rep TargetPlatform x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TargetPlatform x -> TargetPlatform
$cfrom :: forall x. TargetPlatform -> Rep TargetPlatform x
Prelude.Generic)
newTargetPlatform ::
TargetPlatformOs ->
TargetPlatformArch ->
TargetPlatform
newTargetPlatform :: TargetPlatformOs -> TargetPlatformArch -> TargetPlatform
newTargetPlatform TargetPlatformOs
pOs_ TargetPlatformArch
pArch_ =
TargetPlatform' :: Maybe TargetPlatformAccelerator
-> TargetPlatformOs -> TargetPlatformArch -> TargetPlatform
TargetPlatform'
{ $sel:accelerator:TargetPlatform' :: Maybe TargetPlatformAccelerator
accelerator = Maybe TargetPlatformAccelerator
forall a. Maybe a
Prelude.Nothing,
$sel:os:TargetPlatform' :: TargetPlatformOs
os = TargetPlatformOs
pOs_,
$sel:arch:TargetPlatform' :: TargetPlatformArch
arch = TargetPlatformArch
pArch_
}
targetPlatform_accelerator :: Lens.Lens' TargetPlatform (Prelude.Maybe TargetPlatformAccelerator)
targetPlatform_accelerator :: (Maybe TargetPlatformAccelerator
-> f (Maybe TargetPlatformAccelerator))
-> TargetPlatform -> f TargetPlatform
targetPlatform_accelerator = (TargetPlatform -> Maybe TargetPlatformAccelerator)
-> (TargetPlatform
-> Maybe TargetPlatformAccelerator -> TargetPlatform)
-> Lens
TargetPlatform
TargetPlatform
(Maybe TargetPlatformAccelerator)
(Maybe TargetPlatformAccelerator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetPlatform' {Maybe TargetPlatformAccelerator
accelerator :: Maybe TargetPlatformAccelerator
$sel:accelerator:TargetPlatform' :: TargetPlatform -> Maybe TargetPlatformAccelerator
accelerator} -> Maybe TargetPlatformAccelerator
accelerator) (\s :: TargetPlatform
s@TargetPlatform' {} Maybe TargetPlatformAccelerator
a -> TargetPlatform
s {$sel:accelerator:TargetPlatform' :: Maybe TargetPlatformAccelerator
accelerator = Maybe TargetPlatformAccelerator
a} :: TargetPlatform)
targetPlatform_os :: Lens.Lens' TargetPlatform TargetPlatformOs
targetPlatform_os :: (TargetPlatformOs -> f TargetPlatformOs)
-> TargetPlatform -> f TargetPlatform
targetPlatform_os = (TargetPlatform -> TargetPlatformOs)
-> (TargetPlatform -> TargetPlatformOs -> TargetPlatform)
-> Lens
TargetPlatform TargetPlatform TargetPlatformOs TargetPlatformOs
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetPlatform' {TargetPlatformOs
os :: TargetPlatformOs
$sel:os:TargetPlatform' :: TargetPlatform -> TargetPlatformOs
os} -> TargetPlatformOs
os) (\s :: TargetPlatform
s@TargetPlatform' {} TargetPlatformOs
a -> TargetPlatform
s {$sel:os:TargetPlatform' :: TargetPlatformOs
os = TargetPlatformOs
a} :: TargetPlatform)
targetPlatform_arch :: Lens.Lens' TargetPlatform TargetPlatformArch
targetPlatform_arch :: (TargetPlatformArch -> f TargetPlatformArch)
-> TargetPlatform -> f TargetPlatform
targetPlatform_arch = (TargetPlatform -> TargetPlatformArch)
-> (TargetPlatform -> TargetPlatformArch -> TargetPlatform)
-> Lens
TargetPlatform TargetPlatform TargetPlatformArch TargetPlatformArch
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetPlatform' {TargetPlatformArch
arch :: TargetPlatformArch
$sel:arch:TargetPlatform' :: TargetPlatform -> TargetPlatformArch
arch} -> TargetPlatformArch
arch) (\s :: TargetPlatform
s@TargetPlatform' {} TargetPlatformArch
a -> TargetPlatform
s {$sel:arch:TargetPlatform' :: TargetPlatformArch
arch = TargetPlatformArch
a} :: TargetPlatform)
instance Core.FromJSON TargetPlatform where
parseJSON :: Value -> Parser TargetPlatform
parseJSON =
String
-> (Object -> Parser TargetPlatform)
-> Value
-> Parser TargetPlatform
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TargetPlatform"
( \Object
x ->
Maybe TargetPlatformAccelerator
-> TargetPlatformOs -> TargetPlatformArch -> TargetPlatform
TargetPlatform'
(Maybe TargetPlatformAccelerator
-> TargetPlatformOs -> TargetPlatformArch -> TargetPlatform)
-> Parser (Maybe TargetPlatformAccelerator)
-> Parser
(TargetPlatformOs -> TargetPlatformArch -> TargetPlatform)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TargetPlatformAccelerator)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Accelerator")
Parser (TargetPlatformOs -> TargetPlatformArch -> TargetPlatform)
-> Parser TargetPlatformOs
-> Parser (TargetPlatformArch -> TargetPlatform)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TargetPlatformOs
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Os")
Parser (TargetPlatformArch -> TargetPlatform)
-> Parser TargetPlatformArch -> Parser TargetPlatform
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TargetPlatformArch
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Arch")
)
instance Prelude.Hashable TargetPlatform
instance Prelude.NFData TargetPlatform
instance Core.ToJSON TargetPlatform where
toJSON :: TargetPlatform -> Value
toJSON TargetPlatform' {Maybe TargetPlatformAccelerator
TargetPlatformArch
TargetPlatformOs
arch :: TargetPlatformArch
os :: TargetPlatformOs
accelerator :: Maybe TargetPlatformAccelerator
$sel:arch:TargetPlatform' :: TargetPlatform -> TargetPlatformArch
$sel:os:TargetPlatform' :: TargetPlatform -> TargetPlatformOs
$sel:accelerator:TargetPlatform' :: TargetPlatform -> Maybe TargetPlatformAccelerator
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Accelerator" Text -> TargetPlatformAccelerator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TargetPlatformAccelerator -> Pair)
-> Maybe TargetPlatformAccelerator -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TargetPlatformAccelerator
accelerator,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Os" Text -> TargetPlatformOs -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TargetPlatformOs
os),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Arch" Text -> TargetPlatformArch -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TargetPlatformArch
arch)
]
)