modify_rule
¶
modify_rule(
*,
config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
rule_arn: Optional[RuleArn] = None,
conditions: Optional[RuleConditionList] = None,
actions: Optional[Actions] = None,
transforms: Optional[RuleTransformList] = None,
reset_transforms: Optional[ResetTransforms] = None,
) -> ModifyRuleOutput
Replaces the specified properties of the specified rule. Any properties that you do not specify are unchanged.
To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action.
Parameters:
-
rule_arn(Optional[RuleArn], default:None) –The Amazon Resource Name (ARN) of the rule.
-
conditions(Optional[RuleConditionList], default:None) –The conditions.
-
actions(Optional[Actions], default:None) –The actions.
-
transforms(Optional[RuleTransformList], default:None) –The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify
Transforms, you can't specifyResetTransforms. -
reset_transforms(Optional[ResetTransforms], default:None) –Indicates whether to remove all transforms from the rule. If you specify
ResetTransforms, you can't specifyTransforms.
Raises:
-
IncompatibleProtocolsException–The specified configuration is not valid with this protocol.
-
InvalidLoadBalancerActionException–The requested action is not valid.
-
OperationNotPermittedException–This operation is not allowed.
-
RuleNotFoundException–The specified rule does not exist.
-
TargetGroupAssociationLimitException–You've reached the limit on the number of load balancers per target group.
-
TargetGroupNotFoundException–The specified target group does not exist.
-
TooManyActionsException–You've reached the limit on the number of actions per rule.
-
TooManyRegistrationsForTargetIdException–You've reached the limit on the number of times a target can be registered with a load balancer.
-
TooManyTargetsException–You've reached the limit on the number of targets.
-
TooManyUniqueTargetGroupsPerLoadBalancerException–You've reached the limit on the number of unique target groups per load balancer across all listeners. If a target group is used by multiple actions for a load balancer, it is counted as only one use.
-
UnsupportedProtocolException–The specified protocol is not supported.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To modify a rule This example modifies the condition for the specified rule.
>>> client.modify_rule(rule_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee', conditions=[{'Field': 'path-pattern', 'Values': ['/images/*']}])
To modify a Network Load Balancer listener rule
This example modifies an NLB listener rule to forward traffic to a different target group.
>>> client.modify_rule(rule_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/net/my-nlb/1234567890abcdef/1234567890abcdef/1234567890abcdef', actions=[{'Type': 'forward', 'TargetGroupArn': 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-ipv4-targets/1234567890abcdef'}])
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 | |