{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Resolver.Types.ResolverRuleAssociation 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.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'
  { -- | 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,
    -- | The name of an association between a Resolver rule and a VPC.
    ResolverRuleAssociation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | A code that specifies the current status of the association between a
    -- Resolver rule and a VPC.
    ResolverRuleAssociation -> Maybe ResolverRuleAssociationStatus
status :: Prelude.Maybe ResolverRuleAssociationStatus,
    -- | 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 ID of the VPC that you associated the Resolver rule with.
    ResolverRuleAssociation -> Maybe Text
vPCId :: Prelude.Maybe Prelude.Text
  }
  deriving (ResolverRuleAssociation -> ResolverRuleAssociation -> Bool
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]
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
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. 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:
--
-- '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.
--
-- 'name', 'resolverRuleAssociation_name' - The name of an 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@.
--
-- 'status', 'resolverRuleAssociation_status' - A code that specifies the current status of the association between a
-- Resolver rule and a VPC.
--
-- 'statusMessage', 'resolverRuleAssociation_statusMessage' - A detailed description of the status of the association between a
-- Resolver rule and a VPC.
--
-- 'vPCId', 'resolverRuleAssociation_vPCId' - The ID of the VPC that you associated the Resolver rule with.
newResolverRuleAssociation ::
  ResolverRuleAssociation
newResolverRuleAssociation :: ResolverRuleAssociation
newResolverRuleAssociation =
  ResolverRuleAssociation'
    { $sel:id:ResolverRuleAssociation' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResolverRuleAssociation' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:resolverRuleId:ResolverRuleAssociation' :: Maybe Text
resolverRuleId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ResolverRuleAssociation' :: Maybe ResolverRuleAssociationStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ResolverRuleAssociation' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:vPCId:ResolverRuleAssociation' :: Maybe Text
vPCId = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' ResolverRuleAssociation (Maybe Text)
resolverRuleAssociation_id = 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)

-- | The name of an association between a Resolver rule and a VPC.
resolverRuleAssociation_name :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_name :: Lens' ResolverRuleAssociation (Maybe Text)
resolverRuleAssociation_name = 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 Resolver rule that you associated with the VPC that is
-- specified by @VPCId@.
resolverRuleAssociation_resolverRuleId :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_resolverRuleId :: Lens' ResolverRuleAssociation (Maybe Text)
resolverRuleAssociation_resolverRuleId = 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)

-- | 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 :: Lens' ResolverRuleAssociation (Maybe ResolverRuleAssociationStatus)
resolverRuleAssociation_status = 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)

-- | 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 :: Lens' ResolverRuleAssociation (Maybe Text)
resolverRuleAssociation_statusMessage = 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 ID of the VPC that you associated the Resolver rule with.
resolverRuleAssociation_vPCId :: Lens.Lens' ResolverRuleAssociation (Prelude.Maybe Prelude.Text)
resolverRuleAssociation_vPCId :: Lens' ResolverRuleAssociation (Maybe Text)
resolverRuleAssociation_vPCId = 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)

instance Data.FromJSON ResolverRuleAssociation where
  parseJSON :: Value -> Parser ResolverRuleAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResolverRuleAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ResolverRuleAssociationStatus
-> Maybe Text
-> Maybe Text
-> ResolverRuleAssociation
ResolverRuleAssociation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ResolverRuleId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatusMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VPCId")
      )

instance Prelude.Hashable ResolverRuleAssociation where
  hashWithSalt :: Int -> ResolverRuleAssociation -> Int
hashWithSalt Int
_salt ResolverRuleAssociation' {Maybe Text
Maybe ResolverRuleAssociationStatus
vPCId :: Maybe Text
statusMessage :: Maybe Text
status :: Maybe ResolverRuleAssociationStatus
resolverRuleId :: Maybe Text
name :: Maybe Text
id :: Maybe Text
$sel:vPCId:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:statusMessage:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:status:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe ResolverRuleAssociationStatus
$sel:resolverRuleId:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:name:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:id:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resolverRuleId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResolverRuleAssociationStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vPCId

instance Prelude.NFData ResolverRuleAssociation where
  rnf :: ResolverRuleAssociation -> ()
rnf ResolverRuleAssociation' {Maybe Text
Maybe ResolverRuleAssociationStatus
vPCId :: Maybe Text
statusMessage :: Maybe Text
status :: Maybe ResolverRuleAssociationStatus
resolverRuleId :: Maybe Text
name :: Maybe Text
id :: Maybe Text
$sel:vPCId:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:statusMessage:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:status:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe ResolverRuleAssociationStatus
$sel:resolverRuleId:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:name:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
$sel:id:ResolverRuleAssociation' :: ResolverRuleAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resolverRuleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResolverRuleAssociationStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vPCId