{-# 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.RobOMaker.Types.VPCConfig 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 VPCConfig = VPCConfig'
{
VPCConfig -> Maybe Bool
assignPublicIp :: Prelude.Maybe Prelude.Bool,
VPCConfig -> Maybe (NonEmpty Text)
securityGroups :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
VPCConfig -> NonEmpty Text
subnets :: Prelude.NonEmpty Prelude.Text
}
deriving (VPCConfig -> VPCConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VPCConfig -> VPCConfig -> Bool
$c/= :: VPCConfig -> VPCConfig -> Bool
== :: VPCConfig -> VPCConfig -> Bool
$c== :: VPCConfig -> VPCConfig -> Bool
Prelude.Eq, ReadPrec [VPCConfig]
ReadPrec VPCConfig
Int -> ReadS VPCConfig
ReadS [VPCConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VPCConfig]
$creadListPrec :: ReadPrec [VPCConfig]
readPrec :: ReadPrec VPCConfig
$creadPrec :: ReadPrec VPCConfig
readList :: ReadS [VPCConfig]
$creadList :: ReadS [VPCConfig]
readsPrec :: Int -> ReadS VPCConfig
$creadsPrec :: Int -> ReadS VPCConfig
Prelude.Read, Int -> VPCConfig -> ShowS
[VPCConfig] -> ShowS
VPCConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VPCConfig] -> ShowS
$cshowList :: [VPCConfig] -> ShowS
show :: VPCConfig -> String
$cshow :: VPCConfig -> String
showsPrec :: Int -> VPCConfig -> ShowS
$cshowsPrec :: Int -> VPCConfig -> ShowS
Prelude.Show, forall x. Rep VPCConfig x -> VPCConfig
forall x. VPCConfig -> Rep VPCConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VPCConfig x -> VPCConfig
$cfrom :: forall x. VPCConfig -> Rep VPCConfig x
Prelude.Generic)
newVPCConfig ::
Prelude.NonEmpty Prelude.Text ->
VPCConfig
newVPCConfig :: NonEmpty Text -> VPCConfig
newVPCConfig NonEmpty Text
pSubnets_ =
VPCConfig'
{ $sel:assignPublicIp:VPCConfig' :: Maybe Bool
assignPublicIp = forall a. Maybe a
Prelude.Nothing,
$sel:securityGroups:VPCConfig' :: Maybe (NonEmpty Text)
securityGroups = forall a. Maybe a
Prelude.Nothing,
$sel:subnets:VPCConfig' :: NonEmpty Text
subnets = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSubnets_
}
vPCConfig_assignPublicIp :: Lens.Lens' VPCConfig (Prelude.Maybe Prelude.Bool)
vPCConfig_assignPublicIp :: Lens' VPCConfig (Maybe Bool)
vPCConfig_assignPublicIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCConfig' {Maybe Bool
assignPublicIp :: Maybe Bool
$sel:assignPublicIp:VPCConfig' :: VPCConfig -> Maybe Bool
assignPublicIp} -> Maybe Bool
assignPublicIp) (\s :: VPCConfig
s@VPCConfig' {} Maybe Bool
a -> VPCConfig
s {$sel:assignPublicIp:VPCConfig' :: Maybe Bool
assignPublicIp = Maybe Bool
a} :: VPCConfig)
vPCConfig_securityGroups :: Lens.Lens' VPCConfig (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
vPCConfig_securityGroups :: Lens' VPCConfig (Maybe (NonEmpty Text))
vPCConfig_securityGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCConfig' {Maybe (NonEmpty Text)
securityGroups :: Maybe (NonEmpty Text)
$sel:securityGroups:VPCConfig' :: VPCConfig -> Maybe (NonEmpty Text)
securityGroups} -> Maybe (NonEmpty Text)
securityGroups) (\s :: VPCConfig
s@VPCConfig' {} Maybe (NonEmpty Text)
a -> VPCConfig
s {$sel:securityGroups:VPCConfig' :: Maybe (NonEmpty Text)
securityGroups = Maybe (NonEmpty Text)
a} :: VPCConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
vPCConfig_subnets :: Lens.Lens' VPCConfig (Prelude.NonEmpty Prelude.Text)
vPCConfig_subnets :: Lens' VPCConfig (NonEmpty Text)
vPCConfig_subnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCConfig' {NonEmpty Text
subnets :: NonEmpty Text
$sel:subnets:VPCConfig' :: VPCConfig -> NonEmpty Text
subnets} -> NonEmpty Text
subnets) (\s :: VPCConfig
s@VPCConfig' {} NonEmpty Text
a -> VPCConfig
s {$sel:subnets:VPCConfig' :: NonEmpty Text
subnets = NonEmpty Text
a} :: VPCConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON VPCConfig where
parseJSON :: Value -> Parser VPCConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"VPCConfig"
( \Object
x ->
Maybe Bool -> Maybe (NonEmpty Text) -> NonEmpty Text -> VPCConfig
VPCConfig'
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
"assignPublicIp")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"securityGroups")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"subnets")
)
instance Prelude.Hashable VPCConfig where
hashWithSalt :: Int -> VPCConfig -> Int
hashWithSalt Int
_salt VPCConfig' {Maybe Bool
Maybe (NonEmpty Text)
NonEmpty Text
subnets :: NonEmpty Text
securityGroups :: Maybe (NonEmpty Text)
assignPublicIp :: Maybe Bool
$sel:subnets:VPCConfig' :: VPCConfig -> NonEmpty Text
$sel:securityGroups:VPCConfig' :: VPCConfig -> Maybe (NonEmpty Text)
$sel:assignPublicIp:VPCConfig' :: VPCConfig -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
assignPublicIp
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
securityGroups
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
subnets
instance Prelude.NFData VPCConfig where
rnf :: VPCConfig -> ()
rnf VPCConfig' {Maybe Bool
Maybe (NonEmpty Text)
NonEmpty Text
subnets :: NonEmpty Text
securityGroups :: Maybe (NonEmpty Text)
assignPublicIp :: Maybe Bool
$sel:subnets:VPCConfig' :: VPCConfig -> NonEmpty Text
$sel:securityGroups:VPCConfig' :: VPCConfig -> Maybe (NonEmpty Text)
$sel:assignPublicIp:VPCConfig' :: VPCConfig -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
assignPublicIp
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
securityGroups
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
subnets
instance Data.ToJSON VPCConfig where
toJSON :: VPCConfig -> Value
toJSON VPCConfig' {Maybe Bool
Maybe (NonEmpty Text)
NonEmpty Text
subnets :: NonEmpty Text
securityGroups :: Maybe (NonEmpty Text)
assignPublicIp :: Maybe Bool
$sel:subnets:VPCConfig' :: VPCConfig -> NonEmpty Text
$sel:securityGroups:VPCConfig' :: VPCConfig -> Maybe (NonEmpty Text)
$sel:assignPublicIp:VPCConfig' :: VPCConfig -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"assignPublicIp" 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 Bool
assignPublicIp,
(Key
"securityGroups" 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 (NonEmpty Text)
securityGroups,
forall a. a -> Maybe a
Prelude.Just (Key
"subnets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
subnets)
]
)