{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53Resolver.Types.ResolverRule
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Resolver.Types.ResolverRule where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Resolver.Types.ResolverRuleStatus
import Amazonka.Route53Resolver.Types.RuleTypeOption
import Amazonka.Route53Resolver.Types.ShareStatus
import Amazonka.Route53Resolver.Types.TargetAddress

-- | For queries that originate in your VPC, detailed information about a
-- Resolver rule, which specifies how to route DNS queries out of the VPC.
-- The @ResolverRule@ parameter appears in the response to a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_CreateResolverRule.html CreateResolverRule>,
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_DeleteResolverRule.html DeleteResolverRule>,
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverRule.html GetResolverRule>,
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_ListResolverRules.html ListResolverRules>,
-- or
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_UpdateResolverRule.html UpdateResolverRule>
-- request.
--
-- /See:/ 'newResolverRule' smart constructor.
data ResolverRule = ResolverRule'
  { -- | The date and time that the Resolver rule was created, in Unix time
    -- format and Coordinated Universal Time (UTC).
    ResolverRule -> Maybe Text
creationTime :: Prelude.Maybe Prelude.Text,
    -- | A code that specifies the current status of the Resolver rule.
    ResolverRule -> Maybe ResolverRuleStatus
status :: Prelude.Maybe ResolverRuleStatus,
    -- | The ARN (Amazon Resource Name) for the Resolver rule specified by @Id@.
    ResolverRule -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the endpoint that the rule is associated with.
    ResolverRule -> Maybe Text
resolverEndpointId :: Prelude.Maybe Prelude.Text,
    -- | A unique string that you specified when you created the Resolver rule.
    -- @CreatorRequestId@ identifies the request and allows failed requests to
    -- be retried without the risk of running the operation twice.
    ResolverRule -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
    -- | An array that contains the IP addresses and ports that an outbound
    -- endpoint forwards DNS queries to. Typically, these are the IP addresses
    -- of DNS resolvers on your network. Specify IPv4 addresses. IPv6 is not
    -- supported.
    ResolverRule -> Maybe (NonEmpty TargetAddress)
targetIps :: Prelude.Maybe (Prelude.NonEmpty TargetAddress),
    -- | The date and time that the Resolver rule was last updated, in Unix time
    -- format and Coordinated Universal Time (UTC).
    ResolverRule -> Maybe Text
modificationTime :: Prelude.Maybe Prelude.Text,
    -- | Whether the rule is shared and, if so, whether the current account is
    -- sharing the rule with another account, or another account is sharing the
    -- rule with the current account.
    ResolverRule -> Maybe ShareStatus
shareStatus :: Prelude.Maybe ShareStatus,
    -- | When a rule is shared with another Amazon Web Services account, the
    -- account ID of the account that the rule is shared with.
    ResolverRule -> Maybe Text
ownerId :: Prelude.Maybe Prelude.Text,
    -- | DNS queries for this domain name are forwarded to the IP addresses that
    -- are specified in @TargetIps@. If a query matches multiple Resolver rules
    -- (example.com and www.example.com), the query is routed using the
    -- Resolver rule that contains the most specific domain name
    -- (www.example.com).
    ResolverRule -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | A detailed description of the status of a Resolver rule.
    ResolverRule -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The name for the Resolver rule, which you specified when you created the
    -- Resolver rule.
    ResolverRule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID that Resolver assigned to the Resolver rule when you created it.
    ResolverRule -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | When you want to forward DNS queries for specified domain name to
    -- resolvers on your network, specify @FORWARD@.
    --
    -- When you have a forwarding rule to forward DNS queries for a domain to
    -- your network and you want Resolver to process queries for a subdomain of
    -- that domain, specify @SYSTEM@.
    --
    -- For example, to forward DNS queries for example.com to resolvers on your
    -- network, you create a rule and specify @FORWARD@ for @RuleType@. To then
    -- have Resolver process queries for apex.example.com, you create a rule
    -- and specify @SYSTEM@ for @RuleType@.
    --
    -- Currently, only Resolver can create rules that have a value of
    -- @RECURSIVE@ for @RuleType@.
    ResolverRule -> Maybe RuleTypeOption
ruleType :: Prelude.Maybe RuleTypeOption
  }
  deriving (ResolverRule -> ResolverRule -> Bool
(ResolverRule -> ResolverRule -> Bool)
-> (ResolverRule -> ResolverRule -> Bool) -> Eq ResolverRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolverRule -> ResolverRule -> Bool
$c/= :: ResolverRule -> ResolverRule -> Bool
== :: ResolverRule -> ResolverRule -> Bool
$c== :: ResolverRule -> ResolverRule -> Bool
Prelude.Eq, ReadPrec [ResolverRule]
ReadPrec ResolverRule
Int -> ReadS ResolverRule
ReadS [ResolverRule]
(Int -> ReadS ResolverRule)
-> ReadS [ResolverRule]
-> ReadPrec ResolverRule
-> ReadPrec [ResolverRule]
-> Read ResolverRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolverRule]
$creadListPrec :: ReadPrec [ResolverRule]
readPrec :: ReadPrec ResolverRule
$creadPrec :: ReadPrec ResolverRule
readList :: ReadS [ResolverRule]
$creadList :: ReadS [ResolverRule]
readsPrec :: Int -> ReadS ResolverRule
$creadsPrec :: Int -> ReadS ResolverRule
Prelude.Read, Int -> ResolverRule -> ShowS
[ResolverRule] -> ShowS
ResolverRule -> String
(Int -> ResolverRule -> ShowS)
-> (ResolverRule -> String)
-> ([ResolverRule] -> ShowS)
-> Show ResolverRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolverRule] -> ShowS
$cshowList :: [ResolverRule] -> ShowS
show :: ResolverRule -> String
$cshow :: ResolverRule -> String
showsPrec :: Int -> ResolverRule -> ShowS
$cshowsPrec :: Int -> ResolverRule -> ShowS
Prelude.Show, (forall x. ResolverRule -> Rep ResolverRule x)
-> (forall x. Rep ResolverRule x -> ResolverRule)
-> Generic ResolverRule
forall x. Rep ResolverRule x -> ResolverRule
forall x. ResolverRule -> Rep ResolverRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolverRule x -> ResolverRule
$cfrom :: forall x. ResolverRule -> Rep ResolverRule x
Prelude.Generic)

