Skip to content

Commit 8ef734a

Browse files
committed
initial commit for metering service
1 parent f75bbe4 commit 8ef734a

File tree

3 files changed

+156
-0
lines changed

3 files changed

+156
-0
lines changed

metering/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Distribution / packaging
2+
.Python
3+
env/
4+
build/
5+
develop-eggs/
6+
dist/
7+
downloads/
8+
eggs/
9+
.eggs/
10+
lib/
11+
lib64/
12+
parts/
13+
sdist/
14+
var/
15+
*.egg-info/
16+
.installed.cfg
17+
*.egg
18+
19+
# Serverless directories
20+
.serverless

metering/handler.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import json
2+
3+
4+
def hello(event, context):
5+
body = {
6+
"message": "Go Serverless v1.0! Your function executed successfully!",
7+
"input": event
8+
}
9+
10+
response = {
11+
"statusCode": 200,
12+
"body": json.dumps(body)
13+
}
14+
15+
return response
16+
17+
# Use this code if you don't use the http event with the LAMBDA-PROXY
18+
# integration
19+
"""
20+
return {
21+
"message": "Go Serverless v1.0! Your function executed successfully!",
22+
"event": event
23+
}
24+
"""

metering/serverless.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Welcome to Serverless!
2+
#
3+
# This file is the main config file for your service.
4+
# It's very minimal at this point and uses default values.
5+
# You can always add more config options for more control.
6+
# We've included some commented out config examples here.
7+
# Just uncomment any of them to get that config option.
8+
#
9+
# For full config options, check the docs:
10+
# docs.serverless.com
11+
#
12+
# Happy Coding!
13+
14+
service: metering
15+
#app: your-app-name
16+
#tenant: your-tenant-name
17+
18+
# You can pin your service to only deploy with a specific Serverless version
19+
# Check out our docs for more details
20+
# frameworkVersion: "=X.X.X"
21+
22+
provider:
23+
name: aws
24+
runtime: python3.7
25+
26+
# you can overwrite defaults here
27+
# stage: dev
28+
# region: us-east-1
29+
30+
# you can add statements to the Lambda function's IAM Role here
31+
# iamRoleStatements:
32+
# - Effect: "Allow"
33+
# Action:
34+
# - "s3:ListBucket"
35+
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
36+
# - Effect: "Allow"
37+
# Action:
38+
# - "s3:PutObject"
39+
# Resource:
40+
# Fn::Join:
41+
# - ""
42+
# - - "arn:aws:s3:::"
43+
# - "Ref" : "ServerlessDeploymentBucket"
44+
# - "/*"
45+
46+
# you can define service wide environment variables here
47+
# environment:
48+
# variable1: value1
49+
50+
# you can add packaging information here
51+
#package:
52+
# include:
53+
# - include-me.py
54+
# - include-me-dir/**
55+
# exclude:
56+
# - exclude-me.py
57+
# - exclude-me-dir/**
58+
59+
functions:
60+
hello:
61+
handler: handler.hello
62+
# The following are a few example events you can configure
63+
# NOTE: Please make sure to change your handler code to work with those events
64+
# Check the event documentation for details
65+
# events:
66+
# - http:
67+
# path: users/create
68+
# method: get
69+
# - websocket: $connect
70+
# - s3: ${env:BUCKET}
71+
# - schedule: rate(10 minutes)
72+
# - sns: greeter-topic
73+
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
74+
# - alexaSkill: amzn1.ask.skill.xx-xx-xx-xx
75+
# - alexaSmartHome: amzn1.ask.skill.xx-xx-xx-xx
76+
# - iot:
77+
# sql: "SELECT * FROM 'some_topic'"
78+
# - cloudwatchEvent:
79+
# event:
80+
# source:
81+
# - "aws.ec2"
82+
# detail-type:
83+
# - "EC2 Instance State-change Notification"
84+
# detail:
85+
# state:
86+
# - pending
87+
# - cloudwatchLog: '/aws/lambda/hello'
88+
# - cognitoUserPool:
89+
# pool: MyUserPool
90+
# trigger: PreSignUp
91+
# - alb:
92+
# listenerArn: arn:aws:elasticloadbalancing:us-east-1:XXXXXX:listener/app/my-load-balancer/50dc6c495c0c9188/
93+
# priority: 1
94+
# conditions:
95+
# host: example.com
96+
# path: /hello
97+
98+
# Define function environment variables here
99+
# environment:
100+
# variable2: value2
101+
102+
# you can add CloudFormation resource templates here
103+
#resources:
104+
# Resources:
105+
# NewResource:
106+
# Type: AWS::S3::Bucket
107+
# Properties:
108+
# BucketName: my-new-bucket
109+
# Outputs:
110+
# NewOutput:
111+
# Description: "Description for the output"
112+
# Value: "Some output value"

0 commit comments

Comments
 (0)