{-# 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.EC2CreateRouteAction
-- 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.EC2CreateRouteAction 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 CreateRoute action in Amazon EC2.
--
-- /See:/ 'newEC2CreateRouteAction' smart constructor.
data EC2CreateRouteAction = EC2CreateRouteAction'
  { -- | Information about the IPv6 CIDR block destination.
    EC2CreateRouteAction -> Maybe Text
destinationIpv6CidrBlock :: Prelude.Maybe Prelude.Text,
    -- | Information about the ID of an internet gateway or virtual private
    -- gateway attached to your VPC.
    EC2CreateRouteAction -> Maybe ActionTarget
gatewayId :: Prelude.Maybe ActionTarget,
    -- | Information about the ID of a VPC endpoint. Supported for Gateway Load
    -- Balancer endpoints only.
    EC2CreateRouteAction -> Maybe ActionTarget
vpcEndpointId :: Prelude.Maybe ActionTarget,
    -- | Information about the ID of a prefix list used for the destination
    -- match.
    EC2CreateRouteAction -> Maybe Text
destinationPrefixListId :: Prelude.Maybe Prelude.Text,
    -- | A description of CreateRoute action in Amazon EC2.
    EC2CreateRouteAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Information about the IPv4 CIDR address block used for the destination
    -- match.
    EC2CreateRouteAction -> Maybe Text
destinationCidrBlock :: Prelude.Maybe Prelude.Text,
    -- | Information about the ID of the route table for the route.
    EC2CreateRouteAction -> ActionTarget
routeTableId :: ActionTarget
  }
  deriving (EC2CreateRouteAction -> EC2CreateRouteAction -> Bool
(EC2CreateRouteAction -> EC2CreateRouteAction -> Bool)
-> (EC2CreateRouteAction -> EC2CreateRouteAction -> Bool)
-> Eq EC2CreateRouteAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2CreateRouteAction -> EC2CreateRouteAction -> Bool
$c/= :: EC2CreateRouteAction -> EC2CreateRouteAction -> Bool
== :: EC2CreateRouteAction -> EC2CreateRouteAction -> Bool
$c== :: EC2CreateRouteAction -> EC2CreateRouteAction -> Bool
Prelude.Eq, ReadPrec [EC2CreateRouteAction]
ReadPrec EC2CreateRouteAction
Int -> ReadS EC2CreateRouteAction
ReadS [EC2CreateRouteAction]
(Int -> ReadS EC2CreateRouteAction)
-> ReadS [EC2CreateRouteAction]
-> ReadPrec EC2CreateRouteAction
-> ReadPrec [EC2CreateRouteAction]
-> Read EC2CreateRouteAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2CreateRouteAction]
$creadListPrec :: ReadPrec [EC2CreateRouteAction]
readPrec :: ReadPrec EC2CreateRouteAction
$creadPrec :: ReadPrec EC2CreateRouteAction
readList :: ReadS [EC2CreateRouteAction]
$creadList :: ReadS [EC2CreateRouteAction]
readsPrec :: Int -> ReadS EC2CreateRouteAction
$creadsPrec :: Int -> ReadS EC2CreateRouteAction
Prelude.Read, Int -> EC2CreateRouteAction -> ShowS
[EC2CreateRouteAction] -> ShowS
EC2CreateRouteAction -> String
(Int -> EC2CreateRouteAction -> ShowS)
-> (EC2CreateRouteAction -> String)
-> ([EC2CreateRouteAction] -> ShowS)
-> Show EC2CreateRouteAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2CreateRouteAction] -> ShowS
$cshowList :: [EC2CreateRouteAction] -> ShowS
show :: EC2CreateRouteAction -> String
$cshow :: EC2CreateRouteAction -> String
showsPrec :: Int -> EC2CreateRouteAction -> ShowS
$cshowsPrec :: Int -> EC2CreateRouteAction -> ShowS
Prelude.Show, (forall x. EC2CreateRouteAction -> Rep EC2CreateRouteAction x)
-> (forall x. Rep EC2CreateRouteAction x -> EC2CreateRouteAction)
-> Generic EC2CreateRouteAction
forall x. Rep EC2CreateRouteAction x -> EC2CreateRouteAction
forall x. EC2CreateRouteAction -> Rep EC2CreateRouteAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EC2CreateRouteAction x -> EC2CreateRouteAction
$cfrom :: forall x. EC2CreateRouteAction -> Rep EC2CreateRouteAction x
Prelude.Generic)

