{-# 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.DirectoryService.Types.Computer where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types.Attribute
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Computer = Computer'
{
Computer -> Maybe Text
computerId :: Prelude.Maybe Prelude.Text,
Computer -> Maybe [Attribute]
computerAttributes :: Prelude.Maybe [Attribute],
Computer -> Maybe Text
computerName :: Prelude.Maybe Prelude.Text
}
deriving (Computer -> Computer -> Bool
(Computer -> Computer -> Bool)
-> (Computer -> Computer -> Bool) -> Eq Computer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Computer -> Computer -> Bool
$c/= :: Computer -> Computer -> Bool
== :: Computer -> Computer -> Bool
$c== :: Computer -> Computer -> Bool
Prelude.Eq, ReadPrec [Computer]
ReadPrec Computer
Int -> ReadS Computer
ReadS [Computer]
(Int -> ReadS Computer)
-> ReadS [Computer]
-> ReadPrec Computer
-> ReadPrec [Computer]
-> Read Computer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Computer]
$creadListPrec :: ReadPrec [Computer]
readPrec :: ReadPrec Computer
$creadPrec :: ReadPrec Computer
readList :: ReadS [Computer]
$creadList :: ReadS [Computer]
readsPrec :: Int -> ReadS Computer
$creadsPrec :: Int -> ReadS Computer
Prelude.Read, Int -> Computer -> ShowS
[Computer] -> ShowS
Computer -> String
(Int -> Computer -> ShowS)
-> (Computer -> String) -> ([Computer] -> ShowS) -> Show Computer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Computer] -> ShowS
$cshowList :: [Computer] -> ShowS
show :: Computer -> String
$cshow :: Computer -> String
showsPrec :: Int -> Computer -> ShowS
$cshowsPrec :: Int -> Computer -> ShowS
Prelude.Show, (forall x. Computer -> Rep Computer x)
-> (forall x. Rep Computer x -> Computer) -> Generic Computer
forall x. Rep Computer x -> Computer
forall x. Computer -> Rep Computer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Computer x -> Computer
$cfrom :: forall x. Computer -> Rep Computer x
Prelude.Generic)
newComputer ::
Computer
newComputer :: Computer
newComputer =
Computer' :: Maybe Text -> Maybe [Attribute] -> Maybe Text -> Computer
Computer'
{ $sel:computerId:Computer' :: Maybe Text
computerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:computerAttributes:Computer' :: Maybe [Attribute]
computerAttributes = Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
$sel:computerName:Computer' :: Maybe Text
computerName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
computer_computerId :: Lens.Lens' Computer (Prelude.Maybe Prelude.Text)
computer_computerId :: (Maybe Text -> f (Maybe Text)) -> Computer -> f Computer
computer_computerId = (Computer -> Maybe Text)
-> (Computer -> Maybe Text -> Computer)
-> Lens Computer Computer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computer' {Maybe Text
computerId :: Maybe Text
$sel:computerId:Computer' :: Computer -> Maybe Text
computerId} -> Maybe Text
computerId) (\s :: Computer
s@Computer' {} Maybe Text
a -> Computer
s {$sel:computerId:Computer' :: Maybe Text
computerId = Maybe Text
a} :: Computer)
computer_computerAttributes :: Lens.Lens' Computer (Prelude.Maybe [Attribute])
computer_computerAttributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> Computer -> f Computer
computer_computerAttributes = (Computer -> Maybe [Attribute])
-> (Computer -> Maybe [Attribute] -> Computer)
-> Lens Computer Computer (Maybe [Attribute]) (Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computer' {Maybe [Attribute]
computerAttributes :: Maybe [Attribute]
$sel:computerAttributes:Computer' :: Computer -> Maybe [Attribute]
computerAttributes} -> Maybe [Attribute]
computerAttributes) (\s :: Computer
s@Computer' {} Maybe [Attribute]
a -> Computer
s {$sel:computerAttributes:Computer' :: Maybe [Attribute]
computerAttributes = Maybe [Attribute]
a} :: Computer) ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> Computer -> f Computer)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> Computer
-> f Computer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
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 [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
computer_computerName :: Lens.Lens' Computer (Prelude.Maybe Prelude.Text)
computer_computerName :: (Maybe Text -> f (Maybe Text)) -> Computer -> f Computer
computer_computerName = (Computer -> Maybe Text)
-> (Computer -> Maybe Text -> Computer)
-> Lens Computer Computer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Computer' {Maybe Text
computerName :: Maybe Text
$sel:computerName:Computer' :: Computer -> Maybe Text
computerName} -> Maybe Text
computerName) (\s :: Computer
s@Computer' {} Maybe Text
a -> Computer
s {$sel:computerName:Computer' :: Maybe Text
computerName = Maybe Text
a} :: Computer)
instance Core.FromJSON Computer where
parseJSON :: Value -> Parser Computer
parseJSON =
String -> (Object -> Parser Computer) -> Value -> Parser Computer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Computer"
( \Object
x ->
Maybe Text -> Maybe [Attribute] -> Maybe Text -> Computer
Computer'
(Maybe Text -> Maybe [Attribute] -> Maybe Text -> Computer)
-> Parser (Maybe Text)
-> Parser (Maybe [Attribute] -> Maybe Text -> Computer)
forall (f :: * -> *) a b. Functor 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
"ComputerId")
Parser (Maybe [Attribute] -> Maybe Text -> Computer)
-> Parser (Maybe [Attribute]) -> Parser (Maybe Text -> Computer)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Attribute]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComputerAttributes"
Parser (Maybe (Maybe [Attribute]))
-> Maybe [Attribute] -> Parser (Maybe [Attribute])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Attribute]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Text -> Computer)
-> Parser (Maybe Text) -> Parser Computer
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
"ComputerName")
)
instance Prelude.Hashable Computer
instance Prelude.NFData Computer