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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A static routes associated with the VPN connection.
--
-- /See:/ 'newAwsEc2VpnConnectionRoutesDetails' smart constructor.
data AwsEc2VpnConnectionRoutesDetails = AwsEc2VpnConnectionRoutesDetails'
  { -- | The current state of the static route.
    AwsEc2VpnConnectionRoutesDetails -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The CIDR block associated with the local subnet of the customer data
    -- center.
    AwsEc2VpnConnectionRoutesDetails -> Maybe Text
destinationCidrBlock :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEc2VpnConnectionRoutesDetails
-> AwsEc2VpnConnectionRoutesDetails -> Bool
(AwsEc2VpnConnectionRoutesDetails
 -> AwsEc2VpnConnectionRoutesDetails -> Bool)
-> (AwsEc2VpnConnectionRoutesDetails
    -> AwsEc2VpnConnectionRoutesDetails -> Bool)
-> Eq AwsEc2VpnConnectionRoutesDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEc2VpnConnectionRoutesDetails
-> AwsEc2VpnConnectionRoutesDetails -> Bool
$c/= :: AwsEc2VpnConnectionRoutesDetails
-> AwsEc2VpnConnectionRoutesDetails -> Bool
== :: AwsEc2VpnConnectionRoutesDetails
-> AwsEc2VpnConnectionRoutesDetails -> Bool
$c== :: AwsEc2VpnConnectionRoutesDetails
-> AwsEc2VpnConnectionRoutesDetails -> Bool
Prelude.Eq, ReadPrec [AwsEc2VpnConnectionRoutesDetails]
ReadPrec AwsEc2VpnConnectionRoutesDetails
Int -> ReadS AwsEc2VpnConnectionRoutesDetails
ReadS [AwsEc2VpnConnectionRoutesDetails]
(Int -> ReadS AwsEc2VpnConnectionRoutesDetails)
-> ReadS [AwsEc2VpnConnectionRoutesDetails]
-> ReadPrec AwsEc2VpnConnectionRoutesDetails
-> ReadPrec [AwsEc2VpnConnectionRoutesDetails]
-> Read AwsEc2VpnConnectionRoutesDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEc2VpnConnectionRoutesDetails]
$creadListPrec :: ReadPrec [AwsEc2VpnConnectionRoutesDetails]
readPrec :: ReadPrec AwsEc2VpnConnectionRoutesDetails
$creadPrec :: ReadPrec AwsEc2VpnConnectionRoutesDetails
readList :: ReadS [AwsEc2VpnConnectionRoutesDetails]
$creadList :: ReadS [AwsEc2VpnConnectionRoutesDetails]
readsPrec :: Int -> ReadS AwsEc2VpnConnectionRoutesDetails
$creadsPrec :: Int -> ReadS AwsEc2VpnConnectionRoutesDetails
Prelude.Read, Int -> AwsEc2VpnConnectionRoutesDetails -> ShowS
[AwsEc2VpnConnectionRoutesDetails] -> ShowS
AwsEc2VpnConnectionRoutesDetails -> String
(Int -> AwsEc2VpnConnectionRoutesDetails -> ShowS)
-> (AwsEc2VpnConnectionRoutesDetails -> String)
-> ([AwsEc2VpnConnectionRoutesDetails] -> ShowS)
-> Show AwsEc2VpnConnectionRoutesDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEc2VpnConnectionRoutesDetails] -> ShowS
$cshowList :: [AwsEc2VpnConnectionRoutesDetails] -> ShowS
show :: AwsEc2VpnConnectionRoutesDetails -> String
$cshow :: AwsEc2VpnConnectionRoutesDetails -> String
showsPrec :: Int -> AwsEc2VpnConnectionRoutesDetails -> ShowS
$cshowsPrec :: Int -> AwsEc2VpnConnectionRoutesDetails -> ShowS
Prelude.Show, (forall x.
 AwsEc2VpnConnectionRoutesDetails
 -> Rep AwsEc2VpnConnectionRoutesDetails x)
-> (forall x.
    Rep AwsEc2VpnConnectionRoutesDetails x
    -> AwsEc2VpnConnectionRoutesDetails)
-> Generic AwsEc2VpnConnectionRoutesDetails
forall x.
Rep AwsEc2VpnConnectionRoutesDetails x
-> AwsEc2VpnConnectionRoutesDetails
forall x.
AwsEc2VpnConnectionRoutesDetails
-> Rep AwsEc2VpnConnectionRoutesDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEc2VpnConnectionRoutesDetails x
-> AwsEc2VpnConnectionRoutesDetails
$cfrom :: forall x.
AwsEc2VpnConnectionRoutesDetails
-> Rep AwsEc2VpnConnectionRoutesDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEc2VpnConnectionRoutesDetails' 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:
--
-- 'state', 'awsEc2VpnConnectionRoutesDetails_state' - The current state of the static route.
--
-- 'destinationCidrBlock', 'awsEc2VpnConnectionRoutesDetails_destinationCidrBlock' - The CIDR block associated with the local subnet of the customer data
-- center.
newAwsEc2VpnConnectionRoutesDetails ::
  AwsEc2VpnConnectionRoutesDetails
newAwsEc2VpnConnectionRoutesDetails :: AwsEc2VpnConnectionRoutesDetails
newAwsEc2VpnConnectionRoutesDetails =
  AwsEc2VpnConnectionRoutesDetails' :: Maybe Text -> Maybe Text -> AwsEc2VpnConnectionRoutesDetails
