{-# 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.ResolverRuleAssociation
-- 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.ResolverRuleAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Resolver.Types.ResolverRuleAssociationStatus

-- | In the response to an
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_AssociateResolverRule.html AssociateResolverRule>,
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_DisassociateResolverRule.html DisassociateResolverRule>,
-- or
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_ListResolverRuleAssociations.html ListResolverRuleAssociations>
-- request, provides information about an association between a Resolver
-- rule and a VPC. The association determines which DNS queries that
-- originate in the VPC are forwarded to your network.
--
-- /See:/ 'newResolverRuleAssociation' smart constructor.
data ResolverRuleAssociation = ResolverRuleAssociation'
  { -- | A code that specifies the current status of the association between a
    -- Resolver rule and a VPC.
    ResolverRuleAssociation -> Maybe ResolverRuleAssociationStatus
status :: Prelude.Maybe ResolverRuleAssociationStatus,
    -- | The ID of the Resolver rule that you associated with the VPC that is
    -- specified by @VPCId@.
    ResolverRuleAssociation -> Maybe Text
resolverRuleId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the VPC that you associated the Resolver rule with.
    ResolverRuleAssociation -> Maybe Text
vPCId :: Prelude.Maybe Prelude.Text,
    -- | A detailed description of the status of the association between a
    -- Resolver rule and a VPC.
    ResolverRuleAssociation -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The name of an association between a Resolver rule and a VPC.
    ResolverRuleAssociation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the association between a Resolver rule and a VPC. Resolver
    -- assigns this value when you submit an
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_AssociateResolverRule.html AssociateResolverRule>
    -- request.
    ResolverRuleAssociation -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (ResolverRuleAssociation -> ResolverRuleAssociation -> Bool
(ResolverRuleAssociation -> ResolverRuleAssociation -> Bool)
-> (ResolverRuleAssociation -> ResolverRuleAssociation -> Bool)
-> Eq ResolverRuleAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolverRuleAssociation -> ResolverRuleAssociation -> Bool
$c/= :: ResolverRuleAssociation -> ResolverRuleAssociation -> Bool
== :: ResolverRuleAssociation -> ResolverRuleAssociation -> Bool
$c== :: ResolverRuleAssociation -> ResolverRuleAssociation -> Bool
Prelude.Eq, ReadPrec [ResolverRuleAssociation]
ReadPrec ResolverRuleAssociation
Int -> ReadS ResolverRuleAssociation
ReadS [ResolverRuleAssociation]
(Int -> ReadS ResolverRuleAssociation)
-> ReadS [ResolverRuleAssociation]
-> ReadPrec ResolverRuleAssociation
-> ReadPrec [ResolverRuleAssociation]
-> Read ResolverRuleAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolverRuleAssociation]
$creadListPrec :: ReadPrec [ResolverRuleAssociation]
readPrec :: ReadPrec ResolverRuleAssociation
$creadPrec :: ReadPrec ResolverRuleAssociation
readList :: ReadS [ResolverRuleAssociation]
$creadList :: ReadS [ResolverRuleAssociation]
readsPrec :: Int -> ReadS ResolverRuleAssociation
$creadsPrec :: Int -> ReadS ResolverRuleAssociation
Prelude.Read, Int -> ResolverRuleAssociation -> ShowS
[ResolverRuleAssociation] -> ShowS
ResolverRuleAssociation -> String
(Int -> ResolverRuleAssociation -> ShowS)
-> (ResolverRuleAssociation -> String)
-> ([ResolverRuleAssociation] -> ShowS)
-> Show ResolverRuleAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolverRuleAssociation] -> ShowS
$cshowList :: [ResolverRuleAssociation] -> ShowS
show :: ResolverRuleAssociation -> String
$cshow :: ResolverRuleAssociation -> String
showsPrec :: Int -> ResolverRuleAssociation -> ShowS
$cshowsPrec :: Int -> ResolverRuleAssociation -> ShowS
Prelude.Show, (forall x.
 ResolverRuleAssociation -> Rep ResolverRuleAssociation x)
-> (forall x.
    Rep ResolverRuleAssociation x -> ResolverRuleAssociation)
-> Generic ResolverRuleAssociation
forall x. Rep ResolverRuleAssociation x -> ResolverRuleAssociation
forall x. ResolverRuleAssociation -> Rep ResolverRuleAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolverRuleAssociation x -> ResolverRuleAssociation
$cfrom :: forall x. ResolverRuleAssociation -> Rep ResolverRuleAssociation x
Prelude.Generic)

