{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.EC2.AssociateRouteTable
(
AssociateRouteTable (..),
newAssociateRouteTable,
associateRouteTable_dryRun,
associateRouteTable_gatewayId,
associateRouteTable_subnetId,
associateRouteTable_routeTableId,
AssociateRouteTableResponse (..),
newAssociateRouteTableResponse,
associateRouteTableResponse_associationId,
associateRouteTableResponse_associationState,
associateRouteTableResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateRouteTable = AssociateRouteTable'
{
AssociateRouteTable -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
AssociateRouteTable -> Maybe Text
gatewayId :: Prelude.Maybe Prelude.Text,
AssociateRouteTable -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text,
AssociateRouteTable -> Text
routeTableId :: Prelude.Text
}
deriving (AssociateRouteTable -> AssociateRouteTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateRouteTable -> AssociateRouteTable -> Bool
$c/= :: AssociateRouteTable -> AssociateRouteTable -> Bool
== :: AssociateRouteTable -> AssociateRouteTable -> Bool
$c== :: AssociateRouteTable -> AssociateRouteTable -> Bool
Prelude.Eq, ReadPrec [AssociateRouteTable]
ReadPrec AssociateRouteTable
Int -> ReadS AssociateRouteTable
ReadS [AssociateRouteTable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateRouteTable]
$creadListPrec :: ReadPrec [AssociateRouteTable]
readPrec :: ReadPrec AssociateRouteTable
$creadPrec :: ReadPrec AssociateRouteTable
readList :: ReadS [AssociateRouteTable]
$creadList :: ReadS [AssociateRouteTable]
readsPrec :: Int -> ReadS AssociateRouteTable
$creadsPrec :: Int -> ReadS AssociateRouteTable
Prelude.Read, Int -> AssociateRouteTable -> ShowS
[AssociateRouteTable] -> ShowS
AssociateRouteTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateRouteTable] -> ShowS
$cshowList :: [AssociateRouteTable] -> ShowS
show :: AssociateRouteTable -> String
$cshow :: AssociateRouteTable -> String
showsPrec :: Int -> AssociateRouteTable -> ShowS
$cshowsPrec :: Int -> AssociateRouteTable -> ShowS
Prelude.Show, forall x. Rep AssociateRouteTable x -> AssociateRouteTable
forall x. AssociateRouteTable -> Rep AssociateRouteTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateRouteTable x -> AssociateRouteTable
$cfrom :: forall x. AssociateRouteTable -> Rep AssociateRouteTable x
Prelude.Generic)
newAssociateRouteTable ::
Prelude.Text ->
AssociateRouteTable
newAssociateRouteTable :: Text -> AssociateRouteTable
newAssociateRouteTable Text
pRouteTableId_ =
AssociateRouteTable'
{ $sel:dryRun:AssociateRouteTable' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:gatewayId:AssociateRouteTable' :: Maybe Text
gatewayId = forall a. Maybe a
Prelude.Nothing,
$sel:subnetId:AssociateRouteTable' :: Maybe Text
subnetId = forall a. Maybe a
Prelude.Nothing,
$sel:routeTableId:AssociateRouteTable' :: Text
routeTableId = Text
pRouteTableId_
}
associateRouteTable_dryRun :: Lens.Lens' AssociateRouteTable (Prelude.Maybe Prelude.Bool)
associateRouteTable_dryRun :: Lens' AssociateRouteTable (Maybe Bool)
associateRouteTable_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTable' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:AssociateRouteTable' :: AssociateRouteTable -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: AssociateRouteTable
s@AssociateRouteTable' {} Maybe Bool
a -> AssociateRouteTable
s {$sel:dryRun:AssociateRouteTable' :: Maybe Bool
dryRun = Maybe Bool
a} :: AssociateRouteTable)
associateRouteTable_gatewayId :: Lens.Lens' AssociateRouteTable (Prelude.Maybe Prelude.Text)
associateRouteTable_gatewayId :: Lens' AssociateRouteTable (Maybe Text)
associateRouteTable_gatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTable' {Maybe Text
gatewayId :: Maybe Text
$sel:gatewayId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
gatewayId} -> Maybe Text
gatewayId) (\s :: AssociateRouteTable
s@AssociateRouteTable' {} Maybe Text
a -> AssociateRouteTable
s {$sel:gatewayId:AssociateRouteTable' :: Maybe Text
gatewayId = Maybe Text
a} :: AssociateRouteTable)
associateRouteTable_subnetId :: Lens.Lens' AssociateRouteTable (Prelude.Maybe Prelude.Text)
associateRouteTable_subnetId :: Lens' AssociateRouteTable (Maybe Text)
associateRouteTable_subnetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTable' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: AssociateRouteTable
s@AssociateRouteTable' {} Maybe Text
a -> AssociateRouteTable
s {$sel:subnetId:AssociateRouteTable' :: Maybe Text
subnetId = Maybe Text
a} :: AssociateRouteTable)
associateRouteTable_routeTableId :: Lens.Lens' AssociateRouteTable Prelude.Text
associateRouteTable_routeTableId :: Lens' AssociateRouteTable Text
associateRouteTable_routeTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTable' {Text
routeTableId :: Text
$sel:routeTableId:AssociateRouteTable' :: AssociateRouteTable -> Text
routeTableId} -> Text
routeTableId) (\s :: AssociateRouteTable
s@AssociateRouteTable' {} Text
a -> AssociateRouteTable
s {$sel:routeTableId:AssociateRouteTable' :: Text
routeTableId = Text
a} :: AssociateRouteTable)
instance Core.AWSRequest AssociateRouteTable where
type
AWSResponse AssociateRouteTable =
AssociateRouteTableResponse
request :: (Service -> Service)
-> AssociateRouteTable -> Request AssociateRouteTable
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateRouteTable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateRouteTable)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe RouteTableAssociationState
-> Int
-> AssociateRouteTableResponse
AssociateRouteTableResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"associationId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"associationState")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AssociateRouteTable where
hashWithSalt :: Int -> AssociateRouteTable -> Int
hashWithSalt Int
_salt AssociateRouteTable' {Maybe Bool
Maybe Text
Text
routeTableId :: Text
subnetId :: Maybe Text
gatewayId :: Maybe Text
dryRun :: Maybe Bool
$sel:routeTableId:AssociateRouteTable' :: AssociateRouteTable -> Text
$sel:subnetId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
$sel:gatewayId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
$sel:dryRun:AssociateRouteTable' :: AssociateRouteTable -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gatewayId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
routeTableId
instance Prelude.NFData AssociateRouteTable where
rnf :: AssociateRouteTable -> ()
rnf AssociateRouteTable' {Maybe Bool
Maybe Text
Text
routeTableId :: Text
subnetId :: Maybe Text
gatewayId :: Maybe Text
dryRun :: Maybe Bool
$sel:routeTableId:AssociateRouteTable' :: AssociateRouteTable -> Text
$sel:subnetId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
$sel:gatewayId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
$sel:dryRun:AssociateRouteTable' :: AssociateRouteTable -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gatewayId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
routeTableId
instance Data.ToHeaders AssociateRouteTable where
toHeaders :: AssociateRouteTable -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath AssociateRouteTable where
toPath :: AssociateRouteTable -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AssociateRouteTable where
toQuery :: AssociateRouteTable -> QueryString
toQuery AssociateRouteTable' {Maybe Bool
Maybe Text
Text
routeTableId :: Text
subnetId :: Maybe Text
gatewayId :: Maybe Text
dryRun :: Maybe Bool
$sel:routeTableId:AssociateRouteTable' :: AssociateRouteTable -> Text
$sel:subnetId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
$sel:gatewayId:AssociateRouteTable' :: AssociateRouteTable -> Maybe Text
$sel:dryRun:AssociateRouteTable' :: AssociateRouteTable -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"AssociateRouteTable" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
ByteString
"GatewayId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
gatewayId,
ByteString
"SubnetId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
subnetId,
ByteString
"RouteTableId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
routeTableId
]
data AssociateRouteTableResponse = AssociateRouteTableResponse'
{
AssociateRouteTableResponse -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
AssociateRouteTableResponse -> Maybe RouteTableAssociationState
associationState :: Prelude.Maybe RouteTableAssociationState,
AssociateRouteTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateRouteTableResponse -> AssociateRouteTableResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateRouteTableResponse -> AssociateRouteTableResponse -> Bool
$c/= :: AssociateRouteTableResponse -> AssociateRouteTableResponse -> Bool
== :: AssociateRouteTableResponse -> AssociateRouteTableResponse -> Bool
$c== :: AssociateRouteTableResponse -> AssociateRouteTableResponse -> Bool
Prelude.Eq, ReadPrec [AssociateRouteTableResponse]
ReadPrec AssociateRouteTableResponse
Int -> ReadS AssociateRouteTableResponse
ReadS [AssociateRouteTableResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateRouteTableResponse]
$creadListPrec :: ReadPrec [AssociateRouteTableResponse]
readPrec :: ReadPrec AssociateRouteTableResponse
$creadPrec :: ReadPrec AssociateRouteTableResponse
readList :: ReadS [AssociateRouteTableResponse]
$creadList :: ReadS [AssociateRouteTableResponse]
readsPrec :: Int -> ReadS AssociateRouteTableResponse
$creadsPrec :: Int -> ReadS AssociateRouteTableResponse
Prelude.Read, Int -> AssociateRouteTableResponse -> ShowS
[AssociateRouteTableResponse] -> ShowS
AssociateRouteTableResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateRouteTableResponse] -> ShowS
$cshowList :: [AssociateRouteTableResponse] -> ShowS
show :: AssociateRouteTableResponse -> String
$cshow :: AssociateRouteTableResponse -> String
showsPrec :: Int -> AssociateRouteTableResponse -> ShowS
$cshowsPrec :: Int -> AssociateRouteTableResponse -> ShowS
Prelude.Show, forall x.
Rep AssociateRouteTableResponse x -> AssociateRouteTableResponse
forall x.
AssociateRouteTableResponse -> Rep AssociateRouteTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateRouteTableResponse x -> AssociateRouteTableResponse
$cfrom :: forall x.
AssociateRouteTableResponse -> Rep AssociateRouteTableResponse x
Prelude.Generic)
newAssociateRouteTableResponse ::
Prelude.Int ->
AssociateRouteTableResponse
newAssociateRouteTableResponse :: Int -> AssociateRouteTableResponse
newAssociateRouteTableResponse Int
pHttpStatus_ =
AssociateRouteTableResponse'
{ $sel:associationId:AssociateRouteTableResponse' :: Maybe Text
associationId =
forall a. Maybe a
Prelude.Nothing,
$sel:associationState:AssociateRouteTableResponse' :: Maybe RouteTableAssociationState
associationState = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateRouteTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateRouteTableResponse_associationId :: Lens.Lens' AssociateRouteTableResponse (Prelude.Maybe Prelude.Text)
associateRouteTableResponse_associationId :: Lens' AssociateRouteTableResponse (Maybe Text)
associateRouteTableResponse_associationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTableResponse' {Maybe Text
associationId :: Maybe Text
$sel:associationId:AssociateRouteTableResponse' :: AssociateRouteTableResponse -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: AssociateRouteTableResponse
s@AssociateRouteTableResponse' {} Maybe Text
a -> AssociateRouteTableResponse
s {$sel:associationId:AssociateRouteTableResponse' :: Maybe Text
associationId = Maybe Text
a} :: AssociateRouteTableResponse)
associateRouteTableResponse_associationState :: Lens.Lens' AssociateRouteTableResponse (Prelude.Maybe RouteTableAssociationState)
associateRouteTableResponse_associationState :: Lens'
AssociateRouteTableResponse (Maybe RouteTableAssociationState)
associateRouteTableResponse_associationState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTableResponse' {Maybe RouteTableAssociationState
associationState :: Maybe RouteTableAssociationState
$sel:associationState:AssociateRouteTableResponse' :: AssociateRouteTableResponse -> Maybe RouteTableAssociationState
associationState} -> Maybe RouteTableAssociationState
associationState) (\s :: AssociateRouteTableResponse
s@AssociateRouteTableResponse' {} Maybe RouteTableAssociationState
a -> AssociateRouteTableResponse
s {$sel:associationState:AssociateRouteTableResponse' :: Maybe RouteTableAssociationState
associationState = Maybe RouteTableAssociationState
a} :: AssociateRouteTableResponse)
associateRouteTableResponse_httpStatus :: Lens.Lens' AssociateRouteTableResponse Prelude.Int
associateRouteTableResponse_httpStatus :: Lens' AssociateRouteTableResponse Int
associateRouteTableResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRouteTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateRouteTableResponse' :: AssociateRouteTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateRouteTableResponse
s@AssociateRouteTableResponse' {} Int
a -> AssociateRouteTableResponse
s {$sel:httpStatus:AssociateRouteTableResponse' :: Int
httpStatus = Int
a} :: AssociateRouteTableResponse)
instance Prelude.NFData AssociateRouteTableResponse where
rnf :: AssociateRouteTableResponse -> ()
rnf AssociateRouteTableResponse' {Int
Maybe Text
Maybe RouteTableAssociationState
httpStatus :: Int
associationState :: Maybe RouteTableAssociationState
associationId :: Maybe Text
$sel:httpStatus:AssociateRouteTableResponse' :: AssociateRouteTableResponse -> Int
$sel:associationState:AssociateRouteTableResponse' :: AssociateRouteTableResponse -> Maybe RouteTableAssociationState
$sel:associationId:AssociateRouteTableResponse' :: AssociateRouteTableResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RouteTableAssociationState
associationState
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus