-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Usage Quota data on get List Cognito User
- Loading branch information
Erik Firmansyah
authored and
Erik Firmansyah
committed
Jan 10, 2025
1 parent
eb7afb6
commit f4aaca8
Showing
10 changed files
with
58 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
1 change: 1 addition & 0 deletions
1
shared_resources/python-modules/python/shared/dynamodb/__init__.py
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 +1,2 @@ | ||
from .ontologies import Anscestors, Descendants, Ontology | ||
from .quota import Quota, UsageMap |
33 changes: 33 additions & 0 deletions
33
shared_resources/python-modules/python/shared/dynamodb/quota.py
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,33 @@ | ||
import os | ||
|
||
import boto3 | ||
from pynamodb.models import Model | ||
from pynamodb.attributes import NumberAttribute, UnicodeAttribute, MapAttribute | ||
from shared.utils import ENV_DYNAMO | ||
|
||
|
||
SESSION = boto3.session.Session() | ||
REGION = SESSION.region_name | ||
|
||
class UsageMap(MapAttribute): | ||
quotaSize = NumberAttribute(attr_name='quotaSize',default=0) | ||
quotaQueryCount = NumberAttribute(attr_name='quotaQueryCount',default=0) | ||
usageSize = NumberAttribute(attr_name='usageSize',default=0) | ||
usageCount = NumberAttribute(attr_name='usageCount',default=0) | ||
|
||
|
||
class Quota(Model): | ||
class Meta: | ||
table_name = ENV_DYNAMO.DYNAMO_QUOTA_USER_TABLE | ||
region = REGION | ||
|
||
uid = UnicodeAttribute(hash_key=True) | ||
CostEstimation = NumberAttribute() | ||
Usage = UsageMap() | ||
|
||
def to_dict(self): | ||
return { | ||
"uid": self.uid, | ||
"CostEstimation": self.CostEstimation, | ||
"Usage": self.Usage.as_dict(), | ||
} |
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