{-# 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.ClientVpnRoute
-- 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.ClientVpnRoute 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.ClientVpnRouteStatus
import qualified Amazonka.Prelude as Prelude

-- | Information about a Client VPN endpoint route.
--
-- /See:/ 'newClientVpnRoute' smart constructor.
data ClientVpnRoute = ClientVpnRoute'
  { -- | The ID of the Client VPN endpoint with which the route is associated.
    ClientVpnRoute -> Maybe Text
clientVpnEndpointId :: Prelude.Maybe Prelude.Text,
    -- | A brief description of the route.
    ClientVpnRoute -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The IPv4 address range, in CIDR notation, of the route destination.
    ClientVpnRoute -> Maybe Text
destinationCidr :: Prelude.Maybe Prelude.Text,
    -- | Indicates how the route was associated with the Client VPN endpoint.
    -- @associate@ indicates that the route was automatically added when the
    -- target network was associated with the Client VPN endpoint. @add-route@
    -- indicates that the route was manually added using the
    -- __CreateClientVpnRoute__ action.
    ClientVpnRoute -> Maybe Text
origin :: Prelude.Maybe Prelude.Text,
    -- | The current state of the route.
    ClientVpnRoute -> Maybe ClientVpnRouteStatus
status :: Prelude.Maybe ClientVpnRouteStatus,
    -- | The ID of the subnet through which traffic is routed.
    ClientVpnRoute -> Maybe Text
targetSubnet :: Prelude.Maybe Prelude.Text,
    -- | The route type.
    ClientVpnRoute -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (ClientVpnRoute -> ClientVpnRoute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientVpnRoute -> ClientVpnRoute -> Bool
$c/= :: ClientVpnRoute -> ClientVpnRoute -> Bool
== :: ClientVpnRoute -> ClientVpnRoute -> Bool
$c== :: ClientVpnRoute -> ClientVpnRoute -> Bool
Prelude.Eq, ReadPrec [ClientVpnRoute]
ReadPrec ClientVpnRoute
Int -> ReadS ClientVpnRoute
ReadS [ClientVpnRoute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClientVpnRoute]
$creadListPrec :: ReadPrec [ClientVpnRoute]
readPrec :: ReadPrec ClientVpnRoute
$creadPrec :: ReadPrec ClientVpnRoute
readList :: ReadS [ClientVpnRoute]
$creadList :: ReadS [ClientVpnRoute]
readsPrec :: Int -> ReadS ClientVpnRoute
$creadsPrec :: Int -> ReadS ClientVpnRoute
Prelude.Read, Int -> ClientVpnRoute -> ShowS
[ClientVpnRoute] -> ShowS
ClientVpnRoute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClientVpnRoute] -> ShowS
$cshowList :: [ClientVpnRoute] -> ShowS
show :: ClientVpnRoute -> String
$cshow :: ClientVpnRoute -> String
showsPrec :: Int -> ClientVpnRoute -> ShowS
$cshowsPrec :: Int -> ClientVpnRoute -> ShowS
Prelude.Show, forall x. Rep ClientVpnRoute x -> ClientVpnRoute
forall x. ClientVpnRoute -> Rep ClientVpnRoute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClientVpnRoute x -> ClientVpnRoute
$cfrom :: forall x. ClientVpnRoute -> Rep ClientVpnRoute x
Prelude.Generic)

-- |
-- Create a value of 'ClientVpnRoute' 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:
--
-- 'clientVpnEndpointId', 'clientVpnRoute_clientVpnEndpointId' - The ID of the Client VPN endpoint with which the route is associated.
--
-- 'description', 'clientVpnRoute_description' - A brief description of the route.
--
-- 'destinationCidr', 'clientVpnRoute_destinationCidr' - The IPv4 address range, in CIDR notation, of the route destination.
--
-- 'origin', 'clientVpnRoute_origin' - Indicates how the route was associated with the Client VPN endpoint.
-- @associate@ indicates that the route was automatically added when the
-- target network was associated with the Client VPN endpoint. @add-route@
-- indicates that the route was manually added using the
-- __CreateClientVpnRoute__ action.
--
-- 'status', 'clientVpnRoute_status' - The current state of the route.
--
-- 'targetSubnet', 'clientVpnRoute_targetSubnet' - The ID of the subnet through which traffic is routed.
--
-- 'type'', 'clientVpnRoute_type' - The route type.
newClientVpnRoute ::
  ClientVpnRoute
newClientVpnRoute :: ClientVpnRoute
newClientVpnRoute =
  ClientVpnRoute'
    { $sel:clientVpnEndpointId:ClientVpnRoute' :: Maybe Text
clientVpnEndpointId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:ClientVpnRoute' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCidr:ClientVpnRoute' :: Maybe Text
destinationCidr = forall a. Maybe a
Prelude.Nothing,
      $sel:origin:ClientVpnRoute' :: Maybe Text
origin = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ClientVpnRoute' :: Maybe ClientVpnRouteStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:targetSubnet:ClientVpnRoute' :: Maybe Text
targetSubnet = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ClientVpnRoute' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the Client VPN endpoint with which the route is associated.
clientVpnRoute_clientVpnEndpointId :: Lens.Lens' ClientVpnRoute (Prelude.Maybe Prelude.Text)
clientVpnRoute_clientVpnEndpointId :: Lens' ClientVpnRoute (Maybe Text)
clientVpnRoute_clientVpnEndpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe Text
clientVpnEndpointId :: Maybe Text
$sel:clientVpnEndpointId:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
clientVpnEndpointId} -> Maybe Text
clientVpnEndpointId) (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe Text
a -> ClientVpnRoute
s {$sel:clientVpnEndpointId:ClientVpnRoute' :: Maybe Text
clientVpnEndpointId = Maybe Text
a} :: ClientVpnRoute)

