{-# 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.EnableVgwRoutePropagation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enables a virtual private gateway (VGW) to propagate routes to the
-- specified route table of a VPC.
module Amazonka.EC2.EnableVgwRoutePropagation
  ( -- * Creating a Request
    EnableVgwRoutePropagation (..),
    newEnableVgwRoutePropagation,

    -- * Request Lenses
    enableVgwRoutePropagation_dryRun,
    enableVgwRoutePropagation_gatewayId,
    enableVgwRoutePropagation_routeTableId,

    -- * Destructuring the Response
    EnableVgwRoutePropagationResponse (..),
    newEnableVgwRoutePropagationResponse,
  )
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 EnableVgwRoutePropagation.
--
-- /See:/ 'newEnableVgwRoutePropagation' smart constructor.
data EnableVgwRoutePropagation = EnableVgwRoutePropagation'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    EnableVgwRoutePropagation -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the virtual private gateway that is attached to a VPC. The
    -- virtual private gateway must be attached to the same VPC that the
    -- routing tables are associated with.
    EnableVgwRoutePropagation -> Text
gatewayId :: Prelude.Text,
    -- | The ID of the route table. The routing table must be associated with the
    -- same VPC that the virtual private gateway is attached to.
    EnableVgwRoutePropagation -> Text
routeTableId :: Prelude.Text
  }
  deriving (EnableVgwRoutePropagation -> EnableVgwRoutePropagation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableVgwRoutePropagation -> EnableVgwRoutePropagation -> Bool
$c/= :: EnableVgwRoutePropagation -> EnableVgwRoutePropagation -> Bool
== :: EnableVgwRoutePropagation -> EnableVgwRoutePropagation -> Bool
$c== :: EnableVgwRoutePropagation -> EnableVgwRoutePropagation -> Bool
Prelude.Eq, ReadPrec [EnableVgwRoutePropagation]
ReadPrec EnableVgwRoutePropagation
Int -> ReadS EnableVgwRoutePropagation
ReadS [EnableVgwRoutePropagation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableVgwRoutePropagation]
$creadListPrec :: ReadPrec [EnableVgwRoutePropagation]
readPrec :: ReadPrec EnableVgwRoutePropagation
$creadPrec :: ReadPrec EnableVgwRoutePropagation
readList :: ReadS [EnableVgwRoutePropagation]
$creadList :: ReadS [EnableVgwRoutePropagation]
readsPrec :: Int -> ReadS EnableVgwRoutePropagation
$creadsPrec :: Int -> ReadS EnableVgwRoutePropagation
Prelude.Read, Int -> EnableVgwRoutePropagation -> ShowS
[EnableVgwRoutePropagation] -> ShowS
EnableVgwRoutePropagation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableVgwRoutePropagation] -> ShowS
$cshowList :: [EnableVgwRoutePropagation] -> ShowS
show :: EnableVgwRoutePropagation -> String
$cshow :: EnableVgwRoutePropagation -> String
showsPrec :: Int -> EnableVgwRoutePropagation -> ShowS
$cshowsPrec :: Int -> EnableVgwRoutePropagation -> ShowS
Prelude.Show, forall x.
Rep EnableVgwRoutePropagation x -> EnableVgwRoutePropagation
forall x.
EnableVgwRoutePropagation -> Rep EnableVgwRoutePropagation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableVgwRoutePropagation x -> EnableVgwRoutePropagation
$cfrom :: forall x.
EnableVgwRoutePropagation -> Rep EnableVgwRoutePropagation x
Prelude.Generic)

-- |
-- Create a value of 'EnableVgwRoutePropagation' 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:
--
-- 'dryRun', 'enableVgwRoutePropagation_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'gatewayId', 'enableVgwRoutePropagation_gatewayId' - The ID of the virtual private gateway that is attached to a VPC. The
-- virtual private gateway must be attached to the same VPC that the
-- routing tables are associated with.
--
-- 'routeTableId', 'enableVgwRoutePropagation_routeTableId' - The ID of the route table. The routing table must be associated with the
-- same VPC that the virtual private gateway is attached to.
newEnableVgwRoutePropagation ::
  -- | 'gatewayId'
  Prelude.Text ->
  -- | 'routeTableId'
  Prelude.Text ->
  EnableVgwRoutePropagation
newEnableVgwRoutePropagation :: Text -> Text -> EnableVgwRoutePropagation
newEnableVgwRoutePropagation
  Text
pGatewayId_
  Text
