Skip to content

Commit

Permalink
Deal with duplicates better (closes #3, but opens #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidansteele committed Oct 21, 2019
1 parent 3269f14 commit 712760f
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 79 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AWS IAM by the numbers

* Unique services: 190
* Unique actions: 6850
* Unique actions: 6819

The following table summarises the AWS APIs.

Expand All @@ -18,7 +18,7 @@ The following table summarises the AWS APIs.
| [`glue`](services/glue.yml) | 123 | 0 | 1 |
| [`ssm`](services/ssm.yml) | 116 | 4 | 7 |
| [`rds`](services/rds.yml) | 111 | 6 | 1 |
| [`ses`](services/ses.yml) | 103 | 2 | 7 |
| [`ses`](services/ses.yml) | 103 | 2 | 0 |
| [`lightsail`](services/lightsail.yml) | 101 | 4 | 0 |
| [`cognito-idp`](services/cognito-idp.yml) | 100 | 0 | 0 |
| [`greengrass`](services/greengrass.yml) | 90 | 0 | 0 |
Expand All @@ -38,6 +38,7 @@ The following table summarises the AWS APIs.
| [`config`](services/config.yml) | 56 | 8 | 2 |
| [`route53`](services/route53.yml) | 56 | 0 | 0 |
| [`codecommit`](services/codecommit.yml) | 54 | 0 | 11 |
| [`elasticloadbalancing`](services/elasticloadbalancing.yml) | 54 | 0 | 1 |
| [`autoscaling`](services/autoscaling.yml) | 54 | 0 | 0 |
| [`directconnect`](services/directconnect.yml) | 53 | 0 | 0 |
| [`ds`](services/ds.yml) | 49 | 1 | 5 |
Expand Down Expand Up @@ -68,7 +69,6 @@ The following table summarises the AWS APIs.
| [`lex`](services/lex.yml) | 35 | 6 | 0 |
| [`iotthingsgraph`](services/iotthingsgraph.yml) | 35 | 0 | 0 |
| [`swf`](services/swf.yml) | 34 | 3 | 12 |
| [`elasticloadbalancing`](services/elasticloadbalancing.yml) | 34 | 0 | 29 |
| [`rekognition`](services/rekognition.yml) | 34 | 0 | 0 |
| [`iotanalytics`](services/iotanalytics.yml) | 33 | 1 | 0 |
| [`workmail`](services/workmail.yml) | 33 | 0 | 53 |
Expand All @@ -94,7 +94,7 @@ The following table summarises the AWS APIs.
| [`mediaconvert`](services/mediaconvert.yml) | 25 | 0 | 0 |
| [`groundstation`](services/groundstation.yml) | 25 | 0 | 0 |
| [`discovery`](services/discovery.yml) | 25 | 0 | 0 |
| [`kinesisanalytics`](services/kinesisanalytics.yml) | 24 | 0 | 16 |
| [`kinesisanalytics`](services/kinesisanalytics.yml) | 24 | 0 | 0 |
| [`route53domains`](services/route53domains.yml) | 23 | 1 | 0 |
| [`cloudwatch`](services/cloudwatch.yml) | 23 | 0 | 0 |
| [`states`](services/states.yml) | 22 | 0 | 0 |
Expand Down Expand Up @@ -209,12 +209,12 @@ Most common action prefixes:
| Prefix | Count |
| ------ | ----- |
| `Get` | 912 |
| `List` | 900 |
| `Describe` | 875 |
| `Delete` | 807 |
| `Create` | 733 |
| `Update` | 541 |
| `List` | 897 |
| `Describe` | 871 |
| `Delete` | 801 |
| `Create` | 729 |
| `Update` | 539 |
| `Put` | 186 |
| `Start` | 113 |
| `Modify` | 94 |
| `Untag` | 79 |
| `Start` | 112 |
| `Modify` | 93 |
| `Untag` | 78 |
11 changes: 6 additions & 5 deletions generator/aws_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"regexp"
)