-- |
-- Create a value of 'ResolverRule' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'creationTime', 'resolverRule_creationTime' - The date and time that the Resolver rule was created, in Unix time
-- format and Coordinated Universal Time (UTC).
--
-- 'status', 'resolverRule_status' - A code that specifies the current status of the Resolver rule.
--
-- 'arn', 'resolverRule_arn' - The ARN (Amazon Resource Name) for the Resolver rule specified by @Id@.
--
-- 'resolverEndpointId', 'resolverRule_resolverEndpointId' - The ID of the endpoint that the rule is associated with.
--
-- 'creatorRequestId', 'resolverRule_creatorRequestId' - A unique string that you specified when you created the Resolver rule.
-- @CreatorRequestId@ identifies the request and allows failed requests to
-- be retried without the risk of running the operation twice.
--
-- 'targetIps', 'resolverRule_targetIps' - An array that contains the IP addresses and ports that an outbound
-- endpoint forwards DNS queries to. Typically, these are the IP addresses
-- of DNS resolvers on your network. Specify IPv4 addresses. IPv6 is not
-- supported.
--
-- 'modificationTime', 'resolverRule_modificationTime' - The date and time that the Resolver rule was last updated, in Unix time
-- format and Coordinated Universal Time (UTC).
--
-- 'shareStatus', 'resolverRule_shareStatus' - Whether the rule is shared and, if so, whether the current account is
-- sharing the rule with another account, or another account is sharing the
-- rule with the current account.
--
-- 'ownerId', 'resolverRule_ownerId' - When a rule is shared with another Amazon Web Services account, the
-- account ID of the account that the rule is shared with.
--
-- 'domainName', 'resolverRule_domainName' - DNS queries for this domain name are forwarded to the IP addresses that
-- are specified in @TargetIps@. If a query matches multiple Resolver rules
-- (example.com and www.example.com), the query is routed using the
-- Resolver rule that contains the most specific domain name
-- (www.example.com).
--
-- 'statusMessage', 'resolverRule_statusMessage' - A detailed description of the status of a Resolver rule.
--
-- 'name', 'resolverRule_name' - The name for the Resolver rule, which you specified when you created the
-- Resolver rule.
--
-- 'id', 'resolverRule_id' - The ID that Resolver assigned to the Resolver rule when you created it.
--
-- 'ruleType', 'resolverRule_ruleType' - When you want to forward DNS queries for specified domain name to
-- resolvers on your network, specify @FORWARD@.
--
-- When you have a forwarding rule to forward DNS queries for a domain to
-- your network and you want Resolver to process queries for a subdomain of
-- that domain, specify @SYSTEM@.
--
-- For example, to forward DNS queries for example.com to resolvers on your
-- network, you create a rule and specify @FORWARD@ for @RuleType@. To then
-- have Resolver process queries for apex.example.com, you create a rule
-- and specify @SYSTEM@ for @RuleType@.
--
-- Currently, only Resolver can create rules that have a value of
-- @RECURSIVE@ for @RuleType@.
newResolverRule ::
  ResolverRule
