gcp-cloud-functions

📁 bagelhole/devops-security-agent-skills 📅 9 days ago
1
总安装量
1
周安装量
#47932
全站排名
安装命令
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill gcp-cloud-functions

Agent 安装分布

opencode 1
codex 1
claude-code 1

Skill 文档

GCP Cloud Functions

Build serverless applications with Cloud Functions.

Deploy Function

# Deploy HTTP function
gcloud functions deploy hello \
  --runtime=python311 \
  --trigger-http \
  --allow-unauthenticated \
  --entry-point=hello_http

# Deploy Pub/Sub triggered function
gcloud functions deploy process-message \
  --runtime=python311 \
  --trigger-topic=my-topic \
  --entry-point=process

Function Code

# main.py
def hello_http(request):
    return 'Hello, World!'

def process(event, context):
    import base64
    data = base64.b64decode(event['data']).decode('utf-8')
    print(f"Received: {data}")

Best Practices

  • Use 2nd gen functions for better performance
  • Implement proper error handling
  • Use environment variables for configuration
  • Monitor with Cloud Logging