-- |
-- Create a value of 'ResolverRuleAssociation' 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:
--
-- 'status', 'resolverRuleAssociation_status' - A code that specifies the current status of the association between a
-- Resolver rule and a VPC.
--
-- 'resolverRuleId', 'resolverRuleAssociation_resolverRuleId' - The ID of the Resolver rule that you associated with the VPC that is
-- specified by @VPCId@.
--
-- 'vPCId', 'resolverRuleAssociation_vPCId' - The ID of the VPC that you associated the Resolver rule with.
--
-- 'statusMessage', 'resolverRuleAssociation_statusMessage' - A detailed description of the status of the association between a
-- Resolver rule and a VPC.
--
-- 'name', 'resolverRuleAssociation_name' - The name of an association between a Resolver rule and a VPC.
--
-- 'id', 'resolverRuleAssociation_id' - The ID of the association between a Resolver rule and a VPC. Resolver
-- assigns this value when you submit an
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_AssociateResolverRule.html AssociateResolverRule>
-- request.
newResolverRuleAssociation ::
  ResolverRuleAssociation
newResolverRuleAssociation :: ResolverRuleAssociation
newResolverRuleAssociation =
  ResolverRuleAssociation' :: Maybe ResolverRuleAssociationStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ResolverRuleAssociation
ResolverRuleAssociation'
    { $sel:status:ResolverRuleAssociation' :: Maybe ResolverRuleAssociationStatus
status = Maybe ResolverRuleAssociationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:resolverRuleId:ResolverRuleAssociation' :: Maybe Text
resolverRuleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vPCId:ResolverRuleAssociation' :: Maybe Text
vPCId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ResolverRuleAssociation' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResolverRuleAssociation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ResolverRuleAssociation' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A code that specifies the current status of the association between a
-- Resolver rule and a VPC.
resolverRuleAssociation_status :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe ResolverRuleAssociationStatus)
resolverRuleAssociation_status :: (Maybe ResolverRuleAssociationStatus
 -> f (Maybe ResolverRuleAssociationStatus))
-> ResolverRuleAssociation -> f ResolverRuleAssociation
resolverRuleAssociation_status = (ResolverRuleAssociation -> Maybe ResolverRuleAssociationStatus)
-> (ResolverRuleAssociation
    -> Maybe ResolverRuleAssociationStatus -> ResolverRuleAssociation)
-> Lens
     ResolverRuleAssociation
     ResolverRuleAssociation
     (Maybe ResolverRuleAssociationStatus)
     (Maybe ResolverRuleAssociationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleAssociation' {Maybe ResolverRuleAssociationStatus
status :: Maybe ResolverRuleAssociationStatus
$sel:status:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe ResolverRuleAssociationStatus
status} -> Maybe ResolverRuleAssociationStatus
status) (\s :: ResolverRuleAssociation
s@ResolverRuleAssociation' {} Maybe ResolverRuleAssociationStatus
a -> ResolverRuleAssociation
s {$sel:status:ResolverRuleAssociation' :: Maybe ResolverRuleAssociationStatus
status = Maybe ResolverRuleAssociationStatus
a} :: ResolverRuleAssociation)

-- | The ID of the Resolver rule that you associated with the VPC that is
-- specified by @VPCId@.
resolverRuleAssociation_resolverRuleId :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_resolverRuleId :: (Maybe Text -> f (Maybe Text))
-> ResolverRuleAssociation -> f ResolverRuleAssociation
resolverRuleAssociation_resolverRuleId = (ResolverRuleAssociation -> Maybe Text)
-> (ResolverRuleAssociation
    -> Maybe Text -> ResolverRuleAssociation)
-> Lens
     ResolverRuleAssociation
     ResolverRuleAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleAssociation' {Maybe Text
