{-# 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.SecurityHub.Types.AwsEc2VpnConnectionOptionsDetails
-- 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.SecurityHub.Types.AwsEc2VpnConnectionOptionsDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsEc2VpnConnectionOptionsTunnelOptionsDetails

-- | VPN connection options.
--
-- /See:/ 'newAwsEc2VpnConnectionOptionsDetails' smart constructor.
data AwsEc2VpnConnectionOptionsDetails = AwsEc2VpnConnectionOptionsDetails'
  { -- | The VPN tunnel options.
    AwsEc2VpnConnectionOptionsDetails
-> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions :: Prelude.Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails],
    -- | Whether the VPN connection uses static routes only.
    AwsEc2VpnConnectionOptionsDetails -> Maybe Bool
staticRoutesOnly :: Prelude.Maybe Prelude.Bool
  }
  deriving (AwsEc2VpnConnectionOptionsDetails
-> AwsEc2VpnConnectionOptionsDetails -> Bool
(AwsEc2VpnConnectionOptionsDetails
 -> AwsEc2VpnConnectionOptionsDetails -> Bool)
-> (AwsEc2VpnConnectionOptionsDetails
    -> AwsEc2VpnConnectionOptionsDetails -> Bool)
-> Eq AwsEc2VpnConnectionOptionsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEc2VpnConnectionOptionsDetails
-> AwsEc2VpnConnectionOptionsDetails -> Bool
$c/= :: AwsEc2VpnConnectionOptionsDetails
-> AwsEc2VpnConnectionOptionsDetails -> Bool
== :: AwsEc2VpnConnectionOptionsDetails
-> AwsEc2VpnConnectionOptionsDetails -> Bool
$c== :: AwsEc2VpnConnectionOptionsDetails
-> AwsEc2VpnConnectionOptionsDetails -> Bool
Prelude.Eq, ReadPrec [AwsEc2VpnConnectionOptionsDetails]
ReadPrec AwsEc2VpnConnectionOptionsDetails
Int -> ReadS AwsEc2VpnConnectionOptionsDetails
ReadS [AwsEc2VpnConnectionOptionsDetails]
(Int -> ReadS AwsEc2VpnConnectionOptionsDetails)
-> ReadS [AwsEc2VpnConnectionOptionsDetails]
-> ReadPrec AwsEc2VpnConnectionOptionsDetails
-> ReadPrec [AwsEc2VpnConnectionOptionsDetails]
-> Read AwsEc2VpnConnectionOptionsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEc2VpnConnectionOptionsDetails]
$creadListPrec :: ReadPrec [AwsEc2VpnConnectionOptionsDetails]
readPrec :: ReadPrec AwsEc2VpnConnectionOptionsDetails
$creadPrec :: ReadPrec AwsEc2VpnConnectionOptionsDetails
readList :: ReadS [AwsEc2VpnConnectionOptionsDetails]
$creadList :: ReadS [AwsEc2VpnConnectionOptionsDetails]
readsPrec :: Int -> ReadS AwsEc2VpnConnectionOptionsDetails
$creadsPrec :: Int -> ReadS AwsEc2VpnConnectionOptionsDetails
Prelude.Read, Int -> AwsEc2VpnConnectionOptionsDetails -> ShowS
[AwsEc2VpnConnectionOptionsDetails] -> ShowS
AwsEc2VpnConnectionOptionsDetails -> String
(Int -> AwsEc2VpnConnectionOptionsDetails -> ShowS)
-> (AwsEc2VpnConnectionOptionsDetails -> String)
-> ([AwsEc2VpnConnectionOptionsDetails] -> ShowS)
-> Show AwsEc2VpnConnectionOptionsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEc2VpnConnectionOptionsDetails] -> ShowS
$cshowList :: [AwsEc2VpnConnectionOptionsDetails] -> ShowS
show :: AwsEc2VpnConnectionOptionsDetails -> String
$cshow :: AwsEc2VpnConnectionOptionsDetails -> String
showsPrec :: Int -> AwsEc2VpnConnectionOptionsDetails -> ShowS
$cshowsPrec :: Int -> AwsEc2VpnConnectionOptionsDetails -> ShowS
Prelude.Show, (forall x.
 AwsEc2VpnConnectionOptionsDetails
 -> Rep AwsEc2VpnConnectionOptionsDetails x)
