update_policy
¶
update_policy(
policy_engine_id: ResourceId,
policy_id: ResourceId,
*,
config_overrides: Optional[BedrockAgentCoreControlClientConfig] = 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/bedrock_agent_core_control.py
12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 | |