From 77582bd341a637faabedea6f337fd8a9c4f28478 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 5 Feb 2018 17:53:39 -0800 Subject: [PATCH] updated templates, added CORS support and docs --- docs/providers/spotinst/guide/cors.md | 42 +++++++++++++++++++ .../templates/spotinst-java8/serverless.yml | 7 +++- .../templates/spotinst-nodejs/serverless.yml | 5 +++ .../templates/spotinst-python/serverless.yml | 7 +++- .../templates/spotinst-ruby/serverless.yml | 5 +++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 docs/providers/spotinst/guide/cors.md diff --git a/docs/providers/spotinst/guide/cors.md b/docs/providers/spotinst/guide/cors.md new file mode 100644 index 000000000..08cb82996 --- /dev/null +++ b/docs/providers/spotinst/guide/cors.md @@ -0,0 +1,42 @@ + + + +### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/providers/spotinst/guide/cors) + + +# Spotinst Functions - CORS + +You can enable CORS for cross-domain HTTP requests with Spotinst Functions. Add the required fields to you serverless.yml file. + +Example CORS object: +```yaml + cors: + - enabled: true + origin: "http://foo.example" + headers: "Content-Type,X-PINGOTHER" + methods: "PUT,POST" +``` + +Parameters: + - enabled: Boolean + - Specify if CORS is enabled for the function. + - default: false + - origin: String + - Specifies a domain/origin that may access the resource. A wildcard '*' may be used to allow any origin to access the resource. + - default: '*' + - methods: String + - Comma-separated list of HTTP methods that are allowed to access the resource. This is used in response to a preflight request. + - default: 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' + - headers: String + - Comma-separated list of allowed headers. + - default: 'Content-Type,Authorization' + + + + diff --git a/lib/plugins/create/templates/spotinst-java8/serverless.yml b/lib/plugins/create/templates/spotinst-java8/serverless.yml index c5f521234..066b918da 100644 --- a/lib/plugins/create/templates/spotinst-java8/serverless.yml +++ b/lib/plugins/create/templates/spotinst-java8/serverless.yml @@ -27,8 +27,13 @@ functions: timeout: 30 access: private # activeVersions: -# - "version": "$LATEST" +# - "version": "$LATEST" # "percentage": 100.0 +# cors: +# enabled: # false by default +# origin: # '*' by default +# headers: # 'Content-Type,Authorization' by default +# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default # cron: # Setup scheduled trigger with cron expression # active: true # value: '* * * * *' diff --git a/lib/plugins/create/templates/spotinst-nodejs/serverless.yml b/lib/plugins/create/templates/spotinst-nodejs/serverless.yml index 68de54513..1adeac7ef 100644 --- a/lib/plugins/create/templates/spotinst-nodejs/serverless.yml +++ b/lib/plugins/create/templates/spotinst-nodejs/serverless.yml @@ -29,6 +29,11 @@ functions: # activeVersions: # - "version": "$LATEST" # "percentage": 100.0 +# cors: +# enabled: # false by default +# origin: # '*' by default +# headers: # 'Content-Type,Authorization' by default +# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default # cron: # Setup scheduled trigger with cron expression # active: true # value: '* * * * *' diff --git a/lib/plugins/create/templates/spotinst-python/serverless.yml b/lib/plugins/create/templates/spotinst-python/serverless.yml index 3acb202ac..1722af08f 100644 --- a/lib/plugins/create/templates/spotinst-python/serverless.yml +++ b/lib/plugins/create/templates/spotinst-python/serverless.yml @@ -28,7 +28,12 @@ functions: access: private # activeVersions: # - "version": "$LATEST" -# "percentage": 100.0 +# "percentage": 100.0 +# cors: +# enabled: # false by default +# origin: # '*' by default +# headers: # 'Content-Type,Authorization' by default +# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default # cron: # Setup scheduled trigger with cron expression # active: true # value: '* * * * *' diff --git a/lib/plugins/create/templates/spotinst-ruby/serverless.yml b/lib/plugins/create/templates/spotinst-ruby/serverless.yml index 03f6b1bf8..4c1807e22 100644 --- a/lib/plugins/create/templates/spotinst-ruby/serverless.yml +++ b/lib/plugins/create/templates/spotinst-ruby/serverless.yml @@ -29,6 +29,11 @@ functions: # activeVersions: # - "version": "$LATEST" # "percentage": 100.0 +# cors: +# enabled: # false by default +# origin: # '*' by default +# headers: # 'Content-Type,Authorization' by default +# methods: # 'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT' by default # cron: # Setup scheduled trigger with cron expression # active: true # value: '* * * * *'