{-# 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.FMS.Types.EC2ReplaceRouteAction
-- 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.FMS.Types.EC2ReplaceRouteAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FMS.Types.ActionTarget
import qualified Amazonka.Prelude as Prelude

-- | Information about the ReplaceRoute action in Amazon EC2.
--
-- /See:/ 'newEC2ReplaceRouteAction' smart constructor.
data EC2ReplaceRouteAction = EC2ReplaceRouteAction'
  { -- | A description of the ReplaceRoute action in Amazon EC2.
    EC2ReplaceRouteAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Information about the IPv4 CIDR address block used for the destination
    -- match. The value that you provide must match the CIDR of an existing
    -- route in the table.
    EC2ReplaceRouteAction -> Maybe Text
destinationCidrBlock :: Prelude.Maybe Prelude.Text,
    -- | Information about the IPv6 CIDR address block used for the destination
    -- match. The value that you provide must match the CIDR of an existing
    -- route in the table.
    EC2ReplaceRouteAction -> Maybe Text
destinationIpv6CidrBlock :: Prelude.Maybe Prelude.Text,
    -- | Information about the ID of the prefix list for the route.
    EC2ReplaceRouteAction -> Maybe Text
destinationPrefixListId :: Prelude.Maybe Prelude.Text,
    -- | Information about the ID of an internet gateway or virtual private
    -- gateway.
    EC2ReplaceRouteAction -> Maybe ActionTarget
gatewayId :: Prelude.Maybe ActionTarget,
    -- | Information about the ID of the route table.
    EC2ReplaceRouteAction -> ActionTarget
routeTableId :: ActionTarget
  }
  deriving (EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool
$c/= :: EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool
== :: EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool
$c== :: EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool
Prelude.Eq, ReadPrec [EC2ReplaceRouteAction]
ReadPrec EC2ReplaceRouteAction
Int -> ReadS EC2ReplaceRouteAction
ReadS [EC2ReplaceRouteAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2ReplaceRouteAction]
$creadListPrec :: ReadPrec [EC2ReplaceRouteAction]
readPrec :: ReadPrec EC2ReplaceRouteAction
$creadPrec :: ReadPrec EC2ReplaceRouteAction
readList :: ReadS [EC2ReplaceRouteAction]
$creadList :: ReadS [EC2ReplaceRouteAction]
readsPrec :: Int -> ReadS EC2ReplaceRouteAction
$creadsPrec :: Int -> ReadS EC2ReplaceRouteAction
Prelude.Read, Int -> EC2ReplaceRouteAction -> ShowS
[EC2ReplaceRouteAction] -> ShowS
EC2ReplaceRouteAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2ReplaceRouteAction] -> ShowS
$cshowList :: [EC2ReplaceRouteAction] -> ShowS
show :: EC2ReplaceRouteAction -> String
$cshow :: EC2ReplaceRouteAction -> String
showsPrec :: Int -> EC2ReplaceRouteAction -> ShowS
$cshowsPrec :: Int -> EC2ReplaceRouteAction -> ShowS
Prelude.Show, forall x. Rep EC2ReplaceRouteAction x -> EC2ReplaceRouteAction
forall x. EC2ReplaceRouteAction -> Rep EC2ReplaceRouteAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EC2ReplaceRouteAction x -> EC2ReplaceRouteAction
$cfrom :: forall x. EC2ReplaceRouteAction -> Rep EC2ReplaceRouteAction x
Prelude.Generic)

-- |
-- Create a value of 'EC2ReplaceRouteAction' 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:
--
-- 'description', 'eC2ReplaceRouteAction_description' - A description of the ReplaceRoute action in Amazon EC2.
--
-- 'destinationCidrBlock', 'eC2ReplaceRouteAction_destinationCidrBlock' - Information about the IPv4 CIDR address block used for the destination
-- match. The value that you provide must match the CIDR of an existing
-- route in the table.
--
-- 'destinationIpv6CidrBlock', 'eC2ReplaceRouteAction_destinationIpv6CidrBlock' - Information about the IPv6 CIDR address block used for the destination
-- match. The value that you provide must match the CIDR of an existing
-- route in the table.
--
-- 'destinationPrefixListId', 'eC2ReplaceRouteAction_destinationPrefixListId' - Information about the ID of the prefix list for the route.
--
-- 'gatewayId', 'eC2ReplaceRouteAction_gatewayId' - Information about the ID of an internet gateway or virtual private
-- gateway.
--
-- 'routeTableId', 'eC2ReplaceRouteAction_routeTableId' - Information about the ID of the route table.
newEC2ReplaceRouteAction ::
  -- | 'routeTableId'
  ActionTarget ->
  EC2ReplaceRouteAction
