Skip to content

Instantly share code, notes, and snippets.

@kesor
Created November 15, 2016 15:28
Show Gist options
  • Save kesor/d6bfedb9b7f791ef6d59e04bb98c7b0b to your computer and use it in GitHub Desktop.
Save kesor/d6bfedb9b7f791ef6d59e04bb98c7b0b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import yaml
import json
with open(sys.argv[1], 'r') as fd_r:
with open(sys.argv[2], 'w') as fd_w:
json.dump(yaml.load(fd_r), fd_w)
paths:
/: &path_with_cors
options:
summary: CORS Response
responses:
200:
description: Stub CORS response
headers: &cors_headers
Access-Control-Allow-Origin: { type: string }
Access-Control-Allow-Methods: { type: string }
Access-Control-Allow-Headers: { type: string }
schema:
$ref: "#/definitions/Empty"
x-amazon-apigateway-integration:
passthroughBehavior: "never"
type: "mock"
responses:
default:
statusCode: 200
responseParameters: &cors_response_params
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,X-Api-Key,X-Amz-Security-Token,Authorization,identityId,requestId'"
method.response.header.Access-Control-Allow-Origin: "'*'"
requestTemplates:
application/json: '{"statusCode": 200}'
/v1/audit/aws:
<<: *path_with_cors
get:
summary: Get the audit log.
security:
- kopter.io: []
parameters:
- $ref: '#/parameters/authorization'
- $ref: '#/parameters/identityId'
- $ref: '#/parameters/requestId'
responses:
200:
description: An array of audit log events
headers:
<<: *cors_headers
schema:
$ref: '#/definitions/AuditLogEvents'
520:
description: Error response
schema:
$ref: '#/definitions/Error'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment