Skip to content

Instantly share code, notes, and snippets.

View koorukuroo's full-sized avatar
🎯
Focusing

Kyunghoon Kim koorukuroo

🎯
Focusing
View GitHub Profile
import json, boto3
bedrock_agent = boto3.client(
'bedrock-agent-runtime',
region_name='us-east-1'
)
def lambda_handler(event, context):
question = json.loads(event['body'])['question']
import json, uuid, datetime
# In-memory store (DynamoDB로 교체 예정)
store = {}
def lambda_handler(event, context):
method = event['httpMethod']
path_params = event.get('pathParameters') or {}
query_params = event.get('queryStringParameters') or {}
import json
import boto3
import uuid
from decimal import Decimal
# DynamoDB 설정
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('ItemsTable') # 테이블 이름 수정
# JSON 직렬화용 (Decimal → float)
import json
def lambda_handler(event, context):
return {
'statusCode': 200,
'headers': {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
},
'body': json.dumps({
import json
import boto3
from PIL import Image
import io
import urllib.parse
s3 = boto3.client('s3')
# 원하는 사이즈 설정
MAX_WIDTH = 300
@app.put("/api/v1/requests/{request_id}/status",
response_model=RequestResponse,
tags=["점검 요청"])
def update_status(request_id: int,
update: StatusUpdate,
db: Session = Depends(get_db)):
req = db.query(InspectionRequest) \
.filter(InspectionRequest.id == request_id) \
.first()
if not req:
@app.get("/api/v1/requests",
response_model=list[RequestResponse])
def list_requests(
status: Optional[str] = Query(None),
priority: Optional[str] = Query(None),
page: int = Query(1, ge=1,
description="페이지 번호 (1부터 시작)"),
limit: int = Query(10, ge=1, le=100,
description="페이지당 항목 수 (최대 100)"),
db: Session = Depends(get_db),
@app.get("/api/v1/requests",
response_model=list[RequestResponse],
tags=["점검 요청"])
def list_requests(
status: Optional[str] = Query(
None,
description="상태 필터 (PENDING, ASSIGNED 등)"
),
priority: Optional[str] = Query(
None,
@app.post("/api/v1/requests",
response_model=RequestResponse,
status_code=201, tags=["점검 요청"])
def create_request(req: RequestCreate,
db: Session = Depends(get_db)):
# 설비 존재 여부 확인
equipment = db.query(Equipment) \
.filter(Equipment.id == req.equipment_id).first()
if not equipment:
raise HTTPException(
apiVersion: apps/v1
kind: Deployment
metadata:
name: fastapi-deployment
namespace: default
spec:
replicas: 3
selector:
matchLabels:
app: fastapi