newResolverRule :: ResolverRule
newResolverRule =
  ResolverRule' :: Maybe Text
-> Maybe ResolverRuleStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty TargetAddress)
-> Maybe Text
-> Maybe ShareStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe RuleTypeOption
-> ResolverRule
ResolverRule'
    { $sel:creationTime:ResolverRule' :: Maybe Text
creationTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ResolverRule' :: Maybe ResolverRuleStatus
status = Maybe ResolverRuleStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ResolverRule' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resolverEndpointId:ResolverRule' :: Maybe Text
resolverEndpointId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creatorRequestId:ResolverRule' :: Maybe Text
creatorRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetIps:ResolverRule' :: Maybe (NonEmpty TargetAddress)
targetIps = Maybe (NonEmpty TargetAddress)
forall a. Maybe a
Prelude.Nothing,
      $sel:modificationTime:ResolverRule' :: Maybe Text
modificationTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:shareStatus:ResolverRule' :: Maybe ShareStatus
shareStatus = Maybe ShareStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:ownerId:ResolverRule' :: Maybe Text
ownerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:ResolverRule' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ResolverRule' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResolverRule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ResolverRule' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleType:ResolverRule' :: Maybe RuleTypeOption
ruleType = Maybe RuleTypeOption
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that the Resolver rule was created, in Unix time
-- format and Coordinated Universal Time (UTC).
resolverRule_creationTime :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_creationTime :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_creationTime = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
creationTime :: Maybe Text
$sel:creationTime:ResolverRule' :: ResolverRule -> Maybe Text
creationTime} -> Maybe Text
creationTime) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:creationTime:ResolverRule' :: Maybe Text
creationTime = Maybe Text
a} :: ResolverRule)

-- | A code that specifies the current status of the Resolver rule.
resolverRule_status :: Lens.Lens' ResolverRule (Prelude.Maybe ResolverRuleStatus)
resolverRule_status :: (Maybe ResolverRuleStatus -> f (Maybe ResolverRuleStatus))
-> ResolverRule -> f ResolverRule
resolverRule_status = (ResolverRule -> Maybe ResolverRuleStatus)
-> (ResolverRule -> Maybe ResolverRuleStatus -> ResolverRule)
-> Lens
     ResolverRule
     ResolverRule
     (Maybe ResolverRuleStatus)
     (Maybe ResolverRuleStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe ResolverRuleStatus
status :: Maybe ResolverRuleStatus
$sel:status:ResolverRule' :: ResolverRule -> Maybe ResolverRuleStatus
status} -> Maybe ResolverRuleStatus
status) (\s :: ResolverRule
s@ResolverRule' {} Maybe ResolverRuleStatus
a -> ResolverRule
s {$sel:status:ResolverRule' :: Maybe ResolverRuleStatus
status = Maybe ResolverRuleStatus
a} :: ResolverRule)

