{-# 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.VpnStaticRoute
-- 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.VpnStaticRoute 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 Amazonka.EC2.Types.VpnState
import Amazonka.EC2.Types.VpnStaticRouteSource
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'VpnStaticRoute' 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:
--
-- 'destinationCidrBlock', 'vpnStaticRoute_destinationCidrBlock' - The CIDR block associated with the local subnet of the customer data
-- center.
--
-- 'source', 'vpnStaticRoute_source' - Indicates how the routes were provided.
--
-- 'state', 'vpnStaticRoute_state' - The current state of the static route.
newVpnStaticRoute ::
  VpnStaticRoute
newVpnStaticRoute :: VpnStaticRoute
newVpnStaticRoute =
  VpnStaticRoute'
    { $sel:destinationCidrBlock:VpnStaticRoute' :: Maybe Text
destinationCidrBlock =
        forall a. Maybe a
Prelude.Nothing,
      $sel:source:VpnStaticRoute' :: Maybe VpnStaticRouteSource
source = forall a. Maybe a
Prelude.Nothing,
      $sel:state:VpnStaticRoute' :: Maybe VpnState
state = forall a. Maybe a
Prelude.Nothing
    }

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

-- | Indicates how the routes were provided.
vpnStaticRoute_source :: Lens.Lens' VpnStaticRoute (Prelude.Maybe VpnStaticRouteSource)
vpnStaticRoute_source :: Lens' VpnStaticRoute (Maybe VpnStaticRouteSource)
vpnStaticRoute_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnStaticRoute' {Maybe VpnStaticRouteSource
source :: Maybe VpnStaticRouteSource
$sel:source:VpnStaticRoute' :: VpnStaticRoute -> Maybe VpnStaticRouteSource
source} -> Maybe VpnStaticRouteSource
source) (\s :: VpnStaticRoute
s@VpnStaticRoute' {} Maybe VpnStaticRouteSource
a -> VpnStaticRoute
s {$sel:source:VpnStaticRoute' :: Maybe VpnStaticRouteSource
source = Maybe VpnStaticRouteSource
a} :: VpnStaticRoute)

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

instance Data.FromXML VpnStaticRoute where
  parseXML :: [Node] -> Either String VpnStaticRoute
parseXML [Node]
x =
    Maybe Text
-> Maybe VpnStaticRouteSource -> Maybe VpnState -> VpnStaticRoute
VpnStaticRoute'
      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
"destinationCidrBlock")
      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
"source")
      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
"state")

instance Prelude.Hashable VpnStaticRoute where
  hashWithSalt :: Int -> VpnStaticRoute -> Int
hashWithSalt Int
_salt VpnStaticRoute' {Maybe Text
Maybe VpnState
Maybe VpnStaticRouteSource
state :: Maybe VpnState
source :: Maybe VpnStaticRouteSource
destinationCidrBlock :: Maybe Text
$sel:state:VpnStaticRoute' :: VpnStaticRoute -> Maybe VpnState
$sel:source:VpnStaticRoute' :: VpnStaticRoute -> Maybe VpnStaticRouteSource
$sel:destinationCidrBlock:VpnStaticRoute' :: VpnStaticRoute -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationCidrBlock
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpnStaticRouteSource
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpnState
state

instance Prelude.NFData VpnStaticRoute where
  rnf :: VpnStaticRoute -> ()
rnf VpnStaticRoute' {Maybe Text
Maybe VpnState
Maybe VpnStaticRouteSource
state :: Maybe VpnState
source :: Maybe VpnStaticRouteSource
destinationCidrBlock :: Maybe Text
$sel:state:VpnStaticRoute' :: VpnStaticRoute -> Maybe VpnState
$sel:source:VpnStaticRoute' :: VpnStaticRoute -> Maybe VpnStaticRouteSource
$sel:destinationCidrBlock:VpnStaticRoute' :: VpnStaticRoute -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationCidrBlock
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpnStaticRouteSource
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpnState
state