{-# 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.SnowDeviceManagement.Types.Command where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SnowDeviceManagement.Types.Reboot
import Amazonka.SnowDeviceManagement.Types.Unlock
data Command = Command'
{
Command -> Maybe Unlock
unlock :: Prelude.Maybe Unlock,
Command -> Maybe Reboot
reboot :: Prelude.Maybe Reboot
}
deriving (Command -> Command -> Bool
(Command -> Command -> Bool)
-> (Command -> Command -> Bool) -> Eq Command
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Command -> Command -> Bool
$c/= :: Command -> Command -> Bool
== :: Command -> Command -> Bool
$c== :: Command -> Command -> Bool
Prelude.Eq, ReadPrec [Command]
ReadPrec Command
Int -> ReadS Command
ReadS [Command]
(Int -> ReadS Command)
-> ReadS [Command]
-> ReadPrec Command
-> ReadPrec [Command]
-> Read Command
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Command]
$creadListPrec :: ReadPrec [Command]
readPrec :: ReadPrec Command
$creadPrec :: ReadPrec Command
readList :: ReadS [Command]
$creadList :: ReadS [Command]
readsPrec :: Int -> ReadS Command
$creadsPrec :: Int -> ReadS Command
Prelude.Read, Int -> Command -> ShowS
[Command] -> ShowS
Command -> String
(Int -> Command -> ShowS)
-> (Command -> String) -> ([Command] -> ShowS) -> Show Command
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Command] -> ShowS
$cshowList :: [Command] -> ShowS
show :: Command -> String
$cshow :: Command -> String
showsPrec :: Int -> Command -> ShowS
$cshowsPrec :: Int -> Command -> ShowS
Prelude.Show, (forall x. Command -> Rep Command x)
-> (forall x. Rep Command x -> Command) -> Generic Command
forall x. Rep Command x -> Command
forall x. Command -> Rep Command x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Command x -> Command
$cfrom :: forall x. Command -> Rep Command x
Prelude.Generic)
newCommand ::
Command
newCommand :: Command
newCommand =
Command' :: Maybe Unlock -> Maybe Reboot -> Command
Command'
{ $sel:unlock:Command' :: Maybe Unlock
unlock = Maybe Unlock
forall a. Maybe a
Prelude.Nothing,
$sel:reboot:Command' :: Maybe Reboot
reboot = Maybe Reboot
forall a. Maybe a
Prelude.Nothing
}
command_unlock :: Lens.Lens' Command (Prelude.Maybe Unlock)
command_unlock :: (Maybe Unlock -> f (Maybe Unlock)) -> Command -> f Command
command_unlock = (Command -> Maybe Unlock)
-> (Command -> Maybe Unlock -> Command)
-> Lens Command Command (Maybe Unlock) (Maybe Unlock)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Command' {Maybe Unlock
unlock :: Maybe Unlock
$sel:unlock:Command' :: Command -> Maybe Unlock
unlock} -> Maybe Unlock
unlock) (\s :: Command
s@Command' {} Maybe Unlock
a -> Command
s {$sel:unlock:Command' :: Maybe Unlock
unlock = Maybe Unlock
a} :: Command)
command_reboot :: Lens.Lens' Command (Prelude.Maybe Reboot)
command_reboot :: (Maybe Reboot -> f (Maybe Reboot)) -> Command -> f Command
command_reboot = (Command -> Maybe Reboot)
-> (Command -> Maybe Reboot -> Command)
-> Lens Command Command (Maybe Reboot) (Maybe Reboot)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Command' {Maybe Reboot
reboot :: Maybe Reboot
$sel:reboot:Command' :: Command -> Maybe Reboot
reboot} -> Maybe Reboot
reboot) (\s :: Command
s@Command' {} Maybe Reboot
a -> Command
s {$sel:reboot:Command' :: Maybe Reboot
reboot = Maybe Reboot
a} :: Command)
instance Prelude.Hashable Command
instance Prelude.NFData Command
instance Core.ToJSON Command where
toJSON :: Command -> Value
toJSON Command' {Maybe Reboot
Maybe Unlock
reboot :: Maybe Reboot
unlock :: Maybe Unlock
$sel:reboot:Command' :: Command -> Maybe Reboot
$sel:unlock:Command' :: Command -> Maybe Unlock
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"unlock" Text -> Unlock -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Unlock -> Pair) -> Maybe Unlock -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Unlock
unlock,
(Text
"reboot" Text -> Reboot -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Reboot -> Pair) -> Maybe Reboot -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Reboot
reboot
]
)