-- |
-- Create a value of 'EC2CreateRouteAction' 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', 'eC2CreateRouteAction_destinationIpv6CidrBlock' - Information about the IPv6 CIDR block destination.
--
-- 'gatewayId', 'eC2CreateRouteAction_gatewayId' - Information about the ID of an internet gateway or virtual private
-- gateway attached to your VPC.
--
-- 'vpcEndpointId', 'eC2CreateRouteAction_vpcEndpointId' - Information about the ID of a VPC endpoint. Supported for Gateway Load
-- Balancer endpoints only.
--
-- 'destinationPrefixListId', 'eC2CreateRouteAction_destinationPrefixListId' - Information about the ID of a prefix list used for the destination
-- match.
--
-- 'description', 'eC2CreateRouteAction_description' - A description of CreateRoute action in Amazon EC2.
--
-- 'destinationCidrBlock', 'eC2CreateRouteAction_destinationCidrBlock' - Information about the IPv4 CIDR address block used for the destination
-- match.
--
-- 'routeTableId', 'eC2CreateRouteAction_routeTableId' - Information about the ID of the route table for the route.
newEC2CreateRouteAction ::
  -- | 'routeTableId'
  ActionTarget ->
  EC2CreateRouteAction
newEC2CreateRouteAction :: ActionTarget -> EC2CreateRouteAction
newEC2CreateRouteAction ActionTarget
pRouteTableId_ =
  EC2CreateRouteAction' :: Maybe Text
-> Maybe ActionTarget
-> Maybe ActionTarget
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ActionTarget
-> EC2CreateRouteAction
EC2CreateRouteAction'
    { $sel:destinationIpv6CidrBlock:EC2CreateRouteAction' :: Maybe Text
destinationIpv6CidrBlock =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayId:EC2CreateRouteAction' :: Maybe ActionTarget
gatewayId = Maybe ActionTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcEndpointId:EC2CreateRouteAction' :: Maybe ActionTarget
vpcEndpointId = Maybe ActionTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPrefixListId:EC2CreateRouteAction' :: Maybe Text
destinationPrefixListId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:EC2CreateRouteAction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCidrBlock:EC2CreateRouteAction' :: Maybe Text
destinationCidrBlock = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableId:EC2CreateRouteAction' :: ActionTarget
routeTableId = ActionTarget
pRouteTableId_
    }

-- | Information about the IPv6 CIDR block destination.
eC2CreateRouteAction_destinationIpv6CidrBlock :: Lens.Lens' EC2CreateRouteAction (Prelude.Maybe Prelude.Text)
eC2CreateRouteAction_destinationIpv6CidrBlock :: (Maybe Text -> f (Maybe Text))
-> EC2CreateRouteAction -> f EC2CreateRouteAction
eC2CreateRouteAction_destinationIpv6CidrBlock = (EC2CreateRouteAction -> Maybe Text)
-> (EC2CreateRouteAction -> Maybe Text -> EC2CreateRouteAction)
-> Lens
     EC2CreateRouteAction EC2CreateRouteAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2CreateRouteAction' {Maybe Text
destinationIpv6CidrBlock :: Maybe Text
$sel:destinationIpv6CidrBlock:EC2CreateRouteAction' :: EC2CreateRouteAction -> Maybe Text
destinationIpv6CidrBlock} -> Maybe Text
destinationIpv6CidrBlock) (\s :: EC2CreateRouteAction
s@EC2CreateRouteAction' {} Maybe Text
a -> EC2CreateRouteAction
s {$sel:destinationIpv6CidrBlock:EC2CreateRouteAction' :: Maybe Text
destinationIpv6CidrBlock = Maybe Text
a} :: EC2CreateRouteAction)

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

-- | Information about the ID of a VPC endpoint. Supported for Gateway Load
-- Balancer endpoints only.
eC2CreateRouteAction_vpcEndpointId :: Lens.Lens' EC2CreateRouteAction (Prelude.Maybe ActionTarget)
eC2CreateRouteAction_vpcEndpointId :: (Maybe ActionTarget -> f (Maybe ActionTarget))
-> EC2CreateRouteAction -> f EC2CreateRouteAction
eC2CreateRouteAction_vpcEndpointId = (EC2CreateRouteAction -> Maybe ActionTarget)
-> (EC2CreateRouteAction
    -> Maybe ActionTarget -> EC2CreateRouteAction)
-> Lens
     EC2CreateRouteAction
     EC2CreateRouteAction
     (Maybe ActionTarget)
     (Maybe ActionTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2CreateRouteAction' {Maybe ActionTarget
vpcEndpointId :: Maybe ActionTarget
$sel:vpcEndpointId:EC2CreateRouteAction' :: EC2CreateRouteAction -> Maybe ActionTarget
vpcEndpointId} -> Maybe ActionTarget
vpcEndpointId) (\s :: EC2CreateRouteAction
s@EC2CreateRouteAction' {} Maybe ActionTarget
a -> EC2CreateRouteAction
s {$sel:vpcEndpointId:EC2CreateRouteAction' :: Maybe ActionTarget
vpcEndpointId = Maybe ActionTarget
a} :: EC2CreateRouteAction)