-- | The ARN (Amazon Resource Name) for the Resolver rule specified by @Id@.
resolverRule_arn :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_arn :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_arn = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
arn :: Maybe Text
$sel:arn:ResolverRule' :: ResolverRule -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:arn:ResolverRule' :: Maybe Text
arn = Maybe Text
a} :: ResolverRule)

-- | The ID of the endpoint that the rule is associated with.
resolverRule_resolverEndpointId :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_resolverEndpointId :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_resolverEndpointId = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
resolverEndpointId :: Maybe Text
$sel:resolverEndpointId:ResolverRule' :: ResolverRule -> Maybe Text
resolverEndpointId} -> Maybe Text
resolverEndpointId) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:resolverEndpointId:ResolverRule' :: Maybe Text
resolverEndpointId = Maybe Text
a} :: ResolverRule)

-- | A unique string that you specified when you created the Resolver rule.
-- @CreatorRequestId@ identifies the request and allows failed requests to
-- be retried without the risk of running the operation twice.
resolverRule_creatorRequestId :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_creatorRequestId :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_creatorRequestId = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:ResolverRule' :: ResolverRule -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:creatorRequestId:ResolverRule' :: Maybe Text
creatorRequestId = Maybe Text
a} :: ResolverRule)

-- | An array that contains the IP addresses and ports that an outbound
-- endpoint forwards DNS queries to. Typically, these are the IP addresses
-- of DNS resolvers on your network. Specify IPv4 addresses. IPv6 is not
-- supported.
resolverRule_targetIps :: Lens.Lens' ResolverRule (Prelude.Maybe (Prelude.NonEmpty TargetAddress))
resolverRule_targetIps :: (Maybe (NonEmpty TargetAddress)
 -> f (Maybe (NonEmpty TargetAddress)))
-> ResolverRule -> f ResolverRule
resolverRule_targetIps = (ResolverRule -> Maybe (NonEmpty TargetAddress))
-> (ResolverRule -> Maybe (NonEmpty TargetAddress) -> ResolverRule)
-> Lens
     ResolverRule
     ResolverRule
     (Maybe (NonEmpty TargetAddress))
     (Maybe (NonEmpty TargetAddress))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe (NonEmpty TargetAddress)
targetIps :: Maybe (NonEmpty TargetAddress)
$sel:targetIps:ResolverRule' :: ResolverRule -> Maybe (NonEmpty TargetAddress)
targetIps} -> Maybe (NonEmpty TargetAddress)
targetIps) (\s :: ResolverRule
s@ResolverRule' {} Maybe (NonEmpty TargetAddress)
a -> ResolverRule
s {$sel:targetIps:ResolverRule' :: Maybe (NonEmpty TargetAddress)
targetIps = Maybe (NonEmpty TargetAddress)
a} :: ResolverRule) ((Maybe (NonEmpty TargetAddress)
  -> f (Maybe (NonEmpty TargetAddress)))
 -> ResolverRule -> f ResolverRule)
-> ((Maybe (NonEmpty TargetAddress)
     -> f (Maybe (NonEmpty TargetAddress)))
    -> Maybe (NonEmpty TargetAddress)
    -> f (Maybe (NonEmpty TargetAddress)))
-> (Maybe (NonEmpty TargetAddress)
    -> f (Maybe (NonEmpty TargetAddress)))
-> ResolverRule
-> f ResolverRule
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

-- | The date and time that the Resolver rule was last updated, in Unix time
-- format and Coordinated Universal Time (UTC).
resolverRule_modificationTime :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_modificationTime :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_modificationTime = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
modificationTime :: Maybe Text
$sel:modificationTime:ResolverRule' :: ResolverRule -> Maybe Text
modificationTime} -> Maybe Text
modificationTime) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:modificationTime:ResolverRule' :: Maybe Text
modificationTime = Maybe Text
a} :: ResolverRule)

