update_policy
async
¶
update_policy(
policy_engine_id: ResourceId,
policy_id: ResourceId,
*,
config_overrides: Optional[AsyncBedrockAgentCoreControlClientConfig] = None,
description: Optional[UpdatedDescription] = None,
definition: Optional[PolicyDefinition] = None,
validation_mode: Optional[PolicyValidationMode] = None,
enforcement_mode: Optional[EnforcementMode] = None,
) -> UpdatePolicyResponse
Updates an existing policy within the AgentCore Policy system. This operation allows modification of the policy description and definition while maintaining the policy's identity. The updated policy is validated against the Cedar schema before being applied. This is an asynchronous operation. Use the GetPolicy operation to poll the status field to track completion.
If the updated policy is a temporal policy, the policy engine invalidates all active temporal sessions. If the update adds or removes temporal operators, the policy engine also invalidates active temporal sessions. For more information about temporal policy sessions, see session-based temporal policies. The policy engine returns an HTTP 409 ConflictException to in-flight sessions. To resume, you must start a new session with a new session ID.
Parameters:
-
policy_engine_id(ResourceId) –The identifier of the policy engine that manages the policy to be updated. This ensures the policy is updated within the correct policy engine context.
-
policy_id(ResourceId) –The unique identifier of the policy to be updated. This must be a valid policy ID that exists within the specified policy engine.
-
description(Optional[UpdatedDescription], default:None) –The new human-readable description for the policy. This optional field allows updating the policy's documentation while keeping the same policy logic.
-
definition(Optional[PolicyDefinition], default:None) –The new Cedar or Dogwood policy statement that defines the access control rules. This replaces the existing policy definition with new logic while maintaining the policy's identity.
-
validation_mode(Optional[PolicyValidationMode], default:None) –The validation mode for the policy update. Determines how Cedar analyzer validation results are handled during policy updates. FAIL_ON_ANY_FINDINGS runs the Cedar analyzer and fails the update if validation issues are detected, ensuring the policy conforms to the Cedar schema and tool context. IGNORE_ALL_FINDINGS runs the Cedar analyzer but allows updates despite validation warnings. Use FAIL_ON_ANY_FINDINGS to ensure policy correctness during updates, especially when modifying policy logic or conditions.
-
enforcement_mode(Optional[EnforcementMode], default:None) –The enforcement mode for the policy. Run this policy in
LOG_ONLYmode to collect data on how it affects your application. Once you are satisfied with the data gathered, switch the policy toACTIVE. If you omit this field, the policy's existing enforcement mode is unchanged.
Raises:
-
AccessDeniedException–This exception is thrown when a request is denied per access permissions
-
ConflictException–This exception is thrown when there is a conflict performing an operation
-
InternalServerException–This exception is thrown if there was an unexpected error during processing of request
-
ResourceNotFoundException–This exception is thrown when a resource referenced by the operation does not exist
-
ServiceQuotaExceededException–This exception is thrown when a request is made beyond the service quota
-
ThrottlingException–This exception is thrown when the number of requests exceeds the limit
-
ValidationException–The input fails to satisfy the constraints specified by the service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_bedrock_agentcore_control/_services/async_bedrock_agent_core_control.py
12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 | |