{-# 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.AppStream.Types.VpcConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VpcConfig = VpcConfig'
{
VpcConfig -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
VpcConfig -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text]
}
deriving (VpcConfig -> VpcConfig -> Bool
(VpcConfig -> VpcConfig -> Bool)
-> (VpcConfig -> VpcConfig -> Bool) -> Eq VpcConfig
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]
(Int -> ReadS VpcConfig)
-> ReadS [VpcConfig]
-> ReadPrec VpcConfig
-> ReadPrec [VpcConfig]
-> Read 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
(Int -> VpcConfig -> ShowS)
-> (VpcConfig -> String)
-> ([VpcConfig] -> ShowS)
-> Show VpcConfig
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. VpcConfig -> Rep VpcConfig x)
-> (forall x. Rep VpcConfig x -> VpcConfig) -> Generic VpcConfig
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 ::
VpcConfig
newVpcConfig :: VpcConfig
newVpcConfig =
VpcConfig' :: Maybe [Text] -> Maybe [Text] -> VpcConfig
VpcConfig'
{ $sel:securityGroupIds:VpcConfig' :: Maybe [Text]
securityGroupIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:subnetIds:VpcConfig' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
vpcConfig_securityGroupIds :: Lens.Lens' VpcConfig (Prelude.Maybe [Prelude.Text])
vpcConfig_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text])) -> VpcConfig -> f VpcConfig
vpcConfig_securityGroupIds = (VpcConfig -> Maybe [Text])
-> (VpcConfig -> Maybe [Text] -> VpcConfig)
-> Lens VpcConfig VpcConfig (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfig' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:VpcConfig' :: VpcConfig -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: VpcConfig
s@VpcConfig' {} Maybe [Text]
a -> VpcConfig
s {$sel:securityGroupIds:VpcConfig' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: VpcConfig) ((Maybe [Text] -> f (Maybe [Text])) -> VpcConfig -> f VpcConfig)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfig
-> f VpcConfig
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
vpcConfig_subnetIds :: Lens.Lens' VpcConfig (Prelude.Maybe [Prelude.Text])
vpcConfig_subnetIds :: (Maybe [Text] -> f (Maybe [Text])) -> VpcConfig -> f VpcConfig
vpcConfig_subnetIds = (VpcConfig -> Maybe [Text])
-> (VpcConfig -> Maybe [Text] -> VpcConfig)
-> Lens VpcConfig VpcConfig (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfig' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:VpcConfig' :: VpcConfig -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: VpcConfig
s@VpcConfig' {} Maybe [Text]
a -> VpcConfig
s {$sel:subnetIds:VpcConfig' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: VpcConfig) ((Maybe [Text] -> f (Maybe [Text])) -> VpcConfig -> f VpcConfig)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfig
-> f VpcConfig
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
instance Core.FromJSON VpcConfig where
parseJSON :: Value -> Parser VpcConfig
parseJSON =
String -> (Object -> Parser VpcConfig) -> Value -> Parser VpcConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VpcConfig"
( \Object
x ->
Maybe [Text] -> Maybe [Text] -> VpcConfig
VpcConfig'
(Maybe [Text] -> Maybe [Text] -> VpcConfig)
-> Parser (Maybe [Text]) -> Parser (Maybe [Text] -> VpcConfig)
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
"SecurityGroupIds"
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 [Text] -> VpcConfig)
-> Parser (Maybe [Text]) -> Parser VpcConfig
forall (f :: * -> *) a b. Applicative f => 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
"SubnetIds" 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)
)
instance Prelude.Hashable VpcConfig
instance Prelude.NFData VpcConfig
instance Core.ToJSON VpcConfig where
toJSON :: VpcConfig -> Value
toJSON VpcConfig' {Maybe [Text]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:VpcConfig' :: VpcConfig -> Maybe [Text]
$sel:securityGroupIds:VpcConfig' :: VpcConfig -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SecurityGroupIds" 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]
securityGroupIds,
(Text
"SubnetIds" 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]
subnetIds
]
)