Skip to content

Commit

Permalink
Add sample of boto3 on oci functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shukawam committed Feb 28, 2024
1 parent 117102e commit 95589ff
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
20 changes: 20 additions & 0 deletions boto3-quickstart/func.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import io
import json
import logging
import boto3

from fdk import response

s3 = boto3.resource("s3")

def handler(ctx, data: io.BytesIO = None):
for b in s3.buckets.all():
print(b.name)
return response.Response(
ctx, response_data=json.dumps(
{"message": "Hello world"}),
headers={"Content-Type": "application/json"}
)

if __name__ == "__main__":
print()
12 changes: 12 additions & 0 deletions boto3-quickstart/func.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
schema_version: 20180708
name: boto3-quickstart
version: 0.0.1
runtime: python
build_image: fnproject/python:3.9-dev
run_image: fnproject/python:3.9
entrypoint: /python/bin/fdk /function/func.py handler
memory: 256
config:
AWS_ACCESS_KEY_ID: ""
AWS_SECRET_ACCESS_KEY: ""
AWS_SESSION_TOKEN: ""
19 changes: 19 additions & 0 deletions boto3-quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
boto3==1.34.50
botocore==1.34.50
contextvars==2.4
Cython==3.0.8
fdk==0.1.68
httptools==0.6.1
immutables==0.20
iniconfig==2.0.0
iso8601==0.1.12
jmespath==1.0.1
packaging==23.2
pbr==6.0.0
pluggy==1.4.0
pytest==8.0.2
pytest-asyncio==0.12.0
python-dateutil==2.8.2
s3transfer==0.10.0
six==1.16.0
urllib3==2.0.7

0 comments on commit 95589ff

Please sign in to comment.