{-# 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.EC2.Types.PeeringConnectionOptions
-- 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.EC2.Types.PeeringConnectionOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | We are retiring EC2-Classic. We recommend that you migrate from
-- EC2-Classic to a VPC. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-migrate.html Migrate from EC2-Classic to a VPC>
-- in the /Amazon Elastic Compute Cloud User Guide/.
--
-- Describes the VPC peering connection options.
--
-- /See:/ 'newPeeringConnectionOptions' smart constructor.
data PeeringConnectionOptions = PeeringConnectionOptions'
  { -- | If true, the public DNS hostnames of instances in the specified VPC
    -- resolve to private IP addresses when queried from instances in the peer
    -- VPC.
    PeeringConnectionOptions -> Maybe Bool
allowDnsResolutionFromRemoteVpc :: Prelude.Maybe Prelude.Bool,
    -- | If true, enables outbound communication from an EC2-Classic instance
    -- that\'s linked to a local VPC using ClassicLink to instances in a peer
    -- VPC.
    PeeringConnectionOptions -> Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc :: Prelude.Maybe Prelude.Bool,
    -- | If true, enables outbound communication from instances in a local VPC to
    -- an EC2-Classic instance that\'s linked to a peer VPC using ClassicLink.
    PeeringConnectionOptions -> Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink :: Prelude.Maybe Prelude.Bool
  }
  deriving (PeeringConnectionOptions -> PeeringConnectionOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PeeringConnectionOptions -> PeeringConnectionOptions -> Bool
$c/= :: PeeringConnectionOptions -> PeeringConnectionOptions -> Bool
== :: PeeringConnectionOptions -> PeeringConnectionOptions -> Bool
$c== :: PeeringConnectionOptions -> PeeringConnectionOptions -> Bool
Prelude.Eq, ReadPrec [PeeringConnectionOptions]
ReadPrec PeeringConnectionOptions
Int -> ReadS PeeringConnectionOptions
ReadS [PeeringConnectionOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PeeringConnectionOptions]
$creadListPrec :: ReadPrec [PeeringConnectionOptions]
readPrec :: ReadPrec PeeringConnectionOptions
$creadPrec :: ReadPrec PeeringConnectionOptions
readList :: ReadS [PeeringConnectionOptions]
$creadList :: ReadS [PeeringConnectionOptions]
readsPrec :: Int -> ReadS PeeringConnectionOptions
$creadsPrec :: Int -> ReadS PeeringConnectionOptions
Prelude.Read, Int -> PeeringConnectionOptions -> ShowS
[PeeringConnectionOptions] -> ShowS
PeeringConnectionOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PeeringConnectionOptions] -> ShowS
$cshowList :: [PeeringConnectionOptions] -> ShowS
show :: PeeringConnectionOptions -> String
$cshow :: PeeringConnectionOptions -> String
showsPrec :: Int -> PeeringConnectionOptions -> ShowS
$cshowsPrec :: Int -> PeeringConnectionOptions -> ShowS
Prelude.Show, forall x.
Rep PeeringConnectionOptions x -> PeeringConnectionOptions
forall x.
PeeringConnectionOptions -> Rep PeeringConnectionOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PeeringConnectionOptions x -> PeeringConnectionOptions
$cfrom :: forall x.
PeeringConnectionOptions -> Rep PeeringConnectionOptions x
Prelude.Generic)

-- |
-- Create a value of 'PeeringConnectionOptions' 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:
--
-- 'allowDnsResolutionFromRemoteVpc', 'peeringConnectionOptions_allowDnsResolutionFromRemoteVpc' - If true, the public DNS hostnames of instances in the specified VPC
-- resolve to private IP addresses when queried from instances in the peer
-- VPC.
--
-- 'allowEgressFromLocalClassicLinkToRemoteVpc', 'peeringConnectionOptions_allowEgressFromLocalClassicLinkToRemoteVpc' - If true, enables outbound communication from an EC2-Classic instance
-- that\'s linked to a local VPC using ClassicLink to instances in a peer
-- VPC.
--
-- 'allowEgressFromLocalVpcToRemoteClassicLink', 'peeringConnectionOptions_allowEgressFromLocalVpcToRemoteClassicLink' - If true, enables outbound communication from instances in a local VPC to
-- an EC2-Classic instance that\'s linked to a peer VPC using ClassicLink.
newPeeringConnectionOptions ::
  PeeringConnectionOptions
newPeeringConnectionOptions :: PeeringConnectionOptions
newPeeringConnectionOptions =
  PeeringConnectionOptions'
    { $sel:allowDnsResolutionFromRemoteVpc:PeeringConnectionOptions' :: Maybe Bool
allowDnsResolutionFromRemoteVpc =
        forall a. Maybe a
Prelude.Nothing,
      $sel:allowEgressFromLocalClassicLinkToRemoteVpc:PeeringConnectionOptions' :: Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc =
        forall a. Maybe a
Prelude.Nothing,
      $sel:allowEgressFromLocalVpcToRemoteClassicLink:PeeringConnectionOptions' :: Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink =
        forall a. Maybe a
Prelude.Nothing
    }