-- | Whether the rule is shared and, if so, whether the current account is
-- sharing the rule with another account, or another account is sharing the
-- rule with the current account.
resolverRule_shareStatus :: Lens.Lens' ResolverRule (Prelude.Maybe ShareStatus)
resolverRule_shareStatus :: (Maybe ShareStatus -> f (Maybe ShareStatus))
-> ResolverRule -> f ResolverRule
resolverRule_shareStatus = (ResolverRule -> Maybe ShareStatus)
-> (ResolverRule -> Maybe ShareStatus -> ResolverRule)
-> Lens
     ResolverRule ResolverRule (Maybe ShareStatus) (Maybe ShareStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe ShareStatus
shareStatus :: Maybe ShareStatus
$sel:shareStatus:ResolverRule' :: ResolverRule -> Maybe ShareStatus
shareStatus} -> Maybe ShareStatus
shareStatus) (\s :: ResolverRule
s@ResolverRule' {} Maybe ShareStatus
a -> ResolverRule
s {$sel:shareStatus:ResolverRule' :: Maybe ShareStatus
shareStatus = Maybe ShareStatus
a} :: ResolverRule)

-- | When a rule is shared with another Amazon Web Services account, the
-- account ID of the account that the rule is shared with.
resolverRule_ownerId :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_ownerId :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_ownerId = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
ownerId :: Maybe Text
$sel:ownerId:ResolverRule' :: ResolverRule -> Maybe Text
ownerId} -> Maybe Text
ownerId) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:ownerId:ResolverRule' :: Maybe Text
ownerId = Maybe Text
a} :: ResolverRule)

-- | DNS queries for this domain name are forwarded to the IP addresses that
-- are specified in @TargetIps@. If a query matches multiple Resolver rules
-- (example.com and www.example.com), the query is routed using the
-- Resolver rule that contains the most specific domain name
-- (www.example.com).
resolverRule_domainName :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_domainName :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_domainName = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
domainName :: Maybe Text
$sel:domainName:ResolverRule' :: ResolverRule -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:domainName:ResolverRule' :: Maybe Text
domainName = Maybe Text
a} :: ResolverRule)

-- | A detailed description of the status of a Resolver rule.
resolverRule_statusMessage :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_statusMessage :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_statusMessage = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ResolverRule' :: ResolverRule -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:statusMessage:ResolverRule' :: Maybe Text
statusMessage = Maybe Text
a} :: ResolverRule)

-- | The name for the Resolver rule, which you specified when you created the
-- Resolver rule.
resolverRule_name :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_name :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_name = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
name :: Maybe Text
$sel:name:ResolverRule' :: ResolverRule -> Maybe Text
name} -> Maybe Text
name) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:name:ResolverRule' :: Maybe Text
name = Maybe Text
a} :: ResolverRule)

-- | The ID that Resolver assigned to the Resolver rule when you created it.
resolverRule_id :: Lens.Lens' ResolverRule (Prelude.Maybe Prelude.Text)
resolverRule_id :: (Maybe Text -> f (Maybe Text)) -> ResolverRule -> f ResolverRule
resolverRule_id = (ResolverRule -> Maybe Text)
-> (ResolverRule -> Maybe Text -> ResolverRule)
-> Lens ResolverRule ResolverRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe Text
id :: Maybe Text
$sel:id:ResolverRule' :: ResolverRule -> Maybe Text
id} -> Maybe Text
id) (\s :: ResolverRule
s@ResolverRule' {} Maybe Text
a -> ResolverRule
s {$sel:id:ResolverRule' :: Maybe Text
id = Maybe Text
a} :: ResolverRule)

