{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FMS.Types.EC2ReplaceRouteAction where

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

-- | Information about the ReplaceRoute action in Amazon EC2.
--
-- /See:/ 'newEC2ReplaceRouteAction' smart constructor.
data EC2ReplaceRouteAction = 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 -> Maybe Text
destinationIpv6CidrBlock :: 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 prefix list for the route.
    EC2ReplaceRouteAction -> Maybe Text
destinationPrefixListId :: Prelude.Maybe Prelude.Text,
    -- | 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 ID of the route table.
    EC2ReplaceRouteAction -> ActionTarget
routeTableId :: ActionTarget
  }
  deriving (EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool
(EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool)
-> (EC2ReplaceRouteAction -> EC2ReplaceRouteAction -> Bool)
-> Eq EC2ReplaceRouteAction
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]
(Int -> ReadS EC2ReplaceRouteAction)
-> ReadS [EC2ReplaceRouteAction]
-> ReadPrec EC2ReplaceRouteAction
-> ReadPrec [EC2ReplaceRouteAction]
-> Read 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
(Int -> EC2ReplaceRouteAction -> ShowS)
-> (EC2ReplaceRouteAction -> String)
-> ([EC2ReplaceRouteAction] -> ShowS)
-> Show EC2ReplaceRouteAction
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. EC2ReplaceRouteAction -> Rep EC2ReplaceRouteAction x)
-> (forall x. Rep EC2ReplaceRouteAction x -> EC2ReplaceRouteAction)
-> Generic EC2ReplaceRouteAction
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:
--
-- '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.
--
-- 'gatewayId', 'eC2ReplaceRouteAction_gatewayId' - Information about the ID of an internet gateway or virtual private
-- gateway.
--
-- 'destinationPrefixListId', 'eC2ReplaceRouteAction_destinationPrefixListId' - Information about the ID of the prefix list for the route.
--
-- '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.
--
-- 'routeTableId', 'eC2ReplaceRouteAction_routeTableId' - Information about the ID of the route table.
newEC2ReplaceRouteAction ::
  -- | 'routeTableId'
  ActionTarget ->
  EC2ReplaceRouteAction
newEC2ReplaceRouteAction :: ActionTarget -> EC2ReplaceRouteAction
newEC2ReplaceRouteAction ActionTarget
pRouteTableId_ =
  EC2ReplaceRouteAction' :: Maybe Text
-> Maybe ActionTarget
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ActionTarget
-> EC2ReplaceRouteAction
EC2ReplaceRouteAction'
    { $sel:destinationIpv6CidrBlock:EC2ReplaceRouteAction' :: Maybe Text
destinationIpv6CidrBlock =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayId:EC2ReplaceRouteAction' :: Maybe ActionTarget
gatewayId = Maybe ActionTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPrefixListId:EC2ReplaceRouteAction' :: Maybe Text
destinationPrefixListId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:EC2ReplaceRouteAction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCidrBlock:EC2ReplaceRouteAction' :: Maybe Text
destinationCidrBlock = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableId:EC2ReplaceRouteAction' :: ActionTarget
routeTableId = ActionTarget
pRouteTableId_
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> EC2ReplaceRouteAction -> f EC2ReplaceRouteAction
eC2ReplaceRouteAction_destinationIpv6CidrBlock = (EC2ReplaceRouteAction -> Maybe Text)
-> (EC2ReplaceRouteAction -> Maybe Text -> EC2ReplaceRouteAction)
-> Lens
     EC2ReplaceRouteAction
     EC2ReplaceRouteAction
     (Maybe Text)
     (Maybe Text)
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 an internet gateway or virtual private
-- gateway.
eC2ReplaceRouteAction_gatewayId :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe ActionTarget)
eC2ReplaceRouteAction_gatewayId :: (Maybe ActionTarget -> f (Maybe ActionTarget))
-> EC2ReplaceRouteAction -> f EC2ReplaceRouteAction
eC2ReplaceRouteAction_gatewayId = (EC2ReplaceRouteAction -> Maybe ActionTarget)
-> (EC2ReplaceRouteAction
    -> Maybe ActionTarget -> EC2ReplaceRouteAction)
