{-# 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.Comprehend.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 -> NonEmpty Text
securityGroupIds :: Prelude.NonEmpty Prelude.Text,
VpcConfig -> NonEmpty Text
subnets :: Prelude.NonEmpty 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 ::
Prelude.NonEmpty Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
VpcConfig
newVpcConfig :: NonEmpty Text -> NonEmpty Text -> VpcConfig
newVpcConfig NonEmpty Text
pSecurityGroupIds_ NonEmpty Text
pSubnets_ =
VpcConfig' :: NonEmpty Text -> NonEmpty Text -> VpcConfig
VpcConfig'
{ $sel:securityGroupIds:VpcConfig' :: NonEmpty Text
securityGroupIds =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSecurityGroupIds_,
$sel:subnets:VpcConfig' :: NonEmpty Text
subnets = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSubnets_
}
vpcConfig_securityGroupIds :: Lens.Lens' VpcConfig (Prelude.NonEmpty Prelude.Text)
vpcConfig_securityGroupIds :: (NonEmpty Text -> f (NonEmpty Text)) -> VpcConfig -> f VpcConfig
vpcConfig_securityGroupIds = (VpcConfig -> NonEmpty Text)
-> (VpcConfig -> NonEmpty Text -> VpcConfig)
-> Lens VpcConfig VpcConfig (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfig' {NonEmpty Text
securityGroupIds :: NonEmpty Text
$sel:securityGroupIds:VpcConfig' :: VpcConfig -> NonEmpty Text
securityGroupIds} -> NonEmpty Text
securityGroupIds) (\s :: VpcConfig
s@VpcConfig' {} NonEmpty Text
a -> VpcConfig
s {$sel:securityGroupIds:VpcConfig' :: NonEmpty Text
securityGroupIds = NonEmpty Text
a} :: VpcConfig) ((NonEmpty Text -> f (NonEmpty Text)) -> VpcConfig -> f VpcConfig)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> VpcConfig
-> f VpcConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
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 :: (NonEmpty Text -> f (NonEmpty Text)) -> VpcConfig -> f VpcConfig
vpcConfig_subnets = (VpcConfig -> NonEmpty Text)
-> (VpcConfig -> NonEmpty Text -> VpcConfig)
-> Lens VpcConfig VpcConfig (NonEmpty Text) (NonEmpty Text)
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) ((NonEmpty Text -> f (NonEmpty Text)) -> VpcConfig -> f VpcConfig)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> VpcConfig
-> f VpcConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty 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 ->
NonEmpty Text -> NonEmpty Text -> VpcConfig
VpcConfig'
(NonEmpty Text -> NonEmpty Text -> VpcConfig)
-> Parser (NonEmpty Text) -> Parser (NonEmpty Text -> VpcConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SecurityGroupIds")
Parser (NonEmpty Text -> VpcConfig)
-> Parser (NonEmpty Text) -> Parser VpcConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Subnets")
)
instance Prelude.Hashable VpcConfig
instance Prelude.NFData VpcConfig
instance Core.ToJSON VpcConfig where
toJSON :: VpcConfig -> Value
toJSON VpcConfig' {NonEmpty Text
subnets :: NonEmpty Text
securityGroupIds :: NonEmpty Text
$sel:subnets:VpcConfig' :: VpcConfig -> NonEmpty Text
$sel:securityGroupIds:VpcConfig' :: VpcConfig -> NonEmpty Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SecurityGroupIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
securityGroupIds),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Subnets" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
subnets)
]
)