{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:condition:ServiceFilter' :: Maybe FilterCondition
condition = forall a. Maybe a
Prelude.Nothing,
$sel:name:ServiceFilter' :: ServiceFilterName
name = ServiceFilterName
pName_,
$sel:values:ServiceFilter' :: [Text]
values = forall a. Monoid a => a
Prelude.mempty
}
serviceFilter_condition :: Lens.Lens' ServiceFilter (Prelude.Maybe FilterCondition)
serviceFilter_condition :: Lens' ServiceFilter (Maybe FilterCondition)
serviceFilter_condition = 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 :: Lens' ServiceFilter ServiceFilterName
serviceFilter_name = 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 :: Lens' ServiceFilter [Text]
serviceFilter_values = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable ServiceFilter where
hashWithSalt :: Int -> ServiceFilter -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FilterCondition
condition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ServiceFilterName
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
values
instance Prelude.NFData ServiceFilter where
rnf :: ServiceFilter -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe FilterCondition
condition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ServiceFilterName
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
values
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Condition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterCondition
condition,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ServiceFilterName
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
values)
]
)