{-# 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.ECS.Types.Volume where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.DockerVolumeConfiguration
import Amazonka.ECS.Types.EFSVolumeConfiguration
import Amazonka.ECS.Types.FSxWindowsFileServerVolumeConfiguration
import Amazonka.ECS.Types.HostVolumeProperties
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Volume = Volume'
{
Volume -> Maybe DockerVolumeConfiguration
dockerVolumeConfiguration :: Prelude.Maybe DockerVolumeConfiguration,
Volume -> Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration :: Prelude.Maybe FSxWindowsFileServerVolumeConfiguration,
Volume -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Volume -> Maybe EFSVolumeConfiguration
efsVolumeConfiguration :: Prelude.Maybe EFSVolumeConfiguration,
Volume -> Maybe HostVolumeProperties
host :: Prelude.Maybe HostVolumeProperties
}
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 DockerVolumeConfiguration
-> Maybe FSxWindowsFileServerVolumeConfiguration
-> Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume
Volume'
{ $sel:dockerVolumeConfiguration:Volume' :: Maybe DockerVolumeConfiguration
dockerVolumeConfiguration =
Maybe DockerVolumeConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:fsxWindowsFileServerVolumeConfiguration:Volume' :: Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration =
Maybe FSxWindowsFileServerVolumeConfiguration
forall a. Maybe a
Prelude.Nothing,
$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 HostVolumeProperties
host = Maybe HostVolumeProperties
forall a. Maybe a
Prelude.Nothing
}
volume_dockerVolumeConfiguration :: Lens.Lens' Volume (Prelude.Maybe DockerVolumeConfiguration)
volume_dockerVolumeConfiguration :: (Maybe DockerVolumeConfiguration
-> f (Maybe DockerVolumeConfiguration))
-> Volume -> f Volume
volume_dockerVolumeConfiguration = (Volume -> Maybe DockerVolumeConfiguration)
-> (Volume -> Maybe DockerVolumeConfiguration -> Volume)
-> Lens
Volume
Volume
(Maybe DockerVolumeConfiguration)
(Maybe DockerVolumeConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Volume' {Maybe DockerVolumeConfiguration
dockerVolumeConfiguration :: Maybe DockerVolumeConfiguration
$sel:dockerVolumeConfiguration:Volume' :: Volume -> Maybe DockerVolumeConfiguration
dockerVolumeConfiguration} -> Maybe DockerVolumeConfiguration
dockerVolumeConfiguration) (\s :: Volume
s@Volume' {} Maybe DockerVolumeConfiguration
a -> Volume
s {$sel:dockerVolumeConfiguration:Volume' :: Maybe DockerVolumeConfiguration
dockerVolumeConfiguration = Maybe DockerVolumeConfiguration
a} :: Volume)
volume_fsxWindowsFileServerVolumeConfiguration :: Lens.Lens' Volume (Prelude.Maybe FSxWindowsFileServerVolumeConfiguration)
volume_fsxWindowsFileServerVolumeConfiguration :: (Maybe FSxWindowsFileServerVolumeConfiguration
-> f (Maybe FSxWindowsFileServerVolumeConfiguration))
-> Volume -> f Volume
volume_fsxWindowsFileServerVolumeConfiguration = (Volume -> Maybe FSxWindowsFileServerVolumeConfiguration)
-> (Volume
-> Maybe FSxWindowsFileServerVolumeConfiguration -> Volume)
-> Lens
Volume
Volume
(Maybe FSxWindowsFileServerVolumeConfiguration)
(Maybe FSxWindowsFileServerVolumeConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Volume' {Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration :: Maybe FSxWindowsFileServerVolumeConfiguration
$sel:fsxWindowsFileServerVolumeConfiguration:Volume' :: Volume -> Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration} -> Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration) (\s :: Volume
s@Volume' {} Maybe FSxWindowsFileServerVolumeConfiguration
a -> Volume
s {$sel:fsxWindowsFileServerVolumeConfiguration:Volume' :: Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration = Maybe FSxWindowsFileServerVolumeConfiguration
a} :: Volume)
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 HostVolumeProperties)
volume_host :: (Maybe HostVolumeProperties -> f (Maybe HostVolumeProperties))
-> Volume -> f Volume
volume_host = (Volume -> Maybe HostVolumeProperties)
-> (Volume -> Maybe HostVolumeProperties -> Volume)
-> Lens
Volume
Volume
(Maybe HostVolumeProperties)
(Maybe HostVolumeProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Volume' {Maybe HostVolumeProperties
host :: Maybe HostVolumeProperties
$sel:host:Volume' :: Volume -> Maybe HostVolumeProperties
host} -> Maybe HostVolumeProperties
host) (\s :: Volume
s@Volume' {} Maybe HostVolumeProperties
a -> Volume
s {$sel:host:Volume' :: Maybe HostVolumeProperties
host = Maybe HostVolumeProperties
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 DockerVolumeConfiguration
-> Maybe FSxWindowsFileServerVolumeConfiguration
-> Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume
Volume'
(Maybe DockerVolumeConfiguration
-> Maybe FSxWindowsFileServerVolumeConfiguration
-> Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume)
-> Parser (Maybe DockerVolumeConfiguration)
-> Parser
(Maybe FSxWindowsFileServerVolumeConfiguration
-> Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DockerVolumeConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dockerVolumeConfiguration")
Parser
(Maybe FSxWindowsFileServerVolumeConfiguration
-> Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume)
-> Parser (Maybe FSxWindowsFileServerVolumeConfiguration)
-> Parser
(Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
Object
-> Text -> Parser (Maybe FSxWindowsFileServerVolumeConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fsxWindowsFileServerVolumeConfiguration"
)
Parser
(Maybe Text
-> Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties
-> Volume)
-> Parser (Maybe Text)
-> Parser
(Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties -> Volume)
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
"name")
Parser
(Maybe EFSVolumeConfiguration
-> Maybe HostVolumeProperties -> Volume)
-> Parser (Maybe EFSVolumeConfiguration)
-> Parser (Maybe HostVolumeProperties -> 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 HostVolumeProperties -> Volume)
-> Parser (Maybe HostVolumeProperties) -> Parser Volume
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HostVolumeProperties)
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 FSxWindowsFileServerVolumeConfiguration
Maybe HostVolumeProperties
Maybe DockerVolumeConfiguration
host :: Maybe HostVolumeProperties
efsVolumeConfiguration :: Maybe EFSVolumeConfiguration
name :: Maybe Text
fsxWindowsFileServerVolumeConfiguration :: Maybe FSxWindowsFileServerVolumeConfiguration
dockerVolumeConfiguration :: Maybe DockerVolumeConfiguration
$sel:host:Volume' :: Volume -> Maybe HostVolumeProperties
$sel:efsVolumeConfiguration:Volume' :: Volume -> Maybe EFSVolumeConfiguration
$sel:name:Volume' :: Volume -> Maybe Text
$sel:fsxWindowsFileServerVolumeConfiguration:Volume' :: Volume -> Maybe FSxWindowsFileServerVolumeConfiguration
$sel:dockerVolumeConfiguration:Volume' :: Volume -> Maybe DockerVolumeConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"dockerVolumeConfiguration" Text -> DockerVolumeConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DockerVolumeConfiguration -> Pair)
-> Maybe DockerVolumeConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DockerVolumeConfiguration
dockerVolumeConfiguration,
(Text
"fsxWindowsFileServerVolumeConfiguration" Text -> FSxWindowsFileServerVolumeConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FSxWindowsFileServerVolumeConfiguration -> Pair)
-> Maybe FSxWindowsFileServerVolumeConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FSxWindowsFileServerVolumeConfiguration
fsxWindowsFileServerVolumeConfiguration,
(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 -> HostVolumeProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HostVolumeProperties -> Pair)
-> Maybe HostVolumeProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HostVolumeProperties
host
]
)