-> (forall x.
    Rep AwsEc2VpnConnectionOptionsDetails x
    -> AwsEc2VpnConnectionOptionsDetails)
-> Generic AwsEc2VpnConnectionOptionsDetails
forall x.
Rep AwsEc2VpnConnectionOptionsDetails x
-> AwsEc2VpnConnectionOptionsDetails
forall x.
AwsEc2VpnConnectionOptionsDetails
-> Rep AwsEc2VpnConnectionOptionsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEc2VpnConnectionOptionsDetails x
-> AwsEc2VpnConnectionOptionsDetails
$cfrom :: forall x.
AwsEc2VpnConnectionOptionsDetails
-> Rep AwsEc2VpnConnectionOptionsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEc2VpnConnectionOptionsDetails' 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:
--
-- 'tunnelOptions', 'awsEc2VpnConnectionOptionsDetails_tunnelOptions' - The VPN tunnel options.
--
-- 'staticRoutesOnly', 'awsEc2VpnConnectionOptionsDetails_staticRoutesOnly' - Whether the VPN connection uses static routes only.
newAwsEc2VpnConnectionOptionsDetails ::
  AwsEc2VpnConnectionOptionsDetails
newAwsEc2VpnConnectionOptionsDetails :: AwsEc2VpnConnectionOptionsDetails
newAwsEc2VpnConnectionOptionsDetails =
  AwsEc2VpnConnectionOptionsDetails' :: Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
