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

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

-- | 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 :: Lens' EC2AssociateRouteTableAction (Maybe Text)
eC2AssociateRouteTableAction_description = 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 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 :: Lens' EC2AssociateRouteTableAction (Maybe ActionTarget)
eC2AssociateRouteTableAction_gatewayId = 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)

-- | 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 :: Lens' EC2AssociateRouteTableAction (Maybe ActionTarget)
eC2AssociateRouteTableAction_subnetId = 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 EC2 route table that is associated with the remediation
-- action.
eC2AssociateRouteTableAction_routeTableId :: Lens.Lens' EC2AssociateRouteTableAction ActionTarget
eC2AssociateRouteTableAction_routeTableId :: Lens' EC2AssociateRouteTableAction ActionTarget
eC2AssociateRouteTableAction_routeTableId = 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 Data.FromJSON EC2AssociateRouteTableAction where
  parseJSON :: Value -> Parser EC2AssociateRouteTableAction
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EC2AssociateRouteTableAction"
      ( \Object
x ->
          Maybe Text
-> Maybe ActionTarget
-> Maybe ActionTarget
-> ActionTarget
-> EC2AssociateRouteTableAction
EC2AssociateRouteTableAction'
            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
"GatewayId")
            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
"SubnetId")
            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
    EC2AssociateRouteTableAction
  where
  hashWithSalt :: Int -> EC2AssociateRouteTableAction -> Int
hashWithSalt Int
_salt EC2AssociateRouteTableAction' {Maybe Text
Maybe ActionTarget
ActionTarget
routeTableId :: ActionTarget
subnetId :: Maybe ActionTarget
gatewayId :: Maybe ActionTarget
description :: Maybe Text
$sel:routeTableId:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> ActionTarget
$sel:subnetId:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> Maybe ActionTarget
$sel:gatewayId:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> Maybe ActionTarget
$sel:description:EC2AssociateRouteTableAction' :: EC2AssociateRouteTableAction -> 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 ActionTarget
gatewayId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionTarget
subnetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ActionTarget
routeTableId

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