{-# 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.Route53Resolver.AssociateResolverRule
(
AssociateResolverRule (..),
newAssociateResolverRule,
associateResolverRule_name,
associateResolverRule_resolverRuleId,
associateResolverRule_vPCId,
AssociateResolverRuleResponse (..),
newAssociateResolverRuleResponse,
associateResolverRuleResponse_resolverRuleAssociation,
associateResolverRuleResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53Resolver.Types
data AssociateResolverRule = AssociateResolverRule'
{
AssociateResolverRule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
AssociateResolverRule -> Text
resolverRuleId :: Prelude.Text,
AssociateResolverRule -> Text
vPCId :: Prelude.Text
}
deriving (AssociateResolverRule -> AssociateResolverRule -> Bool
(AssociateResolverRule -> AssociateResolverRule -> Bool)
-> (AssociateResolverRule -> AssociateResolverRule -> Bool)
-> Eq AssociateResolverRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateResolverRule -> AssociateResolverRule -> Bool
$c/= :: AssociateResolverRule -> AssociateResolverRule -> Bool
== :: AssociateResolverRule -> AssociateResolverRule -> Bool
$c== :: AssociateResolverRule -> AssociateResolverRule -> Bool
Prelude.Eq, ReadPrec [AssociateResolverRule]
ReadPrec AssociateResolverRule
Int -> ReadS AssociateResolverRule
ReadS [AssociateResolverRule]
(Int -> ReadS AssociateResolverRule)
-> ReadS [AssociateResolverRule]
-> ReadPrec AssociateResolverRule
-> ReadPrec [AssociateResolverRule]
-> Read AssociateResolverRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateResolverRule]
$creadListPrec :: ReadPrec [AssociateResolverRule]
readPrec :: ReadPrec AssociateResolverRule
$creadPrec :: ReadPrec AssociateResolverRule
readList :: ReadS [AssociateResolverRule]
$creadList :: ReadS [AssociateResolverRule]
readsPrec :: Int -> ReadS AssociateResolverRule
$creadsPrec :: Int -> ReadS AssociateResolverRule
Prelude.Read, Int -> AssociateResolverRule -> ShowS
[AssociateResolverRule] -> ShowS
AssociateResolverRule -> String
(Int -> AssociateResolverRule -> ShowS)
-> (AssociateResolverRule -> String)
-> ([AssociateResolverRule] -> ShowS)
-> Show AssociateResolverRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateResolverRule] -> ShowS
$cshowList :: [AssociateResolverRule] -> ShowS
show :: AssociateResolverRule -> String
$cshow :: AssociateResolverRule -> String
showsPrec :: Int -> AssociateResolverRule -> ShowS
$cshowsPrec :: Int -> AssociateResolverRule -> ShowS
Prelude.Show, (forall x. AssociateResolverRule -> Rep AssociateResolverRule x)
-> (forall x. Rep AssociateResolverRule x -> AssociateResolverRule)
-> Generic AssociateResolverRule
forall x. Rep AssociateResolverRule x -> AssociateResolverRule
forall x. AssociateResolverRule -> Rep AssociateResolverRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateResolverRule x -> AssociateResolverRule
$cfrom :: forall x. AssociateResolverRule -> Rep AssociateResolverRule x
Prelude.Generic)
newAssociateResolverRule ::
Prelude.Text ->
Prelude.Text ->
AssociateResolverRule
newAssociateResolverRule :: Text -> Text -> AssociateResolverRule
newAssociateResolverRule Text
pResolverRuleId_ Text
pVPCId_ =
AssociateResolverRule' :: Maybe Text -> Text -> Text -> AssociateResolverRule
AssociateResolverRule'
{ $sel:name:AssociateResolverRule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resolverRuleId:AssociateResolverRule' :: Text
resolverRuleId = Text
pResolverRuleId_,
$sel:vPCId:AssociateResolverRule' :: Text
vPCId = Text
pVPCId_
}
associateResolverRule_name :: Lens.Lens' AssociateResolverRule (Prelude.Maybe Prelude.Text)
associateResolverRule_name :: (Maybe Text -> f (Maybe Text))
-> AssociateResolverRule -> f AssociateResolverRule
associateResolverRule_name = (AssociateResolverRule -> Maybe Text)
-> (AssociateResolverRule -> Maybe Text -> AssociateResolverRule)
-> Lens
AssociateResolverRule
AssociateResolverRule
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResolverRule' {Maybe Text
name :: Maybe Text
$sel:name:AssociateResolverRule' :: AssociateResolverRule -> Maybe Text
name} -> Maybe Text
name) (\s :: AssociateResolverRule
s@AssociateResolverRule' {} Maybe Text
a -> AssociateResolverRule
s {$sel:name:AssociateResolverRule' :: Maybe Text
name = Maybe Text
a} :: AssociateResolverRule)
associateResolverRule_resolverRuleId :: Lens.Lens' AssociateResolverRule Prelude.Text
associateResolverRule_resolverRuleId :: (Text -> f Text)
-> AssociateResolverRule -> f AssociateResolverRule
associateResolverRule_resolverRuleId = (AssociateResolverRule -> Text)
-> (AssociateResolverRule -> Text -> AssociateResolverRule)
-> Lens AssociateResolverRule AssociateResolverRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResolverRule' {Text
resolverRuleId :: Text
$sel:resolverRuleId:AssociateResolverRule' :: AssociateResolverRule -> Text
resolverRuleId} -> Text
resolverRuleId) (\s :: AssociateResolverRule
s@AssociateResolverRule' {} Text
a -> AssociateResolverRule
s {$sel:resolverRuleId:AssociateResolverRule' :: Text
resolverRuleId = Text
a} :: AssociateResolverRule)
associateResolverRule_vPCId :: Lens.Lens' AssociateResolverRule Prelude.Text
associateResolverRule_vPCId :: (Text -> f Text)
-> AssociateResolverRule -> f AssociateResolverRule
associateResolverRule_vPCId = (AssociateResolverRule -> Text)
-> (AssociateResolverRule -> Text -> AssociateResolverRule)
-> Lens AssociateResolverRule AssociateResolverRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResolverRule' {Text
vPCId :: Text
$sel:vPCId:AssociateResolverRule' :: AssociateResolverRule -> Text
vPCId} -> Text
vPCId) (\s :: AssociateResolverRule
s@AssociateResolverRule' {} Text
a -> AssociateResolverRule
s {$sel:vPCId:AssociateResolverRule' :: Text
vPCId = Text
a} :: AssociateResolverRule)
instance Core.AWSRequest AssociateResolverRule where
type
AWSResponse AssociateResolverRule =
AssociateResolverRuleResponse
request :: AssociateResolverRule -> Request AssociateResolverRule
request = Service -> AssociateResolverRule -> Request AssociateResolverRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateResolverRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateResolverRule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateResolverRule))
-> Logger
-> Service
-> Proxy AssociateResolverRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateResolverRule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe ResolverRuleAssociation
-> Int -> AssociateResolverRuleResponse
AssociateResolverRuleResponse'
(Maybe ResolverRuleAssociation
-> Int -> AssociateResolverRuleResponse)
-> Either String (Maybe ResolverRuleAssociation)
-> Either String (Int -> AssociateResolverRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResolverRuleAssociation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverRuleAssociation")
Either String (Int -> AssociateResolverRuleResponse)
-> Either String Int -> Either String AssociateResolverRuleResponse
forall (f :: * -> *) a b. Applicative f => 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 AssociateResolverRule
instance Prelude.NFData AssociateResolverRule
instance Core.ToHeaders AssociateResolverRule where
toHeaders :: AssociateResolverRule -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateResolverRule -> 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
"Route53Resolver.AssociateResolverRule" ::
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 AssociateResolverRule where
toJSON :: AssociateResolverRule -> Value
toJSON AssociateResolverRule' {Maybe Text
Text
vPCId :: Text
resolverRuleId :: Text
name :: Maybe Text
$sel:vPCId:AssociateResolverRule' :: AssociateResolverRule -> Text
$sel:resolverRuleId:AssociateResolverRule' :: AssociateResolverRule -> Text
$sel:name:AssociateResolverRule' :: AssociateResolverRule -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ResolverRuleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resolverRuleId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VPCId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vPCId)
]
)
instance Core.ToPath AssociateResolverRule where
toPath :: AssociateResolverRule -> ByteString
toPath = ByteString -> AssociateResolverRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateResolverRule where
toQuery :: AssociateResolverRule -> QueryString
toQuery = QueryString -> AssociateResolverRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateResolverRuleResponse = AssociateResolverRuleResponse'
{
AssociateResolverRuleResponse -> Maybe ResolverRuleAssociation
resolverRuleAssociation :: Prelude.Maybe ResolverRuleAssociation,
AssociateResolverRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool
(AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool)
-> (AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool)
-> Eq AssociateResolverRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool
$c/= :: AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool
== :: AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool
$c== :: AssociateResolverRuleResponse
-> AssociateResolverRuleResponse -> Bool
Prelude.Eq, ReadPrec [AssociateResolverRuleResponse]
ReadPrec AssociateResolverRuleResponse
Int -> ReadS AssociateResolverRuleResponse
ReadS [AssociateResolverRuleResponse]
(Int -> ReadS AssociateResolverRuleResponse)
-> ReadS [AssociateResolverRuleResponse]
-> ReadPrec AssociateResolverRuleResponse
-> ReadPrec [AssociateResolverRuleResponse]
-> Read AssociateResolverRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateResolverRuleResponse]
$creadListPrec :: ReadPrec [AssociateResolverRuleResponse]
readPrec :: ReadPrec AssociateResolverRuleResponse
$creadPrec :: ReadPrec AssociateResolverRuleResponse
readList :: ReadS [AssociateResolverRuleResponse]
$creadList :: ReadS [AssociateResolverRuleResponse]
readsPrec :: Int -> ReadS AssociateResolverRuleResponse
$creadsPrec :: Int -> ReadS AssociateResolverRuleResponse
Prelude.Read, Int -> AssociateResolverRuleResponse -> ShowS
[AssociateResolverRuleResponse] -> ShowS
AssociateResolverRuleResponse -> String
(Int -> AssociateResolverRuleResponse -> ShowS)
-> (AssociateResolverRuleResponse -> String)
-> ([AssociateResolverRuleResponse] -> ShowS)
-> Show AssociateResolverRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateResolverRuleResponse] -> ShowS
$cshowList :: [AssociateResolverRuleResponse] -> ShowS
show :: AssociateResolverRuleResponse -> String
$cshow :: AssociateResolverRuleResponse -> String
showsPrec :: Int -> AssociateResolverRuleResponse -> ShowS
$cshowsPrec :: Int -> AssociateResolverRuleResponse -> ShowS
Prelude.Show, (forall x.
AssociateResolverRuleResponse
-> Rep AssociateResolverRuleResponse x)
-> (forall x.
Rep AssociateResolverRuleResponse x
-> AssociateResolverRuleResponse)
-> Generic AssociateResolverRuleResponse
forall x.
Rep AssociateResolverRuleResponse x
-> AssociateResolverRuleResponse
forall x.
AssociateResolverRuleResponse
-> Rep AssociateResolverRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateResolverRuleResponse x
-> AssociateResolverRuleResponse
$cfrom :: forall x.
AssociateResolverRuleResponse
-> Rep AssociateResolverRuleResponse x
Prelude.Generic)
newAssociateResolverRuleResponse ::
Prelude.Int ->
AssociateResolverRuleResponse
newAssociateResolverRuleResponse :: Int -> AssociateResolverRuleResponse
newAssociateResolverRuleResponse Int
pHttpStatus_ =
AssociateResolverRuleResponse' :: Maybe ResolverRuleAssociation
-> Int -> AssociateResolverRuleResponse
AssociateResolverRuleResponse'
{ $sel:resolverRuleAssociation:AssociateResolverRuleResponse' :: Maybe ResolverRuleAssociation
resolverRuleAssociation =
Maybe ResolverRuleAssociation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateResolverRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateResolverRuleResponse_resolverRuleAssociation :: Lens.Lens' AssociateResolverRuleResponse (Prelude.Maybe ResolverRuleAssociation)
associateResolverRuleResponse_resolverRuleAssociation :: (Maybe ResolverRuleAssociation
-> f (Maybe ResolverRuleAssociation))
-> AssociateResolverRuleResponse -> f AssociateResolverRuleResponse
associateResolverRuleResponse_resolverRuleAssociation = (AssociateResolverRuleResponse -> Maybe ResolverRuleAssociation)
-> (AssociateResolverRuleResponse
-> Maybe ResolverRuleAssociation -> AssociateResolverRuleResponse)
-> Lens
AssociateResolverRuleResponse
AssociateResolverRuleResponse
(Maybe ResolverRuleAssociation)
(Maybe ResolverRuleAssociation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResolverRuleResponse' {Maybe ResolverRuleAssociation
resolverRuleAssociation :: Maybe ResolverRuleAssociation
$sel:resolverRuleAssociation:AssociateResolverRuleResponse' :: AssociateResolverRuleResponse -> Maybe ResolverRuleAssociation
resolverRuleAssociation} -> Maybe ResolverRuleAssociation
resolverRuleAssociation) (\s :: AssociateResolverRuleResponse
s@AssociateResolverRuleResponse' {} Maybe ResolverRuleAssociation
a -> AssociateResolverRuleResponse
s {$sel:resolverRuleAssociation:AssociateResolverRuleResponse' :: Maybe ResolverRuleAssociation
resolverRuleAssociation = Maybe ResolverRuleAssociation
a} :: AssociateResolverRuleResponse)
associateResolverRuleResponse_httpStatus :: Lens.Lens' AssociateResolverRuleResponse Prelude.Int
associateResolverRuleResponse_httpStatus :: (Int -> f Int)
-> AssociateResolverRuleResponse -> f AssociateResolverRuleResponse
associateResolverRuleResponse_httpStatus = (AssociateResolverRuleResponse -> Int)
-> (AssociateResolverRuleResponse
-> Int -> AssociateResolverRuleResponse)
-> Lens
AssociateResolverRuleResponse AssociateResolverRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResolverRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateResolverRuleResponse' :: AssociateResolverRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateResolverRuleResponse
s@AssociateResolverRuleResponse' {} Int
a -> AssociateResolverRuleResponse
s {$sel:httpStatus:AssociateResolverRuleResponse' :: Int
httpStatus = Int
a} :: AssociateResolverRuleResponse)
instance Prelude.NFData AssociateResolverRuleResponse