{-# 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.AwsVpcConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.AssignPublicIp
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AwsVpcConfiguration = AwsVpcConfiguration'
{
AwsVpcConfiguration -> Maybe [Text]
securityGroups :: Prelude.Maybe [Prelude.Text],
AwsVpcConfiguration -> Maybe AssignPublicIp
assignPublicIp :: Prelude.Maybe AssignPublicIp,
AwsVpcConfiguration -> [Text]
subnets :: [Prelude.Text]
}
deriving (AwsVpcConfiguration -> AwsVpcConfiguration -> Bool
(AwsVpcConfiguration -> AwsVpcConfiguration -> Bool)
-> (AwsVpcConfiguration -> AwsVpcConfiguration -> Bool)
-> Eq AwsVpcConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsVpcConfiguration -> AwsVpcConfiguration -> Bool
$c/= :: AwsVpcConfiguration -> AwsVpcConfiguration -> Bool
== :: AwsVpcConfiguration -> AwsVpcConfiguration -> Bool
$c== :: AwsVpcConfiguration -> AwsVpcConfiguration -> Bool
Prelude.Eq, ReadPrec [AwsVpcConfiguration]
ReadPrec AwsVpcConfiguration
Int -> ReadS AwsVpcConfiguration
ReadS [AwsVpcConfiguration]
(Int -> ReadS AwsVpcConfiguration)
-> ReadS [AwsVpcConfiguration]
-> ReadPrec AwsVpcConfiguration
-> ReadPrec [AwsVpcConfiguration]
-> Read AwsVpcConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsVpcConfiguration]
$creadListPrec :: ReadPrec [AwsVpcConfiguration]
readPrec :: ReadPrec AwsVpcConfiguration
$creadPrec :: ReadPrec AwsVpcConfiguration
readList :: ReadS [AwsVpcConfiguration]
$creadList :: ReadS [AwsVpcConfiguration]
readsPrec :: Int -> ReadS AwsVpcConfiguration
$creadsPrec :: Int -> ReadS AwsVpcConfiguration
Prelude.Read, Int -> AwsVpcConfiguration -> ShowS
[AwsVpcConfiguration] -> ShowS
AwsVpcConfiguration -> String
(Int -> AwsVpcConfiguration -> ShowS)
-> (AwsVpcConfiguration -> String)
-> ([AwsVpcConfiguration] -> ShowS)
-> Show AwsVpcConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsVpcConfiguration] -> ShowS
$cshowList :: [AwsVpcConfiguration] -> ShowS
show :: AwsVpcConfiguration -> String
$cshow :: AwsVpcConfiguration -> String
showsPrec :: Int -> AwsVpcConfiguration -> ShowS
$cshowsPrec :: Int -> AwsVpcConfiguration -> ShowS
Prelude.Show, (forall x. AwsVpcConfiguration -> Rep AwsVpcConfiguration x)
-> (forall x. Rep AwsVpcConfiguration x -> AwsVpcConfiguration)
-> Generic AwsVpcConfiguration
forall x. Rep AwsVpcConfiguration x -> AwsVpcConfiguration
forall x. AwsVpcConfiguration -> Rep AwsVpcConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsVpcConfiguration x -> AwsVpcConfiguration
$cfrom :: forall x. AwsVpcConfiguration -> Rep AwsVpcConfiguration x
Prelude.Generic)
newAwsVpcConfiguration ::
AwsVpcConfiguration
newAwsVpcConfiguration :: AwsVpcConfiguration
newAwsVpcConfiguration =
AwsVpcConfiguration' :: Maybe [Text]
-> Maybe AssignPublicIp -> [Text] -> AwsVpcConfiguration
AwsVpcConfiguration'
{ $sel:securityGroups:AwsVpcConfiguration' :: Maybe [Text]
securityGroups =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:assignPublicIp:AwsVpcConfiguration' :: Maybe AssignPublicIp
assignPublicIp = Maybe AssignPublicIp
forall a. Maybe a
Prelude.Nothing,
$sel:subnets:AwsVpcConfiguration' :: [Text]
subnets = [Text]
forall a. Monoid a => a
Prelude.mempty
}
awsVpcConfiguration_securityGroups :: Lens.Lens' AwsVpcConfiguration (Prelude.Maybe [Prelude.Text])
awsVpcConfiguration_securityGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsVpcConfiguration -> f AwsVpcConfiguration
awsVpcConfiguration_securityGroups = (AwsVpcConfiguration -> Maybe [Text])
-> (AwsVpcConfiguration -> Maybe [Text] -> AwsVpcConfiguration)
-> Lens
AwsVpcConfiguration
AwsVpcConfiguration
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsVpcConfiguration' {Maybe [Text]
securityGroups :: Maybe [Text]
$sel:securityGroups:AwsVpcConfiguration' :: AwsVpcConfiguration -> Maybe [Text]
securityGroups} -> Maybe [Text]
securityGroups) (\s :: AwsVpcConfiguration
s@AwsVpcConfiguration' {} Maybe [Text]
a -> AwsVpcConfiguration
s {$sel:securityGroups:AwsVpcConfiguration' :: Maybe [Text]
securityGroups = Maybe [Text]
a} :: AwsVpcConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
-> AwsVpcConfiguration -> f AwsVpcConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsVpcConfiguration
-> f AwsVpcConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
awsVpcConfiguration_assignPublicIp :: Lens.Lens' AwsVpcConfiguration (Prelude.Maybe AssignPublicIp)
awsVpcConfiguration_assignPublicIp :: (Maybe AssignPublicIp -> f (Maybe AssignPublicIp))
-> AwsVpcConfiguration -> f AwsVpcConfiguration
awsVpcConfiguration_assignPublicIp = (AwsVpcConfiguration -> Maybe AssignPublicIp)
-> (AwsVpcConfiguration
-> Maybe AssignPublicIp -> AwsVpcConfiguration)
-> Lens
AwsVpcConfiguration
AwsVpcConfiguration
(Maybe AssignPublicIp)
(Maybe AssignPublicIp)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsVpcConfiguration' {Maybe AssignPublicIp
assignPublicIp :: Maybe AssignPublicIp
$sel:assignPublicIp:AwsVpcConfiguration' :: AwsVpcConfiguration -> Maybe AssignPublicIp
assignPublicIp} -> Maybe AssignPublicIp
assignPublicIp) (\s :: AwsVpcConfiguration
s@AwsVpcConfiguration' {} Maybe AssignPublicIp
a -> AwsVpcConfiguration
s {$sel:assignPublicIp:AwsVpcConfiguration' :: Maybe AssignPublicIp
assignPublicIp = Maybe AssignPublicIp
a} :: AwsVpcConfiguration)
awsVpcConfiguration_subnets :: Lens.Lens' AwsVpcConfiguration [Prelude.Text]
awsVpcConfiguration_subnets :: ([Text] -> f [Text])
-> AwsVpcConfiguration -> f AwsVpcConfiguration
awsVpcConfiguration_subnets = (AwsVpcConfiguration -> [Text])
-> (AwsVpcConfiguration -> [Text] -> AwsVpcConfiguration)
-> Lens AwsVpcConfiguration AwsVpcConfiguration [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsVpcConfiguration' {[Text]
subnets :: [Text]
$sel:subnets:AwsVpcConfiguration' :: AwsVpcConfiguration -> [Text]
subnets} -> [Text]
subnets) (\s :: AwsVpcConfiguration
s@AwsVpcConfiguration' {} [Text]
a -> AwsVpcConfiguration
s {$sel:subnets:AwsVpcConfiguration' :: [Text]
subnets = [Text]
a} :: AwsVpcConfiguration) (([Text] -> f [Text])
-> AwsVpcConfiguration -> f AwsVpcConfiguration)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AwsVpcConfiguration
-> f AwsVpcConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AwsVpcConfiguration where
parseJSON :: Value -> Parser AwsVpcConfiguration
parseJSON =
String
-> (Object -> Parser AwsVpcConfiguration)
-> Value
-> Parser AwsVpcConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AwsVpcConfiguration"
( \Object
x ->
Maybe [Text]
-> Maybe AssignPublicIp -> [Text] -> AwsVpcConfiguration
AwsVpcConfiguration'
(Maybe [Text]
-> Maybe AssignPublicIp -> [Text] -> AwsVpcConfiguration)
-> Parser (Maybe [Text])
-> Parser (Maybe AssignPublicIp -> [Text] -> AwsVpcConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityGroups" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe AssignPublicIp -> [Text] -> AwsVpcConfiguration)
-> Parser (Maybe AssignPublicIp)
-> Parser ([Text] -> AwsVpcConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AssignPublicIp)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"assignPublicIp")
Parser ([Text] -> AwsVpcConfiguration)
-> Parser [Text] -> Parser AwsVpcConfiguration
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
"subnets" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AwsVpcConfiguration
instance Prelude.NFData AwsVpcConfiguration
instance Core.ToJSON AwsVpcConfiguration where
toJSON :: AwsVpcConfiguration -> Value
toJSON AwsVpcConfiguration' {[Text]
Maybe [Text]
Maybe AssignPublicIp
subnets :: [Text]
assignPublicIp :: Maybe AssignPublicIp
securityGroups :: Maybe [Text]
$sel:subnets:AwsVpcConfiguration' :: AwsVpcConfiguration -> [Text]
$sel:assignPublicIp:AwsVpcConfiguration' :: AwsVpcConfiguration -> Maybe AssignPublicIp
$sel:securityGroups:AwsVpcConfiguration' :: AwsVpcConfiguration -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"securityGroups" 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]
securityGroups,
(Text
"assignPublicIp" Text -> AssignPublicIp -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AssignPublicIp -> Pair) -> Maybe AssignPublicIp -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssignPublicIp
assignPublicIp,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"subnets" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnets)
]
)