-- | Information about the ID of a prefix list used for the destination
-- match.
eC2CreateRouteAction_destinationPrefixListId :: Lens.Lens' EC2CreateRouteAction (Prelude.Maybe Prelude.Text)
eC2CreateRouteAction_destinationPrefixListId :: (Maybe Text -> f (Maybe Text))
-> EC2CreateRouteAction -> f EC2CreateRouteAction
eC2CreateRouteAction_destinationPrefixListId = (EC2CreateRouteAction -> Maybe Text)
-> (EC2CreateRouteAction -> Maybe Text -> EC2CreateRouteAction)
-> Lens
     EC2CreateRouteAction EC2CreateRouteAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2CreateRouteAction' {Maybe Text
destinationPrefixListId :: Maybe Text
$sel:destinationPrefixListId:EC2CreateRouteAction' :: EC2CreateRouteAction -> Maybe Text
destinationPrefixListId} -> Maybe Text
destinationPrefixListId) (\s :: EC2CreateRouteAction
s@EC2CreateRouteAction' {} Maybe Text
a -> EC2CreateRouteAction
s {$sel:destinationPrefixListId:EC2CreateRouteAction' :: Maybe Text
destinationPrefixListId = Maybe Text
a} :: EC2CreateRouteAction)

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

-- | Information about the IPv4 CIDR address block used for the destination
-- match.
eC2CreateRouteAction_destinationCidrBlock :: Lens.Lens' EC2CreateRouteAction (Prelude.Maybe Prelude.Text)
eC2CreateRouteAction_destinationCidrBlock :: (Maybe Text -> f (Maybe Text))
-> EC2CreateRouteAction -> f EC2CreateRouteAction
eC2CreateRouteAction_destinationCidrBlock = (EC2CreateRouteAction -> Maybe Text)
-> (EC2CreateRouteAction -> Maybe Text -> EC2CreateRouteAction)
-> Lens
     EC2CreateRouteAction EC2CreateRouteAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2CreateRouteAction' {Maybe Text
destinationCidrBlock :: Maybe Text
$sel:destinationCidrBlock:EC2CreateRouteAction' :: EC2CreateRouteAction -> Maybe Text
destinationCidrBlock} -> Maybe Text
destinationCidrBlock) (\s :: EC2CreateRouteAction
s@EC2CreateRouteAction' {} Maybe Text
a -> EC2CreateRouteAction
s {$sel:destinationCidrBlock:EC2CreateRouteAction' :: Maybe Text
destinationCidrBlock = Maybe Text
a} :: EC2CreateRouteAction)

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

instance Core.FromJSON EC2CreateRouteAction where
  parseJSON :: Value -> Parser EC2CreateRouteAction
parseJSON =
    String
-> (Object -> Parser EC2CreateRouteAction)
-> Value
-> Parser EC2CreateRouteAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EC2CreateRouteAction"
      ( \Object
x ->
          Maybe Text
-> Maybe ActionTarget
-> Maybe ActionTarget
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ActionTarget
-> EC2CreateRouteAction
EC2CreateRouteAction'
            (Maybe Text
 -> Maybe ActionTarget
 -> Maybe ActionTarget
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ActionTarget
 -> EC2CreateRouteAction)
-> Parser (Maybe Text)
-> Parser
     (Maybe ActionTarget
      -> Maybe ActionTarget
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ActionTarget
      -> EC2CreateRouteAction)
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 ActionTarget
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ActionTarget
   -> EC2CreateRouteAction)
-> Parser (Maybe ActionTarget)
-> Parser
     (Maybe ActionTarget
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ActionTarget
      -> EC2CreateRouteAction)
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 ActionTarget
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ActionTarget
   -> EC2CreateRouteAction)
-> Parser (Maybe ActionTarget)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ActionTarget
      -> EC2CreateRouteAction)
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
"VpcEndpointId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ActionTarget
   -> EC2CreateRouteAction)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> ActionTarget -> EC2CreateRouteAction)
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 -> EC2CreateRouteAction)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ActionTarget -> EC2CreateRouteAction)
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 -> EC2CreateRouteAction)
-> Parser (Maybe Text)
-> Parser (ActionTarget -> EC2CreateRouteAction)
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 -> EC2CreateRouteAction)
-> Parser ActionTarget -> Parser EC2CreateRouteAction
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 EC2CreateRouteAction

instance Prelude.NFData EC2CreateRouteAction