{-# 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.EC2AssociateRouteTableAction
-- 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.EC2AssociateRouteTableAction where

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

-- | The action of associating an EC2 resource, such as a subnet or internet
-- gateway, with a route table.
--
-- /See:/ 'newEC2AssociateRouteTableAction' smart constructor.
data EC2AssociateRouteTableAction = EC2AssociateRouteTableAction'
  { -- | The ID of the subnet for the EC2 route table that is associated with the
    -- remediation action.
    EC2AssociateRouteTableAction -> Maybe ActionTarget
subnetId :: Prelude.Maybe ActionTarget,
    -- | The ID of the gateway to be used with the EC2 route table that is
    -- associated with the remediation action.
    EC2AssociateRouteTableAction -> Maybe ActionTarget
gatewayId :: Prelude.Maybe ActionTarget,
    -- | A description of the EC2 route table that is associated with the
    -- remediation action.
    EC2AssociateRouteTableAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the EC2 route table that is associated with the remediation
    -- action.
    EC2AssociateRouteTableAction -> ActionTarget
routeTableId :: ActionTarget
  }
  deriving (EC2AssociateRouteTableAction
-> EC2AssociateRouteTableAction -> Bool
(EC2AssociateRouteTableAction
 -> EC2AssociateRouteTableAction -> Bool)
-> (EC2AssociateRouteTableAction
    -> EC2AssociateRouteTableAction -> Bool)
-> Eq EC2AssociateRouteTableAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2AssociateRouteTableAction
-> EC2AssociateRouteTableAction -> Bool
$c/= :: EC2AssociateRouteTableAction
-> EC2AssociateRouteTableAction -> Bool
== :: EC2AssociateRouteTableAction
-> EC2AssociateRouteTableAction -> Bool
$c== :: EC2AssociateRouteTableAction
-> EC2AssociateRouteTableAction -> Bool
Prelude.Eq, ReadPrec [EC2AssociateRouteTableAction]
ReadPrec EC2AssociateRouteTableAction
Int -> ReadS EC2AssociateRouteTableAction
ReadS [EC2AssociateRouteTableAction]
(Int -> ReadS EC2AssociateRouteTableAction)
-> ReadS [EC2AssociateRouteTableAction]
-> ReadPrec EC2AssociateRouteTableAction
-> ReadPrec [EC2AssociateRouteTableAction]
-> Read EC2AssociateRouteTableAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2AssociateRouteTableAction]
$creadListPrec :: ReadPrec [EC2AssociateRouteTableAction]
readPrec :: ReadPrec EC2AssociateRouteTableAction
$creadPrec :: ReadPrec EC2AssociateRouteTableAction
readList :: ReadS [EC2AssociateRouteTableAction]
$creadList :: ReadS [EC2AssociateRouteTableAction]
readsPrec :: Int -> ReadS EC2AssociateRouteTableAction
$creadsPrec :: Int -> ReadS EC2AssociateRouteTableAction
Prelude.Read, Int -> EC2AssociateRouteTableAction -> ShowS
[EC2AssociateRouteTableAction] -> ShowS
EC2AssociateRouteTableAction -> String
(Int -> EC2AssociateRouteTableAction -> ShowS)
-> (EC2AssociateRouteTableAction -> String)
-> ([EC2AssociateRouteTableAction] -> ShowS)
-> Show EC2AssociateRouteTableAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2AssociateRouteTableAction] -> ShowS
$cshowList :: [EC2AssociateRouteTableAction] -> ShowS
show :: EC2AssociateRouteTableAction -> String
$cshow :: EC2AssociateRouteTableAction -> String
showsPrec :: Int -> EC2AssociateRouteTableAction -> ShowS
$cshowsPrec :: Int -> EC2AssociateRouteTableAction -> ShowS
Prelude.Show, (forall x.
 EC2AssociateRouteTableAction -> Rep EC2AssociateRouteTableAction x)
-> (forall x.
    Rep EC2AssociateRouteTableAction x -> EC2AssociateRouteTableAction)
-> Generic EC2AssociateRouteTableAction
forall x.
Rep EC2AssociateRouteTableAction x -> EC2AssociateRouteTableAction
forall x.
EC2AssociateRouteTableAction -> Rep EC2AssociateRouteTableAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EC2AssociateRouteTableAction x -> EC2AssociateRouteTableAction
$cfrom :: forall x.
EC2AssociateRouteTableAction -> Rep EC2AssociateRouteTableAction x
Prelude.Generic)

-- |
-- Create a value of 'EC2AssociateRouteTableAction' 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:
--
-- 'subnetId', 'eC2AssociateRouteTableAction_subnetId' - The ID of the subnet for the EC2 route table that is associated with the
-- remediation action.
--
-- 'gatewayId', 'eC2AssociateRouteTableAction_gatewayId' - The ID of the gateway to be used with the EC2 route table that is
-- associated with the remediation action.
--
-- 'description', 'eC2AssociateRouteTableAction_description' - A description of the EC2 route table that is associated with the
-- remediation action.
--
-- 'routeTableId', 'eC2AssociateRouteTableAction_routeTableId' - The ID of the EC2 route table that is associated with the remediation
-- action.
newEC2AssociateRouteTableAction ::
  -- | 'routeTableId'
  ActionTarget ->
  EC2AssociateRouteTableAction
newEC2AssociateRouteTableAction :: ActionTarget -> EC2AssociateRouteTableAction
newEC2AssociateRouteTableAction ActionTarget
pRouteTableId_ =
  EC2AssociateRouteTableAction' :: Maybe ActionTarget
