Skip to content

Commit

Permalink
Merge pull request #490 from sebasrp/master
Browse files Browse the repository at this point in the history
issue #489 - Add missing RDS limits (DBInstanceRoles, DBClusterRoles, CustomEndpointsPerDBCluster and ManualClusterSnapshots)
  • Loading branch information
jantman committed Dec 2, 2020
2 parents aae6b84 + 83d00ac commit d5b2c0a
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
40 changes: 40 additions & 0 deletions awslimitchecker/services/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class _RDSService(_AwsService):
'ReadReplicasPerMaster': 'Read replicas per master',
'DBClusters': 'DB Clusters',
'DBClusterParameterGroups': 'DB Cluster Parameter Groups',
'DBInstanceRoles': 'DB Instance Roles',
'DBClusterRoles': 'DB Cluster Roles',
'CustomEndpointsPerDBCluster': 'Custom Endpoints Per DB Cluster',
'ManualClusterSnapshots': 'Manual Cluster Snapshots',
}

def find_usage(self):
Expand Down Expand Up @@ -284,6 +288,42 @@ def get_limits(self):
ta_limit_name='Cluster parameter groups',
quotas_name='DB cluster parameter groups'
)
limits['Manual Cluster Snapshots'] = AwsLimit(
'Manual Cluster Snapshots',
self,
100,
self.warning_threshold,
self.critical_threshold,
limit_type='AWS::RDS::DBCluster',
quotas_name='Manual Cluster Snapshots'
)
limits['Custom Endpoints Per DB Cluster'] = AwsLimit(
'Custom Endpoints Per DB Cluster',
self,
5,
self.warning_threshold,
self.critical_threshold,
limit_type='AWS::RDS::DBCluster',
quotas_name='Custom Endpoints Per DB Cluster'
)
limits['DB Instance Roles'] = AwsLimit(
'DB Instance Roles',
self,
5,
self.warning_threshold,
self.critical_threshold,
limit_type='AWS::RDS::DBInstance',
quotas_name='DB Instance Roles'
)
limits['DB Cluster Roles'] = AwsLimit(
'DB Cluster Roles',
self,
5,
self.warning_threshold,
self.critical_threshold,
limit_type='AWS::RDS::DBCluster',
quotas_name='DB Cluster Roles'
)
self.limits = limits
return limits

Expand Down
20 changes: 20 additions & 0 deletions awslimitchecker/tests/services/result_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,26 @@ class RDS(object):
'AccountQuotaName': 'DBClusterParameterGroups',
'Used': 6
},
{
'Max': 11,
'AccountQuotaName': 'DBInstanceRoles',
'Used': 1
},
{
'Max': 12,
'AccountQuotaName': 'DBClusterRoles',
'Used': 2
},
{
'Max': 13,
'AccountQuotaName': 'CustomEndpointsPerDBCluster',
'Used': 3
},
{
'Max': 101,
'AccountQuotaName': 'ManualClusterSnapshots',
'Used': 5
},
{
'Max': 98,
'AccountQuotaName': 'Foo',
Expand Down
22 changes: 21 additions & 1 deletion awslimitchecker/tests/services/test_rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ def test_get_limits(self):
'Event Subscriptions',
'Read replicas per master',
'DB Clusters',
'DB Cluster Parameter Groups'
'DB Cluster Parameter Groups',
'DB Cluster Roles',
'DB Instance Roles',
'Custom Endpoints Per DB Cluster',
'Manual Cluster Snapshots'
])
for name, limit in res.items():
assert limit.service == cls
Expand Down Expand Up @@ -340,3 +344,19 @@ def test_update_limits_from_api(self):
lim = cls.limits['DB Cluster Parameter Groups']
assert lim.api_limit == 51
assert lim.get_current_usage()[0].get_value() == 6

lim = cls.limits['Manual Cluster Snapshots']
assert lim.api_limit == 101
assert lim.get_current_usage()[0].get_value() == 5

lim = cls.limits['DB Instance Roles']
assert lim.api_limit == 11
assert lim.get_current_usage()[0].get_value() == 1

lim = cls.limits['DB Cluster Roles']
assert lim.api_limit == 12
assert lim.get_current_usage()[0].get_value() == 2

lim = cls.limits['Custom Endpoints Per DB Cluster']
assert lim.api_limit == 13
assert lim.get_current_usage()[0].get_value() == 3

0 comments on commit d5b2c0a

Please sign in to comment.