aws_sdk_bedrockagentcorecontrol/client/
create_policy.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`CreatePolicy`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder) operation.
4    ///
5    /// - The fluent builder is configurable:
6    ///   - [`name(impl Into<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::name) / [`set_name(Option<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::set_name):<br>required: **true**<br><p>The customer-assigned immutable name for the policy. Must be unique within the account. This name is used for policy identification and cannot be changed after creation.</p><br>
7    ///   - [`definition(PolicyDefinition)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::definition) / [`set_definition(Option<PolicyDefinition>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::set_definition):<br>required: **true**<br><p>The Cedar policy statement that defines the access control rules. This contains the actual policy logic written in Cedar policy language, specifying effect (permit or forbid), principals, actions, resources, and conditions for agent behavior control.</p><br>
8    ///   - [`description(impl Into<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::description) / [`set_description(Option<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::set_description):<br>required: **false**<br><p>A human-readable description of the policy's purpose and functionality (1-4,096 characters). This helps policy administrators understand the policy's intent, business rules, and operational scope. Use this field to document why the policy exists, what business requirement it addresses, and any special considerations for maintenance. Clear descriptions are essential for policy governance, auditing, and troubleshooting.</p><br>
9    ///   - [`validation_mode(PolicyValidationMode)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::validation_mode) / [`set_validation_mode(Option<PolicyValidationMode>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::set_validation_mode):<br>required: **false**<br><p>The validation mode for the policy creation. Determines how Cedar analyzer validation results are handled during policy creation. FAIL_ON_ANY_FINDINGS (default) runs the Cedar analyzer to validate the policy against the Cedar schema and tool context, failing creation if the analyzer detects any validation issues to ensure strict conformance. IGNORE_ALL_FINDINGS runs the Cedar analyzer but allows policy creation even if validation issues are detected, useful for testing or when the policy schema is evolving. Use FAIL_ON_ANY_FINDINGS for production policies to ensure correctness, and IGNORE_ALL_FINDINGS only when you understand and accept the analyzer findings.</p><br>
10    ///   - [`policy_engine_id(impl Into<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::policy_engine_id) / [`set_policy_engine_id(Option<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::set_policy_engine_id):<br>required: **true**<br><p>The identifier of the policy engine which contains this policy. Policy engines group related policies and provide the execution context for policy evaluation.</p><br>
11    ///   - [`client_token(impl Into<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::client_token) / [`set_client_token(Option<String>)`](crate::operation::create_policy::builders::CreatePolicyFluentBuilder::set_client_token):<br>required: **false**<br><p>A unique, case-sensitive identifier to ensure the idempotency of the request. The AWS SDK automatically generates this token, so you don't need to provide it in most cases. If you retry a request with the same client token, the service returns the same response without creating a duplicate policy.</p><br>
12    /// - On success, responds with [`CreatePolicyOutput`](crate::operation::create_policy::CreatePolicyOutput) with field(s):
13    ///   - [`policy_id(String)`](crate::operation::create_policy::CreatePolicyOutput::policy_id): <p>The unique identifier for the created policy. This is a system-generated identifier consisting of the user name plus a 10-character generated suffix, used for all subsequent policy operations.</p>
14    ///   - [`name(String)`](crate::operation::create_policy::CreatePolicyOutput::name): <p>The customer-assigned name of the created policy. This matches the name provided in the request and serves as the human-readable identifier for the policy.</p>
15    ///   - [`policy_engine_id(String)`](crate::operation::create_policy::CreatePolicyOutput::policy_engine_id): <p>The identifier of the policy engine that manages this policy. This confirms the policy engine assignment and is used for policy evaluation routing.</p>
16    ///   - [`definition(Option<PolicyDefinition>)`](crate::operation::create_policy::CreatePolicyOutput::definition): <p>The Cedar policy statement that was created. This is the validated policy definition that will be used for agent behavior control and access decisions.</p>
17    ///   - [`description(Option<String>)`](crate::operation::create_policy::CreatePolicyOutput::description): <p>The human-readable description of the policy's purpose and functionality. This helps administrators understand and manage the policy.</p>
18    ///   - [`created_at(DateTime)`](crate::operation::create_policy::CreatePolicyOutput::created_at): <p>The timestamp when the policy was created. This is automatically set by the service and used for auditing and lifecycle management.</p>
19    ///   - [`updated_at(DateTime)`](crate::operation::create_policy::CreatePolicyOutput::updated_at): <p>The timestamp when the policy was last updated. For newly created policies, this matches the createdAt timestamp.</p>
20    ///   - [`policy_arn(String)`](crate::operation::create_policy::CreatePolicyOutput::policy_arn): <p>The Amazon Resource Name (ARN) of the created policy. This globally unique identifier can be used for cross-service references and IAM policy statements.</p>
21    ///   - [`status(PolicyStatus)`](crate::operation::create_policy::CreatePolicyOutput::status): <p>The current status of the policy. A status of <code>ACTIVE</code> indicates the policy is ready for use.</p>
22    ///   - [`status_reasons(Vec::<String>)`](crate::operation::create_policy::CreatePolicyOutput::status_reasons): <p>Additional information about the policy status. This provides details about any failures or the current state of the policy creation process.</p>
23    /// - On failure, responds with [`SdkError<CreatePolicyError>`](crate::operation::create_policy::CreatePolicyError)
24    pub fn create_policy(&self) -> crate::operation::create_policy::builders::CreatePolicyFluentBuilder {
25        crate::operation::create_policy::builders::CreatePolicyFluentBuilder::new(self.handle.clone())
26    }
27}