modify_rule
async
¶
modify_rule(
*,
config_overrides: Optional[AsyncElasticLoadBalancingv2ClientConfig] = 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.
>>> await 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.
>>> await 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/async_elastic_load_balancingv2.py
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 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 | |