newEC2ReplaceRouteAction :: ActionTarget -> EC2ReplaceRouteAction
newEC2ReplaceRouteAction ActionTarget
pRouteTableId_ =
  EC2ReplaceRouteAction'
    { $sel:description:EC2ReplaceRouteAction' :: Maybe Text
description =
        forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCidrBlock:EC2ReplaceRouteAction' :: Maybe Text
destinationCidrBlock = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationIpv6CidrBlock:EC2ReplaceRouteAction' :: Maybe Text
destinationIpv6CidrBlock = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPrefixListId:EC2ReplaceRouteAction' :: Maybe Text
destinationPrefixListId = forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayId:EC2ReplaceRouteAction' :: Maybe ActionTarget
gatewayId = forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableId:EC2ReplaceRouteAction' :: ActionTarget
routeTableId = ActionTarget
pRouteTableId_
    }

-- | A description of the ReplaceRoute action in Amazon EC2.
eC2ReplaceRouteAction_description :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe Prelude.Text)
eC2ReplaceRouteAction_description :: Lens' EC2ReplaceRouteAction (Maybe Text)
eC2ReplaceRouteAction_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2ReplaceRouteAction' {Maybe Text
description :: Maybe Text
$sel:description:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
description} -> Maybe Text
description) (\s :: EC2ReplaceRouteAction
s@EC2ReplaceRouteAction' {} Maybe Text
a -> EC2ReplaceRouteAction
s {$sel:description:EC2ReplaceRouteAction' :: Maybe Text
description = Maybe Text
a} :: EC2ReplaceRouteAction)

-- | Information about the IPv4 CIDR address block used for the destination
-- match. The value that you provide must match the CIDR of an existing
-- route in the table.
eC2ReplaceRouteAction_destinationCidrBlock :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe Prelude.Text)
eC2ReplaceRouteAction_destinationCidrBlock :: Lens' EC2ReplaceRouteAction (Maybe Text)
eC2ReplaceRouteAction_destinationCidrBlock = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2ReplaceRouteAction' {Maybe Text
destinationCidrBlock :: Maybe Text
$sel:destinationCidrBlock:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
destinationCidrBlock} -> Maybe Text
destinationCidrBlock) (\s :: EC2ReplaceRouteAction
s@EC2ReplaceRouteAction' {} Maybe Text
a -> EC2ReplaceRouteAction
s {$sel:destinationCidrBlock:EC2ReplaceRouteAction' :: Maybe Text
destinationCidrBlock = Maybe Text
a} :: EC2ReplaceRouteAction)

-- | Information about the IPv6 CIDR address block used for the destination
-- match. The value that you provide must match the CIDR of an existing
-- route in the table.
eC2ReplaceRouteAction_destinationIpv6CidrBlock :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe Prelude.Text)
eC2ReplaceRouteAction_destinationIpv6CidrBlock :: Lens' EC2ReplaceRouteAction (Maybe Text)
eC2ReplaceRouteAction_destinationIpv6CidrBlock = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2ReplaceRouteAction' {Maybe Text
destinationIpv6CidrBlock :: Maybe Text
$sel:destinationIpv6CidrBlock:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
destinationIpv6CidrBlock} -> Maybe Text
destinationIpv6CidrBlock) (\s :: EC2ReplaceRouteAction
s@EC2ReplaceRouteAction' {} Maybe Text
a -> EC2ReplaceRouteAction
s {$sel:destinationIpv6CidrBlock:EC2ReplaceRouteAction' :: Maybe Text
destinationIpv6CidrBlock = Maybe Text
a} :: EC2ReplaceRouteAction)

-- | Information about the ID of the prefix list for the route.
eC2ReplaceRouteAction_destinationPrefixListId :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe Prelude.Text)
eC2ReplaceRouteAction_destinationPrefixListId :: Lens' EC2ReplaceRouteAction (Maybe Text)
eC2ReplaceRouteAction_destinationPrefixListId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2ReplaceRouteAction' {Maybe Text
destinationPrefixListId :: Maybe Text
$sel:destinationPrefixListId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
destinationPrefixListId} -> Maybe Text
destinationPrefixListId) (\s :: EC2ReplaceRouteAction
s@EC2ReplaceRouteAction' {} Maybe Text
a -> EC2ReplaceRouteAction
s {$sel:destinationPrefixListId:EC2ReplaceRouteAction' :: Maybe Text
destinationPrefixListId = Maybe Text
a} :: EC2ReplaceRouteAction)

