[PR #70] [MERGED] Use SDK info to find operation from method name #216

Closed
opened 2026-03-15 11:53:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/awslabs/iam-policy-autopilot/pull/70
Author: @mschlaipfer
Created: 12/11/2025
Status: Merged
Merged: 12/11/2025
Merged by: @mschlaipfer

Base: mainHead: fixes-66


📝 Commits (1)

  • ee1c152 fix: use SDK info to find operation from method name

📊 Changes

9 files changed (+132 additions, -62 deletions)

View changed files

📝 iam-policy-autopilot-policy-generation/src/api/generate_policies.rs (+11 -1)
📝 iam-policy-autopilot-policy-generation/src/enrichment/engine.rs (+10 -4)
📝 iam-policy-autopilot-policy-generation/src/enrichment/resource_matcher.rs (+56 -27)
📝 iam-policy-autopilot-policy-generation/src/enrichment/service_reference.rs (+28 -21)
📝 iam-policy-autopilot-policy-generation/src/extraction/mod.rs (+1 -0)
📝 iam-policy-autopilot-policy-generation/src/lib.rs (+17 -0)
📝 iam-policy-autopilot-policy-generation/tests/go_extraction_integration_test.rs (+2 -2)
📝 iam-policy-autopilot-policy-generation/tests/go_sdk_features_test.rs (+3 -3)
📝 iam-policy-autopilot-policy-generation/tests/public_api_integration_test.rs (+4 -4)

📄 Description

Issue #, if available: https://github.com/awslabs/iam-policy-autopilot/issues/66

Description of changes:

We now look up method names in the service reference when we detect the SDK type is boto3 (i.e., when the input files are Python). This fixes an issue where we wrongly converted method names to operation names via convert_case's to_case(Case::PascalCase) before, which fails for operations like ModifyDBCluster, where the snake_case method name is modify_db_cluster and the conversion results in ModifyDbCluster.
For other SDKs we use the extracted method names as-is as the operation name. The conversion to PascalCase, also changed ModifyDBCluster to ModifyDbCluster, leading to the same error for Go, Typescript and Javascript.

I introduced SdkType::Boto3 to follow the data the service reference provides, such as

{
      "Name" : "rds",
      "Method" : "modify_db_cluster",
      "Package" : "Boto3"
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/awslabs/iam-policy-autopilot/pull/70 **Author:** [@mschlaipfer](https://github.com/mschlaipfer) **Created:** 12/11/2025 **Status:** ✅ Merged **Merged:** 12/11/2025 **Merged by:** [@mschlaipfer](https://github.com/mschlaipfer) **Base:** `main` ← **Head:** `fixes-66` --- ### 📝 Commits (1) - [`ee1c152`](https://github.com/awslabs/iam-policy-autopilot/commit/ee1c152384cfecf75ddb22ba922ada9d3c6e9465) fix: use SDK info to find operation from method name ### 📊 Changes **9 files changed** (+132 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `iam-policy-autopilot-policy-generation/src/api/generate_policies.rs` (+11 -1) 📝 `iam-policy-autopilot-policy-generation/src/enrichment/engine.rs` (+10 -4) 📝 `iam-policy-autopilot-policy-generation/src/enrichment/resource_matcher.rs` (+56 -27) 📝 `iam-policy-autopilot-policy-generation/src/enrichment/service_reference.rs` (+28 -21) 📝 `iam-policy-autopilot-policy-generation/src/extraction/mod.rs` (+1 -0) 📝 `iam-policy-autopilot-policy-generation/src/lib.rs` (+17 -0) 📝 `iam-policy-autopilot-policy-generation/tests/go_extraction_integration_test.rs` (+2 -2) 📝 `iam-policy-autopilot-policy-generation/tests/go_sdk_features_test.rs` (+3 -3) 📝 `iam-policy-autopilot-policy-generation/tests/public_api_integration_test.rs` (+4 -4) </details> ### 📄 Description *Issue #, if available:* https://github.com/awslabs/iam-policy-autopilot/issues/66 *Description of changes:* We now look up method names in the service reference when we detect the SDK type is boto3 (i.e., when the input files are Python). This fixes an issue where we wrongly converted method names to operation names via `convert_case`'s `to_case(Case::PascalCase)` before, which fails for operations like `ModifyDBCluster`, where the snake_case method name is `modify_db_cluster` and the conversion results in `ModifyDbCluster`. For other SDKs we use the extracted method names as-is as the operation name. The conversion to PascalCase, also changed `ModifyDBCluster` to `ModifyDbCluster`, leading to the same error for Go, Typescript and Javascript. I introduced `SdkType::Boto3` to follow the data the service reference provides, such as ``` { "Name" : "rds", "Method" : "modify_db_cluster", "Package" : "Boto3" } ``` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-15 11:53:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/iam-policy-autopilot#216
No description provided.