This commit is contained in:
kosukesuenaga 2025-11-17 14:21:29 +09:00
commit 922fa0e77a
62 changed files with 2586 additions and 0 deletions

17
api-gateway/create_api_dev.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
# プロジェクトIDを設定
PROJECT_ID="datacom-poc"
# 使用するAPI名
API_NAME="sales-tool-api"
# プロジェクトを設定
gcloud auth application-default set-quota-project dmiru-dev
gcloud config set project $PROJECT_ID
# API Gatewayを作成
gcloud api-gateway apis create sales-tool-api \
echo "API Gateway '${API_NAME}' が作成され、有効化されました。"

31
api-gateway/deploy_dev.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
# 環境変数
API_NAME="sales-tool-api"
API_CONFIG_NAME="sales-tool-gw-dev-conf-20250619"
GATEWAY_NAME="sales-tool-gw-dev"
OPENAPI_SPEC="openapi_dev.yaml"
PROJECT_ID="datacom-poc"
SERVICE_ACCOUNT="api-gateway-mpos@datacom-poc.iam.gserviceaccount.com"
LOCATION="asia-northeast1"
gcloud auth application-default set-quota-project $PROJECT_ID
gcloud config set project $PROJECT_ID
# API GatewayのAPI Configを作成
echo "Creating API Config..."
gcloud api-gateway api-configs create $API_CONFIG_NAME \
--api=$API_NAME \
--openapi-spec=$OPENAPI_SPEC \
--project=$PROJECT_ID \
--backend-auth-service-account=$SERVICE_ACCOUNT
# API GatewayのGatewayを作成
echo "Creating Gateway..."
gcloud api-gateway gateways create $GATEWAY_NAME \
--api=$API_NAME \
--api-config=$API_CONFIG_NAME \
--location=$LOCATION \
--project=$PROJECT_ID
echo "API Gateway deployment completed successfully."

77
api-gateway/openapi.yaml Executable file
View file

@ -0,0 +1,77 @@
swagger: '2.0'
info:
title: crate-minutes-api
description: 'Meeting Minutes Generator Web-API'
version: '1.0.0'
schemes:
- 'https'
host: 'crate-minutes-gw-a8slsa47.an.gateway.dev'
x-google-endpoints:
- name: 'crate-minutes-gw-a8slsa47.an.gateway.dev'
allowCors: True
paths:
/create-minutes:
post:
description: '商談レポート作成'
operationId: 'create-minutes'
x-google-backend:
address: https://asia-northeast1-rational-timing-443808-u0.cloudfunctions.net/create-minutes
path_translation: CONSTANT_ADDRESS
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: JSON payload
required: false
schema:
type: object
additionalProperties: true
responses:
200:
description: 'OK'
schema:
type: object
additionalProperties: true
401:
description: 'Auth Error'
schema:
type: object
properties:
error:
type: string
500:
description: 'Error'
schema:
type: object
properties:
error:
type: string
security:
- APIKeyHeader: []
options:
summary: 'CORS support'
operationId: 'create-minutes-options'
x-google-backend:
address: https://asia-northeast1-rational-timing-443808-u0.cloudfunctions.net/create-minutes
path_translation: CONSTANT_ADDRESS
responses:
204:
description: 'CORS preflight'
headers:
Access-Control-Allow-Origin:
type: string
default: '*'
Access-Control-Allow-Methods:
type: string
default: 'GET, POST, OPTIONS'
Access-Control-Allow-Headers:
type: string
default: 'Content-Type, x-api-key'
securityDefinitions:
APIKeyHeader:
type: apiKey
name: x-api-key
in: header

73
api-gateway/openapi_dev.yaml Executable file
View file

@ -0,0 +1,73 @@
swagger: '2.0'
info:
title: crate-minutes-api
description: 'Meeting Minutes Generator Web-API'
version: '1.0.0'
schemes:
- 'https'
paths:
/trigger-minutes-workflow-from-miitel:
post:
description: 'ワークフロー呼び出し処理'
operationId: 'trigger-minutes-workflow-from-miitel'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/mrt-trigger-minutes-workflow-from-miitel
path_translation: CONSTANT_ADDRESS
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: JSON payload
required: false
schema:
type: object
additionalProperties: true
responses:
200:
description: 'OK'
schema:
type: object
additionalProperties: true
401:
description: 'Auth Error'
schema:
type: object
properties:
error:
type: string
500:
description: 'Error'
schema:
type: object
properties:
error:
type: string
security:
- APIKeyHeader: []
options:
summary: 'CORS support'
operationId: 'trigger-minutes-workflow-from-miitel-options'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/mrttrigger-minutes-workflow-from-miitel
path_translation: CONSTANT_ADDRESS
responses:
204:
description: 'CORS preflight'
headers:
Access-Control-Allow-Origin:
type: string
default: '*'
Access-Control-Allow-Methods:
type: string
default: 'GET, POST, OPTIONS'
Access-Control-Allow-Headers:
type: string
default: 'Content-Type, x-api-key'
securityDefinitions:
APIKeyHeader:
type: apiKey
name: x-api-key
in: header