{-# 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.Batch.Types.Host 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 Host = Host'
{
Host -> Maybe Text
sourcePath :: Prelude.Maybe Prelude.Text
}
deriving (Host -> Host -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Host -> Host -> Bool
$c/= :: Host -> Host -> Bool
== :: Host -> Host -> Bool
$c== :: Host -> Host -> Bool
Prelude.Eq, ReadPrec [Host]
ReadPrec Host
Int -> ReadS Host
ReadS [Host]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Host]
$creadListPrec :: ReadPrec [Host]
readPrec :: ReadPrec Host
$creadPrec :: ReadPrec Host
readList :: ReadS [Host]
$creadList :: ReadS [Host]
readsPrec :: Int -> ReadS Host
$creadsPrec :: Int -> ReadS Host
Prelude.Read, Int -> Host -> ShowS
[Host] -> ShowS
Host -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Host] -> ShowS
$cshowList :: [Host] -> ShowS
show :: Host -> String
$cshow :: Host -> String
showsPrec :: Int -> Host -> ShowS
$cshowsPrec :: Int -> Host -> ShowS
Prelude.Show, forall x. Rep Host x -> Host
forall x. Host -> Rep Host x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Host x -> Host
$cfrom :: forall x. Host -> Rep Host x
Prelude.Generic)
newHost ::
Host
newHost :: Host
newHost = Host' {$sel:sourcePath:Host' :: Maybe Text
sourcePath = forall a. Maybe a
Prelude.Nothing}
host_sourcePath :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_sourcePath :: Lens' Host (Maybe Text)
host_sourcePath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
sourcePath :: Maybe Text
$sel:sourcePath:Host' :: Host -> Maybe Text
sourcePath} -> Maybe Text
sourcePath) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:sourcePath:Host' :: Maybe Text
sourcePath = Maybe Text
a} :: Host)
instance Data.FromJSON Host where
parseJSON :: Value -> Parser Host
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Host"
(\Object
x -> Maybe Text -> Host
Host' 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
"sourcePath"))
instance Prelude.Hashable Host where
hashWithSalt :: Int -> Host -> Int
hashWithSalt Int
_salt Host' {Maybe Text
sourcePath :: Maybe Text
$sel:sourcePath:Host' :: Host -> Maybe Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourcePath
instance Prelude.NFData Host where
rnf :: Host -> ()
rnf Host' {Maybe Text
sourcePath :: Maybe Text
$sel:sourcePath:Host' :: Host -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourcePath
instance Data.ToJSON Host where
toJSON :: Host -> Value
toJSON Host' {Maybe Text
sourcePath :: Maybe Text
$sel:sourcePath:Host' :: Host -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"sourcePath" 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
sourcePath]
)