{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateVpnConnectionRoute
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a static route associated with a VPN connection between an
-- existing virtual private gateway and a VPN customer gateway. The static
-- route allows traffic to be routed from the virtual private gateway to
-- the VPN customer gateway.
--
-- For more information, see
-- <https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html Amazon Web Services Site-to-Site VPN>
-- in the /Amazon Web Services Site-to-Site VPN User Guide/.
module Amazonka.EC2.CreateVpnConnectionRoute
  ( -- * Creating a Request
    CreateVpnConnectionRoute (..),
    newCreateVpnConnectionRoute,

    -- * Request Lenses
    createVpnConnectionRoute_destinationCidrBlock,
    createVpnConnectionRoute_vpnConnectionId,

    -- * Destructuring the Response
    CreateVpnConnectionRouteResponse (..),
    newCreateVpnConnectionRouteResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Contains the parameters for CreateVpnConnectionRoute.
--
-- /See:/ 'newCreateVpnConnectionRoute' smart constructor.
data CreateVpnConnectionRoute = CreateVpnConnectionRoute'
  { -- | The CIDR block associated with the local subnet of the customer network.
    CreateVpnConnectionRoute -> Text
destinationCidrBlock :: Prelude.Text,
    -- | The ID of the VPN connection.
    CreateVpnConnectionRoute -> Text
vpnConnectionId :: Prelude.Text
  }
  deriving (CreateVpnConnectionRoute -> CreateVpnConnectionRoute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVpnConnectionRoute -> CreateVpnConnectionRoute -> Bool
$c/= :: CreateVpnConnectionRoute -> CreateVpnConnectionRoute -> Bool
== :: CreateVpnConnectionRoute -> CreateVpnConnectionRoute -> Bool
$c== :: CreateVpnConnectionRoute -> CreateVpnConnectionRoute -> Bool
Prelude.Eq, ReadPrec [CreateVpnConnectionRoute]
ReadPrec CreateVpnConnectionRoute
Int -> ReadS CreateVpnConnectionRoute
ReadS [CreateVpnConnectionRoute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVpnConnectionRoute]
$creadListPrec :: ReadPrec [CreateVpnConnectionRoute]
readPrec :: ReadPrec CreateVpnConnectionRoute
$creadPrec :: ReadPrec CreateVpnConnectionRoute
readList :: ReadS [CreateVpnConnectionRoute]
$creadList :: ReadS [CreateVpnConnectionRoute]
readsPrec :: Int -> ReadS CreateVpnConnectionRoute
$creadsPrec :: Int -> ReadS CreateVpnConnectionRoute
Prelude.Read, Int -> CreateVpnConnectionRoute -> ShowS
[CreateVpnConnectionRoute] -> ShowS
CreateVpnConnectionRoute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVpnConnectionRoute] -> ShowS
$cshowList :: [CreateVpnConnectionRoute] -> ShowS
show :: CreateVpnConnectionRoute -> String
$cshow :: CreateVpnConnectionRoute -> String
showsPrec :: Int -> CreateVpnConnectionRoute -> ShowS
$cshowsPrec :: Int -> CreateVpnConnectionRoute -> ShowS
Prelude.Show, forall x.
Rep CreateVpnConnectionRoute x -> CreateVpnConnectionRoute
forall x.
CreateVpnConnectionRoute -> Rep CreateVpnConnectionRoute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVpnConnectionRoute x -> CreateVpnConnectionRoute
$cfrom :: forall x.
CreateVpnConnectionRoute -> Rep CreateVpnConnectionRoute x
Prelude.Generic)

-- |
-- Create a value of 'CreateVpnConnectionRoute' 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', 'createVpnConnectionRoute_destinationCidrBlock' - The CIDR block associated with the local subnet of the customer network.
--
-- 'vpnConnectionId', 'createVpnConnectionRoute_vpnConnectionId' - The ID of the VPN connection.
newCreateVpnConnectionRoute ::
  -- | 'destinationCidrBlock'
  Prelude.Text ->
  -- | 'vpnConnectionId'
  Prelude.Text ->
  CreateVpnConnectionRoute
newCreateVpnConnectionRoute :: Text -> Text -> CreateVpnConnectionRoute
newCreateVpnConnectionRoute
  Text
pDestinationCidrBlock_
  Text
pVpnConnectionId_ =
    CreateVpnConnectionRoute'
      { $sel:destinationCidrBlock:CreateVpnConnectionRoute' :: Text
destinationCidrBlock =
          Text
pDestinationCidrBlock_,
        $sel:vpnConnectionId:CreateVpnConnectionRoute' :: Text
vpnConnectionId = Text
pVpnConnectionId_
      }

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

-- | The ID of the VPN connection.
createVpnConnectionRoute_vpnConnectionId :: Lens.Lens' CreateVpnConnectionRoute Prelude.Text
createVpnConnectionRoute_vpnConnectionId :: Lens' CreateVpnConnectionRoute Text
createVpnConnectionRoute_vpnConnectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVpnConnectionRoute' {Text
vpnConnectionId :: Text
$sel:vpnConnectionId:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
vpnConnectionId} -> Text
vpnConnectionId) (\s :: CreateVpnConnectionRoute
s@CreateVpnConnectionRoute' {} Text
a -> CreateVpnConnectionRoute
s {$sel:vpnConnectionId:CreateVpnConnectionRoute' :: Text
vpnConnectionId = Text
a} :: CreateVpnConnectionRoute)