resolverRuleId :: Maybe Text
$sel:resolverRuleId:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
resolverRuleId} -> Maybe Text
resolverRuleId) (\s :: ResolverRuleAssociation
s@ResolverRuleAssociation' {} Maybe Text
a -> ResolverRuleAssociation
s {$sel:resolverRuleId:ResolverRuleAssociation' :: Maybe Text
resolverRuleId = Maybe Text
a} :: ResolverRuleAssociation)

-- | The ID of the VPC that you associated the Resolver rule with.
resolverRuleAssociation_vPCId :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_vPCId :: (Maybe Text -> f (Maybe Text))
-> ResolverRuleAssociation -> f ResolverRuleAssociation
resolverRuleAssociation_vPCId = (ResolverRuleAssociation -> Maybe Text)
-> (ResolverRuleAssociation
    -> Maybe Text -> ResolverRuleAssociation)
-> Lens
     ResolverRuleAssociation
     ResolverRuleAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleAssociation' {Maybe Text
vPCId :: Maybe Text
$sel:vPCId:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
vPCId} -> Maybe Text
vPCId) (\s :: ResolverRuleAssociation
s@ResolverRuleAssociation' {} Maybe Text
a -> ResolverRuleAssociation
s {$sel:vPCId:ResolverRuleAssociation' :: Maybe Text
vPCId = Maybe Text
a} :: ResolverRuleAssociation)

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

-- | The name of an association between a Resolver rule and a VPC.
resolverRuleAssociation_name :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_name :: (Maybe Text -> f (Maybe Text))
-> ResolverRuleAssociation -> f ResolverRuleAssociation
resolverRuleAssociation_name = (ResolverRuleAssociation -> Maybe Text)
-> (ResolverRuleAssociation
    -> Maybe Text -> ResolverRuleAssociation)
-> Lens
     ResolverRuleAssociation
     ResolverRuleAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleAssociation' {Maybe Text
name :: Maybe Text
$sel:name:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
name} -> Maybe Text
name) (\s :: ResolverRuleAssociation
s@ResolverRuleAssociation' {} Maybe Text
a -> ResolverRuleAssociation
s {$sel:name:ResolverRuleAssociation' :: Maybe Text
name = Maybe Text
a} :: ResolverRuleAssociation)

-- | The ID of the association between a Resolver rule and a VPC. Resolver
-- assigns this value when you submit an
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_AssociateResolverRule.html AssociateResolverRule>
-- request.
resolverRuleAssociation_id :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_id :: (Maybe Text -> f (Maybe Text))
-> ResolverRuleAssociation -> f ResolverRuleAssociation
resolverRuleAssociation_id = (ResolverRuleAssociation -> Maybe Text)
-> (ResolverRuleAssociation
    -> Maybe Text -> ResolverRuleAssociation)
-> Lens
     ResolverRuleAssociation
     ResolverRuleAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolverRuleAssociation' {Maybe Text
id :: Maybe Text
$sel:id:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
id} -> Maybe Text
id) (\s :: ResolverRuleAssociation
s@ResolverRuleAssociation' {} Maybe Text
a -> ResolverRuleAssociation
s {$sel:id:ResolverRuleAssociation' :: Maybe Text
id = Maybe Text
a} :: ResolverRuleAssociation)

instance Core.FromJSON ResolverRuleAssociation where
  parseJSON :: Value -> Parser ResolverRuleAssociation
parseJSON =
    String
-> (Object -> Parser ResolverRuleAssociation)
-> Value
-> Parser ResolverRuleAssociation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResolverRuleAssociation"
      ( \Object
x ->
          Maybe ResolverRuleAssociationStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ResolverRuleAssociation
ResolverRuleAssociation'
            (Maybe ResolverRuleAssociationStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ResolverRuleAssociation)
-> Parser (Maybe ResolverRuleAssociationStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ResolverRuleAssociation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResolverRuleAssociationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ResolverRuleAssociation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ResolverRuleAssociation)
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
"ResolverRuleId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ResolverRuleAssociation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ResolverRuleAssociation)
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
"VPCId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> ResolverRuleAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ResolverRuleAssociation)
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 -> ResolverRuleAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ResolverRuleAssociation)
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 -> ResolverRuleAssociation)
-> Parser (Maybe Text) -> Parser ResolverRuleAssociation
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")
      )

instance Prelude.Hashable ResolverRuleAssociation

instance Prelude.NFData ResolverRuleAssociation