{-# 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.DataSync.Types.Ec2Config where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Ec2Config = Ec2Config'
{
Ec2Config -> Text
subnetArn :: Prelude.Text,
Ec2Config -> NonEmpty Text
securityGroupArns :: Prelude.NonEmpty Prelude.Text
}
deriving (Ec2Config -> Ec2Config -> Bool
(Ec2Config -> Ec2Config -> Bool)
-> (Ec2Config -> Ec2Config -> Bool) -> Eq Ec2Config
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ec2Config -> Ec2Config -> Bool
$c/= :: Ec2Config -> Ec2Config -> Bool
== :: Ec2Config -> Ec2Config -> Bool
$c== :: Ec2Config -> Ec2Config -> Bool
Prelude.Eq, ReadPrec [Ec2Config]
ReadPrec Ec2Config
Int -> ReadS Ec2Config
ReadS [Ec2Config]
(Int -> ReadS Ec2Config)
-> ReadS [Ec2Config]
-> ReadPrec Ec2Config
-> ReadPrec [Ec2Config]
-> Read Ec2Config
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ec2Config]
$creadListPrec :: ReadPrec [Ec2Config]
readPrec :: ReadPrec Ec2Config
$creadPrec :: ReadPrec Ec2Config
readList :: ReadS [Ec2Config]
$creadList :: ReadS [Ec2Config]
readsPrec :: Int -> ReadS Ec2Config
$creadsPrec :: Int -> ReadS Ec2Config
Prelude.Read, Int -> Ec2Config -> ShowS
[Ec2Config] -> ShowS
Ec2Config -> String
(Int -> Ec2Config -> ShowS)
-> (Ec2Config -> String)
-> ([Ec2Config] -> ShowS)
-> Show Ec2Config
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ec2Config] -> ShowS
$cshowList :: [Ec2Config] -> ShowS
show :: Ec2Config -> String
$cshow :: Ec2Config -> String
showsPrec :: Int -> Ec2Config -> ShowS
$cshowsPrec :: Int -> Ec2Config -> ShowS
Prelude.Show, (forall x. Ec2Config -> Rep Ec2Config x)
-> (forall x. Rep Ec2Config x -> Ec2Config) -> Generic Ec2Config
forall x. Rep Ec2Config x -> Ec2Config
forall x. Ec2Config -> Rep Ec2Config x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ec2Config x -> Ec2Config
$cfrom :: forall x. Ec2Config -> Rep Ec2Config x
Prelude.Generic)
newEc2Config ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
Ec2Config
newEc2Config :: Text -> NonEmpty Text -> Ec2Config
newEc2Config Text
pSubnetArn_ NonEmpty Text
pSecurityGroupArns_ =
Ec2Config' :: Text -> NonEmpty Text -> Ec2Config
Ec2Config'
{ $sel:subnetArn:Ec2Config' :: Text
subnetArn = Text
pSubnetArn_,
$sel:securityGroupArns:Ec2Config' :: NonEmpty Text
securityGroupArns =
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
pSecurityGroupArns_
}
ec2Config_subnetArn :: Lens.Lens' Ec2Config Prelude.Text
ec2Config_subnetArn :: (Text -> f Text) -> Ec2Config -> f Ec2Config
ec2Config_subnetArn = (Ec2Config -> Text)
-> (Ec2Config -> Text -> Ec2Config)
-> Lens Ec2Config Ec2Config Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ec2Config' {Text
subnetArn :: Text
$sel:subnetArn:Ec2Config' :: Ec2Config -> Text
subnetArn} -> Text
subnetArn) (\s :: Ec2Config
s@Ec2Config' {} Text
a -> Ec2Config
s {$sel:subnetArn:Ec2Config' :: Text
subnetArn = Text
a} :: Ec2Config)
ec2Config_securityGroupArns :: Lens.Lens' Ec2Config (Prelude.NonEmpty Prelude.Text)
ec2Config_securityGroupArns :: (NonEmpty Text -> f (NonEmpty Text)) -> Ec2Config -> f Ec2Config
ec2Config_securityGroupArns = (Ec2Config -> NonEmpty Text)
-> (Ec2Config -> NonEmpty Text -> Ec2Config)
-> Lens Ec2Config Ec2Config (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ec2Config' {NonEmpty Text
securityGroupArns :: NonEmpty Text
$sel:securityGroupArns:Ec2Config' :: Ec2Config -> NonEmpty Text
securityGroupArns} -> NonEmpty Text
securityGroupArns) (\s :: Ec2Config
s@Ec2Config' {} NonEmpty Text
a -> Ec2Config
s {$sel:securityGroupArns:Ec2Config' :: NonEmpty Text
securityGroupArns = NonEmpty Text
a} :: Ec2Config) ((NonEmpty Text -> f (NonEmpty Text)) -> Ec2Config -> f Ec2Config)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> Ec2Config
-> f Ec2Config
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 Ec2Config where
parseJSON :: Value -> Parser Ec2Config
parseJSON =
String -> (Object -> Parser Ec2Config) -> Value -> Parser Ec2Config
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Ec2Config"
( \Object
x ->
Text -> NonEmpty Text -> Ec2Config
Ec2Config'
(Text -> NonEmpty Text -> Ec2Config)
-> Parser Text -> Parser (NonEmpty Text -> Ec2Config)
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
"SubnetArn")
Parser (NonEmpty Text -> Ec2Config)
-> Parser (NonEmpty Text) -> Parser Ec2Config
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
"SecurityGroupArns")
)
instance Prelude.Hashable Ec2Config
instance Prelude.NFData Ec2Config
instance Core.ToJSON Ec2Config where
toJSON :: Ec2Config -> Value
toJSON Ec2Config' {NonEmpty Text
Text
securityGroupArns :: NonEmpty Text
subnetArn :: Text
$sel:securityGroupArns:Ec2Config' :: Ec2Config -> NonEmpty Text
$sel:subnetArn:Ec2Config' :: Ec2Config -> 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
"SubnetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subnetArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SecurityGroupArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
securityGroupArns)
]
)