{-# 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.Route53RecoveryControlConfig.UpdateSafetyRule
(
UpdateSafetyRule (..),
newUpdateSafetyRule,
updateSafetyRule_gatingRuleUpdate,
updateSafetyRule_assertionRuleUpdate,
UpdateSafetyRuleResponse (..),
newUpdateSafetyRuleResponse,
updateSafetyRuleResponse_assertionRule,
updateSafetyRuleResponse_gatingRule,
updateSafetyRuleResponse_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.Route53RecoveryControlConfig.Types
data UpdateSafetyRule = UpdateSafetyRule'
{ UpdateSafetyRule -> Maybe GatingRuleUpdate
gatingRuleUpdate :: Prelude.Maybe GatingRuleUpdate,
UpdateSafetyRule -> Maybe AssertionRuleUpdate
assertionRuleUpdate :: Prelude.Maybe AssertionRuleUpdate
}
deriving (UpdateSafetyRule -> UpdateSafetyRule -> Bool
(UpdateSafetyRule -> UpdateSafetyRule -> Bool)
-> (UpdateSafetyRule -> UpdateSafetyRule -> Bool)
-> Eq UpdateSafetyRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSafetyRule -> UpdateSafetyRule -> Bool
$c/= :: UpdateSafetyRule -> UpdateSafetyRule -> Bool
== :: UpdateSafetyRule -> UpdateSafetyRule -> Bool
$c== :: UpdateSafetyRule -> UpdateSafetyRule -> Bool
Prelude.Eq, ReadPrec [UpdateSafetyRule]
ReadPrec UpdateSafetyRule
Int -> ReadS UpdateSafetyRule
ReadS [UpdateSafetyRule]
(Int -> ReadS UpdateSafetyRule)
-> ReadS [UpdateSafetyRule]
-> ReadPrec UpdateSafetyRule
-> ReadPrec [UpdateSafetyRule]
-> Read UpdateSafetyRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSafetyRule]
$creadListPrec :: ReadPrec [UpdateSafetyRule]
readPrec :: ReadPrec UpdateSafetyRule
$creadPrec :: ReadPrec UpdateSafetyRule
readList :: ReadS [UpdateSafetyRule]
$creadList :: ReadS [UpdateSafetyRule]
readsPrec :: Int -> ReadS UpdateSafetyRule
$creadsPrec :: Int -> ReadS UpdateSafetyRule
Prelude.Read, Int -> UpdateSafetyRule -> ShowS
[UpdateSafetyRule] -> ShowS
UpdateSafetyRule -> String
(Int -> UpdateSafetyRule -> ShowS)
-> (UpdateSafetyRule -> String)
-> ([UpdateSafetyRule] -> ShowS)
-> Show UpdateSafetyRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSafetyRule] -> ShowS
$cshowList :: [UpdateSafetyRule] -> ShowS
show :: UpdateSafetyRule -> String
$cshow :: UpdateSafetyRule -> String
showsPrec :: Int -> UpdateSafetyRule -> ShowS
$cshowsPrec :: Int -> UpdateSafetyRule -> ShowS
Prelude.Show, (forall x. UpdateSafetyRule -> Rep UpdateSafetyRule x)
-> (forall x. Rep UpdateSafetyRule x -> UpdateSafetyRule)
-> Generic UpdateSafetyRule
forall x. Rep UpdateSafetyRule x -> UpdateSafetyRule
forall x. UpdateSafetyRule -> Rep UpdateSafetyRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSafetyRule x -> UpdateSafetyRule
$cfrom :: forall x. UpdateSafetyRule -> Rep UpdateSafetyRule x
Prelude.Generic)
newUpdateSafetyRule ::
UpdateSafetyRule
newUpdateSafetyRule :: UpdateSafetyRule
newUpdateSafetyRule =
UpdateSafetyRule' :: Maybe GatingRuleUpdate
-> Maybe AssertionRuleUpdate -> UpdateSafetyRule
UpdateSafetyRule'
{ $sel:gatingRuleUpdate:UpdateSafetyRule' :: Maybe GatingRuleUpdate
gatingRuleUpdate =
Maybe GatingRuleUpdate
forall a. Maybe a
Prelude.Nothing,
$sel:assertionRuleUpdate:UpdateSafetyRule' :: Maybe AssertionRuleUpdate
assertionRuleUpdate = Maybe AssertionRuleUpdate
forall a. Maybe a
Prelude.Nothing
}
updateSafetyRule_gatingRuleUpdate :: Lens.Lens' UpdateSafetyRule (Prelude.Maybe GatingRuleUpdate)
updateSafetyRule_gatingRuleUpdate :: (Maybe GatingRuleUpdate -> f (Maybe GatingRuleUpdate))
-> UpdateSafetyRule -> f UpdateSafetyRule
updateSafetyRule_gatingRuleUpdate = (UpdateSafetyRule -> Maybe GatingRuleUpdate)
-> (UpdateSafetyRule -> Maybe GatingRuleUpdate -> UpdateSafetyRule)
-> Lens
UpdateSafetyRule
UpdateSafetyRule
(Maybe GatingRuleUpdate)
(Maybe GatingRuleUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSafetyRule' {Maybe GatingRuleUpdate
gatingRuleUpdate :: Maybe GatingRuleUpdate
$sel:gatingRuleUpdate:UpdateSafetyRule' :: UpdateSafetyRule -> Maybe GatingRuleUpdate
gatingRuleUpdate} -> Maybe GatingRuleUpdate
gatingRuleUpdate) (\s :: UpdateSafetyRule
s@UpdateSafetyRule' {} Maybe GatingRuleUpdate
a -> UpdateSafetyRule
s {$sel:gatingRuleUpdate:UpdateSafetyRule' :: Maybe GatingRuleUpdate
gatingRuleUpdate = Maybe GatingRuleUpdate
a} :: UpdateSafetyRule)
updateSafetyRule_assertionRuleUpdate :: Lens.Lens' UpdateSafetyRule (Prelude.Maybe AssertionRuleUpdate)
updateSafetyRule_assertionRuleUpdate :: (Maybe AssertionRuleUpdate -> f (Maybe AssertionRuleUpdate))
-> UpdateSafetyRule -> f UpdateSafetyRule
updateSafetyRule_assertionRuleUpdate = (UpdateSafetyRule -> Maybe AssertionRuleUpdate)
-> (UpdateSafetyRule
-> Maybe AssertionRuleUpdate -> UpdateSafetyRule)
-> Lens
UpdateSafetyRule
UpdateSafetyRule
(Maybe AssertionRuleUpdate)
(Maybe AssertionRuleUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSafetyRule' {Maybe AssertionRuleUpdate
assertionRuleUpdate :: Maybe AssertionRuleUpdate
$sel:assertionRuleUpdate:UpdateSafetyRule' :: UpdateSafetyRule -> Maybe AssertionRuleUpdate
assertionRuleUpdate} -> Maybe AssertionRuleUpdate
assertionRuleUpdate) (\s :: UpdateSafetyRule
s@UpdateSafetyRule' {} Maybe AssertionRuleUpdate
a -> UpdateSafetyRule
s {$sel:assertionRuleUpdate:UpdateSafetyRule' :: Maybe AssertionRuleUpdate
assertionRuleUpdate = Maybe AssertionRuleUpdate
a} :: UpdateSafetyRule)
instance Core.AWSRequest UpdateSafetyRule where
type
AWSResponse UpdateSafetyRule =
UpdateSafetyRuleResponse
request :: UpdateSafetyRule -> Request UpdateSafetyRule
request = Service -> UpdateSafetyRule -> Request UpdateSafetyRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSafetyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSafetyRule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSafetyRule))
-> Logger
-> Service
-> Proxy UpdateSafetyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSafetyRule)))
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 AssertionRule
-> Maybe GatingRule -> Int -> UpdateSafetyRuleResponse
UpdateSafetyRuleResponse'
(Maybe AssertionRule
-> Maybe GatingRule -> Int -> UpdateSafetyRuleResponse)
-> Either String (Maybe AssertionRule)
-> Either
String (Maybe GatingRule -> Int -> UpdateSafetyRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe AssertionRule)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"AssertionRule")
Either String (Maybe GatingRule -> Int -> UpdateSafetyRuleResponse)
-> Either String (Maybe GatingRule)
-> Either String (Int -> UpdateSafetyRuleResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe GatingRule)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"GatingRule")
Either String (Int -> UpdateSafetyRuleResponse)
-> Either String Int -> Either String UpdateSafetyRuleResponse
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 UpdateSafetyRule
instance Prelude.NFData UpdateSafetyRule
instance Core.ToHeaders UpdateSafetyRule where
toHeaders :: UpdateSafetyRule -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSafetyRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateSafetyRule where
toJSON :: UpdateSafetyRule -> Value
toJSON UpdateSafetyRule' {Maybe AssertionRuleUpdate
Maybe GatingRuleUpdate
assertionRuleUpdate :: Maybe AssertionRuleUpdate
gatingRuleUpdate :: Maybe GatingRuleUpdate
$sel:assertionRuleUpdate:UpdateSafetyRule' :: UpdateSafetyRule -> Maybe AssertionRuleUpdate
$sel:gatingRuleUpdate:UpdateSafetyRule' :: UpdateSafetyRule -> Maybe GatingRuleUpdate
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"GatingRuleUpdate" Key -> GatingRuleUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=)
(GatingRuleUpdate -> Pair) -> Maybe GatingRuleUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GatingRuleUpdate
gatingRuleUpdate,
(Key
"AssertionRuleUpdate" Key -> AssertionRuleUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=)
(AssertionRuleUpdate -> Pair)
-> Maybe AssertionRuleUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssertionRuleUpdate
assertionRuleUpdate
]
)
instance Core.ToPath UpdateSafetyRule where
toPath :: UpdateSafetyRule -> ByteString
toPath = ByteString -> UpdateSafetyRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/safetyrule"
instance Core.ToQuery UpdateSafetyRule where
toQuery :: UpdateSafetyRule -> QueryString
toQuery = QueryString -> UpdateSafetyRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSafetyRuleResponse = UpdateSafetyRuleResponse'
{ UpdateSafetyRuleResponse -> Maybe AssertionRule
assertionRule :: Prelude.Maybe AssertionRule,
UpdateSafetyRuleResponse -> Maybe GatingRule
gatingRule :: Prelude.Maybe GatingRule,
UpdateSafetyRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool
(UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool)
-> (UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool)
-> Eq UpdateSafetyRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool
$c/= :: UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool
== :: UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool
$c== :: UpdateSafetyRuleResponse -> UpdateSafetyRuleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSafetyRuleResponse]
ReadPrec UpdateSafetyRuleResponse
Int -> ReadS UpdateSafetyRuleResponse
ReadS [UpdateSafetyRuleResponse]
(Int -> ReadS UpdateSafetyRuleResponse)
-> ReadS [UpdateSafetyRuleResponse]
-> ReadPrec UpdateSafetyRuleResponse
-> ReadPrec [UpdateSafetyRuleResponse]
-> Read UpdateSafetyRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSafetyRuleResponse]
$creadListPrec :: ReadPrec [UpdateSafetyRuleResponse]
readPrec :: ReadPrec UpdateSafetyRuleResponse
$creadPrec :: ReadPrec UpdateSafetyRuleResponse
readList :: ReadS [UpdateSafetyRuleResponse]
$creadList :: ReadS [UpdateSafetyRuleResponse]
readsPrec :: Int -> ReadS UpdateSafetyRuleResponse
$creadsPrec :: Int -> ReadS UpdateSafetyRuleResponse
Prelude.Read, Int -> UpdateSafetyRuleResponse -> ShowS
[UpdateSafetyRuleResponse] -> ShowS
UpdateSafetyRuleResponse -> String
(Int -> UpdateSafetyRuleResponse -> ShowS)
-> (UpdateSafetyRuleResponse -> String)
-> ([UpdateSafetyRuleResponse] -> ShowS)
-> Show UpdateSafetyRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSafetyRuleResponse] -> ShowS
$cshowList :: [UpdateSafetyRuleResponse] -> ShowS
show :: UpdateSafetyRuleResponse -> String
$cshow :: UpdateSafetyRuleResponse -> String
showsPrec :: Int -> UpdateSafetyRuleResponse -> ShowS
$cshowsPrec :: Int -> UpdateSafetyRuleResponse -> ShowS
Prelude.Show, (forall x.
UpdateSafetyRuleResponse -> Rep UpdateSafetyRuleResponse x)
-> (forall x.
Rep UpdateSafetyRuleResponse x -> UpdateSafetyRuleResponse)
-> Generic UpdateSafetyRuleResponse
forall x.
Rep UpdateSafetyRuleResponse x -> UpdateSafetyRuleResponse
forall x.
UpdateSafetyRuleResponse -> Rep UpdateSafetyRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSafetyRuleResponse x -> UpdateSafetyRuleResponse
$cfrom :: forall x.
UpdateSafetyRuleResponse -> Rep UpdateSafetyRuleResponse x
Prelude.Generic)
newUpdateSafetyRuleResponse ::
Prelude.Int ->
UpdateSafetyRuleResponse
newUpdateSafetyRuleResponse :: Int -> UpdateSafetyRuleResponse
newUpdateSafetyRuleResponse Int
pHttpStatus_ =
UpdateSafetyRuleResponse' :: Maybe AssertionRule
-> Maybe GatingRule -> Int -> UpdateSafetyRuleResponse
UpdateSafetyRuleResponse'
{ $sel:assertionRule:UpdateSafetyRuleResponse' :: Maybe AssertionRule
assertionRule =
Maybe AssertionRule
forall a. Maybe a
Prelude.Nothing,
$sel:gatingRule:UpdateSafetyRuleResponse' :: Maybe GatingRule
gatingRule = Maybe GatingRule
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSafetyRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSafetyRuleResponse_assertionRule :: Lens.Lens' UpdateSafetyRuleResponse (Prelude.Maybe AssertionRule)
updateSafetyRuleResponse_assertionRule :: (Maybe AssertionRule -> f (Maybe AssertionRule))
-> UpdateSafetyRuleResponse -> f UpdateSafetyRuleResponse
updateSafetyRuleResponse_assertionRule = (UpdateSafetyRuleResponse -> Maybe AssertionRule)
-> (UpdateSafetyRuleResponse
-> Maybe AssertionRule -> UpdateSafetyRuleResponse)
-> Lens
UpdateSafetyRuleResponse
UpdateSafetyRuleResponse
(Maybe AssertionRule)
(Maybe AssertionRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSafetyRuleResponse' {Maybe AssertionRule
assertionRule :: Maybe AssertionRule
$sel:assertionRule:UpdateSafetyRuleResponse' :: UpdateSafetyRuleResponse -> Maybe AssertionRule
assertionRule} -> Maybe AssertionRule
assertionRule) (\s :: UpdateSafetyRuleResponse
s@UpdateSafetyRuleResponse' {} Maybe AssertionRule
a -> UpdateSafetyRuleResponse
s {$sel:assertionRule:UpdateSafetyRuleResponse' :: Maybe AssertionRule
assertionRule = Maybe AssertionRule
a} :: UpdateSafetyRuleResponse)
updateSafetyRuleResponse_gatingRule :: Lens.Lens' UpdateSafetyRuleResponse (Prelude.Maybe GatingRule)
updateSafetyRuleResponse_gatingRule :: (Maybe GatingRule -> f (Maybe GatingRule))
-> UpdateSafetyRuleResponse -> f UpdateSafetyRuleResponse
updateSafetyRuleResponse_gatingRule = (UpdateSafetyRuleResponse -> Maybe GatingRule)
-> (UpdateSafetyRuleResponse
-> Maybe GatingRule -> UpdateSafetyRuleResponse)
-> Lens
UpdateSafetyRuleResponse
UpdateSafetyRuleResponse
(Maybe GatingRule)
(Maybe GatingRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSafetyRuleResponse' {Maybe GatingRule
gatingRule :: Maybe GatingRule
$sel:gatingRule:UpdateSafetyRuleResponse' :: UpdateSafetyRuleResponse -> Maybe GatingRule
gatingRule} -> Maybe GatingRule
gatingRule) (\s :: UpdateSafetyRuleResponse
s@UpdateSafetyRuleResponse' {} Maybe GatingRule
a -> UpdateSafetyRuleResponse
s {$sel:gatingRule:UpdateSafetyRuleResponse' :: Maybe GatingRule
gatingRule = Maybe GatingRule
a} :: UpdateSafetyRuleResponse)
updateSafetyRuleResponse_httpStatus :: Lens.Lens' UpdateSafetyRuleResponse Prelude.Int
updateSafetyRuleResponse_httpStatus :: (Int -> f Int)
-> UpdateSafetyRuleResponse -> f UpdateSafetyRuleResponse
updateSafetyRuleResponse_httpStatus = (UpdateSafetyRuleResponse -> Int)
-> (UpdateSafetyRuleResponse -> Int -> UpdateSafetyRuleResponse)
-> Lens UpdateSafetyRuleResponse UpdateSafetyRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSafetyRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSafetyRuleResponse' :: UpdateSafetyRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSafetyRuleResponse
s@UpdateSafetyRuleResponse' {} Int
a -> UpdateSafetyRuleResponse
s {$sel:httpStatus:UpdateSafetyRuleResponse' :: Int
httpStatus = Int
a} :: UpdateSafetyRuleResponse)
instance Prelude.NFData UpdateSafetyRuleResponse