AWS verifiedpermissions documentation change
Summary
Restructured documentation with added sections for prerequisites, testing steps, and cleanup instructions. Updated code sample organization and added explicit CLI commands for policy store deletion.
Security assessment
Changes focus on improving documentation structure and code sample clarity. No evidence of addressing security vulnerabilities or adding new security-specific guidance. The policy store deletion instructions are routine resource management.
Diff
diff --git a/verifiedpermissions/latest/userguide/code-samples-rust.md b/verifiedpermissions/latest/userguide/code-samples-rust.md index a5aa5e2c8..ca906f4de 100644 --- a//verifiedpermissions/latest/userguide/code-samples-rust.md +++ b//verifiedpermissions/latest/userguide/code-samples-rust.md @@ -5 +5 @@ -# Amazon Verified Permissions Implementation in Rust Using the AWS SDK +PrerequisitesTest the sample codeClean up resources @@ -7 +7 @@ -In this example, we'll explore a practical example of implementing Verified Permissions in Rust using the AWS SDK. We'll develop an authorization model that can test whether a user is able to view a photo. Our code will leverage the [aws-sdk-verifiedpermissions](https://docs.rs/aws-sdk-verifiedpermissions/latest/aws_sdk_verifiedpermissions/) crate from the [AWS SDK for Rust](https://github.com/awslabs/aws-sdk-rust), which offers a robust set of tools for interacting with AWS services. +# Implementing Amazon Verified Permissions in Rust with the AWS SDK @@ -9 +9 @@ In this example, we'll explore a practical example of implementing Verified Perm -Before diving into the code, ensure you have the [AWS CLI](https://aws.amazon.com/cli/) configured on your system. If you haven't installed it yet, follow the [AWS CLI installation guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). Once installed, set it up using the [configuration basics](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html) or [named profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) documentation. You'll also want to familiarize yourself with the [AWS SDK for Rust Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html) for additional context. +This topic provides a practical example of implementing Amazon Verified Permissions in Rust with the AWS SDK. This example shows how to develop an authorization model that can test whether a user is able to view a photo. The sample code uses the [aws-sdk-verifiedpermissions](https://docs.rs/aws-sdk-verifiedpermissions/latest/aws_sdk_verifiedpermissions/) crate from the [AWS SDK for Rust](https://github.com/awslabs/aws-sdk-rust), which offers a robust set of tools for interacting with AWS services. @@ -11 +11 @@ Before diving into the code, ensure you have the [AWS CLI](https://aws.amazon.co -With your environment prepared, let's explore how to implement Verified Permissions in Rust, enhancing the security and flexibility of your AWS-powered applications. +## Prerequisites @@ -13 +13 @@ With your environment prepared, let's explore how to implement Verified Permissi -This code sample does the following: +Before starting, ensure that you have the [AWS CLI](https://aws.amazon.com/cli/) configured on your system and that you're familiar with Rust. @@ -15 +15 @@ This code sample does the following: - * Sets up the SDK client to communicate with AWS. + * For instructions on installing the AWS CLI, see [AWS CLI installation guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). @@ -17 +17 @@ This code sample does the following: - * Creates a [policy stores](./policy-stores.html). + * For instructions on configuring the AWS CLI, see [Configuring settings for the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html) and [Configuration and credential file settings in the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html). @@ -19 +19 @@ This code sample does the following: - * Defines the structure of the policy store by adding a [schema](./schema.html). + * For more information on Rust, see [rust-lang.org](https://www.rust-lang.org/) and the [AWS SDK for Rust Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html). @@ -21 +20,0 @@ This code sample does the following: - * Adds a [policy](./policies.html) to check authorization requests. @@ -23 +21,0 @@ This code sample does the following: - * Sends a test [authorization request](./authorization.html) to verify everything is set up correctly. @@ -25,0 +24 @@ This code sample does the following: +With your environment prepared, let's explore how to implement Verified Permissions in Rust. @@ -26,0 +26 @@ This code sample does the following: +## Test the sample code @@ -27,0 +28,20 @@ This code sample does the following: +The sample code does the following: + + * Sets up the SDK client to communicate with AWS + + * Creates a [policy store](./policy-stores.html) + + * Defines the structure of the policy store by adding a [schema](./schema.html) + + * Adds a [policy](./policies.html) to check authorization requests + + * Sends a test [authorization request](./authorization.html) to verify everything is set up correctly + + + + +###### To test the sample code + + 1. Create a Rust project. + + 2. Replace any existing code in `main.rs` with the following code: @@ -169,0 +190,21 @@ This code sample does the following: + 3. Run the code by entering `cargo run` in the terminal. + + + + +If the code runs correctly, the terminal will show `Decision: Allow` followed by the policy ID of the determining policy. This means you've successfully created a policy store and tested it using the AWS SDK for Rust. + +## Clean up resources + +After you have finished exploring your policy store, delete it. + +###### To delete a policy store + +You can delete a policy store by using the `delete-policy-store` operation, replacing ``PSEXAMPLEabcdefg111111`` with the policy store ID you want to delete. + + + $ aws verifiedpermissions delete-policy-store \ + --policy-store-id PSEXAMPLEabcdefg111111 + +If successful, this command produces no output. +