{-# 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.ELBV2.ModifyRule
(
ModifyRule (..),
newModifyRule,
modifyRule_actions,
modifyRule_conditions,
modifyRule_ruleArn,
ModifyRuleResponse (..),
newModifyRuleResponse,
modifyRuleResponse_rules,
modifyRuleResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ELBV2.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 ModifyRule = ModifyRule'
{
ModifyRule -> Maybe [Action]
actions :: Prelude.Maybe [Action],
ModifyRule -> Maybe [RuleCondition]
conditions :: Prelude.Maybe [RuleCondition],
ModifyRule -> Text
ruleArn :: Prelude.Text
}
deriving (ModifyRule -> ModifyRule -> Bool
(ModifyRule -> ModifyRule -> Bool)
-> (ModifyRule -> ModifyRule -> Bool) -> Eq ModifyRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyRule -> ModifyRule -> Bool
$c/= :: ModifyRule -> ModifyRule -> Bool
== :: ModifyRule -> ModifyRule -> Bool
$c== :: ModifyRule -> ModifyRule -> Bool
Prelude.Eq, ReadPrec [ModifyRule]
ReadPrec ModifyRule
Int -> ReadS ModifyRule
ReadS [ModifyRule]
(Int -> ReadS ModifyRule)
-> ReadS [ModifyRule]
-> ReadPrec ModifyRule
-> ReadPrec [ModifyRule]
-> Read ModifyRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyRule]
$creadListPrec :: ReadPrec [ModifyRule]
readPrec :: ReadPrec ModifyRule
$creadPrec :: ReadPrec ModifyRule
readList :: ReadS [ModifyRule]
$creadList :: ReadS [ModifyRule]
readsPrec :: Int -> ReadS ModifyRule
$creadsPrec :: Int -> ReadS ModifyRule
Prelude.Read, Int -> ModifyRule -> ShowS
[ModifyRule] -> ShowS
ModifyRule -> String
(Int -> ModifyRule -> ShowS)
-> (ModifyRule -> String)
-> ([ModifyRule] -> ShowS)
-> Show ModifyRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyRule] -> ShowS
$cshowList :: [ModifyRule] -> ShowS
show :: ModifyRule -> String
$cshow :: ModifyRule -> String
showsPrec :: Int -> ModifyRule -> ShowS
$cshowsPrec :: Int -> ModifyRule -> ShowS
Prelude.Show, (forall x. ModifyRule -> Rep ModifyRule x)
-> (forall x. Rep ModifyRule x -> ModifyRule) -> Generic ModifyRule
forall x. Rep ModifyRule x -> ModifyRule
forall x. ModifyRule -> Rep ModifyRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyRule x -> ModifyRule
$cfrom :: forall x. ModifyRule -> Rep ModifyRule x
Prelude.Generic)
newModifyRule ::
Prelude.Text ->
ModifyRule
newModifyRule :: Text -> ModifyRule
newModifyRule Text
pRuleArn_ =
ModifyRule' :: Maybe [Action] -> Maybe [RuleCondition] -> Text -> ModifyRule
ModifyRule'
{ $sel:actions:ModifyRule' :: Maybe [Action]
actions = Maybe [Action]
forall a. Maybe a
Prelude.Nothing,
$sel:conditions:ModifyRule' :: Maybe [RuleCondition]
conditions = Maybe [RuleCondition]
forall a. Maybe a
Prelude.Nothing,
$sel:ruleArn:ModifyRule' :: Text
ruleArn = Text
pRuleArn_
}
modifyRule_actions :: Lens.Lens' ModifyRule (Prelude.Maybe [Action])
modifyRule_actions :: (Maybe [Action] -> f (Maybe [Action]))
-> ModifyRule -> f ModifyRule
modifyRule_actions = (ModifyRule -> Maybe [Action])
-> (ModifyRule -> Maybe [Action] -> ModifyRule)
-> Lens ModifyRule ModifyRule (Maybe [Action]) (Maybe [Action])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyRule' {Maybe [Action]
actions :: Maybe [Action]
$sel:actions:ModifyRule' :: ModifyRule -> Maybe [Action]
actions} -> Maybe [Action]
actions) (\s :: ModifyRule
s@ModifyRule' {} Maybe [Action]
a -> ModifyRule
s {$sel:actions:ModifyRule' :: Maybe [Action]
actions = Maybe [Action]
a} :: ModifyRule) ((Maybe [Action] -> f (Maybe [Action]))
-> ModifyRule -> f ModifyRule)
-> ((Maybe [Action] -> f (Maybe [Action]))
-> Maybe [Action] -> f (Maybe [Action]))
-> (Maybe [Action] -> f (Maybe [Action]))
-> ModifyRule
-> f ModifyRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Action] [Action] [Action] [Action]
-> Iso
(Maybe [Action]) (Maybe [Action]) (Maybe [Action]) (Maybe [Action])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Action] [Action] [Action] [Action]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
modifyRule_conditions :: Lens.Lens' ModifyRule (Prelude.Maybe [RuleCondition])
modifyRule_conditions :: (Maybe [RuleCondition] -> f (Maybe [RuleCondition]))
-> ModifyRule -> f ModifyRule
modifyRule_conditions = (ModifyRule -> Maybe [RuleCondition])
-> (ModifyRule -> Maybe [RuleCondition] -> ModifyRule)
-> Lens
ModifyRule
ModifyRule
(Maybe [RuleCondition])
(Maybe [RuleCondition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyRule' {Maybe [RuleCondition]
conditions :: Maybe [RuleCondition]
$sel:conditions:ModifyRule' :: ModifyRule -> Maybe [RuleCondition]
conditions} -> Maybe [RuleCondition]
conditions) (\s :: ModifyRule
s@ModifyRule' {} Maybe [RuleCondition]
a -> ModifyRule
s {$sel:conditions:ModifyRule' :: Maybe [RuleCondition]
conditions = Maybe [RuleCondition]
a} :: ModifyRule) ((Maybe [RuleCondition] -> f (Maybe [RuleCondition]))
-> ModifyRule -> f ModifyRule)
-> ((Maybe [RuleCondition] -> f (Maybe [RuleCondition]))
-> Maybe [RuleCondition] -> f (Maybe [RuleCondition]))
-> (Maybe [RuleCondition] -> f (Maybe [RuleCondition]))
-> ModifyRule
-> f ModifyRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RuleCondition] [RuleCondition] [RuleCondition] [RuleCondition]
-> Iso
(Maybe [RuleCondition])
(Maybe [RuleCondition])
(Maybe [RuleCondition])
(Maybe [RuleCondition])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[RuleCondition] [RuleCondition] [RuleCondition] [RuleCondition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
modifyRule_ruleArn :: Lens.Lens' ModifyRule Prelude.Text
modifyRule_ruleArn :: (Text -> f Text) -> ModifyRule -> f ModifyRule
modifyRule_ruleArn = (ModifyRule -> Text)
-> (ModifyRule -> Text -> ModifyRule)
-> Lens ModifyRule ModifyRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyRule' {Text
ruleArn :: Text
$sel:ruleArn:ModifyRule' :: ModifyRule -> Text
ruleArn} -> Text
ruleArn) (\s :: ModifyRule
s@ModifyRule' {} Text
a -> ModifyRule
s {$sel:ruleArn:ModifyRule' :: Text
ruleArn = Text
a} :: ModifyRule)
instance Core.AWSRequest ModifyRule where
type AWSResponse ModifyRule = ModifyRuleResponse
request :: ModifyRule -> Request ModifyRule
request = Service -> ModifyRule -> Request ModifyRule
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ModifyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyRule)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ModifyRule))
-> Logger
-> Service
-> Proxy ModifyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyRule)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ModifyRuleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [Rule] -> Int -> ModifyRuleResponse
ModifyRuleResponse'
(Maybe [Rule] -> Int -> ModifyRuleResponse)
-> Either String (Maybe [Rule])
-> Either String (Int -> ModifyRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Rules" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Rule]))
-> Either String (Maybe [Rule])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Rule])
-> [Node] -> Either String (Maybe [Rule])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Rule]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> ModifyRuleResponse)
-> Either String Int -> Either String ModifyRuleResponse
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 ModifyRule
instance Prelude.NFData ModifyRule
instance Core.ToHeaders ModifyRule where
toHeaders :: ModifyRule -> ResponseHeaders
toHeaders = ResponseHeaders -> ModifyRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ModifyRule where
toPath :: ModifyRule -> ByteString
toPath = ByteString -> ModifyRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ModifyRule where
toQuery :: ModifyRule -> QueryString
toQuery ModifyRule' {Maybe [RuleCondition]
Maybe [Action]
Text
ruleArn :: Text
conditions :: Maybe [RuleCondition]
actions :: Maybe [Action]
$sel:ruleArn:ModifyRule' :: ModifyRule -> Text
$sel:conditions:ModifyRule' :: ModifyRule -> Maybe [RuleCondition]
$sel:actions:ModifyRule' :: ModifyRule -> Maybe [Action]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ModifyRule" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
ByteString
"Actions"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Action] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Action] -> QueryString) -> Maybe [Action] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Action]
actions),
ByteString
"Conditions"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [RuleCondition] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([RuleCondition] -> QueryString)
-> Maybe [RuleCondition] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RuleCondition]
conditions),
ByteString
"RuleArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
ruleArn
]
data ModifyRuleResponse = ModifyRuleResponse'
{
ModifyRuleResponse -> Maybe [Rule]
rules :: Prelude.Maybe [Rule],
ModifyRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ModifyRuleResponse -> ModifyRuleResponse -> Bool
(ModifyRuleResponse -> ModifyRuleResponse -> Bool)
-> (ModifyRuleResponse -> ModifyRuleResponse -> Bool)
-> Eq ModifyRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyRuleResponse -> ModifyRuleResponse -> Bool
$c/= :: ModifyRuleResponse -> ModifyRuleResponse -> Bool
== :: ModifyRuleResponse -> ModifyRuleResponse -> Bool
$c== :: ModifyRuleResponse -> ModifyRuleResponse -> Bool
Prelude.Eq, ReadPrec [ModifyRuleResponse]
ReadPrec ModifyRuleResponse
Int -> ReadS ModifyRuleResponse
ReadS [ModifyRuleResponse]
(Int -> ReadS ModifyRuleResponse)
-> ReadS [ModifyRuleResponse]
-> ReadPrec ModifyRuleResponse
-> ReadPrec [ModifyRuleResponse]
-> Read ModifyRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyRuleResponse]
$creadListPrec :: ReadPrec [ModifyRuleResponse]
readPrec :: ReadPrec ModifyRuleResponse
$creadPrec :: ReadPrec ModifyRuleResponse
readList :: ReadS [ModifyRuleResponse]
$creadList :: ReadS [ModifyRuleResponse]
readsPrec :: Int -> ReadS ModifyRuleResponse
$creadsPrec :: Int -> ReadS ModifyRuleResponse
Prelude.Read, Int -> ModifyRuleResponse -> ShowS
[ModifyRuleResponse] -> ShowS
ModifyRuleResponse -> String
(Int -> ModifyRuleResponse -> ShowS)
-> (ModifyRuleResponse -> String)
-> ([ModifyRuleResponse] -> ShowS)
-> Show ModifyRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyRuleResponse] -> ShowS
$cshowList :: [ModifyRuleResponse] -> ShowS
show :: ModifyRuleResponse -> String
$cshow :: ModifyRuleResponse -> String
showsPrec :: Int -> ModifyRuleResponse -> ShowS
$cshowsPrec :: Int -> ModifyRuleResponse -> ShowS
Prelude.Show, (forall x. ModifyRuleResponse -> Rep ModifyRuleResponse x)
-> (forall x. Rep ModifyRuleResponse x -> ModifyRuleResponse)
-> Generic ModifyRuleResponse
forall x. Rep ModifyRuleResponse x -> ModifyRuleResponse
forall x. ModifyRuleResponse -> Rep ModifyRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyRuleResponse x -> ModifyRuleResponse
$cfrom :: forall x. ModifyRuleResponse -> Rep ModifyRuleResponse x
Prelude.Generic)
newModifyRuleResponse ::
Prelude.Int ->
ModifyRuleResponse
newModifyRuleResponse :: Int -> ModifyRuleResponse
newModifyRuleResponse Int
pHttpStatus_ =
ModifyRuleResponse' :: Maybe [Rule] -> Int -> ModifyRuleResponse
ModifyRuleResponse'
{ $sel:rules:ModifyRuleResponse' :: Maybe [Rule]
rules = Maybe [Rule]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ModifyRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
modifyRuleResponse_rules :: Lens.Lens' ModifyRuleResponse (Prelude.Maybe [Rule])
modifyRuleResponse_rules :: (Maybe [Rule] -> f (Maybe [Rule]))
-> ModifyRuleResponse -> f ModifyRuleResponse
modifyRuleResponse_rules = (ModifyRuleResponse -> Maybe [Rule])
-> (ModifyRuleResponse -> Maybe [Rule] -> ModifyRuleResponse)
-> Lens
ModifyRuleResponse ModifyRuleResponse (Maybe [Rule]) (Maybe [Rule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyRuleResponse' {Maybe [Rule]
rules :: Maybe [Rule]
$sel:rules:ModifyRuleResponse' :: ModifyRuleResponse -> Maybe [Rule]
rules} -> Maybe [Rule]
rules) (\s :: ModifyRuleResponse
s@ModifyRuleResponse' {} Maybe [Rule]
a -> ModifyRuleResponse
s {$sel:rules:ModifyRuleResponse' :: Maybe [Rule]
rules = Maybe [Rule]
a} :: ModifyRuleResponse) ((Maybe [Rule] -> f (Maybe [Rule]))
-> ModifyRuleResponse -> f ModifyRuleResponse)
-> ((Maybe [Rule] -> f (Maybe [Rule]))
-> Maybe [Rule] -> f (Maybe [Rule]))
-> (Maybe [Rule] -> f (Maybe [Rule]))
-> ModifyRuleResponse
-> f ModifyRuleResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Rule] [Rule] [Rule] [Rule]
-> Iso (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Rule] [Rule] [Rule] [Rule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
modifyRuleResponse_httpStatus :: Lens.Lens' ModifyRuleResponse Prelude.Int
modifyRuleResponse_httpStatus :: (Int -> f Int) -> ModifyRuleResponse -> f ModifyRuleResponse
modifyRuleResponse_httpStatus = (ModifyRuleResponse -> Int)
-> (ModifyRuleResponse -> Int -> ModifyRuleResponse)
-> Lens ModifyRuleResponse ModifyRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyRuleResponse' :: ModifyRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyRuleResponse
s@ModifyRuleResponse' {} Int
a -> ModifyRuleResponse
s {$sel:httpStatus:ModifyRuleResponse' :: Int
httpStatus = Int
a} :: ModifyRuleResponse)
instance Prelude.NFData ModifyRuleResponse