{-# 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.GetResolverRule
(
GetResolverRule (..),
newGetResolverRule,
getResolverRule_resolverRuleId,
GetResolverRuleResponse (..),
newGetResolverRuleResponse,
getResolverRuleResponse_resolverRule,
getResolverRuleResponse_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 GetResolverRule = GetResolverRule'
{
GetResolverRule -> Text
resolverRuleId :: Prelude.Text
}
deriving (GetResolverRule -> GetResolverRule -> Bool
(GetResolverRule -> GetResolverRule -> Bool)
-> (GetResolverRule -> GetResolverRule -> Bool)
-> Eq GetResolverRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverRule -> GetResolverRule -> Bool
$c/= :: GetResolverRule -> GetResolverRule -> Bool
== :: GetResolverRule -> GetResolverRule -> Bool
$c== :: GetResolverRule -> GetResolverRule -> Bool
Prelude.Eq, ReadPrec [GetResolverRule]
ReadPrec GetResolverRule
Int -> ReadS GetResolverRule
ReadS [GetResolverRule]
(Int -> ReadS GetResolverRule)
-> ReadS [GetResolverRule]
-> ReadPrec GetResolverRule
-> ReadPrec [GetResolverRule]
-> Read GetResolverRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverRule]
$creadListPrec :: ReadPrec [GetResolverRule]
readPrec :: ReadPrec GetResolverRule
$creadPrec :: ReadPrec GetResolverRule
readList :: ReadS [GetResolverRule]
$creadList :: ReadS [GetResolverRule]
readsPrec :: Int -> ReadS GetResolverRule
$creadsPrec :: Int -> ReadS GetResolverRule
Prelude.Read, Int -> GetResolverRule -> ShowS
[GetResolverRule] -> ShowS
GetResolverRule -> String
(Int -> GetResolverRule -> ShowS)
-> (GetResolverRule -> String)
-> ([GetResolverRule] -> ShowS)
-> Show GetResolverRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverRule] -> ShowS
$cshowList :: [GetResolverRule] -> ShowS
show :: GetResolverRule -> String
$cshow :: GetResolverRule -> String
showsPrec :: Int -> GetResolverRule -> ShowS
$cshowsPrec :: Int -> GetResolverRule -> ShowS
Prelude.Show, (forall x. GetResolverRule -> Rep GetResolverRule x)
-> (forall x. Rep GetResolverRule x -> GetResolverRule)
-> Generic GetResolverRule
forall x. Rep GetResolverRule x -> GetResolverRule
forall x. GetResolverRule -> Rep GetResolverRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResolverRule x -> GetResolverRule
$cfrom :: forall x. GetResolverRule -> Rep GetResolverRule x
Prelude.Generic)
newGetResolverRule ::
Prelude.Text ->
GetResolverRule
newGetResolverRule :: Text -> GetResolverRule
newGetResolverRule Text
pResolverRuleId_ =
GetResolverRule' :: Text -> GetResolverRule
GetResolverRule' {$sel:resolverRuleId:GetResolverRule' :: Text
resolverRuleId = Text
pResolverRuleId_}
getResolverRule_resolverRuleId :: Lens.Lens' GetResolverRule Prelude.Text
getResolverRule_resolverRuleId :: (Text -> f Text) -> GetResolverRule -> f GetResolverRule
getResolverRule_resolverRuleId = (GetResolverRule -> Text)
-> (GetResolverRule -> Text -> GetResolverRule)
-> Lens GetResolverRule GetResolverRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverRule' {Text
resolverRuleId :: Text
$sel:resolverRuleId:GetResolverRule' :: GetResolverRule -> Text
resolverRuleId} -> Text
resolverRuleId) (\s :: GetResolverRule
s@GetResolverRule' {} Text
a -> GetResolverRule
s {$sel:resolverRuleId:GetResolverRule' :: Text
resolverRuleId = Text
a} :: GetResolverRule)
instance Core.AWSRequest GetResolverRule where
type
AWSResponse GetResolverRule =
GetResolverRuleResponse
request :: GetResolverRule -> Request GetResolverRule
request = Service -> GetResolverRule -> Request GetResolverRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetResolverRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetResolverRule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetResolverRule))
-> Logger
-> Service
-> Proxy GetResolverRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetResolverRule)))
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 ResolverRule -> Int -> GetResolverRuleResponse
GetResolverRuleResponse'
(Maybe ResolverRule -> Int -> GetResolverRuleResponse)
-> Either String (Maybe ResolverRule)
-> Either String (Int -> GetResolverRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResolverRule)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverRule")
Either String (Int -> GetResolverRuleResponse)
-> Either String Int -> Either String GetResolverRuleResponse
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 GetResolverRule
instance Prelude.NFData GetResolverRule
instance Core.ToHeaders GetResolverRule where
toHeaders :: GetResolverRule -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetResolverRule -> 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.GetResolverRule" ::
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 GetResolverRule where
toJSON :: GetResolverRule -> Value
toJSON GetResolverRule' {Text
resolverRuleId :: Text
$sel:resolverRuleId:GetResolverRule' :: GetResolverRule -> 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
"ResolverRuleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resolverRuleId)
]
)
instance Core.ToPath GetResolverRule where
toPath :: GetResolverRule -> ByteString
toPath = ByteString -> GetResolverRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetResolverRule where
toQuery :: GetResolverRule -> QueryString
toQuery = QueryString -> GetResolverRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetResolverRuleResponse = GetResolverRuleResponse'
{
GetResolverRuleResponse -> Maybe ResolverRule
resolverRule :: Prelude.Maybe ResolverRule,
GetResolverRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetResolverRuleResponse -> GetResolverRuleResponse -> Bool
(GetResolverRuleResponse -> GetResolverRuleResponse -> Bool)
-> (GetResolverRuleResponse -> GetResolverRuleResponse -> Bool)
-> Eq GetResolverRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverRuleResponse -> GetResolverRuleResponse -> Bool
$c/= :: GetResolverRuleResponse -> GetResolverRuleResponse -> Bool
== :: GetResolverRuleResponse -> GetResolverRuleResponse -> Bool
$c== :: GetResolverRuleResponse -> GetResolverRuleResponse -> Bool
Prelude.Eq, ReadPrec [GetResolverRuleResponse]
ReadPrec GetResolverRuleResponse
Int -> ReadS GetResolverRuleResponse
ReadS [GetResolverRuleResponse]
(Int -> ReadS GetResolverRuleResponse)
-> ReadS [GetResolverRuleResponse]
-> ReadPrec GetResolverRuleResponse
-> ReadPrec [GetResolverRuleResponse]
-> Read GetResolverRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverRuleResponse]
$creadListPrec :: ReadPrec [GetResolverRuleResponse]
readPrec :: ReadPrec GetResolverRuleResponse
$creadPrec :: ReadPrec GetResolverRuleResponse
readList :: ReadS [GetResolverRuleResponse]
$creadList :: ReadS [GetResolverRuleResponse]
readsPrec :: Int -> ReadS GetResolverRuleResponse
$creadsPrec :: Int -> ReadS GetResolverRuleResponse
Prelude.Read, Int -> GetResolverRuleResponse -> ShowS
[GetResolverRuleResponse] -> ShowS
GetResolverRuleResponse -> String
(Int -> GetResolverRuleResponse -> ShowS)
-> (GetResolverRuleResponse -> String)
-> ([GetResolverRuleResponse] -> ShowS)
-> Show GetResolverRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverRuleResponse] -> ShowS
$cshowList :: [GetResolverRuleResponse] -> ShowS
show :: GetResolverRuleResponse -> String
$cshow :: GetResolverRuleResponse -> String
showsPrec :: Int -> GetResolverRuleResponse -> ShowS
$cshowsPrec :: Int -> GetResolverRuleResponse -> ShowS
Prelude.Show, (forall x.
GetResolverRuleResponse -> Rep GetResolverRuleResponse x)
-> (forall x.
Rep GetResolverRuleResponse x -> GetResolverRuleResponse)
-> Generic GetResolverRuleResponse
forall x. Rep GetResolverRuleResponse x -> GetResolverRuleResponse
forall x. GetResolverRuleResponse -> Rep GetResolverRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResolverRuleResponse x -> GetResolverRuleResponse
$cfrom :: forall x. GetResolverRuleResponse -> Rep GetResolverRuleResponse x
Prelude.Generic)
newGetResolverRuleResponse ::
Prelude.Int ->
GetResolverRuleResponse
newGetResolverRuleResponse :: Int -> GetResolverRuleResponse
newGetResolverRuleResponse Int
pHttpStatus_ =
GetResolverRuleResponse' :: Maybe ResolverRule -> Int -> GetResolverRuleResponse
GetResolverRuleResponse'
{ $sel:resolverRule:GetResolverRuleResponse' :: Maybe ResolverRule
resolverRule =
Maybe ResolverRule
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetResolverRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getResolverRuleResponse_resolverRule :: Lens.Lens' GetResolverRuleResponse (Prelude.Maybe ResolverRule)
getResolverRuleResponse_resolverRule :: (Maybe ResolverRule -> f (Maybe ResolverRule))
-> GetResolverRuleResponse -> f GetResolverRuleResponse
getResolverRuleResponse_resolverRule = (GetResolverRuleResponse -> Maybe ResolverRule)
-> (GetResolverRuleResponse
-> Maybe ResolverRule -> GetResolverRuleResponse)
-> Lens
GetResolverRuleResponse
GetResolverRuleResponse
(Maybe ResolverRule)
(Maybe ResolverRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverRuleResponse' {Maybe ResolverRule
resolverRule :: Maybe ResolverRule
$sel:resolverRule:GetResolverRuleResponse' :: GetResolverRuleResponse -> Maybe ResolverRule
resolverRule} -> Maybe ResolverRule
resolverRule) (\s :: GetResolverRuleResponse
s@GetResolverRuleResponse' {} Maybe ResolverRule
a -> GetResolverRuleResponse
s {$sel:resolverRule:GetResolverRuleResponse' :: Maybe ResolverRule
resolverRule = Maybe ResolverRule
a} :: GetResolverRuleResponse)
getResolverRuleResponse_httpStatus :: Lens.Lens' GetResolverRuleResponse Prelude.Int
getResolverRuleResponse_httpStatus :: (Int -> f Int)
-> GetResolverRuleResponse -> f GetResolverRuleResponse
getResolverRuleResponse_httpStatus = (GetResolverRuleResponse -> Int)
-> (GetResolverRuleResponse -> Int -> GetResolverRuleResponse)
-> Lens GetResolverRuleResponse GetResolverRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetResolverRuleResponse' :: GetResolverRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetResolverRuleResponse
s@GetResolverRuleResponse' {} Int
a -> GetResolverRuleResponse
s {$sel:httpStatus:GetResolverRuleResponse' :: Int
httpStatus = Int
a} :: GetResolverRuleResponse)
instance Prelude.NFData GetResolverRuleResponse