-- | If true, the public DNS hostnames of instances in the specified VPC
-- resolve to private IP addresses when queried from instances in the peer
-- VPC.
peeringConnectionOptions_allowDnsResolutionFromRemoteVpc :: Lens.Lens' PeeringConnectionOptions (Prelude.Maybe Prelude.Bool)
peeringConnectionOptions_allowDnsResolutionFromRemoteVpc :: Lens' PeeringConnectionOptions (Maybe Bool)
peeringConnectionOptions_allowDnsResolutionFromRemoteVpc = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PeeringConnectionOptions' {Maybe Bool
allowDnsResolutionFromRemoteVpc :: Maybe Bool
$sel:allowDnsResolutionFromRemoteVpc:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
allowDnsResolutionFromRemoteVpc} -> Maybe Bool
allowDnsResolutionFromRemoteVpc) (\s :: PeeringConnectionOptions
s@PeeringConnectionOptions' {} Maybe Bool
a -> PeeringConnectionOptions
s {$sel:allowDnsResolutionFromRemoteVpc:PeeringConnectionOptions' :: Maybe Bool
allowDnsResolutionFromRemoteVpc = Maybe Bool
a} :: PeeringConnectionOptions)

-- | If true, enables outbound communication from an EC2-Classic instance
-- that\'s linked to a local VPC using ClassicLink to instances in a peer
-- VPC.
peeringConnectionOptions_allowEgressFromLocalClassicLinkToRemoteVpc :: Lens.Lens' PeeringConnectionOptions (Prelude.Maybe Prelude.Bool)
peeringConnectionOptions_allowEgressFromLocalClassicLinkToRemoteVpc :: Lens' PeeringConnectionOptions (Maybe Bool)
peeringConnectionOptions_allowEgressFromLocalClassicLinkToRemoteVpc = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PeeringConnectionOptions' {Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc :: Maybe Bool
$sel:allowEgressFromLocalClassicLinkToRemoteVpc:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc} -> Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc) (\s :: PeeringConnectionOptions
s@PeeringConnectionOptions' {} Maybe Bool
a -> PeeringConnectionOptions
s {$sel:allowEgressFromLocalClassicLinkToRemoteVpc:PeeringConnectionOptions' :: Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc = Maybe Bool
a} :: PeeringConnectionOptions)

-- | If true, enables outbound communication from instances in a local VPC to
-- an EC2-Classic instance that\'s linked to a peer VPC using ClassicLink.
peeringConnectionOptions_allowEgressFromLocalVpcToRemoteClassicLink :: Lens.Lens' PeeringConnectionOptions (Prelude.Maybe Prelude.Bool)
peeringConnectionOptions_allowEgressFromLocalVpcToRemoteClassicLink :: Lens' PeeringConnectionOptions (Maybe Bool)
peeringConnectionOptions_allowEgressFromLocalVpcToRemoteClassicLink = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PeeringConnectionOptions' {Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink :: Maybe Bool
$sel:allowEgressFromLocalVpcToRemoteClassicLink:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink} -> Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink) (\s :: PeeringConnectionOptions
s@PeeringConnectionOptions' {} Maybe Bool
a -> PeeringConnectionOptions
s {$sel:allowEgressFromLocalVpcToRemoteClassicLink:PeeringConnectionOptions' :: Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink = Maybe Bool
a} :: PeeringConnectionOptions)

instance Data.FromXML PeeringConnectionOptions where
  parseXML :: [Node] -> Either String PeeringConnectionOptions
parseXML [Node]
x =
    Maybe Bool -> Maybe Bool -> Maybe Bool -> PeeringConnectionOptions
PeeringConnectionOptions'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"allowDnsResolutionFromRemoteVpc")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"allowEgressFromLocalClassicLinkToRemoteVpc"
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"allowEgressFromLocalVpcToRemoteClassicLink"
                  )

instance Prelude.Hashable PeeringConnectionOptions where
  hashWithSalt :: Int -> PeeringConnectionOptions -> Int
hashWithSalt Int
_salt PeeringConnectionOptions' {Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink :: Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc :: Maybe Bool
allowDnsResolutionFromRemoteVpc :: Maybe Bool
$sel:allowEgressFromLocalVpcToRemoteClassicLink:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
$sel:allowEgressFromLocalClassicLinkToRemoteVpc:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
$sel:allowDnsResolutionFromRemoteVpc:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowDnsResolutionFromRemoteVpc
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink

instance Prelude.NFData PeeringConnectionOptions where
  rnf :: PeeringConnectionOptions -> ()
rnf PeeringConnectionOptions' {Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink :: Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc :: Maybe Bool
allowDnsResolutionFromRemoteVpc :: Maybe Bool
$sel:allowEgressFromLocalVpcToRemoteClassicLink:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
$sel:allowEgressFromLocalClassicLinkToRemoteVpc:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
$sel:allowDnsResolutionFromRemoteVpc:PeeringConnectionOptions' :: PeeringConnectionOptions -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowDnsResolutionFromRemoteVpc
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe Bool
allowEgressFromLocalClassicLinkToRemoteVpc
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe Bool
allowEgressFromLocalVpcToRemoteClassicLink