-> Maybe Bool -> AwsEc2VpnConnectionOptionsDetails
AwsEc2VpnConnectionOptionsDetails'
    { $sel:tunnelOptions:AwsEc2VpnConnectionOptionsDetails' :: Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions =
        Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
forall a. Maybe a
Prelude.Nothing,
      $sel:staticRoutesOnly:AwsEc2VpnConnectionOptionsDetails' :: Maybe Bool
staticRoutesOnly = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The VPN tunnel options.
awsEc2VpnConnectionOptionsDetails_tunnelOptions :: Lens.Lens' AwsEc2VpnConnectionOptionsDetails (Prelude.Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
awsEc2VpnConnectionOptionsDetails_tunnelOptions :: (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
 -> f (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
-> AwsEc2VpnConnectionOptionsDetails
-> f AwsEc2VpnConnectionOptionsDetails
awsEc2VpnConnectionOptionsDetails_tunnelOptions = (AwsEc2VpnConnectionOptionsDetails
 -> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
-> (AwsEc2VpnConnectionOptionsDetails
    -> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
    -> AwsEc2VpnConnectionOptionsDetails)
-> Lens
     AwsEc2VpnConnectionOptionsDetails
     AwsEc2VpnConnectionOptionsDetails
     (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
     (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VpnConnectionOptionsDetails' {Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions :: Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
$sel:tunnelOptions:AwsEc2VpnConnectionOptionsDetails' :: AwsEc2VpnConnectionOptionsDetails
-> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions} -> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions) (\s :: AwsEc2VpnConnectionOptionsDetails
s@AwsEc2VpnConnectionOptionsDetails' {} Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
a -> AwsEc2VpnConnectionOptionsDetails
s {$sel:tunnelOptions:AwsEc2VpnConnectionOptionsDetails' :: Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions = Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
a} :: AwsEc2VpnConnectionOptionsDetails) ((Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  -> f (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
 -> AwsEc2VpnConnectionOptionsDetails
 -> f AwsEc2VpnConnectionOptionsDetails)
-> ((Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
     -> f (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
    -> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
    -> f (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
-> (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
    -> f (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
-> AwsEc2VpnConnectionOptionsDetails
-> f AwsEc2VpnConnectionOptionsDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
-> Iso
     (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
     (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
     (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
     (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
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
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
  [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Whether the VPN connection uses static routes only.
awsEc2VpnConnectionOptionsDetails_staticRoutesOnly :: Lens.Lens' AwsEc2VpnConnectionOptionsDetails (Prelude.Maybe Prelude.Bool)
awsEc2VpnConnectionOptionsDetails_staticRoutesOnly :: (Maybe Bool -> f (Maybe Bool))
-> AwsEc2VpnConnectionOptionsDetails
-> f AwsEc2VpnConnectionOptionsDetails
awsEc2VpnConnectionOptionsDetails_staticRoutesOnly = (AwsEc2VpnConnectionOptionsDetails -> Maybe Bool)
-> (AwsEc2VpnConnectionOptionsDetails
    -> Maybe Bool -> AwsEc2VpnConnectionOptionsDetails)
-> Lens
     AwsEc2VpnConnectionOptionsDetails
     AwsEc2VpnConnectionOptionsDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VpnConnectionOptionsDetails' {Maybe Bool
staticRoutesOnly :: Maybe Bool
$sel:staticRoutesOnly:AwsEc2VpnConnectionOptionsDetails' :: AwsEc2VpnConnectionOptionsDetails -> Maybe Bool
staticRoutesOnly} -> Maybe Bool
staticRoutesOnly) (\s :: AwsEc2VpnConnectionOptionsDetails
s@AwsEc2VpnConnectionOptionsDetails' {} Maybe Bool
a -> AwsEc2VpnConnectionOptionsDetails
s {$sel:staticRoutesOnly:AwsEc2VpnConnectionOptionsDetails' :: Maybe Bool
staticRoutesOnly = Maybe Bool
a} :: AwsEc2VpnConnectionOptionsDetails)

instance
  Core.FromJSON
    AwsEc2VpnConnectionOptionsDetails
  where
  parseJSON :: Value -> Parser AwsEc2VpnConnectionOptionsDetails
parseJSON =
    String
-> (Object -> Parser AwsEc2VpnConnectionOptionsDetails)
-> Value
-> Parser AwsEc2VpnConnectionOptionsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEc2VpnConnectionOptionsDetails"
      ( \Object
x ->
          Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
-> Maybe Bool -> AwsEc2VpnConnectionOptionsDetails
AwsEc2VpnConnectionOptionsDetails'
            (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
 -> Maybe Bool -> AwsEc2VpnConnectionOptionsDetails)
-> Parser (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
-> Parser (Maybe Bool -> AwsEc2VpnConnectionOptionsDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TunnelOptions" Parser
  (Maybe (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]))
-> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
-> Parser (Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Bool -> AwsEc2VpnConnectionOptionsDetails)
-> Parser (Maybe Bool) -> Parser AwsEc2VpnConnectionOptionsDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StaticRoutesOnly")
      )

instance
  Prelude.Hashable
    AwsEc2VpnConnectionOptionsDetails

instance
  Prelude.NFData
    AwsEc2VpnConnectionOptionsDetails

instance
  Core.ToJSON
    AwsEc2VpnConnectionOptionsDetails
  where
  toJSON :: AwsEc2VpnConnectionOptionsDetails -> Value
toJSON AwsEc2VpnConnectionOptionsDetails' {Maybe Bool
Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
staticRoutesOnly :: Maybe Bool
tunnelOptions :: Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
$sel:staticRoutesOnly:AwsEc2VpnConnectionOptionsDetails' :: AwsEc2VpnConnectionOptionsDetails -> Maybe Bool
$sel:tunnelOptions:AwsEc2VpnConnectionOptionsDetails' :: AwsEc2VpnConnectionOptionsDetails
-> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TunnelOptions" Text -> [AwsEc2VpnConnectionOptionsTunnelOptionsDetails] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AwsEc2VpnConnectionOptionsTunnelOptionsDetails] -> Pair)
-> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsEc2VpnConnectionOptionsTunnelOptionsDetails]
tunnelOptions,
            (Text
"StaticRoutesOnly" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
staticRoutesOnly
          ]
      )