-> Lens
     EC2ReplaceRouteAction
     EC2ReplaceRouteAction
     (Maybe ActionTarget)
     (Maybe ActionTarget)
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 prefix list for the route.
eC2ReplaceRouteAction_destinationPrefixListId :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe Prelude.Text)
eC2ReplaceRouteAction_destinationPrefixListId :: (Maybe Text -> f (Maybe Text))
-> EC2ReplaceRouteAction -> f EC2ReplaceRouteAction
eC2ReplaceRouteAction_destinationPrefixListId = (EC2ReplaceRouteAction -> Maybe Text)
-> (EC2ReplaceRouteAction -> Maybe Text -> EC2ReplaceRouteAction)
-> Lens
     EC2ReplaceRouteAction
     EC2ReplaceRouteAction
     (Maybe Text)
     (Maybe Text)
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)

-- | A description of the ReplaceRoute action in Amazon EC2.
eC2ReplaceRouteAction_description :: Lens.Lens' EC2ReplaceRouteAction (Prelude.Maybe Prelude.Text)
eC2ReplaceRouteAction_description :: (Maybe Text -> f (Maybe Text))
-> EC2ReplaceRouteAction -> f EC2ReplaceRouteAction
eC2ReplaceRouteAction_description = (EC2ReplaceRouteAction -> Maybe Text)
-> (EC2ReplaceRouteAction -> Maybe Text -> EC2ReplaceRouteAction)
-> Lens
     EC2ReplaceRouteAction
     EC2ReplaceRouteAction
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> EC2ReplaceRouteAction -> f EC2ReplaceRouteAction
eC2ReplaceRouteAction_destinationCidrBlock = (EC2ReplaceRouteAction -> Maybe Text)
-> (EC2ReplaceRouteAction -> Maybe Text -> EC2ReplaceRouteAction)
-> Lens
     EC2ReplaceRouteAction
     EC2ReplaceRouteAction
     (Maybe Text)
     (Maybe Text)
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 ID of the route table.
eC2ReplaceRouteAction_routeTableId :: Lens.Lens' EC2ReplaceRouteAction ActionTarget
eC2ReplaceRouteAction_routeTableId :: (ActionTarget -> f ActionTarget)
-> EC2ReplaceRouteAction -> f EC2ReplaceRouteAction
eC2ReplaceRouteAction_routeTableId = (EC2ReplaceRouteAction -> ActionTarget)
-> (EC2ReplaceRouteAction -> ActionTarget -> EC2ReplaceRouteAction)
-> Lens
     EC2ReplaceRouteAction
     EC2ReplaceRouteAction
     ActionTarget
     ActionTarget
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 Core.FromJSON EC2ReplaceRouteAction where
  parseJSON :: Value -> Parser EC2ReplaceRouteAction
parseJSON =
    String
-> (Object -> Parser EC2ReplaceRouteAction)
-> Value
-> Parser EC2ReplaceRouteAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EC2ReplaceRouteAction"
      ( \Object
x ->
          Maybe Text
-> Maybe ActionTarget
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ActionTarget
-> EC2ReplaceRouteAction
EC2ReplaceRouteAction'
            (Maybe Text
 -> Maybe ActionTarget
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ActionTarget
 -> EC2ReplaceRouteAction)
-> Parser (Maybe Text)
-> Parser
     (Maybe ActionTarget
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ActionTarget
      -> EC2ReplaceRouteAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationIpv6CidrBlock")
            Parser
  (Maybe ActionTarget
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ActionTarget
   -> EC2ReplaceRouteAction)
-> Parser (Maybe ActionTarget)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ActionTarget
      -> EC2ReplaceRouteAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ActionTarget)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GatewayId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ActionTarget
   -> EC2ReplaceRouteAction)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> ActionTarget -> EC2ReplaceRouteAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationPrefixListId")
            Parser
  (Maybe Text -> Maybe Text -> ActionTarget -> EC2ReplaceRouteAction)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ActionTarget -> EC2ReplaceRouteAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
            Parser (Maybe Text -> ActionTarget -> EC2ReplaceRouteAction)
-> Parser (Maybe Text)
-> Parser (ActionTarget -> EC2ReplaceRouteAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationCidrBlock")
            Parser (ActionTarget -> EC2ReplaceRouteAction)
-> Parser ActionTarget -> Parser EC2ReplaceRouteAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActionTarget
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RouteTableId")
      )

instance Prelude.Hashable EC2ReplaceRouteAction

instance Prelude.NFData EC2ReplaceRouteAction