{-# 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.CodeDeploy.Types.TargetInstances where
import Amazonka.CodeDeploy.Types.EC2TagFilter
import Amazonka.CodeDeploy.Types.EC2TagSet
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TargetInstances = TargetInstances'
{
TargetInstances -> Maybe EC2TagSet
ec2TagSet :: Prelude.Maybe EC2TagSet,
TargetInstances -> Maybe [EC2TagFilter]
tagFilters :: Prelude.Maybe [EC2TagFilter],
TargetInstances -> Maybe [Text]
autoScalingGroups :: Prelude.Maybe [Prelude.Text]
}
deriving (TargetInstances -> TargetInstances -> Bool
(TargetInstances -> TargetInstances -> Bool)
-> (TargetInstances -> TargetInstances -> Bool)
-> Eq TargetInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetInstances -> TargetInstances -> Bool
$c/= :: TargetInstances -> TargetInstances -> Bool
== :: TargetInstances -> TargetInstances -> Bool
$c== :: TargetInstances -> TargetInstances -> Bool
Prelude.Eq, ReadPrec [TargetInstances]
ReadPrec TargetInstances
Int -> ReadS TargetInstances
ReadS [TargetInstances]
(Int -> ReadS TargetInstances)
-> ReadS [TargetInstances]
-> ReadPrec TargetInstances
-> ReadPrec [TargetInstances]
-> Read TargetInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TargetInstances]
$creadListPrec :: ReadPrec [TargetInstances]
readPrec :: ReadPrec TargetInstances
$creadPrec :: ReadPrec TargetInstances
readList :: ReadS [TargetInstances]
$creadList :: ReadS [TargetInstances]
readsPrec :: Int -> ReadS TargetInstances
$creadsPrec :: Int -> ReadS TargetInstances
Prelude.Read, Int -> TargetInstances -> ShowS
[TargetInstances] -> ShowS
TargetInstances -> String
(Int -> TargetInstances -> ShowS)
-> (TargetInstances -> String)
-> ([TargetInstances] -> ShowS)
-> Show TargetInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetInstances] -> ShowS
$cshowList :: [TargetInstances] -> ShowS
show :: TargetInstances -> String
$cshow :: TargetInstances -> String
showsPrec :: Int -> TargetInstances -> ShowS
$cshowsPrec :: Int -> TargetInstances -> ShowS
Prelude.Show, (forall x. TargetInstances -> Rep TargetInstances x)
-> (forall x. Rep TargetInstances x -> TargetInstances)
-> Generic TargetInstances
forall x. Rep TargetInstances x -> TargetInstances
forall x. TargetInstances -> Rep TargetInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TargetInstances x -> TargetInstances
$cfrom :: forall x. TargetInstances -> Rep TargetInstances x
Prelude.Generic)
newTargetInstances ::
TargetInstances
newTargetInstances :: TargetInstances
newTargetInstances =
TargetInstances' :: Maybe EC2TagSet
-> Maybe [EC2TagFilter] -> Maybe [Text] -> TargetInstances
TargetInstances'
{ $sel:ec2TagSet:TargetInstances' :: Maybe EC2TagSet
ec2TagSet = Maybe EC2TagSet
forall a. Maybe a
Prelude.Nothing,
$sel:tagFilters:TargetInstances' :: Maybe [EC2TagFilter]
tagFilters = Maybe [EC2TagFilter]
forall a. Maybe a
Prelude.Nothing,
$sel:autoScalingGroups:TargetInstances' :: Maybe [Text]
autoScalingGroups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
targetInstances_ec2TagSet :: Lens.Lens' TargetInstances (Prelude.Maybe EC2TagSet)
targetInstances_ec2TagSet :: (Maybe EC2TagSet -> f (Maybe EC2TagSet))
-> TargetInstances -> f TargetInstances
targetInstances_ec2TagSet = (TargetInstances -> Maybe EC2TagSet)
-> (TargetInstances -> Maybe EC2TagSet -> TargetInstances)
-> Lens
TargetInstances TargetInstances (Maybe EC2TagSet) (Maybe EC2TagSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetInstances' {Maybe EC2TagSet
ec2TagSet :: Maybe EC2TagSet
$sel:ec2TagSet:TargetInstances' :: TargetInstances -> Maybe EC2TagSet
ec2TagSet} -> Maybe EC2TagSet
ec2TagSet) (\s :: TargetInstances
s@TargetInstances' {} Maybe EC2TagSet
a -> TargetInstances
s {$sel:ec2TagSet:TargetInstances' :: Maybe EC2TagSet
ec2TagSet = Maybe EC2TagSet
a} :: TargetInstances)
targetInstances_tagFilters :: Lens.Lens' TargetInstances (Prelude.Maybe [EC2TagFilter])
targetInstances_tagFilters :: (Maybe [EC2TagFilter] -> f (Maybe [EC2TagFilter]))
-> TargetInstances -> f TargetInstances
targetInstances_tagFilters = (TargetInstances -> Maybe [EC2TagFilter])
-> (TargetInstances -> Maybe [EC2TagFilter] -> TargetInstances)
-> Lens
TargetInstances
TargetInstances
(Maybe [EC2TagFilter])
(Maybe [EC2TagFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetInstances' {Maybe [EC2TagFilter]
tagFilters :: Maybe [EC2TagFilter]
$sel:tagFilters:TargetInstances' :: TargetInstances -> Maybe [EC2TagFilter]
tagFilters} -> Maybe [EC2TagFilter]
tagFilters) (\s :: TargetInstances
s@TargetInstances' {} Maybe [EC2TagFilter]
a -> TargetInstances
s {$sel:tagFilters:TargetInstances' :: Maybe [EC2TagFilter]
tagFilters = Maybe [EC2TagFilter]
a} :: TargetInstances) ((Maybe [EC2TagFilter] -> f (Maybe [EC2TagFilter]))
-> TargetInstances -> f TargetInstances)
-> ((Maybe [EC2TagFilter] -> f (Maybe [EC2TagFilter]))
-> Maybe [EC2TagFilter] -> f (Maybe [EC2TagFilter]))
-> (Maybe [EC2TagFilter] -> f (Maybe [EC2TagFilter]))
-> TargetInstances
-> f TargetInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EC2TagFilter] [EC2TagFilter] [EC2TagFilter] [EC2TagFilter]
-> Iso
(Maybe [EC2TagFilter])
(Maybe [EC2TagFilter])
(Maybe [EC2TagFilter])
(Maybe [EC2TagFilter])
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 [EC2TagFilter] [EC2TagFilter] [EC2TagFilter] [EC2TagFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
targetInstances_autoScalingGroups :: Lens.Lens' TargetInstances (Prelude.Maybe [Prelude.Text])
targetInstances_autoScalingGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> TargetInstances -> f TargetInstances
targetInstances_autoScalingGroups = (TargetInstances -> Maybe [Text])
-> (TargetInstances -> Maybe [Text] -> TargetInstances)
-> Lens
TargetInstances TargetInstances (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetInstances' {Maybe [Text]
autoScalingGroups :: Maybe [Text]
$sel:autoScalingGroups:TargetInstances' :: TargetInstances -> Maybe [Text]
autoScalingGroups} -> Maybe [Text]
autoScalingGroups) (\s :: TargetInstances
s@TargetInstances' {} Maybe [Text]
a -> TargetInstances
s {$sel:autoScalingGroups:TargetInstances' :: Maybe [Text]
autoScalingGroups = Maybe [Text]
a} :: TargetInstances) ((Maybe [Text] -> f (Maybe [Text]))
-> TargetInstances -> f TargetInstances)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> TargetInstances
-> f TargetInstances
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 TargetInstances where
parseJSON :: Value -> Parser TargetInstances
parseJSON =
String
-> (Object -> Parser TargetInstances)
-> Value
-> Parser TargetInstances
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TargetInstances"
( \Object
x ->
Maybe EC2TagSet
-> Maybe [EC2TagFilter] -> Maybe [Text] -> TargetInstances
TargetInstances'
(Maybe EC2TagSet
-> Maybe [EC2TagFilter] -> Maybe [Text] -> TargetInstances)
-> Parser (Maybe EC2TagSet)
-> Parser (Maybe [EC2TagFilter] -> Maybe [Text] -> TargetInstances)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EC2TagSet)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ec2TagSet")
Parser (Maybe [EC2TagFilter] -> Maybe [Text] -> TargetInstances)
-> Parser (Maybe [EC2TagFilter])
-> Parser (Maybe [Text] -> TargetInstances)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [EC2TagFilter]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tagFilters" Parser (Maybe (Maybe [EC2TagFilter]))
-> Maybe [EC2TagFilter] -> Parser (Maybe [EC2TagFilter])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EC2TagFilter]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [Text] -> TargetInstances)
-> Parser (Maybe [Text]) -> Parser TargetInstances
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
"autoScalingGroups"
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 TargetInstances
instance Prelude.NFData TargetInstances
instance Core.ToJSON TargetInstances where
toJSON :: TargetInstances -> Value
toJSON TargetInstances' {Maybe [Text]
Maybe [EC2TagFilter]
Maybe EC2TagSet
autoScalingGroups :: Maybe [Text]
tagFilters :: Maybe [EC2TagFilter]
ec2TagSet :: Maybe EC2TagSet
$sel:autoScalingGroups:TargetInstances' :: TargetInstances -> Maybe [Text]
$sel:tagFilters:TargetInstances' :: TargetInstances -> Maybe [EC2TagFilter]
$sel:ec2TagSet:TargetInstances' :: TargetInstances -> Maybe EC2TagSet
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ec2TagSet" Text -> EC2TagSet -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EC2TagSet -> Pair) -> Maybe EC2TagSet -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EC2TagSet
ec2TagSet,
(Text
"tagFilters" Text -> [EC2TagFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([EC2TagFilter] -> Pair) -> Maybe [EC2TagFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EC2TagFilter]
tagFilters,
(Text
"autoScalingGroups" 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]
autoScalingGroups
]
)