-- | Information about the ID of an internet gateway or virtual private
-- gateway.
eC2ReplaceRouteAction_gatewayId :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe ActionTarget)
eC2ReplaceRouteAction_gatewayId :: Lens' EC2ReplaceRouteAction (Maybe ActionTarget)
eC2ReplaceRouteAction_gatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2ReplaceRouteAction' {Maybe ActionTarget
gatewayId :: Maybe ActionTarget
$sel:gatewayId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe ActionTarget
gatewayId} -> Maybe ActionTarget
gatewayId) (\s :: EC2ReplaceRouteAction
s@EC2ReplaceRouteAction' {} Maybe ActionTarget
a -> EC2ReplaceRouteAction
s {$sel:gatewayId:EC2ReplaceRouteAction' :: Maybe ActionTarget
gatewayId = Maybe ActionTarget
a} :: EC2ReplaceRouteAction)

-- | Information about the ID of the route table.
eC2ReplaceRouteAction_routeTableId :: Lens.Lens' EC2ReplaceRouteAction ActionTarget
eC2ReplaceRouteAction_routeTableId :: Lens' EC2ReplaceRouteAction ActionTarget
eC2ReplaceRouteAction_routeTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2ReplaceRouteAction' {ActionTarget
routeTableId :: ActionTarget
$sel:routeTableId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> ActionTarget
routeTableId} -> ActionTarget
routeTableId) (\s :: EC2ReplaceRouteAction
s@EC2ReplaceRouteAction' {} ActionTarget
a -> EC2ReplaceRouteAction
s {$sel:routeTableId:EC2ReplaceRouteAction' :: ActionTarget
routeTableId = ActionTarget
a} :: EC2ReplaceRouteAction)

instance Data.FromJSON EC2ReplaceRouteAction where
  parseJSON :: Value -> Parser EC2ReplaceRouteAction
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EC2ReplaceRouteAction"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ActionTarget
-> ActionTarget
-> EC2ReplaceRouteAction
EC2ReplaceRouteAction'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DestinationCidrBlock")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DestinationIpv6CidrBlock")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DestinationPrefixListId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GatewayId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RouteTableId")
      )

instance Prelude.Hashable EC2ReplaceRouteAction where
  hashWithSalt :: Int -> EC2ReplaceRouteAction -> Int
hashWithSalt Int
_salt EC2ReplaceRouteAction' {Maybe Text
Maybe ActionTarget
ActionTarget
routeTableId :: ActionTarget
gatewayId :: Maybe ActionTarget
destinationPrefixListId :: Maybe Text
destinationIpv6CidrBlock :: Maybe Text
destinationCidrBlock :: Maybe Text
description :: Maybe Text
$sel:routeTableId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> ActionTarget
$sel:gatewayId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe ActionTarget
$sel:destinationPrefixListId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
$sel:destinationIpv6CidrBlock:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
$sel:destinationCidrBlock:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
$sel:description:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationCidrBlock
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationIpv6CidrBlock
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationPrefixListId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionTarget
gatewayId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ActionTarget
routeTableId

instance Prelude.NFData EC2ReplaceRouteAction where
  rnf :: EC2ReplaceRouteAction -> ()
rnf EC2ReplaceRouteAction' {Maybe Text
Maybe ActionTarget
ActionTarget
routeTableId :: ActionTarget
gatewayId :: Maybe ActionTarget
destinationPrefixListId :: Maybe Text
destinationIpv6CidrBlock :: Maybe Text
destinationCidrBlock :: Maybe Text
description :: Maybe Text
$sel:routeTableId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> ActionTarget
$sel:gatewayId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe ActionTarget
$sel:destinationPrefixListId:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
$sel:destinationIpv6CidrBlock:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
$sel:destinationCidrBlock:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
$sel:description:EC2ReplaceRouteAction' :: EC2ReplaceRouteAction -> Maybe Text
..} =
    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
destinationCidrBlock
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationIpv6CidrBlock
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationPrefixListId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionTarget
gatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ActionTarget
routeTableId