{-# 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.Route53Resolver.Types.ResolverRuleConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Resolver.Types.TargetAddress
data ResolverRuleConfig = ResolverRuleConfig'
{
ResolverRuleConfig -> Maybe Text
resolverEndpointId :: Prelude.Maybe Prelude.Text,
ResolverRuleConfig -> Maybe (NonEmpty TargetAddress)
targetIps :: Prelude.Maybe (Prelude.NonEmpty TargetAddress),
ResolverRuleConfig -> Maybe Text
name :: Prelude.Maybe Prelude.Text
}
deriving (ResolverRuleConfig -> ResolverRuleConfig -> Bool
(ResolverRuleConfig -> ResolverRuleConfig -> Bool)
-> (ResolverRuleConfig -> ResolverRuleConfig -> Bool)
-> Eq ResolverRuleConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolverRuleConfig -> ResolverRuleConfig -> Bool
$c/= :: ResolverRuleConfig -> ResolverRuleConfig -> Bool
== :: ResolverRuleConfig -> ResolverRuleConfig -> Bool
$c== :: ResolverRuleConfig -> ResolverRuleConfig -> Bool
Prelude.Eq, ReadPrec [ResolverRuleConfig]
ReadPrec ResolverRuleConfig
Int -> ReadS ResolverRuleConfig
ReadS [ResolverRuleConfig]
(Int -> ReadS ResolverRuleConfig)
-> ReadS [ResolverRuleConfig]
-> ReadPrec ResolverRuleConfig
-> ReadPrec [ResolverRuleConfig]
-> Read ResolverRuleConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolverRuleConfig]
$creadListPrec :: ReadPrec [ResolverRuleConfig]
readPrec :: ReadPrec ResolverRuleConfig
$creadPrec :: ReadPrec ResolverRuleConfig
readList :: ReadS [ResolverRuleConfig]
$creadList :: ReadS [ResolverRuleConfig]
readsPrec :: Int -> ReadS ResolverRuleConfig
$creadsPrec :: Int -> ReadS ResolverRuleConfig
Prelude.Read, Int -> ResolverRuleConfig -> ShowS
[ResolverRuleConfig] -> ShowS
ResolverRuleConfig -> String
(Int -> ResolverRuleConfig -> ShowS)
-> (ResolverRuleConfig -> String)
-> ([ResolverRuleConfig] -> ShowS)
-> Show ResolverRuleConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolverRuleConfig] -> ShowS
$cshowList :: [ResolverRuleConfig] -> ShowS
show :: ResolverRuleConfig -> String
$cshow :: ResolverRuleConfig -> String
showsPrec :: Int -> ResolverRuleConfig -> ShowS
$cshowsPrec :: Int -> ResolverRuleConfig -> ShowS
Prelude.Show, (forall x. ResolverRuleConfig -> Rep ResolverRuleConfig x)
-> (forall x. Rep ResolverRuleConfig x -> ResolverRuleConfig)
-> Generic ResolverRuleConfig
forall x. Rep ResolverRuleConfig x -> ResolverRuleConfig
forall x. ResolverRuleConfig -> Rep ResolverRuleConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolverRuleConfig x -> ResolverRuleConfig
$cfrom :: forall x. ResolverRuleConfig -> Rep ResolverRuleConfig x
Prelude.Generic)
newResolverRuleConfig ::
ResolverRuleConfig
newResolverRuleConfig :: ResolverRuleConfig
newResolverRuleConfig =
ResolverRuleConfig' :: Maybe Text
-> Maybe (NonEmpty TargetAddress)
-> Maybe Text
-> ResolverRuleConfig
ResolverRuleConfig'
{ $sel:resolverEndpointId:ResolverRuleConfig' :: Maybe Text
resolverEndpointId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetIps:ResolverRuleConfig' :: Maybe (NonEmpty TargetAddress)
targetIps = Maybe (NonEmpty TargetAddress)
forall a. Maybe a
Prelude.Nothing,
$sel:name:ResolverRuleConfig' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
resolverRuleConfig_resolverEndpointId :: Lens.Lens' ResolverRuleConfig (Prelude.Maybe Prelude.Text)
resolverRuleConfig_resolverEndpointId :: (Maybe Text -> f (Maybe Text))
-> ResolverRuleConfig -> f ResolverRuleConfig
resolverRuleConfig_resolverEndpointId = (ResolverRuleConfig -> Maybe Text)
-> (ResolverRuleConfig -> Maybe Text -> ResolverRuleConfig)
-> Lens
ResolverRuleConfig ResolverRuleConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleConfig' {Maybe Text
resolverEndpointId :: Maybe Text
$sel:resolverEndpointId:ResolverRuleConfig' :: ResolverRuleConfig -> Maybe Text
resolverEndpointId} -> Maybe Text
resolverEndpointId) (\s :: ResolverRuleConfig
s@ResolverRuleConfig' {} Maybe Text
a -> ResolverRuleConfig
s {$sel:resolverEndpointId:ResolverRuleConfig' :: Maybe Text
resolverEndpointId = Maybe Text
a} :: ResolverRuleConfig)
resolverRuleConfig_targetIps :: Lens.Lens' ResolverRuleConfig (Prelude.Maybe (Prelude.NonEmpty TargetAddress))
resolverRuleConfig_targetIps :: (Maybe (NonEmpty TargetAddress)
-> f (Maybe (NonEmpty TargetAddress)))
-> ResolverRuleConfig -> f ResolverRuleConfig
resolverRuleConfig_targetIps = (ResolverRuleConfig -> Maybe (NonEmpty TargetAddress))
-> (ResolverRuleConfig
-> Maybe (NonEmpty TargetAddress) -> ResolverRuleConfig)
-> Lens
ResolverRuleConfig
ResolverRuleConfig
(Maybe (NonEmpty TargetAddress))
(Maybe (NonEmpty TargetAddress))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleConfig' {Maybe (NonEmpty TargetAddress)
targetIps :: Maybe (NonEmpty TargetAddress)
$sel:targetIps:ResolverRuleConfig' :: ResolverRuleConfig -> Maybe (NonEmpty TargetAddress)
targetIps} -> Maybe (NonEmpty TargetAddress)
targetIps) (\s :: ResolverRuleConfig
s@ResolverRuleConfig' {} Maybe (NonEmpty TargetAddress)
a -> ResolverRuleConfig
s {$sel:targetIps:ResolverRuleConfig' :: Maybe (NonEmpty TargetAddress)
targetIps = Maybe (NonEmpty TargetAddress)
a} :: ResolverRuleConfig) ((Maybe (NonEmpty TargetAddress)
-> f (Maybe (NonEmpty TargetAddress)))
-> ResolverRuleConfig -> f ResolverRuleConfig)
-> ((Maybe (NonEmpty TargetAddress)
-> f (Maybe (NonEmpty TargetAddress)))
-> Maybe (NonEmpty TargetAddress)
-> f (Maybe (NonEmpty TargetAddress)))
-> (Maybe (NonEmpty TargetAddress)
-> f (Maybe (NonEmpty TargetAddress)))
-> ResolverRuleConfig
-> f ResolverRuleConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty TargetAddress)
(NonEmpty TargetAddress)
(NonEmpty TargetAddress)
(NonEmpty TargetAddress)
-> Iso
(Maybe (NonEmpty TargetAddress))
(Maybe (NonEmpty TargetAddress))
(Maybe (NonEmpty TargetAddress))
(Maybe (NonEmpty TargetAddress))
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
(NonEmpty TargetAddress)
(NonEmpty TargetAddress)
(NonEmpty TargetAddress)
(NonEmpty TargetAddress)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
resolverRuleConfig_name :: Lens.Lens' ResolverRuleConfig (Prelude.Maybe Prelude.Text)
resolverRuleConfig_name :: (Maybe Text -> f (Maybe Text))
-> ResolverRuleConfig -> f ResolverRuleConfig
resolverRuleConfig_name = (ResolverRuleConfig -> Maybe Text)
-> (ResolverRuleConfig -> Maybe Text -> ResolverRuleConfig)
-> Lens
ResolverRuleConfig ResolverRuleConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleConfig' {Maybe Text
name :: Maybe Text
$sel:name:ResolverRuleConfig' :: ResolverRuleConfig -> Maybe Text
name} -> Maybe Text
name) (\s :: ResolverRuleConfig
s@ResolverRuleConfig' {} Maybe Text
a -> ResolverRuleConfig
s {$sel:name:ResolverRuleConfig' :: Maybe Text
name = Maybe Text
a} :: ResolverRuleConfig)
instance Prelude.Hashable ResolverRuleConfig
instance Prelude.NFData ResolverRuleConfig
instance Core.ToJSON ResolverRuleConfig where
toJSON :: ResolverRuleConfig -> Value
toJSON ResolverRuleConfig' {Maybe (NonEmpty TargetAddress)
Maybe Text
name :: Maybe Text
targetIps :: Maybe (NonEmpty TargetAddress)
resolverEndpointId :: Maybe Text
$sel:name:ResolverRuleConfig' :: ResolverRuleConfig -> Maybe Text
$sel:targetIps:ResolverRuleConfig' :: ResolverRuleConfig -> Maybe (NonEmpty TargetAddress)
$sel:resolverEndpointId:ResolverRuleConfig' :: ResolverRuleConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ResolverEndpointId" 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
resolverEndpointId,
(Text
"TargetIps" Text -> NonEmpty TargetAddress -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty TargetAddress -> Pair)
-> Maybe (NonEmpty TargetAddress) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty TargetAddress)
targetIps,
(Text
"Name" 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
name
]
)