func apiDocs() (map[string]*apiDoc, error) {
output := map[string]*apiDoc{}
func apiDocs() ([]*apiDoc, error) {
output := []*apiDoc{}

resp, err := http.Get("https://github.com/aws/aws-sdk-go/archive/master.zip")
if err != nil {
Expand Down Expand Up @@ -59,17 +59,18 @@ func apiDocs() (map[string]*apiDoc, error) {
if guess == "" {
guess = doc.Metadata.EndpointPrefix
}
fmt.Println(guess)
//fmt.Println(guess)

output[doc.Metadata.ServiceFullName] = &doc
output = append(output, &doc)
}

return output, nil
}

func apis(apiDocs map[string]*apiDoc, acts *actions) error {
func apis(apiDocs []*apiDoc, acts *actions) error {
for _, api := range apiDocs {
iamPrefix := api.iamPrefix()
fmt.Println(iamPrefix)
for name, _ := range api.Operations {
act := acts.get(iamPrefix, name)
if act == nil {
Expand Down
12 changes: 7 additions & 5 deletions generator/policiesjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ func policiesDocToActions(doc *policiesDoc) actions {

for _, service := range doc.ServiceMap {
for _, name := range service.Actions {
a = append(a, &action{
IamPrefix: service.StringPrefix,
Name: name,
HasAction: true,
})
if a.get(service.StringPrefix, name) == nil {
a = append(a, &action{
IamPrefix: service.StringPrefix,
Name: name,
HasAction: true,
})
}
}
}

Expand Down
48 changes: 20 additions & 28 deletions services/elasticloadbalancing.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,58 @@
Actions:
- Name: elasticloadbalancing:AddListenerCertificates
- Name: elasticloadbalancing:AddTags
- Name: elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
- Name: elasticloadbalancing:AttachLoadBalancerToSubnets
- Name: elasticloadbalancing:ConfigureHealthCheck
- Name: elasticloadbalancing:CreateAppCookieStickinessPolicy
- Name: elasticloadbalancing:CreateLBCookieStickinessPolicy
- Name: elasticloadbalancing:CreateListener
- Name: elasticloadbalancing:CreateLoadBalancer
- Name: elasticloadbalancing:CreateLoadBalancerListeners
- Name: elasticloadbalancing:CreateLoadBalancerPolicy
- Name: elasticloadbalancing:CreateRule
- Name: elasticloadbalancing:CreateTargetGroup
- Name: elasticloadbalancing:DeleteListener
- Name: elasticloadbalancing:DeleteLoadBalancer
- Name: elasticloadbalancing:DeleteLoadBalancerListeners
- Name: elasticloadbalancing:DeleteLoadBalancerPolicy
- Name: elasticloadbalancing:DeleteRule
- Name: elasticloadbalancing:DeleteTargetGroup
- Name: elasticloadbalancing:DeregisterInstancesFromLoadBalancer
- Name: elasticloadbalancing:DeregisterTargets
- Name: elasticloadbalancing:DescribeAccountLimits
- Name: elasticloadbalancing:DescribeInstanceHealth
- Name: elasticloadbalancing:DescribeListenerCertificates
- Name: elasticloadbalancing:DescribeListeners
- Name: elasticloadbalancing:DescribeLoadBalancerAttributes
- Name: elasticloadbalancing:DescribeLoadBalancerPolicies
- Name: elasticloadbalancing:DescribeLoadBalancerPolicyTypes
- Name: elasticloadbalancing:DescribeLoadBalancers
- Name: elasticloadbalancing:DescribeRules
- Name: elasticloadbalancing:DescribeSSLPolicies
- Name: elasticloadbalancing:DescribeTags
- Name: elasticloadbalancing:DescribeTargetGroupAttributes
- Name: elasticloadbalancing:DescribeTargetGroups
- Name: elasticloadbalancing:DescribeTargetHealth
- Name: elasticloadbalancing:DetachLoadBalancerFromSubnets
- Name: elasticloadbalancing:DisableAvailabilityZonesForLoadBalancer
- Name: elasticloadbalancing:EnableAvailabilityZonesForLoadBalancer
- Name: elasticloadbalancing:ModifyListener
- Name: elasticloadbalancing:ModifyLoadBalancerAttributes
- Name: elasticloadbalancing:ModifyRule
- Name: elasticloadbalancing:ModifyTargetGroup
- Name: elasticloadbalancing:ModifyTargetGroupAttributes
- Name: elasticloadbalancing:RegisterInstancesWithLoadBalancer
- Name: elasticloadbalancing:RegisterTargets
- Name: elasticloadbalancing:RemoveListenerCertificates
- Name: elasticloadbalancing:RemoveTags
- Name: elasticloadbalancing:SetIpAddressType
- Name: elasticloadbalancing:SetLoadBalancerListenerSSLCertificate
- Name: elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer
- Name: elasticloadbalancing:SetLoadBalancerPoliciesOfListener
- Name: elasticloadbalancing:SetRulePriorities
- Name: elasticloadbalancing:SetSecurityGroups
- Name: elasticloadbalancing:SetSubnets

# actions with no corresponding API
- Name: elasticloadbalancing:AddTags
- Name: elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
- Name: elasticloadbalancing:AttachLoadBalancerToSubnets
- Name: elasticloadbalancing:ConfigureHealthCheck
- Name: elasticloadbalancing:CreateAppCookieStickinessPolicy
- Name: elasticloadbalancing:CreateLBCookieStickinessPolicy
- Name: elasticloadbalancing:CreateLoadBalancer
- Name: elasticloadbalancing:CreateLoadBalancerListeners
- Name: elasticloadbalancing:CreateLoadBalancerPolicy
- Name: elasticloadbalancing:DeleteLoadBalancer
- Name: elasticloadbalancing:DeleteLoadBalancerListeners
- Name: elasticloadbalancing:DeleteLoadBalancerPolicy
- Name: elasticloadbalancing:DeregisterInstancesFromLoadBalancer
- Name: elasticloadbalancing:DescribeInstanceHealth
- Name: elasticloadbalancing:DescribeLoadBalancerAttributes
- Name: elasticloadbalancing:DescribeLoadBalancerPolicies
- Name: elasticloadbalancing:DescribeLoadBalancerPolicyTypes
- Name: elasticloadbalancing:DescribeLoadBalancers
- Name: elasticloadbalancing:DescribeTags
- Name: elasticloadbalancing:DetachLoadBalancerFromSubnets
- Name: elasticloadbalancing:DisableAvailabilityZonesForLoadBalancer
- Name: elasticloadbalancing:EnableAvailabilityZonesForLoadBalancer
- Name: elasticloadbalancing:ModifyLoadBalancerAttributes
- Name: elasticloadbalancing:RegisterInstancesWithLoadBalancer
- Name: elasticloadbalancing:RemoveTags
- Name: elasticloadbalancing:SetLoadBalancerListenerSSLCertificate
- Name: elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer
- Name: elasticloadbalancing:SetLoadBalancerPoliciesOfListener
- Name: elasticloadbalancing:SetWebAcl
1 change: 0 additions & 1 deletion services/iq-permission.yml

This file was deleted.

1 change: 0 additions & 1 deletion services/iq.yml

This file was deleted.

18 changes: 0 additions & 18 deletions services/kinesisanalytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,3 @@ Actions:
- Name: kinesisanalytics:TagResource
- Name: kinesisanalytics:UntagResource
- Name: kinesisanalytics:UpdateApplication

# actions with no corresponding API
- Name: kinesisanalytics:AddApplicationInput
- Name: kinesisanalytics:AddApplicationOutput
- Name: kinesisanalytics:AddApplicationReferenceDataSource
- Name: kinesisanalytics:CreateApplication
- Name: kinesisanalytics:DeleteApplication
- Name: kinesisanalytics:DeleteApplicationOutput
- Name: kinesisanalytics:DeleteApplicationReferenceDataSource
- Name: kinesisanalytics:DescribeApplication
- Name: kinesisanalytics:DiscoverInputSchema
- Name: kinesisanalytics:ListApplications
- Name: kinesisanalytics:ListTagsForResource
- Name: kinesisanalytics:StartApplication
- Name: kinesisanalytics:StopApplication
- Name: kinesisanalytics:TagResource
- Name: kinesisanalytics:UntagResource
- Name: kinesisanalytics:UpdateApplication
9 changes: 0 additions & 9 deletions services/ses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@ Actions:
- Name: ses:VerifyEmailAddress
- Name: ses:VerifyEmailIdentity

# actions with no corresponding API
- Name: ses:CreateConfigurationSet
- Name: ses:CreateConfigurationSetEventDestination
- Name: ses:DeleteConfigurationSet
- Name: ses:DeleteConfigurationSetEventDestination
- Name: ses:ListConfigurationSets
- Name: ses:SendEmail
- Name: ses:UpdateConfigurationSetEventDestination

# APIs without an IAM action
- Name: ses:GetDomainDeliverabilityCampaign
- Name: ses:ListDomainDeliverabilityCampaigns

0 comments on commit 712760f

Please sign in to comment.