{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SnowDeviceManagement.Types.Reboot
import Amazonka.SnowDeviceManagement.Types.Unlock
data Command = Command'
{
Command -> Maybe Reboot
reboot :: Prelude.Maybe Reboot,
Command -> Maybe Unlock
unlock :: Prelude.Maybe Unlock
}
deriving (Command -> Command -> Bool
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]
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
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. 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'
{ $sel:reboot:Command' :: Maybe Reboot
reboot = forall a. Maybe a
Prelude.Nothing,
$sel:unlock:Command' :: Maybe Unlock
unlock = forall a. Maybe a
Prelude.Nothing
}
command_reboot :: Lens.Lens' Command (Prelude.Maybe Reboot)
command_reboot :: Lens' Command (Maybe Reboot)
command_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)
command_unlock :: Lens.Lens' Command (Prelude.Maybe Unlock)
command_unlock :: Lens' Command (Maybe Unlock)
command_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)
instance Prelude.Hashable Command where
hashWithSalt :: Int -> Command -> Int
hashWithSalt Int
_salt Command' {Maybe Reboot
Maybe Unlock
unlock :: Maybe Unlock
reboot :: Maybe Reboot
$sel:unlock:Command' :: Command -> Maybe Unlock
$sel:reboot:Command' :: Command -> Maybe Reboot
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Reboot
reboot
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Unlock
unlock
instance Prelude.NFData Command where
rnf :: Command -> ()
rnf Command' {Maybe Reboot
Maybe Unlock
unlock :: Maybe Unlock
reboot :: Maybe Reboot
$sel:unlock:Command' :: Command -> Maybe Unlock
$sel:reboot:Command' :: Command -> Maybe Reboot
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Reboot
reboot seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Unlock
unlock
instance Data.ToJSON Command where
toJSON :: Command -> Value
toJSON Command' {Maybe Reboot
Maybe Unlock
unlock :: Maybe Unlock
reboot :: Maybe Reboot
$sel:unlock:Command' :: Command -> Maybe Unlock
$sel:reboot:Command' :: Command -> Maybe Reboot
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"reboot" 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 Reboot
reboot,
(Key
"unlock" 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 Unlock
unlock
]
)