{-# 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.Volume where
import Amazonka.Batch.Types.EFSVolumeConfiguration
import Amazonka.Batch.Types.Host
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Volume = Volume'
{
Volume -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Volume -> Maybe EFSVolumeConfiguration
efsVolumeConfiguration :: Prelude.Maybe EFSVolumeConfiguration,
Volume -> Maybe Host
host :: Prelude.Maybe Host
}
deriving (Volume -> Volume -> Bool
(Volume -> Volume -> Bool)
-> (Volume -> Volume -> Bool) -> Eq Volume
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Volume -> Volume -> Bool
$c/= :: Volume -> Volume -> Bool
== :: Volume -> Volume -> Bool
$c== :: Volume -> Volume -> Bool
Prelude.Eq, ReadPrec [Volume]
ReadPrec Volume
Int -> ReadS Volume
ReadS [Volume]
(Int -> ReadS Volume)
-> ReadS [Volume]
-> ReadPrec Volume
-> ReadPrec [Volume]
-> Read Volume
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Volume]
$creadListPrec :: ReadPrec [Volume]
readPrec :: ReadPrec Volume
$creadPrec :: ReadPrec Volume
readList :: ReadS [Volume]
$creadList :: ReadS [Volume]
readsPrec :: Int -> ReadS Volume
$creadsPrec :: Int -> ReadS Volume
Prelude.Read, Int -> Volume -> ShowS
[Volume] -> ShowS
Volume -> String
(Int -> Volume -> ShowS)
-> (Volume -> String) -> ([Volume] -> ShowS) -> Show Volume
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Volume] -> ShowS
$cshowList :: [Volume] -> ShowS
show :: Volume -> String
$cshow :: Volume -> String
showsPrec :: Int -> Volume -> ShowS
$cshowsPrec :: Int -> Volume -> ShowS
Prelude.Show, (forall x. Volume -> Rep Volume x)
-> (forall x. Rep Volume x -> Volume) -> Generic Volume
forall x. Rep Volume x -> Volume
forall x. Volume -> Rep Volume x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Volume x -> Volume
$cfrom :: forall x. Volume -> Rep Volume x
Prelude.Generic)
newVolume ::
Volume
newVolume :: Volume
newVolume =
Volume' :: Maybe Text -> Maybe EFSVolumeConfiguration -> Maybe Host -> Volume
Volume'
{ $sel:name:Volume' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:efsVolumeConfiguration:Volume' :: Maybe EFSVolumeConfiguration
efsVolumeConfiguration = Maybe EFSVolumeConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:host:Volume' :: Maybe Host
host = Maybe Host
forall a. Maybe a
Prelude.Nothing
}
volume_name :: Lens.Lens' Volume (Prelude.Maybe Prelude.Text)
volume_name :: (Maybe Text -> f (Maybe Text)) -> Volume -> f Volume
volume_name = (Volume -> Maybe Text)
-> (Volume -> Maybe Text -> Volume)
-> Lens Volume Volume (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Volume' {Maybe Text
name :: Maybe Text
$sel:name:Volume' :: Volume -> Maybe Text
name} -> Maybe Text
name) (\s :: Volume
s@Volume' {} Maybe Text
a -> Volume
s {$sel:name:Volume' :: Maybe Text
name = Maybe Text
a} :: Volume)
volume_efsVolumeConfiguration :: Lens.Lens' Volume (Prelude.Maybe EFSVolumeConfiguration)
volume_efsVolumeConfiguration :: (Maybe EFSVolumeConfiguration -> f (Maybe EFSVolumeConfiguration))
-> Volume -> f Volume
volume_efsVolumeConfiguration = (Volume -> Maybe EFSVolumeConfiguration)
-> (Volume -> Maybe EFSVolumeConfiguration -> Volume)
-> Lens
Volume
Volume
(Maybe EFSVolumeConfiguration)
(Maybe EFSVolumeConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Volume' {Maybe EFSVolumeConfiguration
efsVolumeConfiguration :: Maybe EFSVolumeConfiguration
$sel:efsVolumeConfiguration:Volume' :: Volume -> Maybe EFSVolumeConfiguration
efsVolumeConfiguration} -> Maybe EFSVolumeConfiguration
efsVolumeConfiguration) (\s :: Volume
s@Volume' {} Maybe EFSVolumeConfiguration
a -> Volume
s {$sel:efsVolumeConfiguration:Volume' :: Maybe EFSVolumeConfiguration
efsVolumeConfiguration = Maybe EFSVolumeConfiguration
a} :: Volume)
volume_host :: Lens.Lens' Volume (Prelude.Maybe Host)
volume_host :: (Maybe Host -> f (Maybe Host)) -> Volume -> f Volume
volume_host = (Volume -> Maybe Host)
-> (Volume -> Maybe Host -> Volume)
-> Lens Volume Volume (Maybe Host) (Maybe Host)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Volume' {Maybe Host
host :: Maybe Host
$sel:host:Volume' :: Volume -> Maybe Host
host} -> Maybe Host
host) (\s :: Volume
s@Volume' {} Maybe Host
a -> Volume
s {$sel:host:Volume' :: Maybe Host
host = Maybe Host
a} :: Volume)
instance Core.FromJSON Volume where
parseJSON :: Value -> Parser Volume
parseJSON =
String -> (Object -> Parser Volume) -> Value -> Parser Volume
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Volume"
( \Object
x ->
Maybe Text -> Maybe EFSVolumeConfiguration -> Maybe Host -> Volume
Volume'
(Maybe Text
-> Maybe EFSVolumeConfiguration -> Maybe Host -> Volume)
-> Parser (Maybe Text)
-> Parser (Maybe EFSVolumeConfiguration -> Maybe Host -> Volume)
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
"name")
Parser (Maybe EFSVolumeConfiguration -> Maybe Host -> Volume)
-> Parser (Maybe EFSVolumeConfiguration)
-> Parser (Maybe Host -> Volume)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EFSVolumeConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"efsVolumeConfiguration")
Parser (Maybe Host -> Volume)
-> Parser (Maybe Host) -> Parser Volume
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Host)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"host")
)
instance Prelude.Hashable Volume
instance Prelude.NFData Volume
instance Core.ToJSON Volume where
toJSON :: Volume -> Value
toJSON Volume' {Maybe Text
Maybe EFSVolumeConfiguration
Maybe Host
host :: Maybe Host
efsVolumeConfiguration :: Maybe EFSVolumeConfiguration
name :: Maybe Text
$sel:host:Volume' :: Volume -> Maybe Host
$sel:efsVolumeConfiguration:Volume' :: Volume -> Maybe EFSVolumeConfiguration
$sel:name:Volume' :: Volume -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Text
"efsVolumeConfiguration" Text -> EFSVolumeConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(EFSVolumeConfiguration -> Pair)
-> Maybe EFSVolumeConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EFSVolumeConfiguration
efsVolumeConfiguration,
(Text
"host" Text -> Host -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Host -> Pair) -> Maybe Host -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Host
host
]
)