{-# 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.Route53AutoNaming.Types.ServiceFilter where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53AutoNaming.Types.FilterCondition
import Amazonka.Route53AutoNaming.Types.ServiceFilterName
data ServiceFilter = ServiceFilter'
{
ServiceFilter -> Maybe FilterCondition
condition :: Prelude.Maybe FilterCondition,
ServiceFilter -> ServiceFilterName
name :: ServiceFilterName,
ServiceFilter -> [Text]
values :: [Prelude.Text]
}
deriving (ServiceFilter -> ServiceFilter -> Bool
(ServiceFilter -> ServiceFilter -> Bool)
-> (ServiceFilter -> ServiceFilter -> Bool) -> Eq ServiceFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceFilter -> ServiceFilter -> Bool
$c/= :: ServiceFilter -> ServiceFilter -> Bool
== :: ServiceFilter -> ServiceFilter -> Bool
$c== :: ServiceFilter -> ServiceFilter -> Bool
Prelude.Eq, ReadPrec [ServiceFilter]
ReadPrec ServiceFilter
Int -> ReadS ServiceFilter
ReadS [ServiceFilter]
(Int -> ReadS ServiceFilter)
-> ReadS [ServiceFilter]
-> ReadPrec ServiceFilter
-> ReadPrec [ServiceFilter]
-> Read ServiceFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceFilter]
$creadListPrec :: ReadPrec [ServiceFilter]
readPrec :: ReadPrec ServiceFilter
$creadPrec :: ReadPrec ServiceFilter
readList :: ReadS [ServiceFilter]
$creadList :: ReadS [ServiceFilter]
readsPrec :: Int -> ReadS ServiceFilter
$creadsPrec :: Int -> ReadS ServiceFilter
Prelude.Read, Int -> ServiceFilter -> ShowS
[ServiceFilter] -> ShowS
ServiceFilter -> String
(Int -> ServiceFilter -> ShowS)
-> (ServiceFilter -> String)
-> ([ServiceFilter] -> ShowS)
-> Show ServiceFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceFilter] -> ShowS
$cshowList :: [ServiceFilter] -> ShowS
show :: ServiceFilter -> String
$cshow :: ServiceFilter -> String
showsPrec :: Int -> ServiceFilter -> ShowS
$cshowsPrec :: Int -> ServiceFilter -> ShowS
Prelude.Show, (forall x. ServiceFilter -> Rep ServiceFilter x)
-> (forall x. Rep ServiceFilter x -> ServiceFilter)
-> Generic ServiceFilter
forall x. Rep ServiceFilter x -> ServiceFilter
forall x. ServiceFilter -> Rep ServiceFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceFilter x -> ServiceFilter
$cfrom :: forall x. ServiceFilter -> Rep ServiceFilter x
Prelude.Generic)
newServiceFilter ::
ServiceFilterName ->
ServiceFilter
newServiceFilter :: ServiceFilterName -> ServiceFilter
newServiceFilter ServiceFilterName
pName_ =
ServiceFilter' :: Maybe FilterCondition
-> ServiceFilterName -> [Text] -> ServiceFilter
ServiceFilter'
{ $sel:condition:ServiceFilter' :: Maybe FilterCondition
condition = Maybe FilterCondition
forall a. Maybe a
Prelude.Nothing,
$sel:name:ServiceFilter' :: ServiceFilterName
name = ServiceFilterName
pName_,
$sel:values:ServiceFilter' :: [Text]
values = [Text]
forall a. Monoid a => a
Prelude.mempty
}
serviceFilter_condition :: Lens.Lens' ServiceFilter (Prelude.Maybe FilterCondition)
serviceFilter_condition :: (Maybe FilterCondition -> f (Maybe FilterCondition))
-> ServiceFilter -> f ServiceFilter
serviceFilter_condition = (ServiceFilter -> Maybe FilterCondition)
-> (ServiceFilter -> Maybe FilterCondition -> ServiceFilter)
-> Lens
ServiceFilter
ServiceFilter
(Maybe FilterCondition)
(Maybe FilterCondition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceFilter' {Maybe FilterCondition
condition :: Maybe FilterCondition
$sel:condition:ServiceFilter' :: ServiceFilter -> Maybe FilterCondition
condition} -> Maybe FilterCondition
condition) (\s :: ServiceFilter
s@ServiceFilter' {} Maybe FilterCondition
a -> ServiceFilter
s {$sel:condition:ServiceFilter' :: Maybe FilterCondition
condition = Maybe FilterCondition
a} :: ServiceFilter)
serviceFilter_name :: Lens.Lens' ServiceFilter ServiceFilterName
serviceFilter_name :: (ServiceFilterName -> f ServiceFilterName)
-> ServiceFilter -> f ServiceFilter
serviceFilter_name = (ServiceFilter -> ServiceFilterName)
-> (ServiceFilter -> ServiceFilterName -> ServiceFilter)
-> Lens
ServiceFilter ServiceFilter ServiceFilterName ServiceFilterName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceFilter' {ServiceFilterName
name :: ServiceFilterName
$sel:name:ServiceFilter' :: ServiceFilter -> ServiceFilterName
name} -> ServiceFilterName
name) (\s :: ServiceFilter
s@ServiceFilter' {} ServiceFilterName
a -> ServiceFilter
s {$sel:name:ServiceFilter' :: ServiceFilterName
name = ServiceFilterName
a} :: ServiceFilter)
serviceFilter_values :: Lens.Lens' ServiceFilter [Prelude.Text]
serviceFilter_values :: ([Text] -> f [Text]) -> ServiceFilter -> f ServiceFilter
serviceFilter_values = (ServiceFilter -> [Text])
-> (ServiceFilter -> [Text] -> ServiceFilter)
-> Lens ServiceFilter ServiceFilter [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceFilter' {[Text]
values :: [Text]
$sel:values:ServiceFilter' :: ServiceFilter -> [Text]
values} -> [Text]
values) (\s :: ServiceFilter
s@ServiceFilter' {} [Text]
a -> ServiceFilter
s {$sel:values:ServiceFilter' :: [Text]
values = [Text]
a} :: ServiceFilter) (([Text] -> f [Text]) -> ServiceFilter -> f ServiceFilter)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ServiceFilter
-> f ServiceFilter
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 Prelude.Hashable ServiceFilter
instance Prelude.NFData ServiceFilter
instance Core.ToJSON ServiceFilter where
toJSON :: ServiceFilter -> Value
toJSON ServiceFilter' {[Text]
Maybe FilterCondition
ServiceFilterName
values :: [Text]
name :: ServiceFilterName
condition :: Maybe FilterCondition
$sel:values:ServiceFilter' :: ServiceFilter -> [Text]
$sel:name:ServiceFilter' :: ServiceFilter -> ServiceFilterName
$sel:condition:ServiceFilter' :: ServiceFilter -> Maybe FilterCondition
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Condition" Text -> FilterCondition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FilterCondition -> Pair) -> Maybe FilterCondition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterCondition
condition,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> ServiceFilterName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ServiceFilterName
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Values" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
values)
]
)