-- | A brief description of the route.
clientVpnRoute_description :: Lens.Lens' ClientVpnRoute (Prelude.Maybe Prelude.Text)
clientVpnRoute_description :: Lens' ClientVpnRoute (Maybe Text)
clientVpnRoute_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe Text
description :: Maybe Text
$sel:description:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
description} -> Maybe Text
description) (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe Text
a -> ClientVpnRoute
s {$sel:description:ClientVpnRoute' :: Maybe Text
description = Maybe Text
a} :: ClientVpnRoute)

-- | The IPv4 address range, in CIDR notation, of the route destination.
clientVpnRoute_destinationCidr :: Lens.Lens' ClientVpnRoute (Prelude.Maybe Prelude.Text)
clientVpnRoute_destinationCidr :: Lens' ClientVpnRoute (Maybe Text)
clientVpnRoute_destinationCidr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe Text
destinationCidr :: Maybe Text
$sel:destinationCidr:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
destinationCidr} -> Maybe Text
destinationCidr) (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe Text
a -> ClientVpnRoute
s {$sel:destinationCidr:ClientVpnRoute' :: Maybe Text
destinationCidr = Maybe Text
a} :: ClientVpnRoute)

-- | Indicates how the route was associated with the Client VPN endpoint.
-- @associate@ indicates that the route was automatically added when the
-- target network was associated with the Client VPN endpoint. @add-route@
-- indicates that the route was manually added using the
-- __CreateClientVpnRoute__ action.
clientVpnRoute_origin :: Lens.Lens' ClientVpnRoute (Prelude.Maybe Prelude.Text)
clientVpnRoute_origin :: Lens' ClientVpnRoute (Maybe Text)
clientVpnRoute_origin = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe Text
origin :: Maybe Text
$sel:origin:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
origin} -> Maybe Text
origin) (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe Text
a -> ClientVpnRoute
s {$sel:origin:ClientVpnRoute' :: Maybe Text
origin = Maybe Text
a} :: ClientVpnRoute)