-> Maybe ActionTarget
-> Maybe Text
-> ActionTarget
-> EC2AssociateRouteTableAction
EC2AssociateRouteTableAction'
    { $sel:subnetId:EC2AssociateRouteTableAction' :: Maybe ActionTarget
subnetId =
        Maybe ActionTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayId:EC2AssociateRouteTableAction' :: Maybe ActionTarget
gatewayId = Maybe ActionTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:description:EC2AssociateRouteTableAction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableId:EC2AssociateRouteTableAction' :: ActionTarget
routeTableId = ActionTarget
pRouteTableId_
    }

-- | The ID of the subnet for the EC2 route table that is associated with the
-- remediation action.
eC2AssociateRouteTableAction_subnetId :: Lens.Lens' EC2AssociateRouteTableAction (Prelude.Maybe ActionTarget)
eC2AssociateRouteTableAction_subnetId :: (Maybe ActionTarget -> f (Maybe ActionTarget))
-> EC2AssociateRouteTableAction -> f EC2AssociateRouteTableAction
eC2AssociateRouteTableAction_subnetId = (EC2AssociateRouteTableAction -> Maybe ActionTarget)
-> (EC2AssociateRouteTableAction
    -> Maybe ActionTarget -> EC2AssociateRouteTableAction)
-> Lens
     EC2AssociateRouteTableAction
     EC2AssociateRouteTableAction
     (Maybe ActionTarget)
     (Maybe ActionTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2AssociateRouteTableAction' {Maybe ActionTarget
subnetId :: Maybe ActionTarget
$sel:subnetId:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> Maybe ActionTarget
subnetId} -> Maybe ActionTarget
subnetId) (\s :: EC2AssociateRouteTableAction
s@EC2AssociateRouteTableAction' {} Maybe ActionTarget
a -> EC2AssociateRouteTableAction
s {$sel:subnetId:EC2AssociateRouteTableAction' :: Maybe ActionTarget
subnetId = Maybe ActionTarget
a} :: EC2AssociateRouteTableAction)

-- | The ID of the gateway to be used with the EC2 route table that is
-- associated with the remediation action.
eC2AssociateRouteTableAction_gatewayId :: Lens.Lens' EC2AssociateRouteTableAction (Prelude.Maybe ActionTarget)
eC2AssociateRouteTableAction_gatewayId :: (Maybe ActionTarget -> f (Maybe ActionTarget))
-> EC2AssociateRouteTableAction -> f EC2AssociateRouteTableAction
eC2AssociateRouteTableAction_gatewayId = (EC2AssociateRouteTableAction -> Maybe ActionTarget)
-> (EC2AssociateRouteTableAction
    -> Maybe ActionTarget -> EC2AssociateRouteTableAction)
-> Lens
     EC2AssociateRouteTableAction
     EC2AssociateRouteTableAction
     (Maybe ActionTarget)
     (Maybe ActionTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2AssociateRouteTableAction' {Maybe ActionTarget
gatewayId :: Maybe ActionTarget
$sel:gatewayId:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> Maybe ActionTarget
gatewayId} -> Maybe ActionTarget
gatewayId) (\s :: EC2AssociateRouteTableAction
s@EC2AssociateRouteTableAction' {} Maybe ActionTarget
a -> EC2AssociateRouteTableAction
s {$sel:gatewayId:EC2AssociateRouteTableAction' :: Maybe ActionTarget
gatewayId = Maybe ActionTarget
a} :: EC2AssociateRouteTableAction)

-- | A description of the EC2 route table that is associated with the
-- remediation action.
eC2AssociateRouteTableAction_description :: Lens.Lens' EC2AssociateRouteTableAction (Prelude.Maybe Prelude.Text)
eC2AssociateRouteTableAction_description :: (Maybe Text -> f (Maybe Text))
-> EC2AssociateRouteTableAction -> f EC2AssociateRouteTableAction
eC2AssociateRouteTableAction_description = (EC2AssociateRouteTableAction -> Maybe Text)
-> (EC2AssociateRouteTableAction
    -> Maybe Text -> EC2AssociateRouteTableAction)
-> Lens
     EC2AssociateRouteTableAction
     EC2AssociateRouteTableAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2AssociateRouteTableAction' {Maybe Text
description :: Maybe Text
$sel:description:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> Maybe Text
description} -> Maybe Text
description) (\s :: EC2AssociateRouteTableAction
s@EC2AssociateRouteTableAction' {} Maybe Text
a -> EC2AssociateRouteTableAction
s {$sel:description:EC2AssociateRouteTableAction' :: Maybe Text
description = Maybe Text
a} :: EC2AssociateRouteTableAction)

-- | The ID of the EC2 route table that is associated with the remediation
-- action.
eC2AssociateRouteTableAction_routeTableId :: Lens.Lens' EC2AssociateRouteTableAction ActionTarget
eC2AssociateRouteTableAction_routeTableId :: (ActionTarget -> f ActionTarget)
-> EC2AssociateRouteTableAction -> f EC2AssociateRouteTableAction
eC2AssociateRouteTableAction_routeTableId = (EC2AssociateRouteTableAction -> ActionTarget)
-> (EC2AssociateRouteTableAction
    -> ActionTarget -> EC2AssociateRouteTableAction)
-> Lens
     EC2AssociateRouteTableAction
     EC2AssociateRouteTableAction
     ActionTarget
     ActionTarget
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2AssociateRouteTableAction' {ActionTarget
routeTableId :: ActionTarget
$sel:routeTableId:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> ActionTarget
routeTableId} -> ActionTarget
routeTableId) (\s :: EC2AssociateRouteTableAction
s@EC2AssociateRouteTableAction' {} ActionTarget
a -> EC2AssociateRouteTableAction
s {$sel:routeTableId:EC2AssociateRouteTableAction' :: ActionTarget
routeTableId = ActionTarget
a} :: EC2AssociateRouteTableAction)

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

instance Prelude.NFData EC2AssociateRouteTableAction