{-# 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.CreateConditionalForwarder
(
CreateConditionalForwarder (..),
newCreateConditionalForwarder,
createConditionalForwarder_directoryId,
createConditionalForwarder_remoteDomainName,
createConditionalForwarder_dnsIpAddrs,
CreateConditionalForwarderResponse (..),
newCreateConditionalForwarderResponse,
createConditionalForwarderResponse_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 CreateConditionalForwarder = CreateConditionalForwarder'
{
CreateConditionalForwarder -> Text
directoryId :: Prelude.Text,
CreateConditionalForwarder -> Text
remoteDomainName :: Prelude.Text,
CreateConditionalForwarder -> [Text]
dnsIpAddrs :: [Prelude.Text]
}
deriving (CreateConditionalForwarder -> CreateConditionalForwarder -> Bool
(CreateConditionalForwarder -> CreateConditionalForwarder -> Bool)
-> (CreateConditionalForwarder
-> CreateConditionalForwarder -> Bool)
-> Eq CreateConditionalForwarder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConditionalForwarder -> CreateConditionalForwarder -> Bool
$c/= :: CreateConditionalForwarder -> CreateConditionalForwarder -> Bool
== :: CreateConditionalForwarder -> CreateConditionalForwarder -> Bool
$c== :: CreateConditionalForwarder -> CreateConditionalForwarder -> Bool
Prelude.Eq, ReadPrec [CreateConditionalForwarder]
ReadPrec CreateConditionalForwarder
Int -> ReadS CreateConditionalForwarder
ReadS [CreateConditionalForwarder]
(Int -> ReadS CreateConditionalForwarder)
-> ReadS [CreateConditionalForwarder]
-> ReadPrec CreateConditionalForwarder
-> ReadPrec [CreateConditionalForwarder]
-> Read CreateConditionalForwarder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConditionalForwarder]
$creadListPrec :: ReadPrec [CreateConditionalForwarder]
readPrec :: ReadPrec CreateConditionalForwarder
$creadPrec :: ReadPrec CreateConditionalForwarder
readList :: ReadS [CreateConditionalForwarder]
$creadList :: ReadS [CreateConditionalForwarder]
readsPrec :: Int -> ReadS CreateConditionalForwarder
$creadsPrec :: Int -> ReadS CreateConditionalForwarder
Prelude.Read, Int -> CreateConditionalForwarder -> ShowS
[CreateConditionalForwarder] -> ShowS
CreateConditionalForwarder -> String
(Int -> CreateConditionalForwarder -> ShowS)
-> (CreateConditionalForwarder -> String)
-> ([CreateConditionalForwarder] -> ShowS)
-> Show CreateConditionalForwarder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConditionalForwarder] -> ShowS
$cshowList :: [CreateConditionalForwarder] -> ShowS
show :: CreateConditionalForwarder -> String
$cshow :: CreateConditionalForwarder -> String
showsPrec :: Int -> CreateConditionalForwarder -> ShowS
$cshowsPrec :: Int -> CreateConditionalForwarder -> ShowS
Prelude.Show, (forall x.
CreateConditionalForwarder -> Rep CreateConditionalForwarder x)
-> (forall x.
Rep CreateConditionalForwarder x -> CreateConditionalForwarder)
-> Generic CreateConditionalForwarder
forall x.
Rep CreateConditionalForwarder x -> CreateConditionalForwarder
forall x.
CreateConditionalForwarder -> Rep CreateConditionalForwarder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConditionalForwarder x -> CreateConditionalForwarder
$cfrom :: forall x.
CreateConditionalForwarder -> Rep CreateConditionalForwarder x
Prelude.Generic)
newCreateConditionalForwarder ::
Prelude.Text ->
Prelude.Text ->
CreateConditionalForwarder
newCreateConditionalForwarder :: Text -> Text -> CreateConditionalForwarder
newCreateConditionalForwarder
Text
pDirectoryId_
Text
pRemoteDomainName_ =
CreateConditionalForwarder' :: Text -> Text -> [Text] -> CreateConditionalForwarder
CreateConditionalForwarder'
{ $sel:directoryId:CreateConditionalForwarder' :: Text
directoryId =
Text
pDirectoryId_,
$sel:remoteDomainName:CreateConditionalForwarder' :: Text
remoteDomainName = Text
pRemoteDomainName_,
$sel:dnsIpAddrs:CreateConditionalForwarder' :: [Text]
dnsIpAddrs = [Text]
forall a. Monoid a => a
Prelude.mempty
}
createConditionalForwarder_directoryId :: Lens.Lens' CreateConditionalForwarder Prelude.Text
createConditionalForwarder_directoryId :: (Text -> f Text)
-> CreateConditionalForwarder -> f CreateConditionalForwarder
createConditionalForwarder_directoryId = (CreateConditionalForwarder -> Text)
-> (CreateConditionalForwarder
-> Text -> CreateConditionalForwarder)
-> Lens
CreateConditionalForwarder CreateConditionalForwarder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConditionalForwarder' {Text
directoryId :: Text
$sel:directoryId:CreateConditionalForwarder' :: CreateConditionalForwarder -> Text
directoryId} -> Text
directoryId) (\s :: CreateConditionalForwarder
s@CreateConditionalForwarder' {} Text
a -> CreateConditionalForwarder
s {$sel:directoryId:CreateConditionalForwarder' :: Text
directoryId = Text
a} :: CreateConditionalForwarder)
createConditionalForwarder_remoteDomainName :: Lens.Lens' CreateConditionalForwarder Prelude.Text
createConditionalForwarder_remoteDomainName :: (Text -> f Text)
-> CreateConditionalForwarder -> f CreateConditionalForwarder
createConditionalForwarder_remoteDomainName = (CreateConditionalForwarder -> Text)
-> (CreateConditionalForwarder
-> Text -> CreateConditionalForwarder)
-> Lens
CreateConditionalForwarder CreateConditionalForwarder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConditionalForwarder' {Text
remoteDomainName :: Text
$sel:remoteDomainName:CreateConditionalForwarder' :: CreateConditionalForwarder -> Text
remoteDomainName} -> Text
remoteDomainName) (\s :: CreateConditionalForwarder
s@CreateConditionalForwarder' {} Text
a -> CreateConditionalForwarder
s {$sel:remoteDomainName:CreateConditionalForwarder' :: Text
remoteDomainName = Text
a} :: CreateConditionalForwarder)
createConditionalForwarder_dnsIpAddrs :: Lens.Lens' CreateConditionalForwarder [Prelude.Text]
createConditionalForwarder_dnsIpAddrs :: ([Text] -> f [Text])
-> CreateConditionalForwarder -> f CreateConditionalForwarder
createConditionalForwarder_dnsIpAddrs = (CreateConditionalForwarder -> [Text])
-> (CreateConditionalForwarder
-> [Text] -> CreateConditionalForwarder)
-> Lens
CreateConditionalForwarder CreateConditionalForwarder [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConditionalForwarder' {[Text]
dnsIpAddrs :: [Text]
$sel:dnsIpAddrs:CreateConditionalForwarder' :: CreateConditionalForwarder -> [Text]
dnsIpAddrs} -> [Text]
dnsIpAddrs) (\s :: CreateConditionalForwarder
s@CreateConditionalForwarder' {} [Text]
a -> CreateConditionalForwarder
s {$sel:dnsIpAddrs:CreateConditionalForwarder' :: [Text]
dnsIpAddrs = [Text]
a} :: CreateConditionalForwarder) (([Text] -> f [Text])
-> CreateConditionalForwarder -> f CreateConditionalForwarder)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateConditionalForwarder
-> f CreateConditionalForwarder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateConditionalForwarder where
type
AWSResponse CreateConditionalForwarder =
CreateConditionalForwarderResponse
request :: CreateConditionalForwarder -> Request CreateConditionalForwarder
request = Service
-> CreateConditionalForwarder -> Request CreateConditionalForwarder
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateConditionalForwarder
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateConditionalForwarder)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateConditionalForwarder))
-> Logger
-> Service
-> Proxy CreateConditionalForwarder
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateConditionalForwarder)))
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 -> CreateConditionalForwarderResponse
CreateConditionalForwarderResponse'
(Int -> CreateConditionalForwarderResponse)
-> Either String Int
-> Either String CreateConditionalForwarderResponse
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 CreateConditionalForwarder
instance Prelude.NFData CreateConditionalForwarder
instance Core.ToHeaders CreateConditionalForwarder where
toHeaders :: CreateConditionalForwarder -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateConditionalForwarder -> 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.CreateConditionalForwarder" ::
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 CreateConditionalForwarder where
toJSON :: CreateConditionalForwarder -> Value
toJSON CreateConditionalForwarder' {[Text]
Text
dnsIpAddrs :: [Text]
remoteDomainName :: Text
directoryId :: Text
$sel:dnsIpAddrs:CreateConditionalForwarder' :: CreateConditionalForwarder -> [Text]
$sel:remoteDomainName:CreateConditionalForwarder' :: CreateConditionalForwarder -> Text
$sel:directoryId:CreateConditionalForwarder' :: CreateConditionalForwarder -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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
"RemoteDomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
remoteDomainName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DnsIpAddrs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
dnsIpAddrs)
]
)
instance Core.ToPath CreateConditionalForwarder where
toPath :: CreateConditionalForwarder -> ByteString
toPath = ByteString -> CreateConditionalForwarder -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateConditionalForwarder where
toQuery :: CreateConditionalForwarder -> QueryString
toQuery = QueryString -> CreateConditionalForwarder -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateConditionalForwarderResponse = CreateConditionalForwarderResponse'
{
CreateConditionalForwarderResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool
(CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool)
-> (CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool)
-> Eq CreateConditionalForwarderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool
$c/= :: CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool
== :: CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool
$c== :: CreateConditionalForwarderResponse
-> CreateConditionalForwarderResponse -> Bool
Prelude.Eq, ReadPrec [CreateConditionalForwarderResponse]
ReadPrec CreateConditionalForwarderResponse
Int -> ReadS CreateConditionalForwarderResponse
ReadS [CreateConditionalForwarderResponse]
(Int -> ReadS CreateConditionalForwarderResponse)
-> ReadS [CreateConditionalForwarderResponse]
-> ReadPrec CreateConditionalForwarderResponse
-> ReadPrec [CreateConditionalForwarderResponse]
-> Read CreateConditionalForwarderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConditionalForwarderResponse]
$creadListPrec :: ReadPrec [CreateConditionalForwarderResponse]
readPrec :: ReadPrec CreateConditionalForwarderResponse
$creadPrec :: ReadPrec CreateConditionalForwarderResponse
readList :: ReadS [CreateConditionalForwarderResponse]
$creadList :: ReadS [CreateConditionalForwarderResponse]
readsPrec :: Int -> ReadS CreateConditionalForwarderResponse
$creadsPrec :: Int -> ReadS CreateConditionalForwarderResponse
Prelude.Read, Int -> CreateConditionalForwarderResponse -> ShowS
[CreateConditionalForwarderResponse] -> ShowS
CreateConditionalForwarderResponse -> String
(Int -> CreateConditionalForwarderResponse -> ShowS)
-> (CreateConditionalForwarderResponse -> String)
-> ([CreateConditionalForwarderResponse] -> ShowS)
-> Show CreateConditionalForwarderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConditionalForwarderResponse] -> ShowS
$cshowList :: [CreateConditionalForwarderResponse] -> ShowS
show :: CreateConditionalForwarderResponse -> String
$cshow :: CreateConditionalForwarderResponse -> String
showsPrec :: Int -> CreateConditionalForwarderResponse -> ShowS
$cshowsPrec :: Int -> CreateConditionalForwarderResponse -> ShowS
Prelude.Show, (forall x.
CreateConditionalForwarderResponse
-> Rep CreateConditionalForwarderResponse x)
-> (forall x.
Rep CreateConditionalForwarderResponse x
-> CreateConditionalForwarderResponse)
-> Generic CreateConditionalForwarderResponse
forall x.
Rep CreateConditionalForwarderResponse x
-> CreateConditionalForwarderResponse
forall x.
CreateConditionalForwarderResponse
-> Rep CreateConditionalForwarderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConditionalForwarderResponse x
-> CreateConditionalForwarderResponse
$cfrom :: forall x.
CreateConditionalForwarderResponse
-> Rep CreateConditionalForwarderResponse x
Prelude.Generic)
newCreateConditionalForwarderResponse ::
Prelude.Int ->
CreateConditionalForwarderResponse
newCreateConditionalForwarderResponse :: Int -> CreateConditionalForwarderResponse
newCreateConditionalForwarderResponse Int
pHttpStatus_ =
CreateConditionalForwarderResponse' :: Int -> CreateConditionalForwarderResponse
CreateConditionalForwarderResponse'
{ $sel:httpStatus:CreateConditionalForwarderResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createConditionalForwarderResponse_httpStatus :: Lens.Lens' CreateConditionalForwarderResponse Prelude.Int
createConditionalForwarderResponse_httpStatus :: (Int -> f Int)
-> CreateConditionalForwarderResponse
-> f CreateConditionalForwarderResponse
createConditionalForwarderResponse_httpStatus = (CreateConditionalForwarderResponse -> Int)
-> (CreateConditionalForwarderResponse
-> Int -> CreateConditionalForwarderResponse)
-> Lens
CreateConditionalForwarderResponse
CreateConditionalForwarderResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConditionalForwarderResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateConditionalForwarderResponse' :: CreateConditionalForwarderResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateConditionalForwarderResponse
s@CreateConditionalForwarderResponse' {} Int
a -> CreateConditionalForwarderResponse
s {$sel:httpStatus:CreateConditionalForwarderResponse' :: Int
httpStatus = Int
a} :: CreateConditionalForwarderResponse)
instance
Prelude.NFData
CreateConditionalForwarderResponse