-- | The current state of the route.
clientVpnRoute_status :: Lens.Lens' ClientVpnRoute (Prelude.Maybe ClientVpnRouteStatus)
clientVpnRoute_status :: Lens' ClientVpnRoute (Maybe ClientVpnRouteStatus)
clientVpnRoute_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe ClientVpnRouteStatus
status :: Maybe ClientVpnRouteStatus
$sel:status:ClientVpnRoute' :: ClientVpnRoute -> Maybe ClientVpnRouteStatus
status} -> Maybe ClientVpnRouteStatus
status) (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe ClientVpnRouteStatus
a -> ClientVpnRoute
s {$sel:status:ClientVpnRoute' :: Maybe ClientVpnRouteStatus
status = Maybe ClientVpnRouteStatus
a} :: ClientVpnRoute)

-- | The ID of the subnet through which traffic is routed.
clientVpnRoute_targetSubnet :: Lens.Lens' ClientVpnRoute (Prelude.Maybe Prelude.Text)
clientVpnRoute_targetSubnet :: Lens' ClientVpnRoute (Maybe Text)
clientVpnRoute_targetSubnet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe Text
targetSubnet :: Maybe Text
$sel:targetSubnet:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
targetSubnet} -> Maybe Text
targetSubnet) (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe Text
a -> ClientVpnRoute
s {$sel:targetSubnet:ClientVpnRoute' :: Maybe Text
targetSubnet = Maybe Text
a} :: ClientVpnRoute)

-- | The route type.
clientVpnRoute_type :: Lens.Lens' ClientVpnRoute (Prelude.Maybe Prelude.Text)
clientVpnRoute_type :: Lens' ClientVpnRoute (Maybe Text)
clientVpnRoute_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientVpnRoute' {Maybe Text
type' :: Maybe Text
$sel:type':ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
type'} -> Maybe Text
type') (\s :: ClientVpnRoute
s@ClientVpnRoute' {} Maybe Text
a -> ClientVpnRoute
s {$sel:type':ClientVpnRoute' :: Maybe Text
type' = Maybe Text
a} :: ClientVpnRoute)

instance Data.FromXML ClientVpnRoute where
  parseXML :: [Node] -> Either String ClientVpnRoute
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ClientVpnRouteStatus
-> Maybe Text
-> Maybe Text
-> ClientVpnRoute
ClientVpnRoute'
      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
"clientVpnEndpointId")
      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
"description")
      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
"destinationCidr")
      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
"origin")
      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
"status")
      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
"targetSubnet")
      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
"type")

instance Prelude.Hashable ClientVpnRoute where
  hashWithSalt :: Int -> ClientVpnRoute -> Int
hashWithSalt Int
_salt ClientVpnRoute' {Maybe Text
Maybe ClientVpnRouteStatus
type' :: Maybe Text
targetSubnet :: Maybe Text
status :: Maybe ClientVpnRouteStatus
origin :: Maybe Text
destinationCidr :: Maybe Text
description :: Maybe Text
clientVpnEndpointId :: Maybe Text
$sel:type':ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:targetSubnet:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:status:ClientVpnRoute' :: ClientVpnRoute -> Maybe ClientVpnRouteStatus
$sel:origin:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:destinationCidr:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:description:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:clientVpnEndpointId:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientVpnEndpointId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationCidr
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
origin
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ClientVpnRouteStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetSubnet
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'

instance Prelude.NFData ClientVpnRoute where
  rnf :: ClientVpnRoute -> ()
rnf ClientVpnRoute' {Maybe Text
Maybe ClientVpnRouteStatus
type' :: Maybe Text
targetSubnet :: Maybe Text
status :: Maybe ClientVpnRouteStatus
origin :: Maybe Text
destinationCidr :: Maybe Text
description :: Maybe Text
clientVpnEndpointId :: Maybe Text
$sel:type':ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:targetSubnet:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:status:ClientVpnRoute' :: ClientVpnRoute -> Maybe ClientVpnRouteStatus
$sel:origin:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:destinationCidr:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:description:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
$sel:clientVpnEndpointId:ClientVpnRoute' :: ClientVpnRoute -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientVpnEndpointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationCidr
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
origin
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ClientVpnRouteStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetSubnet
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'