-- | When you want to forward DNS queries for specified domain name to
-- resolvers on your network, specify @FORWARD@.
--
-- When you have a forwarding rule to forward DNS queries for a domain to
-- your network and you want Resolver to process queries for a subdomain of
-- that domain, specify @SYSTEM@.
--
-- For example, to forward DNS queries for example.com to resolvers on your
-- network, you create a rule and specify @FORWARD@ for @RuleType@. To then
-- have Resolver process queries for apex.example.com, you create a rule
-- and specify @SYSTEM@ for @RuleType@.
--
-- Currently, only Resolver can create rules that have a value of
-- @RECURSIVE@ for @RuleType@.
resolverRule_ruleType :: Lens.Lens' ResolverRule (Prelude.Maybe RuleTypeOption)
resolverRule_ruleType :: (Maybe RuleTypeOption -> f (Maybe RuleTypeOption))
-> ResolverRule -> f ResolverRule
resolverRule_ruleType = (ResolverRule -> Maybe RuleTypeOption)
-> (ResolverRule -> Maybe RuleTypeOption -> ResolverRule)
-> Lens
     ResolverRule
     ResolverRule
     (Maybe RuleTypeOption)
     (Maybe RuleTypeOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRule' {Maybe RuleTypeOption
ruleType :: Maybe RuleTypeOption
$sel:ruleType:ResolverRule' :: ResolverRule -> Maybe RuleTypeOption
ruleType} -> Maybe RuleTypeOption
ruleType) (\s :: ResolverRule
s@ResolverRule' {} Maybe RuleTypeOption
a -> ResolverRule
s {$sel:ruleType:ResolverRule' :: Maybe RuleTypeOption
ruleType = Maybe RuleTypeOption
a} :: ResolverRule)

instance Core.FromJSON ResolverRule where
  parseJSON :: Value -> Parser ResolverRule
parseJSON =
    String
-> (Object -> Parser ResolverRule) -> Value -> Parser ResolverRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResolverRule"
      ( \Object
x ->
          Maybe Text
-> Maybe ResolverRuleStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty TargetAddress)
-> Maybe Text
-> Maybe ShareStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe RuleTypeOption
-> ResolverRule
ResolverRule'
            (Maybe Text
 -> Maybe ResolverRuleStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty TargetAddress)
 -> Maybe Text
 -> Maybe ShareStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe RuleTypeOption
 -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe ResolverRuleStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty TargetAddress)
      -> Maybe Text
      -> Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe ResolverRuleStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty TargetAddress)
   -> Maybe Text
   -> Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe ResolverRuleStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty TargetAddress)
      -> Maybe Text
      -> Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResolverRuleStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty TargetAddress)
   -> Maybe Text
   -> Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty TargetAddress)
      -> Maybe Text
      -> Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty TargetAddress)
   -> Maybe Text
   -> Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty TargetAddress)
      -> Maybe Text
      -> Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResolverEndpointId")
            Parser
  (Maybe Text
   -> Maybe (NonEmpty TargetAddress)
   -> Maybe Text
   -> Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty TargetAddress)
      -> Maybe Text
      -> Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatorRequestId")
            Parser
  (Maybe (NonEmpty TargetAddress)
   -> Maybe Text
   -> Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe (NonEmpty TargetAddress))
-> Parser
     (Maybe Text
      -> Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty TargetAddress))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetIps")
            Parser
  (Maybe Text
   -> Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe ShareStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ModificationTime")
            Parser
  (Maybe ShareStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe ShareStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ShareStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ShareStatus")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OwnerId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe RuleTypeOption
      -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DomainName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe RuleTypeOption
   -> ResolverRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe RuleTypeOption -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusMessage")
            Parser
  (Maybe Text -> Maybe Text -> Maybe RuleTypeOption -> ResolverRule)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe RuleTypeOption -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> Maybe RuleTypeOption -> ResolverRule)
-> Parser (Maybe Text)
-> Parser (Maybe RuleTypeOption -> ResolverRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser (Maybe RuleTypeOption -> ResolverRule)
-> Parser (Maybe RuleTypeOption) -> Parser ResolverRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RuleTypeOption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RuleType")
      )

instance Prelude.Hashable ResolverRule

instance Prelude.NFData ResolverRule