{-# 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.PutResolverRulePolicy
(
PutResolverRulePolicy (..),
newPutResolverRulePolicy,
putResolverRulePolicy_arn,
putResolverRulePolicy_resolverRulePolicy,
PutResolverRulePolicyResponse (..),
newPutResolverRulePolicyResponse,
putResolverRulePolicyResponse_returnValue,
putResolverRulePolicyResponse_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 PutResolverRulePolicy = PutResolverRulePolicy'
{
PutResolverRulePolicy -> Text
arn :: Prelude.Text,
PutResolverRulePolicy -> Text
resolverRulePolicy :: Prelude.Text
}
deriving (PutResolverRulePolicy -> PutResolverRulePolicy -> Bool
(PutResolverRulePolicy -> PutResolverRulePolicy -> Bool)
-> (PutResolverRulePolicy -> PutResolverRulePolicy -> Bool)
-> Eq PutResolverRulePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutResolverRulePolicy -> PutResolverRulePolicy -> Bool
$c/= :: PutResolverRulePolicy -> PutResolverRulePolicy -> Bool
== :: PutResolverRulePolicy -> PutResolverRulePolicy -> Bool
$c== :: PutResolverRulePolicy -> PutResolverRulePolicy -> Bool
Prelude.Eq, ReadPrec [PutResolverRulePolicy]
ReadPrec PutResolverRulePolicy
Int -> ReadS PutResolverRulePolicy
ReadS [PutResolverRulePolicy]
(Int -> ReadS PutResolverRulePolicy)
-> ReadS [PutResolverRulePolicy]
-> ReadPrec PutResolverRulePolicy
-> ReadPrec [PutResolverRulePolicy]
-> Read PutResolverRulePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutResolverRulePolicy]
$creadListPrec :: ReadPrec [PutResolverRulePolicy]
readPrec :: ReadPrec PutResolverRulePolicy
$creadPrec :: ReadPrec PutResolverRulePolicy
readList :: ReadS [PutResolverRulePolicy]
$creadList :: ReadS [PutResolverRulePolicy]
readsPrec :: Int -> ReadS PutResolverRulePolicy
$creadsPrec :: Int -> ReadS PutResolverRulePolicy
Prelude.Read, Int -> PutResolverRulePolicy -> ShowS
[PutResolverRulePolicy] -> ShowS
PutResolverRulePolicy -> String
(Int -> PutResolverRulePolicy -> ShowS)
-> (PutResolverRulePolicy -> String)
-> ([PutResolverRulePolicy] -> ShowS)
-> Show PutResolverRulePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutResolverRulePolicy] -> ShowS
$cshowList :: [PutResolverRulePolicy] -> ShowS
show :: PutResolverRulePolicy -> String
$cshow :: PutResolverRulePolicy -> String
showsPrec :: Int -> PutResolverRulePolicy -> ShowS
$cshowsPrec :: Int -> PutResolverRulePolicy -> ShowS
Prelude.Show, (forall x. PutResolverRulePolicy -> Rep PutResolverRulePolicy x)
-> (forall x. Rep PutResolverRulePolicy x -> PutResolverRulePolicy)
-> Generic PutResolverRulePolicy
forall x. Rep PutResolverRulePolicy x -> PutResolverRulePolicy
forall x. PutResolverRulePolicy -> Rep PutResolverRulePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutResolverRulePolicy x -> PutResolverRulePolicy
$cfrom :: forall x. PutResolverRulePolicy -> Rep PutResolverRulePolicy x
Prelude.Generic)
newPutResolverRulePolicy ::
Prelude.Text ->
Prelude.Text ->
PutResolverRulePolicy
newPutResolverRulePolicy :: Text -> Text -> PutResolverRulePolicy
newPutResolverRulePolicy Text
pArn_ Text
pResolverRulePolicy_ =
PutResolverRulePolicy' :: Text -> Text -> PutResolverRulePolicy
PutResolverRulePolicy'
{ $sel:arn:PutResolverRulePolicy' :: Text
arn = Text
pArn_,
$sel:resolverRulePolicy:PutResolverRulePolicy' :: Text
resolverRulePolicy = Text
pResolverRulePolicy_
}
putResolverRulePolicy_arn :: Lens.Lens' PutResolverRulePolicy Prelude.Text
putResolverRulePolicy_arn :: (Text -> f Text)
-> PutResolverRulePolicy -> f PutResolverRulePolicy
putResolverRulePolicy_arn = (PutResolverRulePolicy -> Text)
-> (PutResolverRulePolicy -> Text -> PutResolverRulePolicy)
-> Lens PutResolverRulePolicy PutResolverRulePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResolverRulePolicy' {Text
arn :: Text
$sel:arn:PutResolverRulePolicy' :: PutResolverRulePolicy -> Text
arn} -> Text
arn) (\s :: PutResolverRulePolicy
s@PutResolverRulePolicy' {} Text
a -> PutResolverRulePolicy
s {$sel:arn:PutResolverRulePolicy' :: Text
arn = Text
a} :: PutResolverRulePolicy)
putResolverRulePolicy_resolverRulePolicy :: Lens.Lens' PutResolverRulePolicy Prelude.Text
putResolverRulePolicy_resolverRulePolicy :: (Text -> f Text)
-> PutResolverRulePolicy -> f PutResolverRulePolicy
putResolverRulePolicy_resolverRulePolicy = (PutResolverRulePolicy -> Text)
-> (PutResolverRulePolicy -> Text -> PutResolverRulePolicy)
-> Lens PutResolverRulePolicy PutResolverRulePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResolverRulePolicy' {Text
resolverRulePolicy :: Text
$sel:resolverRulePolicy:PutResolverRulePolicy' :: PutResolverRulePolicy -> Text
resolverRulePolicy} -> Text
resolverRulePolicy) (\s :: PutResolverRulePolicy
s@PutResolverRulePolicy' {} Text
a -> PutResolverRulePolicy
s {$sel:resolverRulePolicy:PutResolverRulePolicy' :: Text
resolverRulePolicy = Text
a} :: PutResolverRulePolicy)
instance Core.AWSRequest PutResolverRulePolicy where
type
AWSResponse PutResolverRulePolicy =
PutResolverRulePolicyResponse
request :: PutResolverRulePolicy -> Request PutResolverRulePolicy
request = Service -> PutResolverRulePolicy -> Request PutResolverRulePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutResolverRulePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutResolverRulePolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutResolverRulePolicy))
-> Logger
-> Service
-> Proxy PutResolverRulePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutResolverRulePolicy)))
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 Bool -> Int -> PutResolverRulePolicyResponse
PutResolverRulePolicyResponse'
(Maybe Bool -> Int -> PutResolverRulePolicyResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> PutResolverRulePolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReturnValue")
Either String (Int -> PutResolverRulePolicyResponse)
-> Either String Int -> Either String PutResolverRulePolicyResponse
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 PutResolverRulePolicy
instance Prelude.NFData PutResolverRulePolicy
instance Core.ToHeaders PutResolverRulePolicy where
toHeaders :: PutResolverRulePolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutResolverRulePolicy -> 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.PutResolverRulePolicy" ::
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 PutResolverRulePolicy where
toJSON :: PutResolverRulePolicy -> Value
toJSON PutResolverRulePolicy' {Text
resolverRulePolicy :: Text
arn :: Text
$sel:resolverRulePolicy:PutResolverRulePolicy' :: PutResolverRulePolicy -> Text
$sel:arn:PutResolverRulePolicy' :: PutResolverRulePolicy -> 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
"Arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ResolverRulePolicy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resolverRulePolicy)
]
)
instance Core.ToPath PutResolverRulePolicy where
toPath :: PutResolverRulePolicy -> ByteString
toPath = ByteString -> PutResolverRulePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutResolverRulePolicy where
toQuery :: PutResolverRulePolicy -> QueryString
toQuery = QueryString -> PutResolverRulePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutResolverRulePolicyResponse = PutResolverRulePolicyResponse'
{
PutResolverRulePolicyResponse -> Maybe Bool
returnValue :: Prelude.Maybe Prelude.Bool,
PutResolverRulePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool
(PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool)
-> (PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool)
-> Eq PutResolverRulePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool
$c/= :: PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool
== :: PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool
$c== :: PutResolverRulePolicyResponse
-> PutResolverRulePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutResolverRulePolicyResponse]
ReadPrec PutResolverRulePolicyResponse
Int -> ReadS PutResolverRulePolicyResponse
ReadS [PutResolverRulePolicyResponse]
(Int -> ReadS PutResolverRulePolicyResponse)
-> ReadS [PutResolverRulePolicyResponse]
-> ReadPrec PutResolverRulePolicyResponse
-> ReadPrec [PutResolverRulePolicyResponse]
-> Read PutResolverRulePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutResolverRulePolicyResponse]
$creadListPrec :: ReadPrec [PutResolverRulePolicyResponse]
readPrec :: ReadPrec PutResolverRulePolicyResponse
$creadPrec :: ReadPrec PutResolverRulePolicyResponse
readList :: ReadS [PutResolverRulePolicyResponse]
$creadList :: ReadS [PutResolverRulePolicyResponse]
readsPrec :: Int -> ReadS PutResolverRulePolicyResponse
$creadsPrec :: Int -> ReadS PutResolverRulePolicyResponse
Prelude.Read, Int -> PutResolverRulePolicyResponse -> ShowS
[PutResolverRulePolicyResponse] -> ShowS
PutResolverRulePolicyResponse -> String
(Int -> PutResolverRulePolicyResponse -> ShowS)
-> (PutResolverRulePolicyResponse -> String)
-> ([PutResolverRulePolicyResponse] -> ShowS)
-> Show PutResolverRulePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutResolverRulePolicyResponse] -> ShowS
$cshowList :: [PutResolverRulePolicyResponse] -> ShowS
show :: PutResolverRulePolicyResponse -> String
$cshow :: PutResolverRulePolicyResponse -> String
showsPrec :: Int -> PutResolverRulePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutResolverRulePolicyResponse -> ShowS
Prelude.Show, (forall x.
PutResolverRulePolicyResponse
-> Rep PutResolverRulePolicyResponse x)
-> (forall x.
Rep PutResolverRulePolicyResponse x
-> PutResolverRulePolicyResponse)
-> Generic PutResolverRulePolicyResponse
forall x.
Rep PutResolverRulePolicyResponse x
-> PutResolverRulePolicyResponse
forall x.
PutResolverRulePolicyResponse
-> Rep PutResolverRulePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutResolverRulePolicyResponse x
-> PutResolverRulePolicyResponse
$cfrom :: forall x.
PutResolverRulePolicyResponse
-> Rep PutResolverRulePolicyResponse x
Prelude.Generic)
newPutResolverRulePolicyResponse ::
Prelude.Int ->
PutResolverRulePolicyResponse
newPutResolverRulePolicyResponse :: Int -> PutResolverRulePolicyResponse
newPutResolverRulePolicyResponse Int
pHttpStatus_ =
PutResolverRulePolicyResponse' :: Maybe Bool -> Int -> PutResolverRulePolicyResponse
PutResolverRulePolicyResponse'
{ $sel:returnValue:PutResolverRulePolicyResponse' :: Maybe Bool
returnValue =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutResolverRulePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putResolverRulePolicyResponse_returnValue :: Lens.Lens' PutResolverRulePolicyResponse (Prelude.Maybe Prelude.Bool)
putResolverRulePolicyResponse_returnValue :: (Maybe Bool -> f (Maybe Bool))
-> PutResolverRulePolicyResponse -> f PutResolverRulePolicyResponse
putResolverRulePolicyResponse_returnValue = (PutResolverRulePolicyResponse -> Maybe Bool)
-> (PutResolverRulePolicyResponse
-> Maybe Bool -> PutResolverRulePolicyResponse)
-> Lens
PutResolverRulePolicyResponse
PutResolverRulePolicyResponse
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResolverRulePolicyResponse' {Maybe Bool
returnValue :: Maybe Bool
$sel:returnValue:PutResolverRulePolicyResponse' :: PutResolverRulePolicyResponse -> Maybe Bool
returnValue} -> Maybe Bool
returnValue) (\s :: PutResolverRulePolicyResponse
s@PutResolverRulePolicyResponse' {} Maybe Bool
a -> PutResolverRulePolicyResponse
s {$sel:returnValue:PutResolverRulePolicyResponse' :: Maybe Bool
returnValue = Maybe Bool
a} :: PutResolverRulePolicyResponse)
putResolverRulePolicyResponse_httpStatus :: Lens.Lens' PutResolverRulePolicyResponse Prelude.Int
putResolverRulePolicyResponse_httpStatus :: (Int -> f Int)
-> PutResolverRulePolicyResponse -> f PutResolverRulePolicyResponse
putResolverRulePolicyResponse_httpStatus = (PutResolverRulePolicyResponse -> Int)
-> (PutResolverRulePolicyResponse
-> Int -> PutResolverRulePolicyResponse)
-> Lens
PutResolverRulePolicyResponse PutResolverRulePolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResolverRulePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutResolverRulePolicyResponse' :: PutResolverRulePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutResolverRulePolicyResponse
s@PutResolverRulePolicyResponse' {} Int
a -> PutResolverRulePolicyResponse
s {$sel:httpStatus:PutResolverRulePolicyResponse' :: Int
httpStatus = Int
a} :: PutResolverRulePolicyResponse)
instance Prelude.NFData PutResolverRulePolicyResponse