pRouteTableId_ =
    EnableVgwRoutePropagation'
      { $sel:dryRun:EnableVgwRoutePropagation' :: Maybe Bool
dryRun =
          forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayId:EnableVgwRoutePropagation' :: Text
gatewayId = Text
pGatewayId_,
        $sel:routeTableId:EnableVgwRoutePropagation' :: Text
routeTableId = Text
pRouteTableId_
      }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
enableVgwRoutePropagation_dryRun :: Lens.Lens' EnableVgwRoutePropagation (Prelude.Maybe Prelude.Bool)
enableVgwRoutePropagation_dryRun :: Lens' EnableVgwRoutePropagation (Maybe Bool)
enableVgwRoutePropagation_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableVgwRoutePropagation' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: EnableVgwRoutePropagation
s@EnableVgwRoutePropagation' {} Maybe Bool
a -> EnableVgwRoutePropagation
s {$sel:dryRun:EnableVgwRoutePropagation' :: Maybe Bool
dryRun = Maybe Bool
a} :: EnableVgwRoutePropagation)

-- | The ID of the virtual private gateway that is attached to a VPC. The
-- virtual private gateway must be attached to the same VPC that the
-- routing tables are associated with.
enableVgwRoutePropagation_gatewayId :: Lens.Lens' EnableVgwRoutePropagation Prelude.Text
enableVgwRoutePropagation_gatewayId :: Lens' EnableVgwRoutePropagation Text
enableVgwRoutePropagation_gatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableVgwRoutePropagation' {Text
gatewayId :: Text
$sel:gatewayId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
gatewayId} -> Text
gatewayId) (\s :: EnableVgwRoutePropagation
s@EnableVgwRoutePropagation' {} Text
a -> EnableVgwRoutePropagation
s {$sel:gatewayId:EnableVgwRoutePropagation' :: Text
gatewayId = Text
a} :: EnableVgwRoutePropagation)

-- | The ID of the route table. The routing table must be associated with the
-- same VPC that the virtual private gateway is attached to.
enableVgwRoutePropagation_routeTableId :: Lens.Lens' EnableVgwRoutePropagation Prelude.Text
enableVgwRoutePropagation_routeTableId :: Lens' EnableVgwRoutePropagation Text
enableVgwRoutePropagation_routeTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableVgwRoutePropagation' {Text
routeTableId :: Text
$sel:routeTableId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
routeTableId} -> Text
routeTableId) (\s :: EnableVgwRoutePropagation
s@EnableVgwRoutePropagation' {} Text
a -> EnableVgwRoutePropagation
s {$sel:routeTableId:EnableVgwRoutePropagation' :: Text
routeTableId = Text
a} :: EnableVgwRoutePropagation)

instance Core.AWSRequest EnableVgwRoutePropagation where
  type
    AWSResponse EnableVgwRoutePropagation =
      EnableVgwRoutePropagationResponse
  request :: (Service -> Service)
-> EnableVgwRoutePropagation -> Request EnableVgwRoutePropagation
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 EnableVgwRoutePropagation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableVgwRoutePropagation)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      EnableVgwRoutePropagationResponse
EnableVgwRoutePropagationResponse'

instance Prelude.Hashable EnableVgwRoutePropagation where
  hashWithSalt :: Int -> EnableVgwRoutePropagation -> Int
hashWithSalt Int
_salt EnableVgwRoutePropagation' {Maybe Bool
Text
routeTableId :: Text
gatewayId :: Text
dryRun :: Maybe Bool
$sel:routeTableId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
$sel:gatewayId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
$sel:dryRun:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
routeTableId

instance Prelude.NFData EnableVgwRoutePropagation where
  rnf :: EnableVgwRoutePropagation -> ()
rnf EnableVgwRoutePropagation' {Maybe Bool
Text
routeTableId :: Text
gatewayId :: Text
dryRun :: Maybe Bool
$sel:routeTableId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
$sel:gatewayId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
$sel:dryRun:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
routeTableId

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

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

instance Data.ToQuery EnableVgwRoutePropagation where
  toQuery :: EnableVgwRoutePropagation -> QueryString
toQuery EnableVgwRoutePropagation' {Maybe Bool
Text
routeTableId :: Text
gatewayId :: Text
dryRun :: Maybe Bool
$sel:routeTableId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
$sel:gatewayId:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Text
$sel:dryRun:EnableVgwRoutePropagation' :: EnableVgwRoutePropagation -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"EnableVgwRoutePropagation" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"GatewayId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
gatewayId,
        ByteString
"RouteTableId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
routeTableId
      ]

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

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

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