{-# 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.DirectoryService.AddIpRoutes
(
AddIpRoutes (..),
newAddIpRoutes,
addIpRoutes_updateSecurityGroupForDirectoryControllers,
addIpRoutes_directoryId,
addIpRoutes_ipRoutes,
AddIpRoutesResponse (..),
newAddIpRoutesResponse,
addIpRoutesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddIpRoutes = AddIpRoutes'
{
AddIpRoutes -> Maybe Bool
updateSecurityGroupForDirectoryControllers :: Prelude.Maybe Prelude.Bool,
AddIpRoutes -> Text
directoryId :: Prelude.Text,
AddIpRoutes -> [IpRoute]
ipRoutes :: [IpRoute]
}
deriving (AddIpRoutes -> AddIpRoutes -> Bool
(AddIpRoutes -> AddIpRoutes -> Bool)
-> (AddIpRoutes -> AddIpRoutes -> Bool) -> Eq AddIpRoutes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddIpRoutes -> AddIpRoutes -> Bool
$c/= :: AddIpRoutes -> AddIpRoutes -> Bool
== :: AddIpRoutes -> AddIpRoutes -> Bool
$c== :: AddIpRoutes -> AddIpRoutes -> Bool
Prelude.Eq, ReadPrec [AddIpRoutes]
ReadPrec AddIpRoutes
Int -> ReadS AddIpRoutes
ReadS [AddIpRoutes]
(Int -> ReadS AddIpRoutes)
-> ReadS [AddIpRoutes]
-> ReadPrec AddIpRoutes
-> ReadPrec [AddIpRoutes]
-> Read AddIpRoutes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddIpRoutes]
$creadListPrec :: ReadPrec [AddIpRoutes]
readPrec :: ReadPrec AddIpRoutes
$creadPrec :: ReadPrec AddIpRoutes
readList :: ReadS [AddIpRoutes]
$creadList :: ReadS [AddIpRoutes]
readsPrec :: Int -> ReadS AddIpRoutes
$creadsPrec :: Int -> ReadS AddIpRoutes
Prelude.Read, Int -> AddIpRoutes -> ShowS
[AddIpRoutes] -> ShowS
AddIpRoutes -> String
(Int -> AddIpRoutes -> ShowS)
-> (AddIpRoutes -> String)
-> ([AddIpRoutes] -> ShowS)
-> Show AddIpRoutes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddIpRoutes] -> ShowS
$cshowList :: [AddIpRoutes] -> ShowS
show :: AddIpRoutes -> String
$cshow :: AddIpRoutes -> String
showsPrec :: Int -> AddIpRoutes -> ShowS
$cshowsPrec :: Int -> AddIpRoutes -> ShowS
Prelude.Show, (forall x. AddIpRoutes -> Rep AddIpRoutes x)
-> (forall x. Rep AddIpRoutes x -> AddIpRoutes)
-> Generic AddIpRoutes
forall x. Rep AddIpRoutes x -> AddIpRoutes
forall x. AddIpRoutes -> Rep AddIpRoutes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddIpRoutes x -> AddIpRoutes
$cfrom :: forall x. AddIpRoutes -> Rep AddIpRoutes x
Prelude.Generic)
newAddIpRoutes ::
Prelude.Text ->
AddIpRoutes
newAddIpRoutes :: Text -> AddIpRoutes
newAddIpRoutes Text
pDirectoryId_ =
AddIpRoutes' :: Maybe Bool -> Text -> [IpRoute] -> AddIpRoutes
AddIpRoutes'
{ $sel:updateSecurityGroupForDirectoryControllers:AddIpRoutes' :: Maybe Bool
updateSecurityGroupForDirectoryControllers =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:directoryId:AddIpRoutes' :: Text
directoryId = Text
pDirectoryId_,
$sel:ipRoutes:AddIpRoutes' :: [IpRoute]
ipRoutes = [IpRoute]
forall a. Monoid a => a
Prelude.mempty
}
addIpRoutes_updateSecurityGroupForDirectoryControllers :: Lens.Lens' AddIpRoutes (Prelude.Maybe Prelude.Bool)
addIpRoutes_updateSecurityGroupForDirectoryControllers :: (Maybe Bool -> f (Maybe Bool)) -> AddIpRoutes -> f AddIpRoutes
addIpRoutes_updateSecurityGroupForDirectoryControllers = (AddIpRoutes -> Maybe Bool)
-> (AddIpRoutes -> Maybe Bool -> AddIpRoutes)
-> Lens AddIpRoutes AddIpRoutes (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddIpRoutes' {Maybe Bool
updateSecurityGroupForDirectoryControllers :: Maybe Bool
$sel:updateSecurityGroupForDirectoryControllers:AddIpRoutes' :: AddIpRoutes -> Maybe Bool
updateSecurityGroupForDirectoryControllers} -> Maybe Bool
updateSecurityGroupForDirectoryControllers) (\s :: AddIpRoutes
s@AddIpRoutes' {} Maybe Bool
a -> AddIpRoutes
s {$sel:updateSecurityGroupForDirectoryControllers:AddIpRoutes' :: Maybe Bool
updateSecurityGroupForDirectoryControllers = Maybe Bool
a} :: AddIpRoutes)
addIpRoutes_directoryId :: Lens.Lens' AddIpRoutes Prelude.Text
addIpRoutes_directoryId :: (Text -> f Text) -> AddIpRoutes -> f AddIpRoutes
addIpRoutes_directoryId = (AddIpRoutes -> Text)
-> (AddIpRoutes -> Text -> AddIpRoutes)
-> Lens AddIpRoutes AddIpRoutes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddIpRoutes' {Text
directoryId :: Text
$sel:directoryId:AddIpRoutes' :: AddIpRoutes -> Text
directoryId} -> Text
directoryId) (\s :: AddIpRoutes
s@AddIpRoutes' {} Text
a -> AddIpRoutes
s {$sel:directoryId:AddIpRoutes' :: Text
directoryId = Text
a} :: AddIpRoutes)
addIpRoutes_ipRoutes :: Lens.Lens' AddIpRoutes [IpRoute]
addIpRoutes_ipRoutes :: ([IpRoute] -> f [IpRoute]) -> AddIpRoutes -> f AddIpRoutes
addIpRoutes_ipRoutes = (AddIpRoutes -> [IpRoute])
-> (AddIpRoutes -> [IpRoute] -> AddIpRoutes)
-> Lens AddIpRoutes AddIpRoutes [IpRoute] [IpRoute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddIpRoutes' {[IpRoute]
ipRoutes :: [IpRoute]
$sel:ipRoutes:AddIpRoutes' :: AddIpRoutes -> [IpRoute]
ipRoutes} -> [IpRoute]
ipRoutes) (\s :: AddIpRoutes
s@AddIpRoutes' {} [IpRoute]
a -> AddIpRoutes
s {$sel:ipRoutes:AddIpRoutes' :: [IpRoute]
ipRoutes = [IpRoute]
a} :: AddIpRoutes) (([IpRoute] -> f [IpRoute]) -> AddIpRoutes -> f AddIpRoutes)
-> (([IpRoute] -> f [IpRoute]) -> [IpRoute] -> f [IpRoute])
-> ([IpRoute] -> f [IpRoute])
-> AddIpRoutes
-> f AddIpRoutes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([IpRoute] -> f [IpRoute]) -> [IpRoute] -> f [IpRoute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AddIpRoutes where
type AWSResponse AddIpRoutes = AddIpRoutesResponse
request :: AddIpRoutes -> Request AddIpRoutes
request = Service -> AddIpRoutes -> Request AddIpRoutes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddIpRoutes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddIpRoutes)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AddIpRoutes))
-> Logger
-> Service
-> Proxy AddIpRoutes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddIpRoutes)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AddIpRoutesResponse
AddIpRoutesResponse'
(Int -> AddIpRoutesResponse)
-> Either String Int -> Either String AddIpRoutesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AddIpRoutes
instance Prelude.NFData AddIpRoutes
instance Core.ToHeaders AddIpRoutes where
toHeaders :: AddIpRoutes -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddIpRoutes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DirectoryService_20150416.AddIpRoutes" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AddIpRoutes where
toJSON :: AddIpRoutes -> Value
toJSON AddIpRoutes' {[IpRoute]
Maybe Bool
Text
ipRoutes :: [IpRoute]
directoryId :: Text
updateSecurityGroupForDirectoryControllers :: Maybe Bool
$sel:ipRoutes:AddIpRoutes' :: AddIpRoutes -> [IpRoute]
$sel:directoryId:AddIpRoutes' :: AddIpRoutes -> Text
$sel:updateSecurityGroupForDirectoryControllers:AddIpRoutes' :: AddIpRoutes -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ ( Text
"UpdateSecurityGroupForDirectoryControllers"
Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=
)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
updateSecurityGroupForDirectoryControllers,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IpRoutes" Text -> [IpRoute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [IpRoute]
ipRoutes)
]
)
instance Core.ToPath AddIpRoutes where
toPath :: AddIpRoutes -> ByteString
toPath = ByteString -> AddIpRoutes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddIpRoutes where
toQuery :: AddIpRoutes -> QueryString
toQuery = QueryString -> AddIpRoutes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddIpRoutesResponse = AddIpRoutesResponse'
{
AddIpRoutesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddIpRoutesResponse -> AddIpRoutesResponse -> Bool
(AddIpRoutesResponse -> AddIpRoutesResponse -> Bool)
-> (AddIpRoutesResponse -> AddIpRoutesResponse -> Bool)
-> Eq AddIpRoutesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddIpRoutesResponse -> AddIpRoutesResponse -> Bool
$c/= :: AddIpRoutesResponse -> AddIpRoutesResponse -> Bool
== :: AddIpRoutesResponse -> AddIpRoutesResponse -> Bool
$c== :: AddIpRoutesResponse -> AddIpRoutesResponse -> Bool
Prelude.Eq, ReadPrec [AddIpRoutesResponse]
ReadPrec AddIpRoutesResponse
Int -> ReadS AddIpRoutesResponse
ReadS [AddIpRoutesResponse]
(Int -> ReadS AddIpRoutesResponse)
-> ReadS [AddIpRoutesResponse]
-> ReadPrec AddIpRoutesResponse
-> ReadPrec [AddIpRoutesResponse]
-> Read AddIpRoutesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddIpRoutesResponse]
$creadListPrec :: ReadPrec [AddIpRoutesResponse]
readPrec :: ReadPrec AddIpRoutesResponse
$creadPrec :: ReadPrec AddIpRoutesResponse
readList :: ReadS [AddIpRoutesResponse]
$creadList :: ReadS [AddIpRoutesResponse]
readsPrec :: Int -> ReadS AddIpRoutesResponse
$creadsPrec :: Int -> ReadS AddIpRoutesResponse
Prelude.Read, Int -> AddIpRoutesResponse -> ShowS
[AddIpRoutesResponse] -> ShowS
AddIpRoutesResponse -> String
(Int -> AddIpRoutesResponse -> ShowS)
-> (AddIpRoutesResponse -> String)
-> ([AddIpRoutesResponse] -> ShowS)
-> Show AddIpRoutesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddIpRoutesResponse] -> ShowS
$cshowList :: [AddIpRoutesResponse] -> ShowS
show :: AddIpRoutesResponse -> String
$cshow :: AddIpRoutesResponse -> String
showsPrec :: Int -> AddIpRoutesResponse -> ShowS
$cshowsPrec :: Int -> AddIpRoutesResponse -> ShowS
Prelude.Show, (forall x. AddIpRoutesResponse -> Rep AddIpRoutesResponse x)
-> (forall x. Rep AddIpRoutesResponse x -> AddIpRoutesResponse)
-> Generic AddIpRoutesResponse
forall x. Rep AddIpRoutesResponse x -> AddIpRoutesResponse
forall x. AddIpRoutesResponse -> Rep AddIpRoutesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddIpRoutesResponse x -> AddIpRoutesResponse
$cfrom :: forall x. AddIpRoutesResponse -> Rep AddIpRoutesResponse x
Prelude.Generic)
newAddIpRoutesResponse ::
Prelude.Int ->
AddIpRoutesResponse
newAddIpRoutesResponse :: Int -> AddIpRoutesResponse
newAddIpRoutesResponse Int
pHttpStatus_ =
AddIpRoutesResponse' :: Int -> AddIpRoutesResponse
AddIpRoutesResponse' {$sel:httpStatus:AddIpRoutesResponse' :: Int
httpStatus = Int
pHttpStatus_}
addIpRoutesResponse_httpStatus :: Lens.Lens' AddIpRoutesResponse Prelude.Int
addIpRoutesResponse_httpStatus :: (Int -> f Int) -> AddIpRoutesResponse -> f AddIpRoutesResponse
addIpRoutesResponse_httpStatus = (AddIpRoutesResponse -> Int)
-> (AddIpRoutesResponse -> Int -> AddIpRoutesResponse)
-> Lens AddIpRoutesResponse AddIpRoutesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddIpRoutesResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddIpRoutesResponse' :: AddIpRoutesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddIpRoutesResponse
s@AddIpRoutesResponse' {} Int
a -> AddIpRoutesResponse
s {$sel:httpStatus:AddIpRoutesResponse' :: Int
httpStatus = Int
a} :: AddIpRoutesResponse)
instance Prelude.NFData AddIpRoutesResponse