{-# 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.DirectoryService.Types.DirectoryVpcSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DirectoryVpcSettings = DirectoryVpcSettings'
{
DirectoryVpcSettings -> Text
vpcId :: Prelude.Text,
DirectoryVpcSettings -> [Text]
subnetIds :: [Prelude.Text]
}
deriving (DirectoryVpcSettings -> DirectoryVpcSettings -> Bool
(DirectoryVpcSettings -> DirectoryVpcSettings -> Bool)
-> (DirectoryVpcSettings -> DirectoryVpcSettings -> Bool)
-> Eq DirectoryVpcSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DirectoryVpcSettings -> DirectoryVpcSettings -> Bool
$c/= :: DirectoryVpcSettings -> DirectoryVpcSettings -> Bool
== :: DirectoryVpcSettings -> DirectoryVpcSettings -> Bool
$c== :: DirectoryVpcSettings -> DirectoryVpcSettings -> Bool
Prelude.Eq, ReadPrec [DirectoryVpcSettings]
ReadPrec DirectoryVpcSettings
Int -> ReadS DirectoryVpcSettings
ReadS [DirectoryVpcSettings]
(Int -> ReadS DirectoryVpcSettings)
-> ReadS [DirectoryVpcSettings]
-> ReadPrec DirectoryVpcSettings
-> ReadPrec [DirectoryVpcSettings]
-> Read DirectoryVpcSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DirectoryVpcSettings]
$creadListPrec :: ReadPrec [DirectoryVpcSettings]
readPrec :: ReadPrec DirectoryVpcSettings
$creadPrec :: ReadPrec DirectoryVpcSettings
readList :: ReadS [DirectoryVpcSettings]
$creadList :: ReadS [DirectoryVpcSettings]
readsPrec :: Int -> ReadS DirectoryVpcSettings
$creadsPrec :: Int -> ReadS DirectoryVpcSettings
Prelude.Read, Int -> DirectoryVpcSettings -> ShowS
[DirectoryVpcSettings] -> ShowS
DirectoryVpcSettings -> String
(Int -> DirectoryVpcSettings -> ShowS)
-> (DirectoryVpcSettings -> String)
-> ([DirectoryVpcSettings] -> ShowS)
-> Show DirectoryVpcSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DirectoryVpcSettings] -> ShowS
$cshowList :: [DirectoryVpcSettings] -> ShowS
show :: DirectoryVpcSettings -> String
$cshow :: DirectoryVpcSettings -> String
showsPrec :: Int -> DirectoryVpcSettings -> ShowS
$cshowsPrec :: Int -> DirectoryVpcSettings -> ShowS
Prelude.Show, (forall x. DirectoryVpcSettings -> Rep DirectoryVpcSettings x)
-> (forall x. Rep DirectoryVpcSettings x -> DirectoryVpcSettings)
-> Generic DirectoryVpcSettings
forall x. Rep DirectoryVpcSettings x -> DirectoryVpcSettings
forall x. DirectoryVpcSettings -> Rep DirectoryVpcSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DirectoryVpcSettings x -> DirectoryVpcSettings
$cfrom :: forall x. DirectoryVpcSettings -> Rep DirectoryVpcSettings x
Prelude.Generic)
newDirectoryVpcSettings ::
Prelude.Text ->
DirectoryVpcSettings
newDirectoryVpcSettings :: Text -> DirectoryVpcSettings
newDirectoryVpcSettings Text
pVpcId_ =
DirectoryVpcSettings' :: Text -> [Text] -> DirectoryVpcSettings
DirectoryVpcSettings'
{ $sel:vpcId:DirectoryVpcSettings' :: Text
vpcId = Text
pVpcId_,
$sel:subnetIds:DirectoryVpcSettings' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
directoryVpcSettings_vpcId :: Lens.Lens' DirectoryVpcSettings Prelude.Text
directoryVpcSettings_vpcId :: (Text -> f Text) -> DirectoryVpcSettings -> f DirectoryVpcSettings
directoryVpcSettings_vpcId = (DirectoryVpcSettings -> Text)
-> (DirectoryVpcSettings -> Text -> DirectoryVpcSettings)
-> Lens DirectoryVpcSettings DirectoryVpcSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectoryVpcSettings' {Text
vpcId :: Text
$sel:vpcId:DirectoryVpcSettings' :: DirectoryVpcSettings -> Text
vpcId} -> Text
vpcId) (\s :: DirectoryVpcSettings
s@DirectoryVpcSettings' {} Text
a -> DirectoryVpcSettings
s {$sel:vpcId:DirectoryVpcSettings' :: Text
vpcId = Text
a} :: DirectoryVpcSettings)
directoryVpcSettings_subnetIds :: Lens.Lens' DirectoryVpcSettings [Prelude.Text]
directoryVpcSettings_subnetIds :: ([Text] -> f [Text])
-> DirectoryVpcSettings -> f DirectoryVpcSettings
directoryVpcSettings_subnetIds = (DirectoryVpcSettings -> [Text])
-> (DirectoryVpcSettings -> [Text] -> DirectoryVpcSettings)
-> Lens DirectoryVpcSettings DirectoryVpcSettings [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectoryVpcSettings' {[Text]
subnetIds :: [Text]
$sel:subnetIds:DirectoryVpcSettings' :: DirectoryVpcSettings -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: DirectoryVpcSettings
s@DirectoryVpcSettings' {} [Text]
a -> DirectoryVpcSettings
s {$sel:subnetIds:DirectoryVpcSettings' :: [Text]
subnetIds = [Text]
a} :: DirectoryVpcSettings) (([Text] -> f [Text])
-> DirectoryVpcSettings -> f DirectoryVpcSettings)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DirectoryVpcSettings
-> f DirectoryVpcSettings
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 DirectoryVpcSettings where
parseJSON :: Value -> Parser DirectoryVpcSettings
parseJSON =
String
-> (Object -> Parser DirectoryVpcSettings)
-> Value
-> Parser DirectoryVpcSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DirectoryVpcSettings"
( \Object
x ->
Text -> [Text] -> DirectoryVpcSettings
DirectoryVpcSettings'
(Text -> [Text] -> DirectoryVpcSettings)
-> Parser Text -> Parser ([Text] -> DirectoryVpcSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"VpcId")
Parser ([Text] -> DirectoryVpcSettings)
-> Parser [Text] -> Parser DirectoryVpcSettings
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
"SubnetIds" 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 DirectoryVpcSettings
instance Prelude.NFData DirectoryVpcSettings
instance Core.ToJSON DirectoryVpcSettings where
toJSON :: DirectoryVpcSettings -> Value
toJSON DirectoryVpcSettings' {[Text]
Text
subnetIds :: [Text]
vpcId :: Text
$sel:subnetIds:DirectoryVpcSettings' :: DirectoryVpcSettings -> [Text]
$sel:vpcId:DirectoryVpcSettings' :: DirectoryVpcSettings -> 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
"VpcId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpcId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnetIds)
]
)