instance Core.AWSRequest CreateVpnConnectionRoute where
  type
    AWSResponse CreateVpnConnectionRoute =
      CreateVpnConnectionRouteResponse
  request :: (Service -> Service)
-> CreateVpnConnectionRoute -> Request CreateVpnConnectionRoute
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateVpnConnectionRoute
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateVpnConnectionRoute)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      CreateVpnConnectionRouteResponse
CreateVpnConnectionRouteResponse'

instance Prelude.Hashable CreateVpnConnectionRoute where
  hashWithSalt :: Int -> CreateVpnConnectionRoute -> Int
hashWithSalt Int
_salt CreateVpnConnectionRoute' {Text
vpnConnectionId :: Text
destinationCidrBlock :: Text
$sel:vpnConnectionId:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
$sel:destinationCidrBlock:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationCidrBlock
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vpnConnectionId

instance Prelude.NFData CreateVpnConnectionRoute where
  rnf :: CreateVpnConnectionRoute -> ()
rnf CreateVpnConnectionRoute' {Text
vpnConnectionId :: Text
destinationCidrBlock :: Text
$sel:vpnConnectionId:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
$sel:destinationCidrBlock:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
destinationCidrBlock
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vpnConnectionId

instance Data.ToHeaders CreateVpnConnectionRoute where
  toHeaders :: CreateVpnConnectionRoute -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath CreateVpnConnectionRoute where
  toPath :: CreateVpnConnectionRoute -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateVpnConnectionRoute where
  toQuery :: CreateVpnConnectionRoute -> QueryString
toQuery CreateVpnConnectionRoute' {Text
vpnConnectionId :: Text
destinationCidrBlock :: Text
$sel:vpnConnectionId:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
$sel:destinationCidrBlock:CreateVpnConnectionRoute' :: CreateVpnConnectionRoute -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateVpnConnectionRoute" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DestinationCidrBlock" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
destinationCidrBlock,
        ByteString
"VpnConnectionId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
vpnConnectionId
      ]

-- | /See:/ 'newCreateVpnConnectionRouteResponse' smart constructor.
data CreateVpnConnectionRouteResponse = CreateVpnConnectionRouteResponse'
  {
  }
  deriving (CreateVpnConnectionRouteResponse
-> CreateVpnConnectionRouteResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVpnConnectionRouteResponse
-> CreateVpnConnectionRouteResponse -> Bool
$c/= :: CreateVpnConnectionRouteResponse
-> CreateVpnConnectionRouteResponse -> Bool
== :: CreateVpnConnectionRouteResponse
-> CreateVpnConnectionRouteResponse -> Bool
$c== :: CreateVpnConnectionRouteResponse
-> CreateVpnConnectionRouteResponse -> Bool
Prelude.Eq, ReadPrec [CreateVpnConnectionRouteResponse]
ReadPrec CreateVpnConnectionRouteResponse
Int -> ReadS CreateVpnConnectionRouteResponse
ReadS [CreateVpnConnectionRouteResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVpnConnectionRouteResponse]
$creadListPrec :: ReadPrec [CreateVpnConnectionRouteResponse]
readPrec :: ReadPrec CreateVpnConnectionRouteResponse
$creadPrec :: ReadPrec CreateVpnConnectionRouteResponse
readList :: ReadS [CreateVpnConnectionRouteResponse]
$creadList :: ReadS [CreateVpnConnectionRouteResponse]
readsPrec :: Int -> ReadS CreateVpnConnectionRouteResponse
$creadsPrec :: Int -> ReadS CreateVpnConnectionRouteResponse
Prelude.Read, Int -> CreateVpnConnectionRouteResponse -> ShowS
[CreateVpnConnectionRouteResponse] -> ShowS
CreateVpnConnectionRouteResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVpnConnectionRouteResponse] -> ShowS
$cshowList :: [CreateVpnConnectionRouteResponse] -> ShowS
show :: CreateVpnConnectionRouteResponse -> String
$cshow :: CreateVpnConnectionRouteResponse -> String
showsPrec :: Int -> CreateVpnConnectionRouteResponse -> ShowS
$cshowsPrec :: Int -> CreateVpnConnectionRouteResponse -> ShowS
Prelude.Show, forall x.
Rep CreateVpnConnectionRouteResponse x
-> CreateVpnConnectionRouteResponse
forall x.
CreateVpnConnectionRouteResponse
-> Rep CreateVpnConnectionRouteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVpnConnectionRouteResponse x
-> CreateVpnConnectionRouteResponse
$cfrom :: forall x.
CreateVpnConnectionRouteResponse
-> Rep CreateVpnConnectionRouteResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateVpnConnectionRouteResponse' 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.
newCreateVpnConnectionRouteResponse ::
  CreateVpnConnectionRouteResponse
newCreateVpnConnectionRouteResponse :: CreateVpnConnectionRouteResponse
newCreateVpnConnectionRouteResponse =
  CreateVpnConnectionRouteResponse
CreateVpnConnectionRouteResponse'

instance
  Prelude.NFData
    CreateVpnConnectionRouteResponse
  where
  rnf :: CreateVpnConnectionRouteResponse -> ()
rnf CreateVpnConnectionRouteResponse
_ = ()