Skip to content

Commit

Permalink
Add quota_region_override for quotas that report from us-east-1 onl…
Browse files Browse the repository at this point in the history
…y (like s3 bucket count) (#48)
  • Loading branch information
taraspos authored Nov 21, 2024
1 parent fca725d commit ed453b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions aws_quota/check/quota_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class QuotaCheck:
service_code: str = None
quota_code: str = None
quota_limit_override: int = None
quota_region_override: str = None
warning_threshold: float = None
error_threshold: float = None
# retries are needed to handle rate limiting
Expand All @@ -45,12 +46,18 @@ def __init__(self, boto_session: boto3.Session) -> None:
super().__init__()

self.boto_session = boto_session
self.sq_client = boto_session.client('service-quotas', config=Config(
client_config = Config(
retries = {
'max_attempts': self.retry_attempts,
'mode': 'standard'
}
))
)

client_region=None
if self.scope == QuotaScope.ACCOUNT and self.quota_region_override:
client_region = self.quota_region_override

self.sq_client = boto_session.client('service-quotas', config=client_config, region_name=client_region)

def __str__(self) -> str:
return f'{self.key}{self.label_values}'
Expand Down
1 change: 1 addition & 0 deletions aws_quota/check/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class BucketCountCheck(QuotaCheck):
scope = QuotaScope.ACCOUNT
service_code = 's3'
quota_code = 'L-DC2B2D3D'
quota_region_override = 'us-east-1'
description = "The number of Amazon S3 general purpose buckets that you can create in an account"

@property
Expand Down

0 comments on commit ed453b0

Please sign in to comment.