-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
236 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,79 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "Stmt1722444480676", | ||
"Action": [ | ||
"cloudformation:ListStacks" | ||
"cloudformation:GetResource", | ||
"cloudformation:GetResourceRequestStatus", | ||
"cloudformation:ListResourceRequests", | ||
"cloudformation:ListResources", | ||
"cloudformation:DescribeStacks", | ||
"cloudformation:ListChangeSets", | ||
"cloudformation:ListExports", | ||
"cloudformation:ListGeneratedTemplates", | ||
"cloudformation:ListImports", | ||
"cloudformation:ListResourceScanRelatedResources", | ||
"cloudformation:ListResourceScanResources", | ||
"cloudformation:ListResourceScans", | ||
"cloudformation:ListStackInstanceResourceDrifts", | ||
"cloudformation:ListStackInstances", | ||
"cloudformation:ListStackResources", | ||
"cloudformation:ListStacks", | ||
"cloudformation:ListStackSetAutoDeploymentTargets", | ||
"cloudformation:ListStackSetOperationResults", | ||
"cloudformation:ListStackSetOperations", | ||
"cloudformation:ListStackSets", | ||
"cloudformation:ListTypeRegistrations", | ||
"cloudformation:ListTypes", | ||
"cloudformation:ListTypeVersions", | ||
"cloudformation:DescribeAccountLimits", | ||
"cloudformation:DescribeStackDriftDetectionStatus", | ||
"cloudformation:DescribeStackEvents", | ||
"cloudformation:DescribeStackInstance", | ||
"cloudformation:DescribeStackResource", | ||
"cloudformation:DescribeStackResourceDrifts", | ||
"cloudformation:DescribeStackResources", | ||
"cloudformation:DescribeStackSet", | ||
"cloudformation:DescribeStackSetOperation", | ||
"cloudformation:DetectStackDrift", | ||
"cloudformation:DetectStackResourceDrift", | ||
"cloudformation:DetectStackSetDrift", | ||
"cloudformation:GetStackPolicy" | ||
], | ||
"Effect": "Allow", | ||
"Resource": "*" | ||
"Resource": "*", | ||
"Sid": "TemboMetricsCFNAccess" | ||
}, | ||
{ | ||
"Sid": "Stmt1722444523636", | ||
"Action": [ | ||
"servicequotas:GetAssociationForServiceQuotaTemplate", | ||
"servicequotas:GetAWSDefaultServiceQuota", | ||
"servicequotas:GetRequestedServiceQuotaChange", | ||
"servicequotas:GetServiceQuota", | ||
"servicequotas:GetServiceQuotaIncreaseRequestFromTemplate", | ||
"servicequotas:ListAWSDefaultServiceQuotas", | ||
"servicequotas:ListRequestedServiceQuotaChangeHistory", | ||
"servicequotas:ListRequestedServiceQuotaChangeHistoryByQuota", | ||
"servicequotas:ListServiceQuotaIncreaseRequestsInTemplate", | ||
"servicequotas:ListServiceQuotas", | ||
"servicequotas:ListServices" | ||
"servicequotas:ListServices", | ||
"servicequotas:ListTagsForResource" | ||
], | ||
"Effect": "Allow", | ||
"Resource": "*", | ||
"Sid": "TemboMetericsServiceQuotasAccess" | ||
}, | ||
{ | ||
"Sid": "TemboMetricsIAMAccess", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:ListRoles", | ||
"iam:ListRoleTags", | ||
"iam:ListRolePolicies", | ||
"iam:GetRole", | ||
"iam:GetRolePolicy" | ||
], | ||
"Resource": "*" | ||
} | ||
] | ||
], | ||
"Version": "2012-10-17" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use aws_sdk_iam::Client; | ||
|
||
/// get_iam_role_count looks up all Roles in the account and returns the count as a i64 | ||
pub async fn get_iam_role_count(client: &Client) -> Result<i64, Box<dyn std::error::Error>> { | ||
let mut role_count = 0; | ||
let mut marker: Option<String> = None; | ||
|
||
loop { | ||
let mut request = client.list_roles(); | ||
if let Some(token) = marker { | ||
request = request.marker(token); | ||
} | ||
|
||
let response = request.send().await?; | ||
|
||
let roles = response.roles(); | ||
role_count += roles.len() as i64; | ||
|
||
match response.marker() { | ||
Some(token) => marker = Some(token.to_string()), | ||
None => break, | ||
} | ||
} | ||
|
||
Ok(role_count) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod cloudformation; | ||
pub mod iam; | ||
pub mod servicequotas; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.