AwsEc2VpnConnectionRoutesDetails'
    { $sel:state:AwsEc2VpnConnectionRoutesDetails' :: Maybe Text
state =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCidrBlock:AwsEc2VpnConnectionRoutesDetails' :: Maybe Text
destinationCidrBlock = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the static route.
awsEc2VpnConnectionRoutesDetails_state :: Lens.Lens' AwsEc2VpnConnectionRoutesDetails (Prelude.Maybe Prelude.Text)
awsEc2VpnConnectionRoutesDetails_state :: (Maybe Text -> f (Maybe Text))
-> AwsEc2VpnConnectionRoutesDetails
-> f AwsEc2VpnConnectionRoutesDetails
awsEc2VpnConnectionRoutesDetails_state = (AwsEc2VpnConnectionRoutesDetails -> Maybe Text)
-> (AwsEc2VpnConnectionRoutesDetails
    -> Maybe Text -> AwsEc2VpnConnectionRoutesDetails)
-> Lens
     AwsEc2VpnConnectionRoutesDetails
     AwsEc2VpnConnectionRoutesDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VpnConnectionRoutesDetails' {Maybe Text
state :: Maybe Text
$sel:state:AwsEc2VpnConnectionRoutesDetails' :: AwsEc2VpnConnectionRoutesDetails -> Maybe Text
state} -> Maybe Text
state) (\s :: AwsEc2VpnConnectionRoutesDetails
s@AwsEc2VpnConnectionRoutesDetails' {} Maybe Text
a -> AwsEc2VpnConnectionRoutesDetails
s {$sel:state:AwsEc2VpnConnectionRoutesDetails' :: Maybe Text
state = Maybe Text
a} :: AwsEc2VpnConnectionRoutesDetails)

-- | The CIDR block associated with the local subnet of the customer data
-- center.
awsEc2VpnConnectionRoutesDetails_destinationCidrBlock :: Lens.Lens' AwsEc2VpnConnectionRoutesDetails (Prelude.Maybe Prelude.Text)
awsEc2VpnConnectionRoutesDetails_destinationCidrBlock :: (Maybe Text -> f (Maybe Text))
-> AwsEc2VpnConnectionRoutesDetails
-> f AwsEc2VpnConnectionRoutesDetails
awsEc2VpnConnectionRoutesDetails_destinationCidrBlock = (AwsEc2VpnConnectionRoutesDetails -> Maybe Text)
-> (AwsEc2VpnConnectionRoutesDetails
    -> Maybe Text -> AwsEc2VpnConnectionRoutesDetails)
-> Lens
     AwsEc2VpnConnectionRoutesDetails
     AwsEc2VpnConnectionRoutesDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VpnConnectionRoutesDetails' {Maybe Text
destinationCidrBlock :: Maybe Text
$sel:destinationCidrBlock:AwsEc2VpnConnectionRoutesDetails' :: AwsEc2VpnConnectionRoutesDetails -> Maybe Text
destinationCidrBlock} -> Maybe Text
destinationCidrBlock) (\s :: AwsEc2VpnConnectionRoutesDetails
s@AwsEc2VpnConnectionRoutesDetails' {} Maybe Text
a -> AwsEc2VpnConnectionRoutesDetails
s {$sel:destinationCidrBlock:AwsEc2VpnConnectionRoutesDetails' :: Maybe Text
destinationCidrBlock = Maybe Text
a} :: AwsEc2VpnConnectionRoutesDetails)

instance
  Core.FromJSON
    AwsEc2VpnConnectionRoutesDetails
  where
  parseJSON :: Value -> Parser AwsEc2VpnConnectionRoutesDetails
parseJSON =
    String
-> (Object -> Parser AwsEc2VpnConnectionRoutesDetails)
-> Value
-> Parser AwsEc2VpnConnectionRoutesDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEc2VpnConnectionRoutesDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsEc2VpnConnectionRoutesDetails
AwsEc2VpnConnectionRoutesDetails'
            (Maybe Text -> Maybe Text -> AwsEc2VpnConnectionRoutesDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsEc2VpnConnectionRoutesDetails)
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
"State")
            Parser (Maybe Text -> AwsEc2VpnConnectionRoutesDetails)
-> Parser (Maybe Text) -> Parser AwsEc2VpnConnectionRoutesDetails
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
"DestinationCidrBlock")
      )

instance
  Prelude.Hashable
    AwsEc2VpnConnectionRoutesDetails

instance
  Prelude.NFData
    AwsEc2VpnConnectionRoutesDetails

instance Core.ToJSON AwsEc2VpnConnectionRoutesDetails where
  toJSON :: AwsEc2VpnConnectionRoutesDetails -> Value
toJSON AwsEc2VpnConnectionRoutesDetails' {Maybe Text
destinationCidrBlock :: Maybe Text
state :: Maybe Text
$sel:destinationCidrBlock:AwsEc2VpnConnectionRoutesDetails' :: AwsEc2VpnConnectionRoutesDetails -> Maybe Text
$sel:state:AwsEc2VpnConnectionRoutesDetails' :: AwsEc2VpnConnectionRoutesDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"State" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
state,
            (Text
"DestinationCidrBlock" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationCidrBlock
          ]
      )