Skip to content

Commit 3a29e7c

Browse files
committed
signature authorisation added for demon request
1 parent ca9fb4d commit 3a29e7c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

metering/models.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ class OrgServiceConfigModel(Base):
1212
org_id = Column('org_id', VARCHAR(225), nullable=False)
1313
service_id = Column('service_id', VARCHAR(225), nullable=False)
1414
free_calls = Column('free_calls', Integer, nullable=False)
15-
effective_start_date = Column(
16-
'effective_start_date', TIMESTAMP(timezone=True))
17-
effective_end_date = Column('effective_end_date', TIMESTAMP(
18-
timezone=True))
19-
created_at = Column('created_at', TIMESTAMP(timezone=True))
15+
effective_start_date = Column('effective_start_date', TIMESTAMP(timezone=True))
16+
effective_end_date = Column('effective_end_date', TIMESTAMP(timezone=True))
17+
created_at = Column('created_at', TIMESTAMP(timezone=True), server_default=func.current_timestamp())
2018

2119

2220
class UserOrgGroupModel(Base):

metering/serverless.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ functions:
8585
- http:
8686
path: /usage
8787
method: post
88+
authorizer:
89+
type: request
90+
arn: ${file(./config.${self:provider.stage}.json):SIGN_AUTHORIZER}
91+
identitySource: ${file(./config.${self:provider.stage}.json):SIGN_HEADERS}
8892
cors:
8993
origin: ${self:custom.origin.${self:provider.stage}}
9094
headers:

metering/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22

33

4-
def make_response(status_code, body, header=None, ):
4+
def make_response(status_code, body, header=None):
55
return {
66
"statusCode": status_code,
77
"headers": header,

0 commit comments

Comments
 (0)